Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
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
....@@ -582,7 +582,7 @@
582582 */
583583 cGridBag copyOptionsPanel = new cGridBag();
584584
585
- copyOptionsPanel.preferredHeight = 2;
585
+ copyOptionsPanel.preferredHeight = 1;
586586
587587 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588588
....@@ -590,9 +590,12 @@
590590 //minButton.setToolTipText("Minimize window");
591591 //minButton.addActionListener(this);
592592
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
593
+ if (Globals.ADVANCED)
594
+ {
595
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ maxButton.setToolTipText("Maximize window");
597
+ maxButton.addActionListener(this);
598
+ }
596599
597600 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598601 fullButton.setToolTipText("Full-screen window");
....@@ -605,10 +608,12 @@
605608 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606609 undoButton.setToolTipText("Undo changes");
607610 undoButton.addActionListener(this);
611
+ undoButton.setEnabled(false);
608612
609613 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610614 redoButton.setToolTipText("Redo changes");
611615 redoButton.addActionListener(this);
616
+ redoButton.setEnabled(false);
612617
613618 copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614619 saveButton.setToolTipText("Save changes");
....@@ -724,7 +729,7 @@
724729 compositeButton.addActionListener(this);
725730
726731 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
- switchButton.setToolTipText("Create switch");
732
+ switchButton.setToolTipText("Create item switcher");
728733 switchButton.addActionListener(this);
729734
730735 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -743,17 +748,29 @@
743748 lightButton.setToolTipText("Create light");
744749 lightButton.addActionListener(this);
745750
751
+ for (int i=6; --i>=0;)
752
+ {
753
+ oe.toolboxPanel.Return();
754
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
762
+
746763 // EDIT panel
747
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
- editButton.setToolTipText("Edit selection");
764
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editButton.setToolTipText("Pin selection controls");
749766 editButton.addActionListener(this);
750767
751
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
- uneditButton.setToolTipText("Unedit selection");
768
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ uneditButton.setToolTipText("Remove selection controls");
753770 uneditButton.addActionListener(this);
754771
755772 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
756
- allParamsButton.setToolTipText("Edit all params");
773
+ allParamsButton.setToolTipText("Show all controle");
757774 allParamsButton.addActionListener(this);
758775
759776 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -770,6 +787,7 @@
770787
771788 editCommandsPanel.preferredHeight = 1;
772789
790
+ SetPinStates(false);
773791 // oe.treePanel.add(commandsPanel);
774792 // oe.treePanel.Return();
775793
....@@ -843,14 +861,18 @@
843861 boxCB.addItemListener(this);
844862
845863 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
846
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
864
+ zoomBoxCB.setToolTipText("Display only for wheel");
847865 zoomBoxCB.addItemListener(this);
848866
849867 if (true) // Globals.ADVANCED)
850868 {
851
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
852
- supportCB.setToolTipText("Enable rigging");
853
- supportCB.addItemListener(this);
869
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
870
+// supportCB.setToolTipText("Enable rigging");
871
+// supportCB.addItemListener(this);
872
+
873
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
874
+ freezeCB.setToolTipText("Fast moving camera");
875
+ freezeCB.addItemListener(this);
854876
855877 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
856878 // localCB.addItemListener(this);
....@@ -905,7 +927,7 @@
905927 oeilCB.addItemListener(this);
906928
907929 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
- shadowCB.setToolTipText("Compute shadows when live");
930
+ shadowCB.setToolTipText("When live compute shadows");
909931 shadowCB.addItemListener(this);
910932
911933 panel.Return();
....@@ -914,11 +936,11 @@
914936 toggleTextureCB.addItemListener(this);
915937
916938 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
- toggleSwitchCB.setToolTipText("Use switch");
939
+ toggleSwitchCB.setToolTipText("Choose a single item");
918940 toggleSwitchCB.addItemListener(this);
919941
920942 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
- autosaveCB.setToolTipText("Auto-save on structure change");
943
+ autosaveCB.setToolTipText("On structure change");
922944 autosaveCB.addItemListener(this);
923945
924946 panel.Return();
....@@ -985,6 +1007,7 @@
9851007 cCheckBox slowCB;
9861008 cCheckBox boxCB;
9871009 cCheckBox zoomBoxCB;
1010
+ cCheckBox freezeCB;
9881011 //cToggleButton trackCB;
9891012 cCheckBox trackCB;
9901013 cCheckBox smoothfocusCB;
....@@ -1102,6 +1125,10 @@
11021125 else if(e.getSource() == shadowCB)
11031126 {
11041127 Globals.COMPUTESHADOWWHENLIVE ^= true;
1128
+ }
1129
+ else if(e.getSource() == freezeCB)
1130
+ {
1131
+ Globals.FREEZEONMOVE ^= true;
11051132 }
11061133 else if(e.getSource() == autosaveCB)
11071134 {
....@@ -1614,6 +1641,20 @@
16141641
16151642 makeSomething(shadow);
16161643 }
1644
+
1645
+ private void ClearUnpinned()
1646
+ {
1647
+ //for (Object3D obj : listUI)
1648
+ for (int i=listUI.size(); --i>=0;)
1649
+ {
1650
+ Object3D obj = listUI.elementAt(i);
1651
+ if (!obj.pinned)
1652
+ {
1653
+ obj.CloseUI();
1654
+ listUI.remove(i);
1655
+ }
1656
+ }
1657
+ }
16171658
16181659 /**
16191660 * applyExample
....@@ -2093,25 +2134,25 @@
20932134 Composite csg = new GroupLeaf();
20942135 csg.count = 5;
20952136 group(csg);
2096
- Composite child = new cGroup();
2137
+ Composite child = new cGroup("Branch");
20972138 csg.addChild(child);
20982139 child.addChild(csg);
20992140 } else
21002141 if (source == doubleItem)
21012142 {
2102
- Composite csg = new GroupLeaf();
2143
+ Composite csg = new GroupLeaf("Fork");
21032144 csg.count = 5;
21042145 group(csg);
2105
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch A");
21062147 csg.addChild(child);
21072148 child.addChild(csg);
2108
- child = new cGroup();
2149
+ child = new cGroup("Branch B");
21092150 csg.addChild(child);
21102151 child.addChild(csg);
21112152 } else
21122153 if (source == tripleItem)
21132154 {
2114
- Composite csg = new GroupLeaf();
2155
+ Composite csg = new GroupLeaf("Trident");
21152156 csg.count = 4;
21162157 group(csg);
21172158 Composite child = new cGroup();
....@@ -2726,15 +2767,28 @@
27262767 } else
27272768 if (source == ungroupItem || source == ungroupButton)
27282769 {
2729
- //ungroup();
2770
+ boolean hasRoot = false;
2771
+
27302772 for (int i=0; i<group.selection.size(); i++)
27312773 {
2732
- Ungroup(group.selection.get(i));
2774
+ if (group.selection.get(i) == group)
2775
+ {
2776
+ hasRoot = true;
2777
+ break;
2778
+ }
27332779 }
27342780
2735
- ClearSelection(false);
2736
-
2737
- refreshContents();
2781
+ if (!hasRoot)
2782
+ {
2783
+ for (int i=0; i<group.selection.size(); i++)
2784
+ {
2785
+ Ungroup(group.selection.get(i));
2786
+ }
2787
+
2788
+ ClearSelection(false);
2789
+
2790
+ refreshContents();
2791
+ }
27382792 } else
27392793 if (source == genUVItem)
27402794 {
....@@ -3326,6 +3380,12 @@
33263380 } else
33273381 if (source == editItem || source == editButton)
33283382 {
3383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3384
+ {
3385
+ Object3D child = (Object3D)e.nextElement();
3386
+ child.pinned = true;
3387
+ }
3388
+
33293389 EditSelection(false);
33303390 } else
33313391 if (source == uneditButton)
....@@ -3335,6 +3395,7 @@
33353395 Object3D child = (Object3D)e.nextElement();
33363396 if(child.editWindow != null)
33373397 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3398
+ child.pinned = false;
33383399 child.CloseUI();
33393400 listUI.remove(child);
33403401
....@@ -3351,6 +3412,7 @@
33513412 //copy.ClearUI();
33523413 for (Object3D obj : listUI)
33533414 {
3415
+ obj.pinned = false;
33543416 obj.CloseUI();
33553417 }
33563418 listUI.clear();
....@@ -3360,7 +3422,7 @@
33603422 {
33613423 assert(copy == group);
33623424
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3425
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643426
33653427 for (Object3D obj : listUI)
33663428 {
....@@ -3435,6 +3497,11 @@
34353497 currentLayout = sevenButton;
34363498 */
34373499 radio.layout.doClick();
3500
+
3501
+ ClearUnpinned();
3502
+ SetPinStates(group.selection.size() > 0);
3503
+ if (group.selection.size() == 1)
3504
+ EditSelection(false);
34383505 keepparent = group.parent;
34393506 // PARENT = NULL or not???
34403507 //group.parent = null; // ROOT
....@@ -4502,10 +4569,6 @@
45024569 // }
45034570 // }
45044571
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45094572 void EditSelection(boolean newWindow)
45104573 {
45114574 // aConstraints.gridy = 0;
....@@ -4598,7 +4661,8 @@
45984661 //new Exception().printStackTrace();
45994662
46004663 freezemodel = true;
4601
-
4664
+ ClearUnpinned();
4665
+
46024666 /**/
46034667 //switch (event.id)
46044668 {
....@@ -4631,7 +4695,7 @@
46314695 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46324696 // a camera
46334697 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4698
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46354699 {
46364700 CameraPane.camerachangeframe = 0; // don't refuse it
46374701 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +4704,13 @@
46404704 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46414705 }
46424706
4707
+ if (tps != null && tps.length == 1)
4708
+ {
4709
+ EditSelection(false);
4710
+ }
4711
+
4712
+ SetPinStates(tps != null && tps.length > 0);
4713
+
46434714 refreshContents();
46444715 //return true;
46454716 }
....@@ -4649,6 +4720,14 @@
46494720 freezemodel = false;
46504721 }
46514722
4723
+ void SetPinStates(boolean enabled)
4724
+ {
4725
+ editButton.setEnabled(enabled);
4726
+ uneditButton.setEnabled(enabled);
4727
+ unselectButton.setEnabled(enabled);
4728
+ flashSelectionButton.setEnabled(enabled);
4729
+ }
4730
+
46524731 void refreshContents(boolean cp)
46534732 {
46544733 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
....@@ -5472,11 +5551,6 @@
54725551
54735552 cButton restoreCameraButton;
54745553
5475
- cButton minButton;
5476
- cButton maxButton;
5477
- cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
54805554 cButton saveButton;
54815555 cButton oneStepButton;
54825556