Normand Briere
2019-07-07 46dbce888e7c3eff8969f1ddbe22e144410b67f4
GroupEditor.java
....@@ -220,7 +220,7 @@
220220 // toggleSwitchItem.addItemListener(this);
221221 // toggleSwitchItem.setState(CameraPane.SWITCH);
222222
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224224 toggleHandleItem.addItemListener(this);
225225 toggleHandleItem.setState(CameraPane.HANDLES);
226226
....@@ -380,6 +380,7 @@
380380 shadowYItem.addActionListener(this);
381381 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382382 shadowZItem.addActionListener(this);
383
+
383384 if (Globals.ADVANCED)
384385 {
385386 menu.add("-");
....@@ -582,7 +583,7 @@
582583 */
583584 cGridBag copyOptionsPanel = new cGridBag();
584585
585
- copyOptionsPanel.preferredHeight = 2;
586
+ copyOptionsPanel.preferredHeight = 1;
586587
587588 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588589
....@@ -590,14 +591,21 @@
590591 //minButton.setToolTipText("Minimize window");
591592 //minButton.addActionListener(this);
592593
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
594
+ if (Globals.ADVANCED)
595
+ {
596
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
+ maxButton.setToolTipText("Maximize window");
598
+ maxButton.addActionListener(this);
599
+ }
596600
597601 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598602 fullButton.setToolTipText("Full-screen window");
599603 fullButton.addActionListener(this);
600604
605
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
+ screenfitButton.setToolTipText("Screen fit");
607
+ screenfitButton.addActionListener(this);
608
+
601609 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602610 restoreCameraButton.setToolTipText("Restore viewpoint");
603611 restoreCameraButton.addActionListener(this);
....@@ -605,10 +613,12 @@
605613 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606614 undoButton.setToolTipText("Undo changes");
607615 undoButton.addActionListener(this);
616
+ undoButton.setEnabled(false);
608617
609618 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610619 redoButton.setToolTipText("Redo changes");
611620 redoButton.addActionListener(this);
621
+ redoButton.setEnabled(false);
612622
613623 copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614624 saveButton.setToolTipText("Save changes");
....@@ -628,10 +638,6 @@
628638
629639 //oe.toolboxPanel.Return();
630640
631
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
- screenfitButton.setToolTipText("Screen fit");
633
- screenfitButton.addActionListener(this);
634
-
635641 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
636642 // trackCB.setToolTipText("Enable tracking");
637643 // trackCB.addItemListener(this);
....@@ -724,7 +730,7 @@
724730 compositeButton.addActionListener(this);
725731
726732 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
- switchButton.setToolTipText("Create switch");
733
+ switchButton.setToolTipText("Create item switcher");
728734 switchButton.addActionListener(this);
729735
730736 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -743,17 +749,29 @@
743749 lightButton.setToolTipText("Create light");
744750 lightButton.addActionListener(this);
745751
752
+ for (int i=6; --i>=0;)
753
+ {
754
+ oe.toolboxPanel.Return();
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ oe.toolboxPanel.add(new cGridBag());
759
+ oe.toolboxPanel.add(new cGridBag());
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ oe.toolboxPanel.add(new cGridBag());
762
+ }
763
+
746764 // EDIT panel
747
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
- editButton.setToolTipText("Edit selection");
765
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ editButton.setToolTipText("Pin selection controls");
749767 editButton.addActionListener(this);
750768
751
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
- uneditButton.setToolTipText("Unedit selection");
769
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
+ uneditButton.setToolTipText("Remove selection controls");
753771 uneditButton.addActionListener(this);
754772
755773 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
756
- allParamsButton.setToolTipText("Edit all params");
774
+ allParamsButton.setToolTipText("Show all controle");
757775 allParamsButton.addActionListener(this);
758776
759777 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -770,6 +788,7 @@
770788
771789 editCommandsPanel.preferredHeight = 1;
772790
791
+ SetPinStates(false);
773792 // oe.treePanel.add(commandsPanel);
774793 // oe.treePanel.Return();
775794
....@@ -843,14 +862,18 @@
843862 boxCB.addItemListener(this);
844863
845864 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
846
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
865
+ zoomBoxCB.setToolTipText("Display only for wheel");
847866 zoomBoxCB.addItemListener(this);
848867
849868 if (true) // Globals.ADVANCED)
850869 {
851
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
852
- supportCB.setToolTipText("Enable rigging");
853
- supportCB.addItemListener(this);
870
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
871
+// supportCB.setToolTipText("Enable rigging");
872
+// supportCB.addItemListener(this);
873
+
874
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
875
+ freezeCB.setToolTipText("Fast moving camera");
876
+ freezeCB.addItemListener(this);
854877
855878 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
856879 // localCB.addItemListener(this);
....@@ -905,7 +928,7 @@
905928 oeilCB.addItemListener(this);
906929
907930 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
- shadowCB.setToolTipText("Compute shadows when live");
931
+ shadowCB.setToolTipText("When live compute shadows");
909932 shadowCB.addItemListener(this);
910933
911934 panel.Return();
....@@ -914,11 +937,11 @@
914937 toggleTextureCB.addItemListener(this);
915938
916939 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
- toggleSwitchCB.setToolTipText("Use switch");
940
+ toggleSwitchCB.setToolTipText("Choose a single item");
918941 toggleSwitchCB.addItemListener(this);
919942
920943 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
- autosaveCB.setToolTipText("Auto-save on structure change");
944
+ autosaveCB.setToolTipText("On structure change");
922945 autosaveCB.addItemListener(this);
923946
924947 panel.Return();
....@@ -985,6 +1008,7 @@
9851008 cCheckBox slowCB;
9861009 cCheckBox boxCB;
9871010 cCheckBox zoomBoxCB;
1011
+ cCheckBox freezeCB;
9881012 //cToggleButton trackCB;
9891013 cCheckBox trackCB;
9901014 cCheckBox smoothfocusCB;
....@@ -1103,6 +1127,10 @@
11031127 {
11041128 Globals.COMPUTESHADOWWHENLIVE ^= true;
11051129 }
1130
+ else if(e.getSource() == freezeCB)
1131
+ {
1132
+ Globals.FREEZEONMOVE ^= true;
1133
+ }
11061134 else if(e.getSource() == autosaveCB)
11071135 {
11081136 Globals.SAVEONMAKE ^= true;
....@@ -1187,8 +1215,6 @@
11871215 }
11881216 }
11891217
1190
- String string = (String) object;
1191
-
11921218 System.out.println("Transfer = " + object + "; drop : " + target);
11931219 // if( object instanceof java.io.File[])
11941220 // {
....@@ -1196,6 +1222,8 @@
11961222 // objEditor.DropFile((java.io.File[]) object, true);
11971223 // return;
11981224 // }
1225
+
1226
+ String string = (String) object;
11991227
12001228 // File path for Mac and Windows
12011229 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1445,6 +1473,9 @@
14451473 animationItem.addItemListener(this);
14461474 animationItem.setState(Globals.ANIMATION);
14471475
1476
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1477
+ archiveItem.addActionListener(this);
1478
+
14481479 menu.add("-");
14491480 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14501481 parseverticesItem.addActionListener(this);
....@@ -1614,6 +1645,20 @@
16141645
16151646 makeSomething(shadow);
16161647 }
1648
+
1649
+ private void ClearUnpinned()
1650
+ {
1651
+ //for (Object3D obj : listUI)
1652
+ for (int i=listUI.size(); --i>=0;)
1653
+ {
1654
+ Object3D obj = listUI.elementAt(i);
1655
+ if (!obj.pinned)
1656
+ {
1657
+ obj.CloseUI();
1658
+ listUI.remove(i);
1659
+ }
1660
+ }
1661
+ }
16171662
16181663 /**
16191664 * applyExample
....@@ -2093,25 +2138,25 @@
20932138 Composite csg = new GroupLeaf();
20942139 csg.count = 5;
20952140 group(csg);
2096
- Composite child = new cGroup();
2141
+ Composite child = new cGroup("Branch");
20972142 csg.addChild(child);
20982143 child.addChild(csg);
20992144 } else
21002145 if (source == doubleItem)
21012146 {
2102
- Composite csg = new GroupLeaf();
2147
+ Composite csg = new GroupLeaf("Fork");
21032148 csg.count = 5;
21042149 group(csg);
2105
- Composite child = new cGroup();
2150
+ Composite child = new cGroup("Branch A");
21062151 csg.addChild(child);
21072152 child.addChild(csg);
2108
- child = new cGroup();
2153
+ child = new cGroup("Branch B");
21092154 csg.addChild(child);
21102155 child.addChild(csg);
21112156 } else
21122157 if (source == tripleItem)
21132158 {
2114
- Composite csg = new GroupLeaf();
2159
+ Composite csg = new GroupLeaf("Trident");
21152160 csg.count = 4;
21162161 group(csg);
21172162 Composite child = new cGroup();
....@@ -2175,7 +2220,8 @@
21752220 } else
21762221 if (source == undoButton)
21772222 {
2178
- Undo();
2223
+ if (!Undo())
2224
+ java.awt.Toolkit.getDefaultToolkit().beep();
21792225 } else
21802226 if (source == redoButton)
21812227 {
....@@ -2183,7 +2229,8 @@
21832229 } else
21842230 if (source == saveButton)
21852231 {
2186
- Save();
2232
+ if (!Save(true))
2233
+ java.awt.Toolkit.getDefaultToolkit().beep();
21872234 } else
21882235 if (source == oneStepButton)
21892236 {
....@@ -2192,17 +2239,14 @@
21922239 } else
21932240 if (source == screenfitButton)
21942241 {
2195
- //Reload(lastConverter, lastFilename, true);
21962242 ScreenFit();
21972243 } else
21982244 if (source == screenfitpointButton)
21992245 {
2200
- //Reload(lastConverter, lastFilename, true);
22012246 ScreenFitPoint();
22022247 } else
22032248 if (source == snapobjectButton)
22042249 {
2205
- //Reload(lastConverter, lastFilename, true);
22062250 SnapObject();
22072251 } else
22082252 // if (event.getSource() == recompileButton)
....@@ -2726,15 +2770,28 @@
27262770 } else
27272771 if (source == ungroupItem || source == ungroupButton)
27282772 {
2729
- //ungroup();
2773
+ boolean hasRoot = false;
2774
+
27302775 for (int i=0; i<group.selection.size(); i++)
27312776 {
2732
- Ungroup(group.selection.get(i));
2777
+ if (group.selection.get(i) == group)
2778
+ {
2779
+ hasRoot = true;
2780
+ break;
2781
+ }
27332782 }
27342783
2735
- ClearSelection(false);
2736
-
2737
- refreshContents();
2784
+ if (!hasRoot)
2785
+ {
2786
+ for (int i=0; i<group.selection.size(); i++)
2787
+ {
2788
+ Ungroup(group.selection.get(i));
2789
+ }
2790
+
2791
+ ClearSelection(false);
2792
+
2793
+ refreshContents();
2794
+ }
27382795 } else
27392796 if (source == genUVItem)
27402797 {
....@@ -3326,6 +3383,12 @@
33263383 } else
33273384 if (source == editItem || source == editButton)
33283385 {
3386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3387
+ {
3388
+ Object3D child = (Object3D)e.nextElement();
3389
+ child.pinned = true;
3390
+ }
3391
+
33293392 EditSelection(false);
33303393 } else
33313394 if (source == uneditButton)
....@@ -3335,6 +3398,7 @@
33353398 Object3D child = (Object3D)e.nextElement();
33363399 if(child.editWindow != null)
33373400 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3401
+ child.pinned = false;
33383402 child.CloseUI();
33393403 listUI.remove(child);
33403404
....@@ -3351,6 +3415,7 @@
33513415 //copy.ClearUI();
33523416 for (Object3D obj : listUI)
33533417 {
3418
+ obj.pinned = false;
33543419 obj.CloseUI();
33553420 }
33563421 listUI.clear();
....@@ -3360,7 +3425,7 @@
33603425 {
33613426 assert(copy == group);
33623427
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3428
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643429
33653430 for (Object3D obj : listUI)
33663431 {
....@@ -3435,6 +3500,11 @@
34353500 currentLayout = sevenButton;
34363501 */
34373502 radio.layout.doClick();
3503
+
3504
+ ClearUnpinned();
3505
+ SetPinStates(group.selection.size() > 0);
3506
+ if (group.selection.size() == 1)
3507
+ EditSelection(false);
34383508 keepparent = group.parent;
34393509 // PARENT = NULL or not???
34403510 //group.parent = null; // ROOT
....@@ -4502,10 +4572,6 @@
45024572 // }
45034573 // }
45044574
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45094575 void EditSelection(boolean newWindow)
45104576 {
45114577 // aConstraints.gridy = 0;
....@@ -4598,7 +4664,8 @@
45984664 //new Exception().printStackTrace();
45994665
46004666 freezemodel = true;
4601
-
4667
+ ClearUnpinned();
4668
+
46024669 /**/
46034670 //switch (event.id)
46044671 {
....@@ -4631,7 +4698,7 @@
46314698 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46324699 // a camera
46334700 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4701
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46354702 {
46364703 CameraPane.camerachangeframe = 0; // don't refuse it
46374704 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +4707,13 @@
46404707 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46414708 }
46424709
4710
+ if (tps != null && tps.length == 1)
4711
+ {
4712
+ EditSelection(false);
4713
+ }
4714
+
4715
+ SetPinStates(tps != null && tps.length > 0);
4716
+
46434717 refreshContents();
46444718 //return true;
46454719 }
....@@ -4649,10 +4723,18 @@
46494723 freezemodel = false;
46504724 }
46514725
4726
+ void SetPinStates(boolean enabled)
4727
+ {
4728
+ editButton.setEnabled(enabled);
4729
+ uneditButton.setEnabled(enabled);
4730
+ unselectButton.setEnabled(enabled);
4731
+ flashSelectionButton.setEnabled(enabled);
4732
+ }
4733
+
46524734 void refreshContents(boolean cp)
46534735 {
46544736 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4655
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4737
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46564738 {
46574739 objEditor.ClearInfo(); // .GetMaterial());
46584740
....@@ -5472,11 +5554,6 @@
54725554
54735555 cButton restoreCameraButton;
54745556
5475
- cButton minButton;
5476
- cButton maxButton;
5477
- cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
54805557 cButton saveButton;
54815558 cButton oneStepButton;
54825559