Normand Briere
2019-07-21 d32f24f147068e6cbecb31c7f98047f68bc8b58a
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,50 +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);
608640 undoButton.setEnabled(false);
609641
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
+
610655 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- redoButton.setToolTipText("Redo changes");
656
+ redoButton.setToolTipText("Next version");
612657 redoButton.addActionListener(this);
613658 redoButton.setEnabled(false);
614659
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);
660
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
620661 liveCB.setToolTipText("Enable animation");
621662 liveCB.addItemListener(this);
622663
623
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624665 oneStepButton.setToolTipText("Animate one step forward");
625666 oneStepButton.addActionListener(this);
626667
627
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
668
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
628669 fastCB.setToolTipText("Fast mode");
629670 fastCB.addItemListener(this);
630671
631672 //oe.toolboxPanel.Return();
632673
633
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- screenfitButton.setToolTipText("Screen fit");
635
- screenfitButton.addActionListener(this);
636
-
637674 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638675 // trackCB.setToolTipText("Enable tracking");
639676 // trackCB.addItemListener(this);
....@@ -650,27 +687,28 @@
650687
651688 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
652689
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
-
658690 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
659691 fourButton.addActionListener(this);
660692 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
+
661699 oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
- sixButton.setToolTipText("2-column layout left");
700
+ sixButton.setToolTipText("Show left and right");
663701 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);
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);
670708 //
671709
672
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
673
- 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");
674712 rootButton.addActionListener(this);
675713
676714 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -726,7 +764,7 @@
726764 compositeButton.addActionListener(this);
727765
728766 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
- switchButton.setToolTipText("Create switch");
767
+ switchButton.setToolTipText("Create item switcher");
730768 switchButton.addActionListener(this);
731769
732770 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -758,16 +796,16 @@
758796 }
759797
760798 // EDIT panel
761
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
- editButton.setToolTipText("Edit selection");
799
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
800
+ editButton.setToolTipText("Pin selection controls");
763801 editButton.addActionListener(this);
764802
765
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
- uneditButton.setToolTipText("Unedit selection");
803
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
804
+ uneditButton.setToolTipText("Remove selection controls");
767805 uneditButton.addActionListener(this);
768806
769807 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
770
- allParamsButton.setToolTipText("Edit all params");
808
+ allParamsButton.setToolTipText("Show all controle");
771809 allParamsButton.addActionListener(this);
772810
773811 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -784,6 +822,7 @@
784822
785823 editCommandsPanel.preferredHeight = 1;
786824
825
+ SetPinStates(false);
787826 // oe.treePanel.add(commandsPanel);
788827 // oe.treePanel.Return();
789828
....@@ -810,6 +849,9 @@
810849
811850 oe.treePanel.add(copyOptionsPanel);
812851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
813855
814856 // mainPanel.setDividerLocation(0.5); //1.0);
815857 // mainPanel.setResizeWeight(0.5);
....@@ -832,7 +874,7 @@
832874 dgr.addDragGestureListener(this);
833875 }catch(Exception e) {}
834876 */
835
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
836878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
837879 }
838880
....@@ -857,14 +899,18 @@
857899 boxCB.addItemListener(this);
858900
859901 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
860
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
902
+ zoomBoxCB.setToolTipText("Display only for wheel");
861903 zoomBoxCB.addItemListener(this);
862904
863905 if (true) // Globals.ADVANCED)
864906 {
865
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
866
- supportCB.setToolTipText("Enable rigging");
867
- 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);
868914
869915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
870916 // localCB.addItemListener(this);
....@@ -919,7 +965,7 @@
919965 oeilCB.addItemListener(this);
920966
921967 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
922
- shadowCB.setToolTipText("Compute shadows when live");
968
+ shadowCB.setToolTipText("When live compute shadows");
923969 shadowCB.addItemListener(this);
924970
925971 panel.Return();
....@@ -928,12 +974,12 @@
928974 toggleTextureCB.addItemListener(this);
929975
930976 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
931
- toggleSwitchCB.setToolTipText("Use switch");
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
932978 toggleSwitchCB.addItemListener(this);
933979
934
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
935
- autosaveCB.setToolTipText("Auto-save on structure change");
936
- autosaveCB.addItemListener(this);
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
937983
938984 panel.Return();
939985 if (Globals.ADVANCED)
....@@ -962,7 +1008,7 @@
9621008 {
9631009 cRadio radioButton = new cRadio(obj.name);
9641010
965
- // Patch to avoid bug with transparency.
1011
+ // June 2019. Patch to avoid bug with transparency.
9661012 radioButton.hadMaterial = obj.material != null;
9671013 if (!radioButton.hadMaterial)
9681014 {
....@@ -970,7 +1016,7 @@
9701016 }
9711017
9721018 radioButton.SetObject(obj);
973
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
9741020 radioButton.SetCamera(cameraView.renderCamera, false);
9751021 radioButton.addActionListener(this);
9761022 radioPanel.add(radioButton);
....@@ -999,6 +1045,7 @@
9991045 cCheckBox slowCB;
10001046 cCheckBox boxCB;
10011047 cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
10021049 //cToggleButton trackCB;
10031050 cCheckBox trackCB;
10041051 cCheckBox smoothfocusCB;
....@@ -1009,7 +1056,7 @@
10091056
10101057 cCheckBox oeilCB;
10111058 cCheckBox shadowCB;
1012
- cCheckBox autosaveCB;
1059
+ cCheckBox autokeepCB;
10131060 cCheckBox lookAtCB;
10141061
10151062 // static int COLOR = 1;
....@@ -1117,9 +1164,13 @@
11171164 {
11181165 Globals.COMPUTESHADOWWHENLIVE ^= true;
11191166 }
1120
- else if(e.getSource() == autosaveCB)
1167
+ else if(e.getSource() == freezeCB)
11211168 {
1122
- Globals.SAVEONMAKE ^= true;
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
11231174 }
11241175 else if(e.getSource() == lookAtCB)
11251176 {
....@@ -1201,8 +1252,6 @@
12011252 }
12021253 }
12031254
1204
- String string = (String) object;
1205
-
12061255 System.out.println("Transfer = " + object + "; drop : " + target);
12071256 // if( object instanceof java.io.File[])
12081257 // {
....@@ -1210,6 +1259,8 @@
12101259 // objEditor.DropFile((java.io.File[]) object, true);
12111260 // return;
12121261 // }
1262
+
1263
+ String string = object.toString();
12131264
12141265 // File path for Mac and Windows
12151266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1459,6 +1510,9 @@
14591510 animationItem.addItemListener(this);
14601511 animationItem.setState(Globals.ANIMATION);
14611512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
14621516 menu.add("-");
14631517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14641518 parseverticesItem.addActionListener(this);
....@@ -1471,6 +1525,8 @@
14711525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14721526 reduce34MorphItem.addActionListener(this);
14731527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
14741530 menu.add(computeAOItem = new MenuItem("Compute AO"));
14751531 computeAOItem.addActionListener(this);
14761532
....@@ -1479,8 +1535,6 @@
14791535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14801536 mirrorItem.addActionListener(this);
14811537 menu.add("-");
1482
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1483
- memoryItem.addActionListener(this);
14841538 menu.add(analyzeItem = new MenuItem("Analyze"));
14851539 analyzeItem.addActionListener(this);
14861540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1628,6 +1682,30 @@
16281682
16291683 makeSomething(shadow);
16301684 }
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
+ }
16311709
16321710 /**
16331711 * applyExample
....@@ -2107,25 +2185,25 @@
21072185 Composite csg = new GroupLeaf();
21082186 csg.count = 5;
21092187 group(csg);
2110
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
21112189 csg.addChild(child);
21122190 child.addChild(csg);
21132191 } else
21142192 if (source == doubleItem)
21152193 {
2116
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
21172195 csg.count = 5;
21182196 group(csg);
2119
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
21202198 csg.addChild(child);
21212199 child.addChild(csg);
2122
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
21232201 csg.addChild(child);
21242202 child.addChild(csg);
21252203 } else
21262204 if (source == tripleItem)
21272205 {
2128
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
21292207 csg.count = 4;
21302208 group(csg);
21312209 Composite child = new cGroup();
....@@ -2189,15 +2267,31 @@
21892267 } else
21902268 if (source == undoButton)
21912269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21922273 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();
21932284 } else
21942285 if (source == redoButton)
21952286 {
2287
+ // Go to next version
21962288 Redo();
21972289 } else
21982290 if (source == saveButton)
21992291 {
2200
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
22012295 } else
22022296 if (source == oneStepButton)
22032297 {
....@@ -2206,17 +2300,14 @@
22062300 } else
22072301 if (source == screenfitButton)
22082302 {
2209
- //Reload(lastConverter, lastFilename, true);
22102303 ScreenFit();
22112304 } else
22122305 if (source == screenfitpointButton)
22132306 {
2214
- //Reload(lastConverter, lastFilename, true);
22152307 ScreenFitPoint();
22162308 } else
22172309 if (source == snapobjectButton)
22182310 {
2219
- //Reload(lastConverter, lastFilename, true);
22202311 SnapObject();
22212312 } else
22222313 // if (event.getSource() == recompileButton)
....@@ -2580,7 +2671,7 @@
25802671 {
25812672 StepAll();
25822673 } else
2583
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
25842675 {
25852676 //int indices[] = jList.getSelectedIndices();
25862677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2740,15 +2831,28 @@
27402831 } else
27412832 if (source == ungroupItem || source == ungroupButton)
27422833 {
2743
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
27442836 for (int i=0; i<group.selection.size(); i++)
27452837 {
2746
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
27472843 }
27482844
2749
- ClearSelection(false);
2750
-
2751
- 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
+ }
27522856 } else
27532857 if (source == genUVItem)
27542858 {
....@@ -3049,7 +3153,7 @@
30493153 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30503154 {
30513155 obj = (Object3D)e.nextElement();
3052
- obj.SetBumpTexture(null);
3156
+ obj.ResetBumpTexture();
30533157 }
30543158
30553159 refreshContents();
....@@ -3372,7 +3476,7 @@
33723476 //copy.ClearUI();
33733477 for (Object3D obj : listUI)
33743478 {
3375
- obj.pinned = true;
3479
+ obj.pinned = false;
33763480 obj.CloseUI();
33773481 }
33783482 listUI.clear();
....@@ -3431,6 +3535,9 @@
34313535 }
34323536
34333537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
34343541 //Globals.theRenderer.object = group;
34353542 if(!useclient)
34363543 {
....@@ -3457,6 +3564,13 @@
34573564 currentLayout = sevenButton;
34583565 */
34593566 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);
34603574 keepparent = group.parent;
34613575 // PARENT = NULL or not???
34623576 //group.parent = null; // ROOT
....@@ -4049,7 +4163,7 @@
40494163
40504164 try
40514165 {
4052
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4166
+ texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
40534167 }
40544168 catch (Exception e)
40554169 {
....@@ -4526,6 +4640,12 @@
45264640
45274641 void EditSelection(boolean newWindow)
45284642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
45294649 // aConstraints.gridy = 0;
45304650 for (int i=0; i<group.selection.size(); i++)
45314651 {
....@@ -4536,12 +4656,7 @@
45364656 Object3D elem = (Object3D)group.selection.elementAt(i);
45374657 if(elem != group || !newWindow)
45384658 {
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
4659
+ EditElement(elem, newWindow); // ? new
45454660 }
45464661 }
45474662 }
....@@ -4616,17 +4731,7 @@
46164731 //new Exception().printStackTrace();
46174732
46184733 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
- }
4734
+ ClearUnpinned();
46304735
46314736 /**/
46324737 //switch (event.id)
....@@ -4689,12 +4794,14 @@
46894794 {
46904795 editButton.setEnabled(enabled);
46914796 uneditButton.setEnabled(enabled);
4797
+ unselectButton.setEnabled(enabled);
4798
+ flashSelectionButton.setEnabled(enabled);
46924799 }
46934800
46944801 void refreshContents(boolean cp)
46954802 {
4696
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4697
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46984805 {
46994806 objEditor.ClearInfo(); // .GetMaterial());
47004807
....@@ -4793,8 +4900,8 @@
47934900
47944901 if (cut)
47954902 {
4796
- if (Globals.SAVEONMAKE)
4797
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
47984905 //int indices[] = jList.getSelectedIndices();
47994906 //for (int i = indices.length - 1; i >= 0; i--)
48004907 //jList.remove(indices[i]);
....@@ -4897,6 +5004,10 @@
48975004
48985005 void paste(boolean expand)
48995006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
49005011 // if (GrafreeD.clipboard == null)
49015012 // return;
49025013 boolean first = true;
....@@ -4956,6 +5067,7 @@
49565067 Grafreed.clipboard.get(0).parent = keepparent;
49575068 }
49585069
5070
+ Globals.REPLACEONMAKE = keep;
49595071 ResetModel();
49605072 refreshContents();
49615073 }
....@@ -5091,6 +5203,10 @@
50915203
50925204 void group(Object3D csg, boolean grab)
50935205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
50945210 if (//false) // why??
50955211 !group.selection.isEmpty())
50965212 {
....@@ -5204,10 +5320,15 @@
52045320 //node.add(csg);
52055321 //makeSomething(node);
52065322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
52075324 }
52085325
52095326 void Ungroup(Object3D g)
52105327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
52115332 if (g instanceof HiddenObject)
52125333 {
52135334 HiddenObject h = (HiddenObject) g;
....@@ -5224,6 +5345,7 @@
52245345 objEditor.makeSomething(g.get(i), false);
52255346 }
52265347 }
5348
+ Globals.REPLACEONMAKE = keep;
52275349 }
52285350
52295351 void ungroup()
....@@ -5514,9 +5636,6 @@
55145636
55155637 cButton restoreCameraButton;
55165638
5517
- cButton minButton;
5518
- cButton maxButton;
5519
- cButton fullButton;
55205639 cButton saveButton;
55215640 cButton oneStepButton;
55225641
....@@ -5590,7 +5709,7 @@
55905709 private MenuItem pasteLinkItem;
55915710 private MenuItem pasteCloneItem;
55925711 private MenuItem pasteExpandItem;
5593
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
55945713 private MenuItem clearAllItem;
55955714 private MenuItem genUVItem;
55965715 private MenuItem genNormalsMESHItem;