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)
....@@ -189,8 +208,8 @@
189208 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190209 // pasteExpandItem.addActionListener(this);
191210 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
211
+ deleteItem = menu.add(new MenuItem("Delete"));
212
+ deleteItem.addActionListener(this);
194213
195214 if (Globals.ADVANCED)
196215 {
....@@ -220,7 +239,7 @@
220239 // toggleSwitchItem.addItemListener(this);
221240 // toggleSwitchItem.setState(CameraPane.SWITCH);
222241
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
242
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224243 toggleHandleItem.addItemListener(this);
225244 toggleHandleItem.setState(CameraPane.HANDLES);
226245
....@@ -380,13 +399,14 @@
380399 shadowYItem.addActionListener(this);
381400 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382401 shadowZItem.addActionListener(this);
402
+ attributeItem = menu.add(new MenuItem("Attribute"));
403
+ attributeItem.addActionListener(this);
404
+
383405 if (Globals.ADVANCED)
384406 {
385407 menu.add("-");
386408 linkerItem = menu.add(new MenuItem("Linker"));
387409 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390410 templateItem = menu.add(new MenuItem("Template"));
391411 templateItem.addActionListener(this);
392412 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -415,7 +435,7 @@
415435 genNormalsMESHItem.addActionListener(this);
416436 if (Globals.ADVANCED)
417437 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
438
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419439 genNormalsMINEItem.addActionListener(this);
420440 }
421441 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -538,6 +558,7 @@
538558 buildToolsMenu(menu);
539559 }
540560
561
+
541562 void SetupUI2(ObjEditor oe)
542563 {
543564 // June 2019
....@@ -582,7 +603,7 @@
582603 */
583604 cGridBag copyOptionsPanel = new cGridBag();
584605
585
- copyOptionsPanel.preferredHeight = 2;
606
+ copyOptionsPanel.preferredHeight = 1;
586607
587608 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588609
....@@ -590,48 +611,66 @@
590611 //minButton.setToolTipText("Minimize window");
591612 //minButton.addActionListener(this);
592613
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- 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
+ }
596620
597621 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598622 fullButton.setToolTipText("Full-screen window");
599623 fullButton.addActionListener(this);
600624
625
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
+ screenfitButton.setToolTipText("Screen fit");
627
+ screenfitButton.addActionListener(this);
628
+
601629 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602630 restoreCameraButton.setToolTipText("Restore viewpoint");
603631 restoreCameraButton.addActionListener(this);
604632
633
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
+ saveButton.setToolTipText("New version");
635
+ saveButton.addActionListener(this);
636
+
605637 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
- undoButton.setToolTipText("Undo changes");
638
+ undoButton.setToolTipText("Previous version");
607639 undoButton.addActionListener(this);
640
+ undoButton.setEnabled(false);
641
+
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);
608654
609655 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
- redoButton.setToolTipText("Redo changes");
656
+ redoButton.setToolTipText("Next version");
611657 redoButton.addActionListener(this);
658
+ redoButton.setEnabled(false);
612659
613
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
- saveButton.setToolTipText("Save changes");
615
- saveButton.addActionListener(this);
616
-
617
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
618661 liveCB.setToolTipText("Enable animation");
619662 liveCB.addItemListener(this);
620663
621
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622665 oneStepButton.setToolTipText("Animate one step forward");
623666 oneStepButton.addActionListener(this);
624667
625
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
626669 fastCB.setToolTipText("Fast mode");
627670 fastCB.addItemListener(this);
628671
629672 //oe.toolboxPanel.Return();
630673
631
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
- screenfitButton.setToolTipText("Screen fit");
633
- screenfitButton.addActionListener(this);
634
-
635674 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
636675 // trackCB.setToolTipText("Enable tracking");
637676 // trackCB.addItemListener(this);
....@@ -648,27 +687,28 @@
648687
649688 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
650689
651
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- twoButton.setToolTipText("Show center view only");
653
- twoButton.addActionListener(this);
654
- this.fullscreenLayout = twoButton;
655
-
656690 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657691 fourButton.addActionListener(this);
658692 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
+
659699 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
- sixButton.setToolTipText("2-column layout left");
700
+ sixButton.setToolTipText("Show left and right");
661701 sixButton.addActionListener(this);
662
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
- threeButton.setToolTipText("2-column layout right");
664
- threeButton.addActionListener(this);
665
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
666
- sevenButton.setToolTipText("3-column layout");
667
- 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);
668708 //
669709
670
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- 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");
672712 rootButton.addActionListener(this);
673713
674714 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -724,7 +764,7 @@
724764 compositeButton.addActionListener(this);
725765
726766 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
- switchButton.setToolTipText("Create switch");
767
+ switchButton.setToolTipText("Create item switcher");
728768 switchButton.addActionListener(this);
729769
730770 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -743,17 +783,29 @@
743783 lightButton.setToolTipText("Create light");
744784 lightButton.addActionListener(this);
745785
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
+
746798 // EDIT panel
747
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
- editButton.setToolTipText("Edit selection");
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
749801 editButton.addActionListener(this);
750802
751
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
753805 uneditButton.addActionListener(this);
754806
755807 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
756
- allParamsButton.setToolTipText("Edit all params");
808
+ allParamsButton.setToolTipText("Show all controle");
757809 allParamsButton.addActionListener(this);
758810
759811 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -770,6 +822,7 @@
770822
771823 editCommandsPanel.preferredHeight = 1;
772824
825
+ SetPinStates(false);
773826 // oe.treePanel.add(commandsPanel);
774827 // oe.treePanel.Return();
775828
....@@ -796,6 +849,9 @@
796849
797850 oe.treePanel.add(copyOptionsPanel);
798851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
799855
800856 // mainPanel.setDividerLocation(0.5); //1.0);
801857 // mainPanel.setResizeWeight(0.5);
....@@ -818,7 +874,7 @@
818874 dgr.addDragGestureListener(this);
819875 }catch(Exception e) {}
820876 */
821
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
822878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
823879 }
824880
....@@ -843,14 +899,18 @@
843899 boxCB.addItemListener(this);
844900
845901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
846
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
847903 zoomBoxCB.addItemListener(this);
848904
849905 if (true) // Globals.ADVANCED)
850906 {
851
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
852
- supportCB.setToolTipText("Enable rigging");
853
- 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);
854914
855915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
856916 // localCB.addItemListener(this);
....@@ -905,7 +965,7 @@
905965 oeilCB.addItemListener(this);
906966
907967 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
- shadowCB.setToolTipText("Compute shadows when live");
968
+ shadowCB.setToolTipText("When live compute shadows");
909969 shadowCB.addItemListener(this);
910970
911971 panel.Return();
....@@ -914,12 +974,12 @@
914974 toggleTextureCB.addItemListener(this);
915975
916976 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
- toggleSwitchCB.setToolTipText("Use switch");
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
918978 toggleSwitchCB.addItemListener(this);
919979
920
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
- autosaveCB.setToolTipText("Auto-save on structure change");
922
- autosaveCB.addItemListener(this);
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
923983
924984 panel.Return();
925985 if (Globals.ADVANCED)
....@@ -948,7 +1008,7 @@
9481008 {
9491009 cRadio radioButton = new cRadio(obj.name);
9501010
951
- // Patch to avoid bug with transparency.
1011
+ // June 2019. Patch to avoid bug with transparency.
9521012 radioButton.hadMaterial = obj.material != null;
9531013 if (!radioButton.hadMaterial)
9541014 {
....@@ -956,7 +1016,7 @@
9561016 }
9571017
9581018 radioButton.SetObject(obj);
959
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
9601020 radioButton.SetCamera(cameraView.renderCamera, false);
9611021 radioButton.addActionListener(this);
9621022 radioPanel.add(radioButton);
....@@ -985,6 +1045,7 @@
9851045 cCheckBox slowCB;
9861046 cCheckBox boxCB;
9871047 cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
9881049 //cToggleButton trackCB;
9891050 cCheckBox trackCB;
9901051 cCheckBox smoothfocusCB;
....@@ -995,7 +1056,7 @@
9951056
9961057 cCheckBox oeilCB;
9971058 cCheckBox shadowCB;
998
- cCheckBox autosaveCB;
1059
+ cCheckBox autokeepCB;
9991060 cCheckBox lookAtCB;
10001061
10011062 // static int COLOR = 1;
....@@ -1103,9 +1164,13 @@
11031164 {
11041165 Globals.COMPUTESHADOWWHENLIVE ^= true;
11051166 }
1106
- else if(e.getSource() == autosaveCB)
1167
+ else if(e.getSource() == freezeCB)
11071168 {
1108
- Globals.SAVEONMAKE ^= true;
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
11091174 }
11101175 else if(e.getSource() == lookAtCB)
11111176 {
....@@ -1187,8 +1252,6 @@
11871252 }
11881253 }
11891254
1190
- String string = (String) object;
1191
-
11921255 System.out.println("Transfer = " + object + "; drop : " + target);
11931256 // if( object instanceof java.io.File[])
11941257 // {
....@@ -1196,6 +1259,8 @@
11961259 // objEditor.DropFile((java.io.File[]) object, true);
11971260 // return;
11981261 // }
1262
+
1263
+ String string = object.toString();
11991264
12001265 // File path for Mac and Windows
12011266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1445,6 +1510,9 @@
14451510 animationItem.addItemListener(this);
14461511 animationItem.setState(Globals.ANIMATION);
14471512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
14481516 menu.add("-");
14491517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14501518 parseverticesItem.addActionListener(this);
....@@ -1457,6 +1525,8 @@
14571525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14581526 reduce34MorphItem.addActionListener(this);
14591527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
14601530 menu.add(computeAOItem = new MenuItem("Compute AO"));
14611531 computeAOItem.addActionListener(this);
14621532
....@@ -1465,8 +1535,6 @@
14651535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14661536 mirrorItem.addActionListener(this);
14671537 menu.add("-");
1468
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1469
- memoryItem.addActionListener(this);
14701538 menu.add(analyzeItem = new MenuItem("Analyze"));
14711539 analyzeItem.addActionListener(this);
14721540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1614,6 +1682,30 @@
16141682
16151683 makeSomething(shadow);
16161684 }
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
+ }
16171709
16181710 /**
16191711 * applyExample
....@@ -2093,25 +2185,25 @@
20932185 Composite csg = new GroupLeaf();
20942186 csg.count = 5;
20952187 group(csg);
2096
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
20972189 csg.addChild(child);
20982190 child.addChild(csg);
20992191 } else
21002192 if (source == doubleItem)
21012193 {
2102
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
21032195 csg.count = 5;
21042196 group(csg);
2105
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
21062198 csg.addChild(child);
21072199 child.addChild(csg);
2108
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
21092201 csg.addChild(child);
21102202 child.addChild(csg);
21112203 } else
21122204 if (source == tripleItem)
21132205 {
2114
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
21152207 csg.count = 4;
21162208 group(csg);
21172209 Composite child = new cGroup();
....@@ -2175,15 +2267,31 @@
21752267 } else
21762268 if (source == undoButton)
21772269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21782273 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();
21792284 } else
21802285 if (source == redoButton)
21812286 {
2287
+ // Go to next version
21822288 Redo();
21832289 } else
21842290 if (source == saveButton)
21852291 {
2186
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
21872295 } else
21882296 if (source == oneStepButton)
21892297 {
....@@ -2192,17 +2300,14 @@
21922300 } else
21932301 if (source == screenfitButton)
21942302 {
2195
- //Reload(lastConverter, lastFilename, true);
21962303 ScreenFit();
21972304 } else
21982305 if (source == screenfitpointButton)
21992306 {
2200
- //Reload(lastConverter, lastFilename, true);
22012307 ScreenFitPoint();
22022308 } else
22032309 if (source == snapobjectButton)
22042310 {
2205
- //Reload(lastConverter, lastFilename, true);
22062311 SnapObject();
22072312 } else
22082313 // if (event.getSource() == recompileButton)
....@@ -2566,7 +2671,7 @@
25662671 {
25672672 StepAll();
25682673 } else
2569
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
25702675 {
25712676 //int indices[] = jList.getSelectedIndices();
25722677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2726,15 +2831,28 @@
27262831 } else
27272832 if (source == ungroupItem || source == ungroupButton)
27282833 {
2729
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
27302836 for (int i=0; i<group.selection.size(); i++)
27312837 {
2732
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
27332843 }
27342844
2735
- ClearSelection(false);
2736
-
2737
- 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
+ }
27382856 } else
27392857 if (source == genUVItem)
27402858 {
....@@ -3326,6 +3444,12 @@
33263444 } else
33273445 if (source == editItem || source == editButton)
33283446 {
3447
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3448
+ {
3449
+ Object3D child = (Object3D)e.nextElement();
3450
+ child.pinned = true;
3451
+ }
3452
+
33293453 EditSelection(false);
33303454 } else
33313455 if (source == uneditButton)
....@@ -3335,6 +3459,7 @@
33353459 Object3D child = (Object3D)e.nextElement();
33363460 if(child.editWindow != null)
33373461 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3462
+ child.pinned = false;
33383463 child.CloseUI();
33393464 listUI.remove(child);
33403465
....@@ -3351,6 +3476,7 @@
33513476 //copy.ClearUI();
33523477 for (Object3D obj : listUI)
33533478 {
3479
+ obj.pinned = false;
33543480 obj.CloseUI();
33553481 }
33563482 listUI.clear();
....@@ -3360,7 +3486,7 @@
33603486 {
33613487 assert(copy == group);
33623488
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3489
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643490
33653491 for (Object3D obj : listUI)
33663492 {
....@@ -3409,6 +3535,9 @@
34093535 }
34103536
34113537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
34123541 //Globals.theRenderer.object = group;
34133542 if(!useclient)
34143543 {
....@@ -3435,6 +3564,13 @@
34353564 currentLayout = sevenButton;
34363565 */
34373566 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);
34383574 keepparent = group.parent;
34393575 // PARENT = NULL or not???
34403576 //group.parent = null; // ROOT
....@@ -4502,12 +4638,14 @@
45024638 // }
45034639 // }
45044640
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45094641 void EditSelection(boolean newWindow)
45104642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
45114649 // aConstraints.gridy = 0;
45124650 for (int i=0; i<group.selection.size(); i++)
45134651 {
....@@ -4518,12 +4656,7 @@
45184656 Object3D elem = (Object3D)group.selection.elementAt(i);
45194657 if(elem != group || !newWindow)
45204658 {
4521
- // if (!(elem instanceof Composite))
4522
- // newWindow = false;
4523
- listUI.add(elem);
4524
- elem.openEditWindow(this, newWindow); //, false);
4525
- System.out.println("edit : " + elem);
4526
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
45274660 }
45284661 }
45294662 }
....@@ -4598,7 +4731,8 @@
45984731 //new Exception().printStackTrace();
45994732
46004733 freezemodel = true;
4601
-
4734
+ ClearUnpinned();
4735
+
46024736 /**/
46034737 //switch (event.id)
46044738 {
....@@ -4631,7 +4765,7 @@
46314765 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46324766 // a camera
46334767 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4768
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46354769 {
46364770 CameraPane.camerachangeframe = 0; // don't refuse it
46374771 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +4774,13 @@
46404774 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46414775 }
46424776
4777
+ if (tps != null && tps.length == 1)
4778
+ {
4779
+ EditSelection(false);
4780
+ }
4781
+
4782
+ SetPinStates(tps != null && tps.length > 0);
4783
+
46434784 refreshContents();
46444785 //return true;
46454786 }
....@@ -4649,10 +4790,18 @@
46494790 freezemodel = false;
46504791 }
46514792
4793
+ void SetPinStates(boolean enabled)
4794
+ {
4795
+ editButton.setEnabled(enabled);
4796
+ uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
4799
+ }
4800
+
46524801 void refreshContents(boolean cp)
46534802 {
4654
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4655
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46564805 {
46574806 objEditor.ClearInfo(); // .GetMaterial());
46584807
....@@ -4751,8 +4900,8 @@
47514900
47524901 if (cut)
47534902 {
4754
- if (Globals.SAVEONMAKE)
4755
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
47564905 //int indices[] = jList.getSelectedIndices();
47574906 //for (int i = indices.length - 1; i >= 0; i--)
47584907 //jList.remove(indices[i]);
....@@ -4855,6 +5004,10 @@
48555004
48565005 void paste(boolean expand)
48575006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
48585011 // if (GrafreeD.clipboard == null)
48595012 // return;
48605013 boolean first = true;
....@@ -4914,6 +5067,7 @@
49145067 Grafreed.clipboard.get(0).parent = keepparent;
49155068 }
49165069
5070
+ Globals.REPLACEONMAKE = keep;
49175071 ResetModel();
49185072 refreshContents();
49195073 }
....@@ -5049,6 +5203,10 @@
50495203
50505204 void group(Object3D csg, boolean grab)
50515205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
50525210 if (//false) // why??
50535211 !group.selection.isEmpty())
50545212 {
....@@ -5162,10 +5320,15 @@
51625320 //node.add(csg);
51635321 //makeSomething(node);
51645322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
51655324 }
51665325
51675326 void Ungroup(Object3D g)
51685327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
51695332 if (g instanceof HiddenObject)
51705333 {
51715334 HiddenObject h = (HiddenObject) g;
....@@ -5182,6 +5345,7 @@
51825345 objEditor.makeSomething(g.get(i), false);
51835346 }
51845347 }
5348
+ Globals.REPLACEONMAKE = keep;
51855349 }
51865350
51875351 void ungroup()
....@@ -5472,11 +5636,6 @@
54725636
54735637 cButton restoreCameraButton;
54745638
5475
- cButton minButton;
5476
- cButton maxButton;
5477
- cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
54805639 cButton saveButton;
54815640 cButton oneStepButton;
54825641
....@@ -5550,7 +5709,7 @@
55505709 private MenuItem pasteLinkItem;
55515710 private MenuItem pasteCloneItem;
55525711 private MenuItem pasteExpandItem;
5553
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
55545713 private MenuItem clearAllItem;
55555714 private MenuItem genUVItem;
55565715 private MenuItem genNormalsMESHItem;