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);
....@@ -811,6 +847,9 @@
811847
812848 oe.treePanel.add(copyOptionsPanel);
813849 oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
814853
815854 // mainPanel.setDividerLocation(0.5); //1.0);
816855 // mainPanel.setResizeWeight(0.5);
....@@ -833,7 +872,7 @@
833872 dgr.addDragGestureListener(this);
834873 }catch(Exception e) {}
835874 */
836
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
837876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
838877 }
839878
....@@ -863,9 +902,13 @@
863902
864903 if (true) // Globals.ADVANCED)
865904 {
866
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
- supportCB.setToolTipText("Enable rigging");
868
- 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);
869912
870913 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
871914 // localCB.addItemListener(this);
....@@ -929,12 +972,12 @@
929972 toggleTextureCB.addItemListener(this);
930973
931974 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
932
- toggleSwitchCB.setToolTipText("Use switch");
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
933976 toggleSwitchCB.addItemListener(this);
934977
935
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
936
- autosaveCB.setToolTipText("On structure change");
937
- autosaveCB.addItemListener(this);
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
938981
939982 panel.Return();
940983 if (Globals.ADVANCED)
....@@ -963,7 +1006,7 @@
9631006 {
9641007 cRadio radioButton = new cRadio(obj.name);
9651008
966
- // Patch to avoid bug with transparency.
1009
+ // June 2019. Patch to avoid bug with transparency.
9671010 radioButton.hadMaterial = obj.material != null;
9681011 if (!radioButton.hadMaterial)
9691012 {
....@@ -971,7 +1014,7 @@
9711014 }
9721015
9731016 radioButton.SetObject(obj);
974
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
9751018 radioButton.SetCamera(cameraView.renderCamera, false);
9761019 radioButton.addActionListener(this);
9771020 radioPanel.add(radioButton);
....@@ -1000,6 +1043,7 @@
10001043 cCheckBox slowCB;
10011044 cCheckBox boxCB;
10021045 cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
10031047 //cToggleButton trackCB;
10041048 cCheckBox trackCB;
10051049 cCheckBox smoothfocusCB;
....@@ -1010,7 +1054,7 @@
10101054
10111055 cCheckBox oeilCB;
10121056 cCheckBox shadowCB;
1013
- cCheckBox autosaveCB;
1057
+ cCheckBox autokeepCB;
10141058 cCheckBox lookAtCB;
10151059
10161060 // static int COLOR = 1;
....@@ -1118,9 +1162,13 @@
11181162 {
11191163 Globals.COMPUTESHADOWWHENLIVE ^= true;
11201164 }
1121
- else if(e.getSource() == autosaveCB)
1165
+ else if(e.getSource() == freezeCB)
11221166 {
1123
- Globals.SAVEONMAKE ^= true;
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
11241172 }
11251173 else if(e.getSource() == lookAtCB)
11261174 {
....@@ -1202,8 +1250,6 @@
12021250 }
12031251 }
12041252
1205
- String string = (String) object;
1206
-
12071253 System.out.println("Transfer = " + object + "; drop : " + target);
12081254 // if( object instanceof java.io.File[])
12091255 // {
....@@ -1211,6 +1257,8 @@
12111257 // objEditor.DropFile((java.io.File[]) object, true);
12121258 // return;
12131259 // }
1260
+
1261
+ String string = object.toString();
12141262
12151263 // File path for Mac and Windows
12161264 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1460,6 +1508,9 @@
14601508 animationItem.addItemListener(this);
14611509 animationItem.setState(Globals.ANIMATION);
14621510
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
1513
+
14631514 menu.add("-");
14641515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14651516 parseverticesItem.addActionListener(this);
....@@ -1472,6 +1523,8 @@
14721523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14731524 reduce34MorphItem.addActionListener(this);
14741525 menu.add("-");
1526
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1527
+ memoryItem.addActionListener(this);
14751528 menu.add(computeAOItem = new MenuItem("Compute AO"));
14761529 computeAOItem.addActionListener(this);
14771530
....@@ -1480,8 +1533,6 @@
14801533 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14811534 mirrorItem.addActionListener(this);
14821535 menu.add("-");
1483
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1484
- memoryItem.addActionListener(this);
14851536 menu.add(analyzeItem = new MenuItem("Analyze"));
14861537 analyzeItem.addActionListener(this);
14871538 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1642,6 +1693,16 @@
16421693 listUI.remove(i);
16431694 }
16441695 }
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
16451706 }
16461707
16471708 /**
....@@ -2122,25 +2183,25 @@
21222183 Composite csg = new GroupLeaf();
21232184 csg.count = 5;
21242185 group(csg);
2125
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
21262187 csg.addChild(child);
21272188 child.addChild(csg);
21282189 } else
21292190 if (source == doubleItem)
21302191 {
2131
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
21322193 csg.count = 5;
21332194 group(csg);
2134
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
21352196 csg.addChild(child);
21362197 child.addChild(csg);
2137
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
21382199 csg.addChild(child);
21392200 child.addChild(csg);
21402201 } else
21412202 if (source == tripleItem)
21422203 {
2143
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
21442205 csg.count = 4;
21452206 group(csg);
21462207 Composite child = new cGroup();
....@@ -2204,15 +2265,31 @@
22042265 } else
22052266 if (source == undoButton)
22062267 {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
22072271 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();
22082282 } else
22092283 if (source == redoButton)
22102284 {
2285
+ // Go to next version
22112286 Redo();
22122287 } else
22132288 if (source == saveButton)
22142289 {
2215
- Save();
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
22162293 } else
22172294 if (source == oneStepButton)
22182295 {
....@@ -2221,17 +2298,14 @@
22212298 } else
22222299 if (source == screenfitButton)
22232300 {
2224
- //Reload(lastConverter, lastFilename, true);
22252301 ScreenFit();
22262302 } else
22272303 if (source == screenfitpointButton)
22282304 {
2229
- //Reload(lastConverter, lastFilename, true);
22302305 ScreenFitPoint();
22312306 } else
22322307 if (source == snapobjectButton)
22332308 {
2234
- //Reload(lastConverter, lastFilename, true);
22352309 SnapObject();
22362310 } else
22372311 // if (event.getSource() == recompileButton)
....@@ -2595,7 +2669,7 @@
25952669 {
25962670 StepAll();
25972671 } else
2598
- if (source == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
25992673 {
26002674 //int indices[] = jList.getSelectedIndices();
26012675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2755,15 +2829,28 @@
27552829 } else
27562830 if (source == ungroupItem || source == ungroupButton)
27572831 {
2758
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
27592834 for (int i=0; i<group.selection.size(); i++)
27602835 {
2761
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
27622841 }
27632842
2764
- ClearSelection(false);
2765
-
2766
- 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
+ }
27672854 } else
27682855 if (source == genUVItem)
27692856 {
....@@ -3446,6 +3533,9 @@
34463533 }
34473534
34483535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
34493539 //Globals.theRenderer.object = group;
34503540 if(!useclient)
34513541 {
....@@ -3474,8 +3564,10 @@
34743564 radio.layout.doClick();
34753565
34763566 ClearUnpinned();
3477
- SetPinStates(group.selection.size() > 0);
3478
- if (group.selection.size() == 1)
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)
34793571 EditSelection(false);
34803572 keepparent = group.parent;
34813573 // PARENT = NULL or not???
....@@ -4546,6 +4638,12 @@
45464638
45474639 void EditSelection(boolean newWindow)
45484640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
45494647 // aConstraints.gridy = 0;
45504648 for (int i=0; i<group.selection.size(); i++)
45514649 {
....@@ -4556,12 +4654,7 @@
45564654 Object3D elem = (Object3D)group.selection.elementAt(i);
45574655 if(elem != group || !newWindow)
45584656 {
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
4657
+ EditElement(elem, newWindow); // ? new
45654658 }
45664659 }
45674660 }
....@@ -4706,7 +4799,7 @@
47064799 void refreshContents(boolean cp)
47074800 {
47084801 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4709
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47104803 {
47114804 objEditor.ClearInfo(); // .GetMaterial());
47124805
....@@ -4805,8 +4898,8 @@
48054898
48064899 if (cut)
48074900 {
4808
- if (Globals.SAVEONMAKE)
4809
- Save();
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
48104903 //int indices[] = jList.getSelectedIndices();
48114904 //for (int i = indices.length - 1; i >= 0; i--)
48124905 //jList.remove(indices[i]);
....@@ -4909,6 +5002,10 @@
49095002
49105003 void paste(boolean expand)
49115004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
49125009 // if (GrafreeD.clipboard == null)
49135010 // return;
49145011 boolean first = true;
....@@ -4968,6 +5065,7 @@
49685065 Grafreed.clipboard.get(0).parent = keepparent;
49695066 }
49705067
5068
+ Globals.REPLACEONMAKE = keep;
49715069 ResetModel();
49725070 refreshContents();
49735071 }
....@@ -5103,6 +5201,10 @@
51035201
51045202 void group(Object3D csg, boolean grab)
51055203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
51065208 if (//false) // why??
51075209 !group.selection.isEmpty())
51085210 {
....@@ -5216,10 +5318,15 @@
52165318 //node.add(csg);
52175319 //makeSomething(node);
52185320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
52195322 }
52205323
52215324 void Ungroup(Object3D g)
52225325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
52235330 if (g instanceof HiddenObject)
52245331 {
52255332 HiddenObject h = (HiddenObject) g;
....@@ -5236,6 +5343,7 @@
52365343 objEditor.makeSomething(g.get(i), false);
52375344 }
52385345 }
5346
+ Globals.REPLACEONMAKE = keep;
52395347 }
52405348
52415349 void ungroup()
....@@ -5526,9 +5634,6 @@
55265634
55275635 cButton restoreCameraButton;
55285636
5529
- cButton minButton;
5530
- cButton maxButton;
5531
- cButton fullButton;
55325637 cButton saveButton;
55335638 cButton oneStepButton;
55345639
....@@ -5602,7 +5707,7 @@
56025707 private MenuItem pasteLinkItem;
56035708 private MenuItem pasteCloneItem;
56045709 private MenuItem pasteExpandItem;
5605
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
56065711 private MenuItem clearAllItem;
56075712 private MenuItem genUVItem;
56085713 private MenuItem genNormalsMESHItem;