Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
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 }
....@@ -74,6 +80,12 @@
7480 this.copy = this.group = copy;
7581 //selectees = this.group.selectees;
7682
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
7789 SetupMenu2(this); //objEditor);
7890 SetupUI2(objEditor);
7991 objEditor.SetupUI(true);
....@@ -84,6 +96,10 @@
8496
8597 void CloneSelection(boolean supports)
8698 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
87103 // Object3D keep = GrafreeD.clipboard;
88104 //Object3D obj;
89105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +110,7 @@
94110
95111 makeSomething(clone, i==group.selection.size()-1);
96112 }
113
+ Globals.REPLACEONMAKE = keep;
97114 }
98115
99116 void CloneClipboard(boolean supports)
....@@ -189,8 +206,8 @@
189206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190207 // pasteExpandItem.addActionListener(this);
191208 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
194211
195212 if (Globals.ADVANCED)
196213 {
....@@ -220,7 +237,7 @@
220237 // toggleSwitchItem.addItemListener(this);
221238 // toggleSwitchItem.setState(CameraPane.SWITCH);
222239
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224241 toggleHandleItem.addItemListener(this);
225242 toggleHandleItem.setState(CameraPane.HANDLES);
226243
....@@ -380,13 +397,14 @@
380397 shadowYItem.addActionListener(this);
381398 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
383403 if (Globals.ADVANCED)
384404 {
385405 menu.add("-");
386406 linkerItem = menu.add(new MenuItem("Linker"));
387407 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390408 templateItem = menu.add(new MenuItem("Template"));
391409 templateItem.addActionListener(this);
392410 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -415,7 +433,7 @@
415433 genNormalsMESHItem.addActionListener(this);
416434 if (Globals.ADVANCED)
417435 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419437 genNormalsMINEItem.addActionListener(this);
420438 }
421439 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -538,6 +556,7 @@
538556 buildToolsMenu(menu);
539557 }
540558
559
+
541560 void SetupUI2(ObjEditor oe)
542561 {
543562 // June 2019
....@@ -582,7 +601,7 @@
582601 */
583602 cGridBag copyOptionsPanel = new cGridBag();
584603
585
- copyOptionsPanel.preferredHeight = 2;
604
+ copyOptionsPanel.preferredHeight = 1;
586605
587606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588607
....@@ -590,50 +609,66 @@
590609 //minButton.setToolTipText("Minimize window");
591610 //minButton.addActionListener(this);
592611
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
596618
597619 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598620 fullButton.setToolTipText("Full-screen window");
599621 fullButton.addActionListener(this);
600622
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
626
+
601627 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602628 restoreCameraButton.setToolTipText("Restore viewpoint");
603629 restoreCameraButton.addActionListener(this);
604630
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
605635 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
- undoButton.setToolTipText("Undo changes");
636
+ undoButton.setToolTipText("Previous version");
607637 undoButton.addActionListener(this);
608638 undoButton.setEnabled(false);
609639
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
610653 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- redoButton.setToolTipText("Redo changes");
654
+ redoButton.setToolTipText("Next version");
612655 redoButton.addActionListener(this);
613656 redoButton.setEnabled(false);
614657
615
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
616
- saveButton.setToolTipText("Save changes");
617
- saveButton.addActionListener(this);
618
-
619
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
620659 liveCB.setToolTipText("Enable animation");
621660 liveCB.addItemListener(this);
622661
623
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624663 oneStepButton.setToolTipText("Animate one step forward");
625664 oneStepButton.addActionListener(this);
626665
627
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
628667 fastCB.setToolTipText("Fast mode");
629668 fastCB.addItemListener(this);
630669
631670 //oe.toolboxPanel.Return();
632671
633
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- screenfitButton.setToolTipText("Screen fit");
635
- screenfitButton.addActionListener(this);
636
-
637672 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638673 // trackCB.setToolTipText("Enable tracking");
639674 // trackCB.addItemListener(this);
....@@ -650,27 +685,28 @@
650685
651686 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
652687
653
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
- twoButton.setToolTipText("Show center view only");
655
- twoButton.addActionListener(this);
656
- this.fullscreenLayout = twoButton;
657
-
658688 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659689 fourButton.addActionListener(this);
660690 fourButton.setToolTipText("Show left panel only");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
661697 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
- sixButton.setToolTipText("2-column layout left");
698
+ sixButton.setToolTipText("Show left and right");
663699 sixButton.addActionListener(this);
664
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
- threeButton.setToolTipText("2-column layout right");
666
- threeButton.addActionListener(this);
667
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- sevenButton.setToolTipText("3-column layout");
669
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
670706 //
671707
672
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
- rootButton.setToolTipText("Edit selection in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
674710 rootButton.addActionListener(this);
675711
676712 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -726,7 +762,7 @@
726762 compositeButton.addActionListener(this);
727763
728764 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
- switchButton.setToolTipText("Create switch");
765
+ switchButton.setToolTipText("Create item switcher");
730766 switchButton.addActionListener(this);
731767
732768 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -758,16 +794,16 @@
758794 }
759795
760796 // EDIT panel
761
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
- editButton.setToolTipText("Edit selection");
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
763799 editButton.addActionListener(this);
764800
765
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
- uneditButton.setToolTipText("Unedit selection");
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
767803 uneditButton.addActionListener(this);
768804
769805 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
- allParamsButton.setToolTipText("Edit all params");
806
+ allParamsButton.setToolTipText("Show all controle");
771807 allParamsButton.addActionListener(this);
772808
773809 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -784,6 +820,7 @@
784820
785821 editCommandsPanel.preferredHeight = 1;
786822
823
+ SetPinStates(false);
787824 // oe.treePanel.add(commandsPanel);
788825 // oe.treePanel.Return();
789826
....@@ -810,6 +847,9 @@
810847
811848 oe.treePanel.add(copyOptionsPanel);
812849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
813853
814854 // mainPanel.setDividerLocation(0.5); //1.0);
815855 // mainPanel.setResizeWeight(0.5);
....@@ -832,7 +872,7 @@
832872 dgr.addDragGestureListener(this);
833873 }catch(Exception e) {}
834874 */
835
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
836876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
837877 }
838878
....@@ -857,14 +897,18 @@
857897 boxCB.addItemListener(this);
858898
859899 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
860
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
861901 zoomBoxCB.addItemListener(this);
862902
863903 if (true) // Globals.ADVANCED)
864904 {
865
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
866
- supportCB.setToolTipText("Enable rigging");
867
- supportCB.addItemListener(this);
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
868912
869913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
870914 // localCB.addItemListener(this);
....@@ -919,7 +963,7 @@
919963 oeilCB.addItemListener(this);
920964
921965 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
- shadowCB.setToolTipText("Compute shadows when live");
966
+ shadowCB.setToolTipText("When live compute shadows");
923967 shadowCB.addItemListener(this);
924968
925969 panel.Return();
....@@ -928,12 +972,12 @@
928972 toggleTextureCB.addItemListener(this);
929973
930974 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
- toggleSwitchCB.setToolTipText("Use switch");
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
932976 toggleSwitchCB.addItemListener(this);
933977
934
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
- autosaveCB.setToolTipText("Auto-save on structure change");
936
- autosaveCB.addItemListener(this);
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
937981
938982 panel.Return();
939983 if (Globals.ADVANCED)
....@@ -962,7 +1006,7 @@
9621006 {
9631007 cRadio radioButton = new cRadio(obj.name);
9641008
965
- // Patch to avoid bug with transparency.
1009
+ // June 2019. Patch to avoid bug with transparency.
9661010 radioButton.hadMaterial = obj.material != null;
9671011 if (!radioButton.hadMaterial)
9681012 {
....@@ -970,7 +1014,7 @@
9701014 }
9711015
9721016 radioButton.SetObject(obj);
973
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
9741018 radioButton.SetCamera(cameraView.renderCamera, false);
9751019 radioButton.addActionListener(this);
9761020 radioPanel.add(radioButton);
....@@ -999,6 +1043,7 @@
9991043 cCheckBox slowCB;
10001044 cCheckBox boxCB;
10011045 cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
10021047 //cToggleButton trackCB;
10031048 cCheckBox trackCB;
10041049 cCheckBox smoothfocusCB;
....@@ -1009,7 +1054,7 @@
10091054
10101055 cCheckBox oeilCB;
10111056 cCheckBox shadowCB;
1012
- cCheckBox autosaveCB;
1057
+ cCheckBox autokeepCB;
10131058 cCheckBox lookAtCB;
10141059
10151060 // static int COLOR = 1;
....@@ -1117,9 +1162,13 @@
11171162 {
11181163 Globals.COMPUTESHADOWWHENLIVE ^= true;
11191164 }
1120
- else if(e.getSource() == autosaveCB)
1165
+ else if(e.getSource() == freezeCB)
11211166 {
1122
- Globals.SAVEONMAKE ^= true;
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
11231172 }
11241173 else if(e.getSource() == lookAtCB)
11251174 {
....@@ -1201,8 +1250,6 @@
12011250 }
12021251 }
12031252
1204
- String string = (String) object;
1205
-
12061253 System.out.println("Transfer = " + object + "; drop : " + target);
12071254 // if( object instanceof java.io.File[])
12081255 // {
....@@ -1210,6 +1257,8 @@
12101257 // objEditor.DropFile((java.io.File[]) object, true);
12111258 // return;
12121259 // }
1260
+
1261
+ String string = object.toString();
12131262
12141263 // File path for Mac and Windows
12151264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1459,6 +1508,9 @@
14591508 animationItem.addItemListener(this);
14601509 animationItem.setState(Globals.ANIMATION);
14611510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
14621514 menu.add("-");
14631515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14641516 parseverticesItem.addActionListener(this);
....@@ -1471,6 +1523,8 @@
14711523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14721524 reduce34MorphItem.addActionListener(this);
14731525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
14741528 menu.add(computeAOItem = new MenuItem("Compute AO"));
14751529 computeAOItem.addActionListener(this);
14761530
....@@ -1479,8 +1533,6 @@
14791533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14801534 mirrorItem.addActionListener(this);
14811535 menu.add("-");
1482
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1483
- memoryItem.addActionListener(this);
14841536 menu.add(analyzeItem = new MenuItem("Analyze"));
14851537 analyzeItem.addActionListener(this);
14861538 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1628,6 +1680,30 @@
16281680
16291681 makeSomething(shadow);
16301682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
16311707
16321708 /**
16331709 * applyExample
....@@ -2107,25 +2183,25 @@
21072183 Composite csg = new GroupLeaf();
21082184 csg.count = 5;
21092185 group(csg);
2110
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
21112187 csg.addChild(child);
21122188 child.addChild(csg);
21132189 } else
21142190 if (source == doubleItem)
21152191 {
2116
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
21172193 csg.count = 5;
21182194 group(csg);
2119
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
21202196 csg.addChild(child);
21212197 child.addChild(csg);
2122
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
21232199 csg.addChild(child);
21242200 child.addChild(csg);
21252201 } else
21262202 if (source == tripleItem)
21272203 {
2128
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
21292205 csg.count = 4;
21302206 group(csg);
21312207 Composite child = new cGroup();
....@@ -2189,15 +2265,31 @@
21892265 } else
21902266 if (source == undoButton)
21912267 {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21922271 Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
21932282 } else
21942283 if (source == redoButton)
21952284 {
2285
+ // Go to next version
21962286 Redo();
21972287 } else
21982288 if (source == saveButton)
21992289 {
2200
- Save();
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
22012293 } else
22022294 if (source == oneStepButton)
22032295 {
....@@ -2206,17 +2298,14 @@
22062298 } else
22072299 if (source == screenfitButton)
22082300 {
2209
- //Reload(lastConverter, lastFilename, true);
22102301 ScreenFit();
22112302 } else
22122303 if (source == screenfitpointButton)
22132304 {
2214
- //Reload(lastConverter, lastFilename, true);
22152305 ScreenFitPoint();
22162306 } else
22172307 if (source == snapobjectButton)
22182308 {
2219
- //Reload(lastConverter, lastFilename, true);
22202309 SnapObject();
22212310 } else
22222311 // if (event.getSource() == recompileButton)
....@@ -2580,7 +2669,7 @@
25802669 {
25812670 StepAll();
25822671 } else
2583
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
25842673 {
25852674 //int indices[] = jList.getSelectedIndices();
25862675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2740,15 +2829,28 @@
27402829 } else
27412830 if (source == ungroupItem || source == ungroupButton)
27422831 {
2743
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
27442834 for (int i=0; i<group.selection.size(); i++)
27452835 {
2746
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
27472841 }
27482842
2749
- ClearSelection(false);
2750
-
2751
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
27522854 } else
27532855 if (source == genUVItem)
27542856 {
....@@ -3372,7 +3474,7 @@
33723474 //copy.ClearUI();
33733475 for (Object3D obj : listUI)
33743476 {
3375
- obj.pinned = true;
3477
+ obj.pinned = false;
33763478 obj.CloseUI();
33773479 }
33783480 listUI.clear();
....@@ -3431,6 +3533,9 @@
34313533 }
34323534
34333535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
34343539 //Globals.theRenderer.object = group;
34353540 if(!useclient)
34363541 {
....@@ -3457,6 +3562,13 @@
34573562 currentLayout = sevenButton;
34583563 */
34593564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
34603572 keepparent = group.parent;
34613573 // PARENT = NULL or not???
34623574 //group.parent = null; // ROOT
....@@ -4526,6 +4638,12 @@
45264638
45274639 void EditSelection(boolean newWindow)
45284640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
45294647 // aConstraints.gridy = 0;
45304648 for (int i=0; i<group.selection.size(); i++)
45314649 {
....@@ -4536,12 +4654,7 @@
45364654 Object3D elem = (Object3D)group.selection.elementAt(i);
45374655 if(elem != group || !newWindow)
45384656 {
4539
- // if (!(elem instanceof Composite))
4540
- // newWindow = false;
4541
- listUI.add(elem);
4542
- elem.openEditWindow(this, newWindow); //, false);
4543
- System.out.println("edit : " + elem);
4544
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
45454658 }
45464659 }
45474660 }
....@@ -4616,17 +4729,7 @@
46164729 //new Exception().printStackTrace();
46174730
46184731 freezemodel = true;
4619
-
4620
- //for (Object3D obj : listUI)
4621
- for (int i=listUI.size(); --i>=0;)
4622
- {
4623
- Object3D obj = listUI.elementAt(i);
4624
- if (!obj.pinned)
4625
- {
4626
- obj.CloseUI();
4627
- listUI.remove(i);
4628
- }
4629
- }
4732
+ ClearUnpinned();
46304733
46314734 /**/
46324735 //switch (event.id)
....@@ -4689,12 +4792,14 @@
46894792 {
46904793 editButton.setEnabled(enabled);
46914794 uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
46924797 }
46934798
46944799 void refreshContents(boolean cp)
46954800 {
46964801 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46984803 {
46994804 objEditor.ClearInfo(); // .GetMaterial());
47004805
....@@ -4793,8 +4898,8 @@
47934898
47944899 if (cut)
47954900 {
4796
- if (Globals.SAVEONMAKE)
4797
- Save();
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
47984903 //int indices[] = jList.getSelectedIndices();
47994904 //for (int i = indices.length - 1; i >= 0; i--)
48004905 //jList.remove(indices[i]);
....@@ -4897,6 +5002,10 @@
48975002
48985003 void paste(boolean expand)
48995004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
49005009 // if (GrafreeD.clipboard == null)
49015010 // return;
49025011 boolean first = true;
....@@ -4956,6 +5065,7 @@
49565065 Grafreed.clipboard.get(0).parent = keepparent;
49575066 }
49585067
5068
+ Globals.REPLACEONMAKE = keep;
49595069 ResetModel();
49605070 refreshContents();
49615071 }
....@@ -5091,6 +5201,10 @@
50915201
50925202 void group(Object3D csg, boolean grab)
50935203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
50945208 if (//false) // why??
50955209 !group.selection.isEmpty())
50965210 {
....@@ -5204,10 +5318,15 @@
52045318 //node.add(csg);
52055319 //makeSomething(node);
52065320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
52075322 }
52085323
52095324 void Ungroup(Object3D g)
52105325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
52115330 if (g instanceof HiddenObject)
52125331 {
52135332 HiddenObject h = (HiddenObject) g;
....@@ -5224,6 +5343,7 @@
52245343 objEditor.makeSomething(g.get(i), false);
52255344 }
52265345 }
5346
+ Globals.REPLACEONMAKE = keep;
52275347 }
52285348
52295349 void ungroup()
....@@ -5514,9 +5634,6 @@
55145634
55155635 cButton restoreCameraButton;
55165636
5517
- cButton minButton;
5518
- cButton maxButton;
5519
- cButton fullButton;
55205637 cButton saveButton;
55215638 cButton oneStepButton;
55225639
....@@ -5590,7 +5707,7 @@
55905707 private MenuItem pasteLinkItem;
55915708 private MenuItem pasteCloneItem;
55925709 private MenuItem pasteExpandItem;
5593
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
55945711 private MenuItem clearAllItem;
55955712 private MenuItem genUVItem;
55965713 private MenuItem genNormalsMESHItem;