Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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)
....@@ -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"));
....@@ -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,48 +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);
638
+ undoButton.setEnabled(false);
639
+
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);
608652
609653 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
- redoButton.setToolTipText("Redo changes");
654
+ redoButton.setToolTipText("Next version");
611655 redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
612657
613
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
- saveButton.setToolTipText("Save changes");
615
- saveButton.addActionListener(this);
616
-
617
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
618659 liveCB.setToolTipText("Enable animation");
619660 liveCB.addItemListener(this);
620661
621
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622663 oneStepButton.setToolTipText("Animate one step forward");
623664 oneStepButton.addActionListener(this);
624665
625
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
626667 fastCB.setToolTipText("Fast mode");
627668 fastCB.addItemListener(this);
628669
629670 //oe.toolboxPanel.Return();
630671
631
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
- screenfitButton.setToolTipText("Screen fit");
633
- screenfitButton.addActionListener(this);
634
-
635672 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
636673 // trackCB.setToolTipText("Enable tracking");
637674 // trackCB.addItemListener(this);
....@@ -724,7 +761,7 @@
724761 compositeButton.addActionListener(this);
725762
726763 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
- switchButton.setToolTipText("Create switch");
764
+ switchButton.setToolTipText("Create item switcher");
728765 switchButton.addActionListener(this);
729766
730767 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -743,17 +780,29 @@
743780 lightButton.setToolTipText("Create light");
744781 lightButton.addActionListener(this);
745782
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ }
794
+
746795 // EDIT panel
747
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
- editButton.setToolTipText("Edit selection");
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
749798 editButton.addActionListener(this);
750799
751
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
- uneditButton.setToolTipText("Unedit selection");
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
753802 uneditButton.addActionListener(this);
754803
755804 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
756
- allParamsButton.setToolTipText("Edit all params");
805
+ allParamsButton.setToolTipText("Show all controle");
757806 allParamsButton.addActionListener(this);
758807
759808 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -770,6 +819,7 @@
770819
771820 editCommandsPanel.preferredHeight = 1;
772821
822
+ SetPinStates(false);
773823 // oe.treePanel.add(commandsPanel);
774824 // oe.treePanel.Return();
775825
....@@ -796,6 +846,9 @@
796846
797847 oe.treePanel.add(copyOptionsPanel);
798848 oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
799852
800853 // mainPanel.setDividerLocation(0.5); //1.0);
801854 // mainPanel.setResizeWeight(0.5);
....@@ -843,14 +896,18 @@
843896 boxCB.addItemListener(this);
844897
845898 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
846
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
847900 zoomBoxCB.addItemListener(this);
848901
849902 if (true) // Globals.ADVANCED)
850903 {
851
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
852
- supportCB.setToolTipText("Enable rigging");
853
- supportCB.addItemListener(this);
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
854911
855912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
856913 // localCB.addItemListener(this);
....@@ -905,7 +962,7 @@
905962 oeilCB.addItemListener(this);
906963
907964 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
- shadowCB.setToolTipText("Compute shadows when live");
965
+ shadowCB.setToolTipText("When live compute shadows");
909966 shadowCB.addItemListener(this);
910967
911968 panel.Return();
....@@ -914,12 +971,12 @@
914971 toggleTextureCB.addItemListener(this);
915972
916973 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
- toggleSwitchCB.setToolTipText("Use switch");
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
918975 toggleSwitchCB.addItemListener(this);
919976
920
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
- autosaveCB.setToolTipText("Auto-save on structure change");
922
- autosaveCB.addItemListener(this);
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
923980
924981 panel.Return();
925982 if (Globals.ADVANCED)
....@@ -948,7 +1005,7 @@
9481005 {
9491006 cRadio radioButton = new cRadio(obj.name);
9501007
951
- // Patch to avoid bug with transparency.
1008
+ // June 2019. Patch to avoid bug with transparency.
9521009 radioButton.hadMaterial = obj.material != null;
9531010 if (!radioButton.hadMaterial)
9541011 {
....@@ -985,6 +1042,7 @@
9851042 cCheckBox slowCB;
9861043 cCheckBox boxCB;
9871044 cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
9881046 //cToggleButton trackCB;
9891047 cCheckBox trackCB;
9901048 cCheckBox smoothfocusCB;
....@@ -995,7 +1053,7 @@
9951053
9961054 cCheckBox oeilCB;
9971055 cCheckBox shadowCB;
998
- cCheckBox autosaveCB;
1056
+ cCheckBox autokeepCB;
9991057 cCheckBox lookAtCB;
10001058
10011059 // static int COLOR = 1;
....@@ -1103,9 +1161,13 @@
11031161 {
11041162 Globals.COMPUTESHADOWWHENLIVE ^= true;
11051163 }
1106
- else if(e.getSource() == autosaveCB)
1164
+ else if(e.getSource() == freezeCB)
11071165 {
1108
- Globals.SAVEONMAKE ^= true;
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
11091171 }
11101172 else if(e.getSource() == lookAtCB)
11111173 {
....@@ -1187,8 +1249,6 @@
11871249 }
11881250 }
11891251
1190
- String string = (String) object;
1191
-
11921252 System.out.println("Transfer = " + object + "; drop : " + target);
11931253 // if( object instanceof java.io.File[])
11941254 // {
....@@ -1196,6 +1256,8 @@
11961256 // objEditor.DropFile((java.io.File[]) object, true);
11971257 // return;
11981258 // }
1259
+
1260
+ String string = object.toString();
11991261
12001262 // File path for Mac and Windows
12011263 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1445,6 +1507,9 @@
14451507 animationItem.addItemListener(this);
14461508 animationItem.setState(Globals.ANIMATION);
14471509
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
1512
+
14481513 menu.add("-");
14491514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14501515 parseverticesItem.addActionListener(this);
....@@ -1457,6 +1522,8 @@
14571522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14581523 reduce34MorphItem.addActionListener(this);
14591524 menu.add("-");
1525
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1526
+ memoryItem.addActionListener(this);
14601527 menu.add(computeAOItem = new MenuItem("Compute AO"));
14611528 computeAOItem.addActionListener(this);
14621529
....@@ -1465,8 +1532,6 @@
14651532 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14661533 mirrorItem.addActionListener(this);
14671534 menu.add("-");
1468
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1469
- memoryItem.addActionListener(this);
14701535 menu.add(analyzeItem = new MenuItem("Analyze"));
14711536 analyzeItem.addActionListener(this);
14721537 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1614,6 +1679,20 @@
16141679
16151680 makeSomething(shadow);
16161681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
16171696
16181697 /**
16191698 * applyExample
....@@ -2093,25 +2172,25 @@
20932172 Composite csg = new GroupLeaf();
20942173 csg.count = 5;
20952174 group(csg);
2096
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
20972176 csg.addChild(child);
20982177 child.addChild(csg);
20992178 } else
21002179 if (source == doubleItem)
21012180 {
2102
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
21032182 csg.count = 5;
21042183 group(csg);
2105
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
21062185 csg.addChild(child);
21072186 child.addChild(csg);
2108
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
21092188 csg.addChild(child);
21102189 child.addChild(csg);
21112190 } else
21122191 if (source == tripleItem)
21132192 {
2114
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
21152194 csg.count = 4;
21162195 group(csg);
21172196 Composite child = new cGroup();
....@@ -2175,15 +2254,31 @@
21752254 } else
21762255 if (source == undoButton)
21772256 {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
21782260 Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
21792271 } else
21802272 if (source == redoButton)
21812273 {
2274
+ // Go to next version
21822275 Redo();
21832276 } else
21842277 if (source == saveButton)
21852278 {
2186
- Save();
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
21872282 } else
21882283 if (source == oneStepButton)
21892284 {
....@@ -2192,17 +2287,14 @@
21922287 } else
21932288 if (source == screenfitButton)
21942289 {
2195
- //Reload(lastConverter, lastFilename, true);
21962290 ScreenFit();
21972291 } else
21982292 if (source == screenfitpointButton)
21992293 {
2200
- //Reload(lastConverter, lastFilename, true);
22012294 ScreenFitPoint();
22022295 } else
22032296 if (source == snapobjectButton)
22042297 {
2205
- //Reload(lastConverter, lastFilename, true);
22062298 SnapObject();
22072299 } else
22082300 // if (event.getSource() == recompileButton)
....@@ -2726,15 +2818,28 @@
27262818 } else
27272819 if (source == ungroupItem || source == ungroupButton)
27282820 {
2729
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
27302823 for (int i=0; i<group.selection.size(); i++)
27312824 {
2732
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
27332830 }
27342831
2735
- ClearSelection(false);
2736
-
2737
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
27382843 } else
27392844 if (source == genUVItem)
27402845 {
....@@ -3326,6 +3431,12 @@
33263431 } else
33273432 if (source == editItem || source == editButton)
33283433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
33293440 EditSelection(false);
33303441 } else
33313442 if (source == uneditButton)
....@@ -3335,6 +3446,7 @@
33353446 Object3D child = (Object3D)e.nextElement();
33363447 if(child.editWindow != null)
33373448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
33383450 child.CloseUI();
33393451 listUI.remove(child);
33403452
....@@ -3351,6 +3463,7 @@
33513463 //copy.ClearUI();
33523464 for (Object3D obj : listUI)
33533465 {
3466
+ obj.pinned = false;
33543467 obj.CloseUI();
33553468 }
33563469 listUI.clear();
....@@ -3360,7 +3473,7 @@
33603473 {
33613474 assert(copy == group);
33623475
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643477
33653478 for (Object3D obj : listUI)
33663479 {
....@@ -3409,6 +3522,9 @@
34093522 }
34103523
34113524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
34123528 //Globals.theRenderer.object = group;
34133529 if(!useclient)
34143530 {
....@@ -3435,6 +3551,13 @@
34353551 currentLayout = sevenButton;
34363552 */
34373553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
34383561 keepparent = group.parent;
34393562 // PARENT = NULL or not???
34403563 //group.parent = null; // ROOT
....@@ -4502,10 +4625,6 @@
45024625 // }
45034626 // }
45044627
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45094628 void EditSelection(boolean newWindow)
45104629 {
45114630 // aConstraints.gridy = 0;
....@@ -4598,7 +4717,8 @@
45984717 //new Exception().printStackTrace();
45994718
46004719 freezemodel = true;
4601
-
4720
+ ClearUnpinned();
4721
+
46024722 /**/
46034723 //switch (event.id)
46044724 {
....@@ -4631,7 +4751,7 @@
46314751 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46324752 // a camera
46334753 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46354755 {
46364756 CameraPane.camerachangeframe = 0; // don't refuse it
46374757 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +4760,13 @@
46404760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46414761 }
46424762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
46434770 refreshContents();
46444771 //return true;
46454772 }
....@@ -4649,10 +4776,18 @@
46494776 freezemodel = false;
46504777 }
46514778
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
46524787 void refreshContents(boolean cp)
46534788 {
46544789 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4655
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46564791 {
46574792 objEditor.ClearInfo(); // .GetMaterial());
46584793
....@@ -4751,8 +4886,8 @@
47514886
47524887 if (cut)
47534888 {
4754
- if (Globals.SAVEONMAKE)
4755
- Save();
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
47564891 //int indices[] = jList.getSelectedIndices();
47574892 //for (int i = indices.length - 1; i >= 0; i--)
47584893 //jList.remove(indices[i]);
....@@ -4855,6 +4990,10 @@
48554990
48564991 void paste(boolean expand)
48574992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
48584997 // if (GrafreeD.clipboard == null)
48594998 // return;
48604999 boolean first = true;
....@@ -4914,6 +5053,7 @@
49145053 Grafreed.clipboard.get(0).parent = keepparent;
49155054 }
49165055
5056
+ Globals.REPLACEONMAKE = keep;
49175057 ResetModel();
49185058 refreshContents();
49195059 }
....@@ -5049,6 +5189,10 @@
50495189
50505190 void group(Object3D csg, boolean grab)
50515191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
50525196 if (//false) // why??
50535197 !group.selection.isEmpty())
50545198 {
....@@ -5162,10 +5306,15 @@
51625306 //node.add(csg);
51635307 //makeSomething(node);
51645308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
51655310 }
51665311
51675312 void Ungroup(Object3D g)
51685313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
51695318 if (g instanceof HiddenObject)
51705319 {
51715320 HiddenObject h = (HiddenObject) g;
....@@ -5182,6 +5331,7 @@
51825331 objEditor.makeSomething(g.get(i), false);
51835332 }
51845333 }
5334
+ Globals.REPLACEONMAKE = keep;
51855335 }
51865336
51875337 void ungroup()
....@@ -5472,11 +5622,6 @@
54725622
54735623 cButton restoreCameraButton;
54745624
5475
- cButton minButton;
5476
- cButton maxButton;
5477
- cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
54805625 cButton saveButton;
54815626 cButton oneStepButton;
54825627