Normand Briere
2019-07-21 5a546232b84ce65d8779d29e9171e7e2df013614
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);
....@@ -811,6 +849,9 @@
811849
812850 oe.treePanel.add(copyOptionsPanel);
813851 oe.treePanel.Return();
852
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
853
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
854
+ sliderPane.preferredHeight = 1;
814855
815856 // mainPanel.setDividerLocation(0.5); //1.0);
816857 // mainPanel.setResizeWeight(0.5);
....@@ -833,7 +874,7 @@
833874 dgr.addDragGestureListener(this);
834875 }catch(Exception e) {}
835876 */
836
- radio.layout = sevenButton;
877
+ radio.layout = sixButton; // sevenButton;
837878 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
838879 }
839880
....@@ -863,9 +904,13 @@
863904
864905 if (true) // Globals.ADVANCED)
865906 {
866
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
- supportCB.setToolTipText("Enable rigging");
868
- 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);
869914
870915 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
871916 // localCB.addItemListener(this);
....@@ -929,12 +974,12 @@
929974 toggleTextureCB.addItemListener(this);
930975
931976 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
932
- toggleSwitchCB.setToolTipText("Use switch");
977
+ toggleSwitchCB.setToolTipText("Choose a single item");
933978 toggleSwitchCB.addItemListener(this);
934979
935
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
936
- autosaveCB.setToolTipText("On structure change");
937
- autosaveCB.addItemListener(this);
980
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
981
+ autokeepCB.setToolTipText("On structure change");
982
+ autokeepCB.addItemListener(this);
938983
939984 panel.Return();
940985 if (Globals.ADVANCED)
....@@ -963,7 +1008,7 @@
9631008 {
9641009 cRadio radioButton = new cRadio(obj.name);
9651010
966
- // Patch to avoid bug with transparency.
1011
+ // June 2019. Patch to avoid bug with transparency.
9671012 radioButton.hadMaterial = obj.material != null;
9681013 if (!radioButton.hadMaterial)
9691014 {
....@@ -971,7 +1016,7 @@
9711016 }
9721017
9731018 radioButton.SetObject(obj);
974
- radioButton.layout = sevenButton;
1019
+ radioButton.layout = sixButton; // sevenButton;
9751020 radioButton.SetCamera(cameraView.renderCamera, false);
9761021 radioButton.addActionListener(this);
9771022 radioPanel.add(radioButton);
....@@ -1000,6 +1045,7 @@
10001045 cCheckBox slowCB;
10011046 cCheckBox boxCB;
10021047 cCheckBox zoomBoxCB;
1048
+ cCheckBox freezeCB;
10031049 //cToggleButton trackCB;
10041050 cCheckBox trackCB;
10051051 cCheckBox smoothfocusCB;
....@@ -1010,7 +1056,7 @@
10101056
10111057 cCheckBox oeilCB;
10121058 cCheckBox shadowCB;
1013
- cCheckBox autosaveCB;
1059
+ cCheckBox autokeepCB;
10141060 cCheckBox lookAtCB;
10151061
10161062 // static int COLOR = 1;
....@@ -1118,9 +1164,13 @@
11181164 {
11191165 Globals.COMPUTESHADOWWHENLIVE ^= true;
11201166 }
1121
- else if(e.getSource() == autosaveCB)
1167
+ else if(e.getSource() == freezeCB)
11221168 {
1123
- Globals.SAVEONMAKE ^= true;
1169
+ Globals.FREEZEONMOVE ^= true;
1170
+ }
1171
+ else if(e.getSource() == autokeepCB)
1172
+ {
1173
+ Globals.REPLACEONMAKE ^= true;
11241174 }
11251175 else if(e.getSource() == lookAtCB)
11261176 {
....@@ -1202,8 +1252,6 @@
12021252 }
12031253 }
12041254
1205
- String string = (String) object;
1206
-
12071255 System.out.println("Transfer = " + object + "; drop : " + target);
12081256 // if( object instanceof java.io.File[])
12091257 // {
....@@ -1211,6 +1259,8 @@
12111259 // objEditor.DropFile((java.io.File[]) object, true);
12121260 // return;
12131261 // }
1262
+
1263
+ String string = object.toString();
12141264
12151265 // File path for Mac and Windows
12161266 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1460,6 +1510,9 @@
14601510 animationItem.addItemListener(this);
14611511 animationItem.setState(Globals.ANIMATION);
14621512
1513
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1514
+ archiveItem.addActionListener(this);
1515
+
14631516 menu.add("-");
14641517 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14651518 parseverticesItem.addActionListener(this);
....@@ -1472,6 +1525,8 @@
14721525 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14731526 reduce34MorphItem.addActionListener(this);
14741527 menu.add("-");
1528
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1529
+ memoryItem.addActionListener(this);
14751530 menu.add(computeAOItem = new MenuItem("Compute AO"));
14761531 computeAOItem.addActionListener(this);
14771532
....@@ -1480,8 +1535,6 @@
14801535 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14811536 mirrorItem.addActionListener(this);
14821537 menu.add("-");
1483
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1484
- memoryItem.addActionListener(this);
14851538 menu.add(analyzeItem = new MenuItem("Analyze"));
14861539 analyzeItem.addActionListener(this);
14871540 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1642,6 +1695,16 @@
16421695 listUI.remove(i);
16431696 }
16441697 }
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
16451708 }
16461709
16471710 /**
....@@ -2122,25 +2185,25 @@
21222185 Composite csg = new GroupLeaf();
21232186 csg.count = 5;
21242187 group(csg);
2125
- Composite child = new cGroup();
2188
+ Composite child = new cGroup("Branch");
21262189 csg.addChild(child);
21272190 child.addChild(csg);
21282191 } else
21292192 if (source == doubleItem)
21302193 {
2131
- Composite csg = new GroupLeaf();
2194
+ Composite csg = new GroupLeaf("Fork");
21322195 csg.count = 5;
21332196 group(csg);
2134
- Composite child = new cGroup();
2197
+ Composite child = new cGroup("Branch A");
21352198 csg.addChild(child);
21362199 child.addChild(csg);
2137
- child = new cGroup();
2200
+ child = new cGroup("Branch B");
21382201 csg.addChild(child);
21392202 child.addChild(csg);
21402203 } else
21412204 if (source == tripleItem)
21422205 {
2143
- Composite csg = new GroupLeaf();
2206
+ Composite csg = new GroupLeaf("Trident");
21442207 csg.count = 4;
21452208 group(csg);
21462209 Composite child = new cGroup();
....@@ -2204,15 +2267,31 @@
22042267 } else
22052268 if (source == undoButton)
22062269 {
2270
+ // Go to previous version
2271
+ //if (!Undo())
2272
+ //java.awt.Toolkit.getDefaultToolkit().beep();
22072273 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();
22082284 } else
22092285 if (source == redoButton)
22102286 {
2287
+ // Go to next version
22112288 Redo();
22122289 } else
22132290 if (source == saveButton)
22142291 {
2215
- Save();
2292
+ // Save a new version
2293
+ if (!Save(true))
2294
+ java.awt.Toolkit.getDefaultToolkit().beep();
22162295 } else
22172296 if (source == oneStepButton)
22182297 {
....@@ -2221,17 +2300,14 @@
22212300 } else
22222301 if (source == screenfitButton)
22232302 {
2224
- //Reload(lastConverter, lastFilename, true);
22252303 ScreenFit();
22262304 } else
22272305 if (source == screenfitpointButton)
22282306 {
2229
- //Reload(lastConverter, lastFilename, true);
22302307 ScreenFitPoint();
22312308 } else
22322309 if (source == snapobjectButton)
22332310 {
2234
- //Reload(lastConverter, lastFilename, true);
22352311 SnapObject();
22362312 } else
22372313 // if (event.getSource() == recompileButton)
....@@ -2595,7 +2671,7 @@
25952671 {
25962672 StepAll();
25972673 } else
2598
- if (source == clearItem) // || event.getSource() == clearButton)
2674
+ if (source == deleteItem) // || event.getSource() == clearButton)
25992675 {
26002676 //int indices[] = jList.getSelectedIndices();
26012677 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2755,15 +2831,28 @@
27552831 } else
27562832 if (source == ungroupItem || source == ungroupButton)
27572833 {
2758
- //ungroup();
2834
+ boolean hasRoot = false;
2835
+
27592836 for (int i=0; i<group.selection.size(); i++)
27602837 {
2761
- Ungroup(group.selection.get(i));
2838
+ if (group.selection.get(i) == group)
2839
+ {
2840
+ hasRoot = true;
2841
+ break;
2842
+ }
27622843 }
27632844
2764
- ClearSelection(false);
2765
-
2766
- 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
+ }
27672856 } else
27682857 if (source == genUVItem)
27692858 {
....@@ -3446,6 +3535,9 @@
34463535 }
34473536
34483537 copy = group;
3538
+
3539
+ SetUndoStates();
3540
+
34493541 //Globals.theRenderer.object = group;
34503542 if(!useclient)
34513543 {
....@@ -3474,8 +3566,10 @@
34743566 radio.layout.doClick();
34753567
34763568 ClearUnpinned();
3477
- SetPinStates(group.selection.size() > 0);
3478
- if (group.selection.size() == 1)
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)
34793573 EditSelection(false);
34803574 keepparent = group.parent;
34813575 // PARENT = NULL or not???
....@@ -4546,6 +4640,12 @@
45464640
45474641 void EditSelection(boolean newWindow)
45484642 {
4643
+ if (group.selection == null)
4644
+ {
4645
+ EditElement(group, newWindow); // ? new
4646
+ return;
4647
+ }
4648
+
45494649 // aConstraints.gridy = 0;
45504650 for (int i=0; i<group.selection.size(); i++)
45514651 {
....@@ -4556,12 +4656,7 @@
45564656 Object3D elem = (Object3D)group.selection.elementAt(i);
45574657 if(elem != group || !newWindow)
45584658 {
4559
- // if (!(elem instanceof Composite))
4560
- // newWindow = false;
4561
- listUI.add(elem);
4562
- elem.openEditWindow(this, newWindow); //, false);
4563
- System.out.println("edit : " + elem);
4564
- elem.editWindow.refreshContents(true); // ? new
4659
+ EditElement(elem, newWindow); // ? new
45654660 }
45664661 }
45674662 }
....@@ -4705,8 +4800,8 @@
47054800
47064801 void refreshContents(boolean cp)
47074802 {
4708
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4709
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4803
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
4804
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47104805 {
47114806 objEditor.ClearInfo(); // .GetMaterial());
47124807
....@@ -4805,8 +4900,8 @@
48054900
48064901 if (cut)
48074902 {
4808
- if (Globals.SAVEONMAKE)
4809
- Save();
4903
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4904
+// Save();
48104905 //int indices[] = jList.getSelectedIndices();
48114906 //for (int i = indices.length - 1; i >= 0; i--)
48124907 //jList.remove(indices[i]);
....@@ -4909,6 +5004,10 @@
49095004
49105005 void paste(boolean expand)
49115006 {
5007
+ if (Globals.REPLACEONMAKE)
5008
+ Save();
5009
+ boolean keep = Globals.REPLACEONMAKE;
5010
+ Globals.REPLACEONMAKE = false;
49125011 // if (GrafreeD.clipboard == null)
49135012 // return;
49145013 boolean first = true;
....@@ -4968,6 +5067,7 @@
49685067 Grafreed.clipboard.get(0).parent = keepparent;
49695068 }
49705069
5070
+ Globals.REPLACEONMAKE = keep;
49715071 ResetModel();
49725072 refreshContents();
49735073 }
....@@ -5103,6 +5203,10 @@
51035203
51045204 void group(Object3D csg, boolean grab)
51055205 {
5206
+ if (Globals.REPLACEONMAKE)
5207
+ Save();
5208
+ boolean keep = Globals.REPLACEONMAKE;
5209
+ Globals.REPLACEONMAKE = false;
51065210 if (//false) // why??
51075211 !group.selection.isEmpty())
51085212 {
....@@ -5216,10 +5320,15 @@
52165320 //node.add(csg);
52175321 //makeSomething(node);
52185322 makeSomething(csg);
5323
+ Globals.REPLACEONMAKE = keep;
52195324 }
52205325
52215326 void Ungroup(Object3D g)
52225327 {
5328
+ if (Globals.REPLACEONMAKE)
5329
+ Save();
5330
+ boolean keep = Globals.REPLACEONMAKE;
5331
+ Globals.REPLACEONMAKE = false;
52235332 if (g instanceof HiddenObject)
52245333 {
52255334 HiddenObject h = (HiddenObject) g;
....@@ -5236,6 +5345,7 @@
52365345 objEditor.makeSomething(g.get(i), false);
52375346 }
52385347 }
5348
+ Globals.REPLACEONMAKE = keep;
52395349 }
52405350
52415351 void ungroup()
....@@ -5526,9 +5636,6 @@
55265636
55275637 cButton restoreCameraButton;
55285638
5529
- cButton minButton;
5530
- cButton maxButton;
5531
- cButton fullButton;
55325639 cButton saveButton;
55335640 cButton oneStepButton;
55345641
....@@ -5602,7 +5709,7 @@
56025709 private MenuItem pasteLinkItem;
56035710 private MenuItem pasteCloneItem;
56045711 private MenuItem pasteExpandItem;
5605
- private MenuItem clearItem;
5712
+ private MenuItem deleteItem;
56065713 private MenuItem clearAllItem;
56075714 private MenuItem genUVItem;
56085715 private MenuItem genNormalsMESHItem;