Normand Briere
2019-07-21 76522bc3ee92bd50dbd946d7f865666be4ad7bac
GroupEditor.java
....@@ -60,6 +60,12 @@
6060 this.copy = this.group = group;
6161 //selectees = this.group.selectees;
6262
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6369 if(ui)
6470 SetupUI(objEditor);
6571 }
....@@ -80,10 +86,22 @@
8086 SetupViews(objEditor);
8187
8288 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
89
+
90
+ if (copy.versions == null)
91
+ {
92
+ copy.versions = new byte[100][];
93
+ copy.versionindex = -1;
94
+
95
+ Save(true);
96
+ }
8397 }
8498
8599 void CloneSelection(boolean supports)
86100 {
101
+ if (Globals.REPLACEONMAKE)
102
+ Save();
103
+ boolean keep = Globals.REPLACEONMAKE;
104
+ Globals.REPLACEONMAKE = false;
87105 // Object3D keep = GrafreeD.clipboard;
88106 //Object3D obj;
89107 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +112,7 @@
94112
95113 makeSomething(clone, i==group.selection.size()-1);
96114 }
115
+ Globals.REPLACEONMAKE = keep;
97116 }
98117
99118 void CloneClipboard(boolean supports)
....@@ -150,6 +169,8 @@
150169
151170 void SetupMenu2(GroupEditor oe)
152171 {
172
+ oe.jTree = new cTree();
173
+
153174 Menu menu;
154175 oe.menuBar.add(menu = new Menu("Edit"));
155176 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +181,7 @@
160181 // redoItem = menu.add(new MenuItem("Redo"));
161182 // redoItem.addActionListener(this);
162183 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
184
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164185 duplicateItem.addActionListener(this);
165186 cloneItem = menu.add(new MenuItem("Clone"));
166187 cloneItem.addActionListener(this);
....@@ -187,8 +208,8 @@
187208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188209 // pasteExpandItem.addActionListener(this);
189210 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
192213
193214 if (Globals.ADVANCED)
194215 {
....@@ -202,23 +223,23 @@
202223 //zBufferItem.addActionListener(this);
203224 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204225 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
226
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
227
+ restoreCameraItem.addActionListener(this);
207228
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
229
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
230
+// toggleFullScreenItem.addItemListener(this);
231
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
232
+// cameraMenu.add("-");
233
+//
234
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
235
+// toggleTextureItem.addItemListener(this);
236
+// toggleTextureItem.setState(CameraPane.textureon);
237
+//
238
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
239
+// toggleSwitchItem.addItemListener(this);
240
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212241
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222243 toggleHandleItem.addItemListener(this);
223244 toggleHandleItem.setState(CameraPane.HANDLES);
224245
....@@ -273,7 +294,7 @@
273294 {
274295 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275296 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
297
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277298 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278299 oe.cameraMenu.add("-");
279300 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +302,7 @@
281302 editLeafItem.addActionListener(this);
282303 lookAtItem.addActionListener(this);
283304 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
305
+ //switchViewItem.addActionListener(this);
285306 }
286307
287308 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +347,29 @@
326347 }
327348
328349 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
350
+// grabItem = menu.add(new MenuItem("Grab"));
351
+// grabItem.addActionListener(this);
331352 backItem = menu.add(new MenuItem("Back"));
332353 backItem.addActionListener(this);
333354 frontItem = menu.add(new MenuItem("Front"));
334355 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
356
+// compositeItem = menu.add(new MenuItem("Composite"));
357
+// compositeItem.addActionListener(this);
358
+
359
+ if (Globals.ADVANCED)
360
+ {
337361 hideItem = menu.add(new MenuItem("Hidden Group"));
338362 hideItem.addActionListener(this);
363
+ }
339364 ungroupItem = menu.add(new MenuItem("Ungroup"));
340365 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
366
+
367
+// menu.add("-");
368
+//
369
+// switchItem = menu.add(new MenuItem("Switch node"));
370
+// switchItem.addActionListener(this);
371
+ if (Globals.ADVANCED)
372
+ {
344373 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345374 switchGeoItem.addActionListener(this);
346375 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +377,6 @@
348377 morphItem = menu.add(new MenuItem("Morph Group"));
349378 morphItem.addActionListener(this);
350379
351
- if (Globals.ADVANCED)
352
- {
353380 menu.add("-");
354381 physicsItem = menu.add(new MenuItem("Physics"));
355382 physicsItem.addActionListener(this);
....@@ -357,13 +384,11 @@
357384 frameselectorItem.addActionListener(this);
358385 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359386 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362387 }
363388
364389 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
390
+// textureItem = menu.add(new MenuItem("Texture"));
391
+// textureItem.addActionListener(this);
367392 billboardItem = menu.add(new MenuItem("Billboard"));
368393 billboardItem.addActionListener(this);
369394 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +399,14 @@
374399 shadowYItem.addActionListener(this);
375400 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
377405 if (Globals.ADVANCED)
378406 {
379407 menu.add("-");
380408 linkerItem = menu.add(new MenuItem("Linker"));
381409 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384410 templateItem = menu.add(new MenuItem("Template"));
385411 templateItem.addActionListener(this);
386412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +435,7 @@
409435 genNormalsMESHItem.addActionListener(this);
410436 if (Globals.ADVANCED)
411437 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413439 genNormalsMINEItem.addActionListener(this);
414440 }
415441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -532,6 +558,7 @@
532558 buildToolsMenu(menu);
533559 }
534560
561
+
535562 void SetupUI2(ObjEditor oe)
536563 {
537564 // June 2019
....@@ -574,51 +601,79 @@
574601 oe.radioPanel.add(dummyButton);
575602 oe.buttonGroup.add(dummyButton);
576603 */
604
+ cGridBag copyOptionsPanel = new cGridBag();
605
+
606
+ copyOptionsPanel.preferredHeight = 1;
607
+
577608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578609
579610 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580611 //minButton.setToolTipText("Minimize window");
581612 //minButton.addActionListener(this);
582613
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
614
+ if (Globals.ADVANCED)
615
+ {
616
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
+ maxButton.setToolTipText("Maximize window");
618
+ maxButton.addActionListener(this);
619
+ }
586620
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588622 fullButton.setToolTipText("Full-screen window");
589623 fullButton.addActionListener(this);
590624
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
629
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreCameraButton.setToolTipText("Restore viewpoint");
631
+ restoreCameraButton.addActionListener(this);
594632
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
601635 saveButton.addActionListener(this);
636
+
637
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
+ undoButton.setToolTipText("Previous version");
639
+ undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
602641
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
642
+ cGridBag updown = new cGridBag().setVertical(true);
643
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ restoreButton.setToolTipText("Restore current");
645
+ restoreButton.addActionListener(this);
646
+ restoreButton.setEnabled(false);
647
+
648
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ replaceButton.setToolTipText("Replace current");
650
+ replaceButton.addActionListener(this);
651
+ replaceButton.setEnabled(false);
652
+
653
+ copyOptionsPanel.add(updown);
654
+
655
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656
+ redoButton.setToolTipText("Next version");
657
+ redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
659
+
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604661 liveCB.setToolTipText("Enable animation");
605662 liveCB.addItemListener(this);
606663
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608665 oneStepButton.setToolTipText("Animate one step forward");
609666 oneStepButton.addActionListener(this);
610667
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612669 fastCB.setToolTipText("Fast mode");
613670 fastCB.addItemListener(this);
614671
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
672
+ //oe.toolboxPanel.Return();
673
+
674
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
675
+// trackCB.setToolTipText("Enable tracking");
676
+// trackCB.addItemListener(this);
622677
623678 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624679 // screenfitpointButton.addActionListener(this);
....@@ -630,49 +685,127 @@
630685 snapobjectButton.setToolTipText("Snap Object");
631686 }
632687
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
688
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636689
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
-
639
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
- twoButton.setToolTipText("Show center view only");
641
- twoButton.addActionListener(this);
642690 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643691 fourButton.addActionListener(this);
644692 fourButton.setToolTipText("Show left panel only");
693
+
694
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ twoButton.setToolTipText("Show right view only");
696
+ twoButton.addActionListener(this);
697
+ this.fullscreenLayout = twoButton;
698
+
645699 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- sixButton.setToolTipText("2-column layout left");
700
+ sixButton.setToolTipText("Show left and right");
647701 sixButton.addActionListener(this);
648
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
- threeButton.setToolTipText("2-column layout right");
650
- threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
702
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+// threeButton.setToolTipText("2-column layout right");
704
+// threeButton.addActionListener(this);
705
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
706
+// sevenButton.setToolTipText("3-column layout");
707
+// sevenButton.addActionListener(this);
654708 //
655709
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
710
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
711
+ rootButton.setToolTipText("Open selection in new tab");
658712 rootButton.addActionListener(this);
659713
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
714
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661715 closeButton.setToolTipText("Close tab");
662716 closeButton.addActionListener(this);
663717 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664718 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
719
+
720
+ // INSERT
721
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
722
+ gridButton.setToolTipText("Create grid");
723
+ gridButton.addActionListener(this);
724
+
725
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
+ boxButton.setToolTipText("Create box");
727
+ boxButton.addActionListener(this);
728
+
729
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
+ sphereButton.setToolTipText("Create sphere");
731
+ sphereButton.addActionListener(this);
732
+
733
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
734
+ coneButton.setToolTipText("Create cone");
735
+ coneButton.addActionListener(this);
736
+
737
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
+ torusButton.setToolTipText("Create torus");
739
+ torusButton.addActionListener(this);
740
+
741
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
+ superButton.setToolTipText("Create superellipsoid");
743
+ superButton.addActionListener(this);
744
+
745
+ if (Globals.ADVANCED)
746
+ {
747
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ kleinButton.setToolTipText("Create Klein bottle");
749
+ kleinButton.addActionListener(this);
750
+ }
751
+
752
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
753
+ particlesButton.setToolTipText("Create particle system");
754
+ particlesButton.addActionListener(this);
755
+
756
+ oe.toolboxPanel.Return();
757
+
758
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
759
+ groupButton.setToolTipText("Create group");
760
+ groupButton.addActionListener(this);
761
+
762
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
763
+ compositeButton.setToolTipText("Create composite");
764
+ compositeButton.addActionListener(this);
765
+
766
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
767
+ switchButton.setToolTipText("Create item switcher");
768
+ switchButton.addActionListener(this);
769
+
770
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
771
+ loopButton.setToolTipText("Create loop");
772
+ loopButton.addActionListener(this);
773
+
774
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
775
+ textureButton.setToolTipText("Create texture");
776
+ textureButton.addActionListener(this);
777
+
778
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
779
+ overlayButton.setToolTipText("Create overlay");
780
+ overlayButton.addActionListener(this);
781
+
782
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
783
+ lightButton.setToolTipText("Create light");
784
+ lightButton.addActionListener(this);
785
+
786
+ for (int i=6; --i>=0;)
787
+ {
788
+ oe.toolboxPanel.Return();
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ oe.toolboxPanel.add(new cGridBag());
795
+ oe.toolboxPanel.add(new cGridBag());
796
+ }
797
+
798
+ // EDIT panel
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
668801 editButton.addActionListener(this);
669802
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
672805 uneditButton.addActionListener(this);
673806
674807 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
808
+ allParamsButton.setToolTipText("Show all controle");
676809 allParamsButton.addActionListener(this);
677810
678811 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +816,13 @@
683816 unselectButton.setToolTipText("Unselect");
684817 unselectButton.addActionListener(this);
685818
819
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
820
+ flashSelectionButton.setToolTipText("Highlight selection");
821
+ flashSelectionButton.addActionListener(this);
822
+
686823 editCommandsPanel.preferredHeight = 1;
687824
825
+ SetPinStates(false);
688826 // oe.treePanel.add(commandsPanel);
689827 // oe.treePanel.Return();
690828
....@@ -703,29 +841,17 @@
703841
704842 JScrollPane jSP;
705843 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
844
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707845 ResetModel();
708846
709847 oe.treePanel.add(jSPPanel);
710848 oe.treePanel.Return();
711849
712
- cGridBag copyOptionsPanel = new cGridBag();
713
-
714
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
- colorCB.setToolTipText("Copy color when dropped");
716
- colorCB.addItemListener(this);
717
-
718
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
- materialCB.setToolTipText("Copy material when dropped");
720
- materialCB.addItemListener(this);
721
-
722
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
- textureCB.setToolTipText("Copy texture when dropped");
724
- textureCB.addItemListener(this);
725
-
726
- copyOptionsPanel.preferredHeight = 1;
727850 oe.treePanel.add(copyOptionsPanel);
728851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
729855
730856 // mainPanel.setDividerLocation(0.5); //1.0);
731857 // mainPanel.setResizeWeight(0.5);
....@@ -748,29 +874,49 @@
748874 dgr.addDragGestureListener(this);
749875 }catch(Exception e) {}
750876 */
751
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
752878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
753879 }
754880
755881 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
756882 {
883
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
884
+ colorCB.setToolTipText("Copy color when dropped");
885
+ colorCB.addItemListener(this);
886
+
887
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
888
+ materialCB.setToolTipText("Copy material when dropped");
889
+ materialCB.addItemListener(this);
890
+
891
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
892
+ textureCB.setToolTipText("Copy texture when dropped");
893
+ textureCB.addItemListener(this);
894
+
895
+ panel.Return();
896
+
757897 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
758898 boxCB.setToolTipText("Display bounding boxes");
759899 boxCB.addItemListener(this);
760900
761901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
763903 zoomBoxCB.addItemListener(this);
764904
765905 if (true) // Globals.ADVANCED)
766906 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
907
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
908
+// supportCB.setToolTipText("Enable rigging");
909
+// supportCB.addItemListener(this);
910
+
911
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
912
+ freezeCB.setToolTipText("Fast moving camera");
913
+ freezeCB.addItemListener(this);
770914
771915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
772916 // localCB.addItemListener(this);
773917
918
+ panel.Return();
919
+
774920 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
775921 crowdCB.setToolTipText("Used for crowds");
776922 crowdCB.addItemListener(this);
....@@ -787,6 +933,8 @@
787933 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
788934 // speakerMocapCB.addItemListener(this);
789935
936
+ panel.Return();
937
+
790938 if (false)
791939 {
792940 // handled in scripts
....@@ -801,34 +949,74 @@
801949 //constraints.gridy += 1;
802950 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
803951 smoothfocusCB.addItemListener(this);
952
+ panel.Return();
804953 }
805954
806955 //constraints.gridx += 1;
807956 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
808957 // debugCB.addItemListener(this);
809958
959
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
960
+ trackCB.setToolTipText("Enable tracking target");
961
+ trackCB.addItemListener(this);
962
+
810963 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
964
+ oeilCB.setToolTipText("Move camera when tracking");
811965 oeilCB.addItemListener(this);
812966
967
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
968
+ shadowCB.setToolTipText("When live compute shadows");
969
+ shadowCB.addItemListener(this);
970
+
971
+ panel.Return();
972
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
973
+ toggleTextureCB.setToolTipText("Load textures");
974
+ toggleTextureCB.addItemListener(this);
975
+
976
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
978
+ toggleSwitchCB.addItemListener(this);
979
+
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
983
+
984
+ panel.Return();
985
+ if (Globals.ADVANCED)
986
+ {
813987 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
814988 lookAtCB.setToolTipText("Look-at target");
815989 lookAtCB.addItemListener(this);
990
+ }
816991
817992 }
818993
819994 cGridBag fill = new cGridBag();
820
-
821995 fill.preferredHeight = 200;
996
+ cGridBag fill2 = new cGridBag();
997
+ fill2.preferredHeight = 200;
998
+ cGridBag fill3 = new cGridBag();
999
+ fill3.preferredHeight = 200;
8221000
8231001 panel.add(fill);
1002
+ panel.add(fill2);
1003
+ panel.add(fill3);
8241004
8251005 }
8261006
8271007 void EditObject(Object3D obj)
8281008 {
8291009 cRadio radioButton = new cRadio(obj.name);
1010
+
1011
+ // June 2019. Patch to avoid bug with transparency.
1012
+ radioButton.hadMaterial = obj.material != null;
1013
+ if (!radioButton.hadMaterial)
1014
+ {
1015
+ obj.material = new cMaterial();
1016
+ }
1017
+
8301018 radioButton.SetObject(obj);
831
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
8321020 radioButton.SetCamera(cameraView.renderCamera, false);
8331021 radioButton.addActionListener(this);
8341022 radioPanel.add(radioButton);
....@@ -848,23 +1036,28 @@
8481036 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491037 }
8501038
851
- JCheckBox liveCB;
852
- JCheckBox supportCB;
853
- JCheckBox localCB;
854
- JCheckBox crowdCB;
855
- JCheckBox smoothCB;
856
- JCheckBox fastCB;
857
- JCheckBox slowCB;
858
- JCheckBox boxCB;
859
- JCheckBox zoomBoxCB;
860
- JCheckBox trackCB;
861
- JCheckBox smoothfocusCB;
1039
+ cToggleButton liveCB;
1040
+ cCheckBox supportCB;
1041
+ cCheckBox localCB;
1042
+ cCheckBox crowdCB;
1043
+ cCheckBox smoothCB;
1044
+ cToggleButton fastCB;
1045
+ cCheckBox slowCB;
1046
+ cCheckBox boxCB;
1047
+ cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
1049
+ //cToggleButton trackCB;
1050
+ cCheckBox trackCB;
1051
+ cCheckBox smoothfocusCB;
8621052 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1053
+ cCheckBox speakerCameraCB;
1054
+ cCheckBox speakerFocusCB;
1055
+ cCheckBox debugCB;
1056
+
1057
+ cCheckBox oeilCB;
1058
+ cCheckBox shadowCB;
1059
+ cCheckBox autokeepCB;
1060
+ cCheckBox lookAtCB;
8681061
8691062 // static int COLOR = 1;
8701063 // static int MATERIAL = 2;
....@@ -872,9 +1065,9 @@
8721065
8731066 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741067
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1068
+ cCheckBox colorCB;
1069
+ cCheckBox materialCB;
1070
+ cCheckBox textureCB;
8781071
8791072 public void itemStateChanged(ItemEvent e)
8801073 {
....@@ -967,6 +1160,18 @@
9671160 {
9681161 cameraView.ToggleOeil();
9691162 }
1163
+ else if(e.getSource() == shadowCB)
1164
+ {
1165
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1166
+ }
1167
+ else if(e.getSource() == freezeCB)
1168
+ {
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
1174
+ }
9701175 else if(e.getSource() == lookAtCB)
9711176 {
9721177 cameraView.ToggleLookAt();
....@@ -983,7 +1188,8 @@
9831188
9841189 /**/
9851190 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1191
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1192
+ TreePath path = objEditor.jTree.getSelectionPath();
9871193 if ((path == null) || (path.getPathCount() <= 1)) {
9881194 // We can't move the root node or an empty selection
9891195 return;
....@@ -1046,8 +1252,6 @@
10461252 }
10471253 }
10481254
1049
- String string = (String) object;
1050
-
10511255 System.out.println("Transfer = " + object + "; drop : " + target);
10521256 // if( object instanceof java.io.File[])
10531257 // {
....@@ -1055,6 +1259,8 @@
10551259 // objEditor.DropFile((java.io.File[]) object, true);
10561260 // return;
10571261 // }
1262
+
1263
+ String string = object.toString();
10581264
10591265 // File path for Mac and Windows
10601266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1306,33 @@
11001306
11011307 assert target == objEditor.jTree;
11021308 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1309
+ Object3D destinationLeaf;
11031310 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1311
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051312 } catch (Exception e) {
11061313 System.out.println("destinationPath : " + destinationPath);
11071314 return;
11081315 }
11091316
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1317
+ for (int i=group.selection.size(); --i>=0;)
11111318 {
1319
+ Object3D child = (Object3D)group.selection.elementAt(i);
1320
+
1321
+ // Cannot move into itself
1322
+ if (child == destinationLeaf)
1323
+ return;
1324
+ }
1325
+
1326
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1327
+// {
11121328 loadClipboard(true);
11131329 objEditor.jTree.setSelectionPath(destinationPath);
11141330 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1331
+// } else {
1332
+// loadClipboard(false);
1333
+// objEditor.jTree.setSelectionPath(destinationPath);
1334
+// pasteInto(false, false); // true); // ???
1335
+// }
11201336 }
11211337 public void dropActionChanged(DropTargetDragEvent dtde)
11221338 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1437,30 @@
12211437 {
12221438 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231439 //heightFieldItem.addActionListener(this);
1224
- gridItem = menu.add(new MenuItem("Grid"));
1225
- gridItem.addActionListener(this);
1226
- rectoidItem = menu.add(new MenuItem("Box"));
1227
- rectoidItem.addActionListener(this);
1228
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1229
- ellipsoidItem.addActionListener(this);
1230
- coneItem = menu.add(new MenuItem("Cone"));
1231
- coneItem.addActionListener(this);
1232
- torusItem = menu.add(new MenuItem("Torus"));
1233
- torusItem.addActionListener(this);
1234
- superItem = menu.add(new MenuItem("Superellipsoid"));
1235
- superItem.addActionListener(this);
1440
+// gridItem = menu.add(new MenuItem("Grid"));
1441
+// gridItem.addActionListener(this);
1442
+// rectoidItem = menu.add(new MenuItem("Box"));
1443
+// rectoidItem.addActionListener(this);
1444
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1445
+// ellipsoidItem.addActionListener(this);
1446
+// coneItem = menu.add(new MenuItem("Cone"));
1447
+// coneItem.addActionListener(this);
1448
+// torusItem = menu.add(new MenuItem("Torus"));
1449
+// torusItem.addActionListener(this);
1450
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1451
+// superItem.addActionListener(this);
1452
+
1453
+ cameraItem = menu.add(new MenuItem("Camera"));
1454
+ cameraItem.addActionListener(this);
1455
+
1456
+ if (!Globals.ADVANCED)
1457
+ {
12361458 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371459 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1460
+ }
1461
+
1462
+// particleItem = menu.add(new MenuItem("Particle system"));
1463
+// particleItem.addActionListener(this);
12401464 if (Globals.ADVANCED)
12411465 {
12421466 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1486,15 @@
12621486 }
12631487 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641488 bezierItem.addActionListener(this);
1265
- overlayItem = menu.add(new MenuItem("Overlay"));
1266
- overlayItem.addActionListener(this);
1267
- lightItem = menu.add(new MenuItem("Light"));
1268
- lightItem.addActionListener(this);
1489
+// overlayItem = menu.add(new MenuItem("Overlay"));
1490
+// overlayItem.addActionListener(this);
1491
+// lightItem = menu.add(new MenuItem("Light"));
1492
+// lightItem.addActionListener(this);
12691493 menu.add("-");
12701494 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711495 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1496
+// loopItem = menu.add(new MenuItem("Loop"));
1497
+// loopItem.addActionListener(this);
12741498 doubleItem = menu.add(new MenuItem("Fork"));
12751499 doubleItem.addActionListener(this);
12761500 if (Globals.ADVANCED)
....@@ -1286,6 +1510,9 @@
12861510 animationItem.addItemListener(this);
12871511 animationItem.setState(Globals.ANIMATION);
12881512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
12891516 menu.add("-");
12901517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911518 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1525,8 @@
12981525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991526 reduce34MorphItem.addActionListener(this);
13001527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
13011530 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021531 computeAOItem.addActionListener(this);
13031532
....@@ -1306,8 +1535,6 @@
13061535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071536 mirrorItem.addActionListener(this);
13081537 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111538 menu.add(analyzeItem = new MenuItem("Analyze"));
13121539 analyzeItem.addActionListener(this);
13131540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +1682,30 @@
14551682
14561683 makeSomething(shadow);
14571684 }
1685
+
1686
+ private void ClearUnpinned()
1687
+ {
1688
+ //for (Object3D obj : listUI)
1689
+ for (int i=listUI.size(); --i>=0;)
1690
+ {
1691
+ Object3D obj = listUI.elementAt(i);
1692
+ if (!obj.pinned)
1693
+ {
1694
+ obj.CloseUI();
1695
+ listUI.remove(i);
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ private void EditElement(Object3D elem, boolean newWindow)
1701
+ {
1702
+ // if (!(elem instanceof Composite))
1703
+ // newWindow = false;
1704
+ listUI.add(elem);
1705
+ elem.openEditWindow(this, newWindow); //, false);
1706
+ System.out.println("edit : " + elem);
1707
+ elem.editWindow.refreshContents(true); // ? new
1708
+ }
14581709
14591710 /**
14601711 * applyExample
....@@ -1699,7 +1950,7 @@
16991950 {
17001951 ScreenFit();
17011952 } else
1702
- if (source == switchItem)
1953
+ if (source == switchViewItem)
17031954 {
17041955 cVector v1 = new cVector();
17051956 cVector v2 = new cVector();
....@@ -1708,11 +1959,11 @@
17081959 objEditor.cameraView.renderCamera.setAim(v2, v1);
17091960 objEditor.cameraView.repaint();
17101961 } else
1711
- if (source == rectoidItem)
1962
+ if (source == rectoidItem || source == boxButton)
17121963 {
17131964 makeSomething(new Box());
17141965 } else
1715
- if (source == particleItem)
1966
+ if (source == particleItem || source == particlesButton)
17161967 {
17171968 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17181969 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2042,27 @@
17912042
17922043 makeSomething(obj);
17932044 } else
1794
- if (source == gridItem)
2045
+ if (source == gridItem || source == gridButton)
17952046 {
17962047 makeSomething(new Grid());
17972048 } else
1798
- if (source == ellipsoidItem)
2049
+ if (source == ellipsoidItem || source == sphereButton)
17992050 {
18002051 makeSomething(new Sphere());
18012052 } else
1802
- if (source == coneItem)
2053
+ if (source == coneItem || source == coneButton)
18032054 {
18042055 makeSomething(new Cone());
18052056 } else
1806
- if (source == torusItem)
2057
+ if (source == torusItem || source == torusButton)
18072058 {
18082059 makeSomething(new Torus());
18092060 } else
1810
- if (source == superItem)
2061
+ if (source == superItem || source == superButton)
18112062 {
18122063 makeSomething(new Superellipsoid());
18132064 } else
1814
- if (source == kleinItem)
2065
+ if (source == kleinItem || source == kleinButton)
18152066 {
18162067 makeSomething(new Klein());
18172068 } else
....@@ -1831,7 +2082,7 @@
18312082 {
18322083 makeSomething(new BezierSurface());
18332084 } else
1834
- if (source == overlayItem)
2085
+ if (source == overlayItem || source == overlayButton)
18352086 {
18362087 /*
18372088 Object3D obj = new BezierSurface(5,8);
....@@ -1879,7 +2130,7 @@
18792130 s.setup();
18802131 makeSomething(s);
18812132 } else
1882
- if (source == lightItem)
2133
+ if (source == lightItem || source == lightButton)
18832134 {
18842135 makeSomething(new Light());
18852136 } else
....@@ -1929,30 +2180,30 @@
19292180
19302181 group(g);
19312182 } else
1932
- if (source == loopItem)
2183
+ if (source == loopItem || source == loopButton)
19332184 {
19342185 Composite csg = new GroupLeaf();
19352186 csg.count = 5;
19362187 group(csg);
1937
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
19382189 csg.addChild(child);
19392190 child.addChild(csg);
19402191 } else
19412192 if (source == doubleItem)
19422193 {
1943
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
19442195 csg.count = 5;
19452196 group(csg);
1946
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
19472198 csg.addChild(child);
19482199 child.addChild(csg);
1949
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
19502201 csg.addChild(child);
19512202 child.addChild(csg);
19522203 } else
19532204 if (source == tripleItem)
19542205 {
1955
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
19562207 csg.count = 4;
19572208 group(csg);
19582209 Composite child = new cGroup();
....@@ -2016,15 +2267,31 @@
20162267 } else
20172268 if (source == undoButton)
20182269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20192273 Undo();
2274
+ } else
2275
+ if (source == restoreButton)
2276
+ {
2277
+ // Restore current version
2278
+ Restore();
2279
+ } else
2280
+ if (source == replaceButton)
2281
+ {
2282
+ // Overwrite current version
2283
+ Replace();
20202284 } else
20212285 if (source == redoButton)
20222286 {
2287
+ // Go to next version
20232288 Redo();
20242289 } else
20252290 if (source == saveButton)
20262291 {
2027
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282295 } else
20292296 if (source == oneStepButton)
20302297 {
....@@ -2033,17 +2300,14 @@
20332300 } else
20342301 if (source == screenfitButton)
20352302 {
2036
- //Reload(lastConverter, lastFilename, true);
20372303 ScreenFit();
20382304 } else
20392305 if (source == screenfitpointButton)
20402306 {
2041
- //Reload(lastConverter, lastFilename, true);
20422307 ScreenFitPoint();
20432308 } else
20442309 if (source == snapobjectButton)
20452310 {
2046
- //Reload(lastConverter, lastFilename, true);
20472311 SnapObject();
20482312 } else
20492313 // if (event.getSource() == recompileButton)
....@@ -2407,7 +2671,7 @@
24072671 {
24082672 StepAll();
24092673 } else
2410
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
24112675 {
24122676 //int indices[] = jList.getSelectedIndices();
24132677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2419,9 +2683,9 @@
24192683 {
24202684 ClearSelection(true);
24212685 } else
2422
- if (source == grabItem)
2686
+ if (source == grabItem || source == groupButton)
24232687 {
2424
- group(new cGroup(), true);
2688
+ group(new cGroup(), false); // true);
24252689 } else
24262690 if (source == hideItem)
24272691 {
....@@ -2439,11 +2703,11 @@
24392703 {
24402704 makeSomething(new Camera());
24412705 } else
2442
- if (source == compositeItem)
2706
+ if (source == compositeItem || source == compositeButton)
24432707 {
24442708 group(new Composite());
24452709 } else
2446
- if (source == randomItem)
2710
+ if (source == switchItem || source == switchButton)
24472711 {
24482712 RandomNode random = new RandomNode();
24492713 group(random);
....@@ -2545,7 +2809,7 @@
25452809 {
25462810 group(new cLinker());
25472811 } else
2548
- if (source == textureItem)
2812
+ if (source == textureItem || source == textureButton)
25492813 {
25502814 group(new TextureNode());
25512815 } else
....@@ -2565,17 +2829,30 @@
25652829 {
25662830 CastShadow(2);
25672831 } else
2568
- if (source == ungroupItem)
2832
+ if (source == ungroupItem || source == ungroupButton)
25692833 {
2570
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
25712836 for (int i=0; i<group.selection.size(); i++)
25722837 {
2573
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
25742843 }
25752844
2576
- ClearSelection(false);
2577
-
2578
- refreshContents();
2845
+ if (!hasRoot)
2846
+ {
2847
+ for (int i=0; i<group.selection.size(); i++)
2848
+ {
2849
+ Ungroup(group.selection.get(i));
2850
+ }
2851
+
2852
+ ClearSelection(false);
2853
+
2854
+ refreshContents();
2855
+ }
25792856 } else
25802857 if (source == genUVItem)
25812858 {
....@@ -2903,6 +3180,10 @@
29033180 if (source == twoButton)
29043181 {
29053182 radio.layout = twoButton;
3183
+
3184
+ if (CameraPane.FULLSCREEN)
3185
+ fullscreenLayout = radio.layout;
3186
+
29063187 // bug
29073188 //gridPanel.setDividerLocation(1.0);
29083189 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3239,9 @@
29583239 {
29593240 radio.layout = threeButton;
29603241
3242
+ if (CameraPane.FULLSCREEN)
3243
+ fullscreenLayout = radio.layout;
3244
+
29613245 // bigThree.remove(scenePanel);
29623246 // bigThree.remove(centralPanel);
29633247 // bigThree.remove(XYZPanel);
....@@ -2996,6 +3280,9 @@
29963280 {
29973281 radio.layout = fourButton;
29983282
3283
+ if (CameraPane.FULLSCREEN)
3284
+ fullscreenLayout = radio.layout;
3285
+
29993286 // bigThree.remove(scenePanel);
30003287 // bigThree.remove(centralPanel);
30013288 // bigThree.remove(XYZPanel);
....@@ -3032,6 +3319,9 @@
30323319 if (source == sixButton)
30333320 {
30343321 radio.layout = sixButton;
3322
+
3323
+ if (CameraPane.FULLSCREEN)
3324
+ fullscreenLayout = radio.layout;
30353325
30363326 // bigThree.remove(scenePanel);
30373327 // bigThree.remove(centralPanel);
....@@ -3070,6 +3360,9 @@
30703360 if (source == sevenButton)
30713361 {
30723362 radio.layout = sevenButton;
3363
+
3364
+ if (CameraPane.FULLSCREEN)
3365
+ fullscreenLayout = radio.layout;
30733366
30743367 // bigThree.remove(scenePanel);
30753368 // bigThree.remove(centralPanel);
....@@ -3126,12 +3419,19 @@
31263419 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273420 {
31283421 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3422
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303423 {
3424
+ // Patch to avoid bug with transparency.
3425
+ if (!ab.hadMaterial)
3426
+ {
3427
+ ab.object.material = null;
3428
+ }
3429
+
31313430 buttonGroup.remove(ab);
31323431 radioPanel.remove(ab);
31333432
3134
- ab.GetObject().editWindow = null;
3433
+ //ab.GetObject().editWindow = null;
3434
+ ab.GetObject().manipWindow = null;
31353435 // ab.GetObject().objectUI = null; // ?????????
31363436
31373437 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3444,12 @@
31443444 } else
31453445 if (source == editItem || source == editButton)
31463446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
31473453 EditSelection(false);
31483454 } else
31493455 if (source == uneditButton)
....@@ -3153,6 +3459,7 @@
31533459 Object3D child = (Object3D)e.nextElement();
31543460 if(child.editWindow != null)
31553461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
31563463 child.CloseUI();
31573464 listUI.remove(child);
31583465
....@@ -3169,6 +3476,7 @@
31693476 //copy.ClearUI();
31703477 for (Object3D obj : listUI)
31713478 {
3479
+ obj.pinned = false;
31723480 obj.CloseUI();
31733481 }
31743482 listUI.clear();
....@@ -3178,7 +3486,7 @@
31783486 {
31793487 assert(copy == group);
31803488
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823490
31833491 for (Object3D obj : listUI)
31843492 {
....@@ -3227,6 +3535,9 @@
32273535 }
32283536
32293537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
32303541 //Globals.theRenderer.object = group;
32313542 if(!useclient)
32323543 {
....@@ -3245,6 +3556,7 @@
32453556
32463557 // fix "+" issue
32473558 //group.editWindow = this;
3559
+ group.manipWindow = this;
32483560
32493561 /*
32503562 currentLayout = radio.layout;
....@@ -3252,6 +3564,13 @@
32523564 currentLayout = sevenButton;
32533565 */
32543566 radio.layout.doClick();
3567
+
3568
+ ClearUnpinned();
3569
+ //Grafreed.Assert(group != null);
3570
+ //Grafreed.Assert(group.selection != null);
3571
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3572
+ if (group.selection == null || group.selection.size() == 1)
3573
+ EditSelection(false);
32553574 keepparent = group.parent;
32563575 // PARENT = NULL or not???
32573576 //group.parent = null; // ROOT
....@@ -3265,7 +3584,7 @@
32653584 cameraView.ProtectCamera();
32663585 cameraView.repaint();
32673586 return;
3268
- } else if (event.getSource() == revertCameraItem)
3587
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693588 {
32703589 cameraView.RevertCamera();
32713590 cameraView.repaint();
....@@ -4319,28 +4638,25 @@
43194638 // }
43204639 // }
43214640
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43264641 void EditSelection(boolean newWindow)
43274642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
43284649 // aConstraints.gridy = 0;
43294650 for (int i=0; i<group.selection.size(); i++)
43304651 {
43314652 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43324653 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4654
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43344655
43354656 Object3D elem = (Object3D)group.selection.elementAt(i);
43364657 if(elem != group || !newWindow)
43374658 {
4338
- // if (!(elem instanceof Composite))
4339
- // newWindow = false;
4340
- listUI.add(elem);
4341
- elem.openEditWindow(this, newWindow); //, false);
4342
- System.out.println("edit : " + elem);
4343
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
43444660 }
43454661 }
43464662 }
....@@ -4415,7 +4731,8 @@
44154731 //new Exception().printStackTrace();
44164732
44174733 freezemodel = true;
4418
-
4734
+ ClearUnpinned();
4735
+
44194736 /**/
44204737 //switch (event.id)
44214738 {
....@@ -4448,7 +4765,7 @@
44484765 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44494766 // a camera
44504767 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44524769 {
44534770 CameraPane.camerachangeframe = 0; // don't refuse it
44544771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +4774,13 @@
44574774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44584775 }
44594776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
44604784 refreshContents();
44614785 //return true;
44624786 }
....@@ -4466,9 +4790,18 @@
44664790 freezemodel = false;
44674791 }
44684792
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
44694801 void refreshContents(boolean cp)
44704802 {
4471
- if (!Globals.MOUSEDRAGGED)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44724805 {
44734806 objEditor.ClearInfo(); // .GetMaterial());
44744807
....@@ -4567,7 +4900,8 @@
45674900
45684901 if (cut)
45694902 {
4570
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
45714905 //int indices[] = jList.getSelectedIndices();
45724906 //for (int i = indices.length - 1; i >= 0; i--)
45734907 //jList.remove(indices[i]);
....@@ -4670,6 +5004,10 @@
46705004
46715005 void paste(boolean expand)
46725006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
46735011 // if (GrafreeD.clipboard == null)
46745012 // return;
46755013 boolean first = true;
....@@ -4729,6 +5067,7 @@
47295067 Grafreed.clipboard.get(0).parent = keepparent;
47305068 }
47315069
5070
+ Globals.REPLACEONMAKE = keep;
47325071 ResetModel();
47335072 refreshContents();
47345073 }
....@@ -4864,6 +5203,10 @@
48645203
48655204 void group(Object3D csg, boolean grab)
48665205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
48675210 if (//false) // why??
48685211 !group.selection.isEmpty())
48695212 {
....@@ -4977,10 +5320,15 @@
49775320 //node.add(csg);
49785321 //makeSomething(node);
49795322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
49805324 }
49815325
49825326 void Ungroup(Object3D g)
49835327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
49845332 if (g instanceof HiddenObject)
49855333 {
49865334 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5345,7 @@
49975345 objEditor.makeSomething(g.get(i), false);
49985346 }
49995347 }
5348
+ Globals.REPLACEONMAKE = keep;
50005349 }
50015350
50025351 void ungroup()
....@@ -5285,13 +5634,28 @@
52855634 cButton clearpanelButton;
52865635 cButton unselectButton;
52875636
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
5637
+ cButton restoreCameraButton;
5638
+
52935639 cButton saveButton;
52945640 cButton oneStepButton;
5641
+
5642
+ cButton groupButton;
5643
+ cButton ungroupButton;
5644
+ cButton compositeButton;
5645
+ cButton switchButton;
5646
+ cButton loopButton;
5647
+ cButton textureButton;
5648
+
5649
+ cButton gridButton;
5650
+ cButton boxButton;
5651
+ cButton sphereButton;
5652
+ cButton coneButton;
5653
+ cButton torusButton;
5654
+ cButton superButton;
5655
+ cButton kleinButton;
5656
+ cButton particlesButton;
5657
+ cButton overlayButton;
5658
+ cButton lightButton;
52955659
52965660 cButton screenfitButton;
52975661 cButton screenfitpointButton;
....@@ -5313,11 +5677,11 @@
53135677 //JTree jTree;
53145678 private MenuItem lookAtItem;
53155679 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
5680
+ private MenuItem switchViewItem;
53175681 private MenuItem cutItem;
53185682 private MenuItem undoItem;
53195683 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
5684
+ private JMenuItem duplicateItem;
53215685 private MenuItem cloneItem;
53225686 private MenuItem cloneSupportItem;
53235687 private MenuItem overwriteGeoItem;
....@@ -5345,7 +5709,7 @@
53455709 private MenuItem pasteLinkItem;
53465710 private MenuItem pasteCloneItem;
53475711 private MenuItem pasteExpandItem;
5348
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
53495713 private MenuItem clearAllItem;
53505714 private MenuItem genUVItem;
53515715 private MenuItem genNormalsMESHItem;
....@@ -5405,7 +5769,7 @@
54055769 private MenuItem frontItem;
54065770 private MenuItem cameraItem;
54075771 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
5772
+ private MenuItem switchItem;
54095773 private MenuItem physicsItem;
54105774 private MenuItem frameselectorItem;
54115775 private MenuItem scriptNodeItem;
....@@ -5479,5 +5843,5 @@
54795843
54805844 Menu cameraMenu;
54815845 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
5846
+ MenuItem restoreCameraItem;
54835847 }