Normand Briere
2019-06-29 a69bb4474a3264a9a7a7f8b8d8154ea771f167c8
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
....@@ -605,10 +605,12 @@
605605 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606606 undoButton.setToolTipText("Undo changes");
607607 undoButton.addActionListener(this);
608
+ undoButton.setEnabled(false);
608609
609610 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610611 redoButton.setToolTipText("Redo changes");
611612 redoButton.addActionListener(this);
613
+ redoButton.setEnabled(false);
612614
613615 copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614616 saveButton.setToolTipText("Save changes");
....@@ -724,7 +726,7 @@
724726 compositeButton.addActionListener(this);
725727
726728 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
- switchButton.setToolTipText("Create switch");
729
+ switchButton.setToolTipText("Create item switcher");
728730 switchButton.addActionListener(this);
729731
730732 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -743,17 +745,29 @@
743745 lightButton.setToolTipText("Create light");
744746 lightButton.addActionListener(this);
745747
748
+ for (int i=6; --i>=0;)
749
+ {
750
+ oe.toolboxPanel.Return();
751
+ oe.toolboxPanel.add(new cGridBag());
752
+ oe.toolboxPanel.add(new cGridBag());
753
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
759
+
746760 // EDIT panel
747
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
- editButton.setToolTipText("Edit selection");
761
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
+ editButton.setToolTipText("Pin selection controls");
749763 editButton.addActionListener(this);
750764
751
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
- uneditButton.setToolTipText("Unedit selection");
765
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
+ uneditButton.setToolTipText("Remove selection controls");
753767 uneditButton.addActionListener(this);
754768
755769 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
756
- allParamsButton.setToolTipText("Edit all params");
770
+ allParamsButton.setToolTipText("Show all controle");
757771 allParamsButton.addActionListener(this);
758772
759773 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -770,6 +784,7 @@
770784
771785 editCommandsPanel.preferredHeight = 1;
772786
787
+ SetPinStates(false);
773788 // oe.treePanel.add(commandsPanel);
774789 // oe.treePanel.Return();
775790
....@@ -843,14 +858,18 @@
843858 boxCB.addItemListener(this);
844859
845860 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
846
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
861
+ zoomBoxCB.setToolTipText("Display only for wheel");
847862 zoomBoxCB.addItemListener(this);
848863
849864 if (true) // Globals.ADVANCED)
850865 {
851
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
852
- supportCB.setToolTipText("Enable rigging");
853
- supportCB.addItemListener(this);
866
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
+// supportCB.setToolTipText("Enable rigging");
868
+// supportCB.addItemListener(this);
869
+
870
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
871
+ freezeCB.setToolTipText("Fast moving camera");
872
+ freezeCB.addItemListener(this);
854873
855874 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
856875 // localCB.addItemListener(this);
....@@ -905,7 +924,7 @@
905924 oeilCB.addItemListener(this);
906925
907926 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
- shadowCB.setToolTipText("Compute shadows when live");
927
+ shadowCB.setToolTipText("When live compute shadows");
909928 shadowCB.addItemListener(this);
910929
911930 panel.Return();
....@@ -914,11 +933,11 @@
914933 toggleTextureCB.addItemListener(this);
915934
916935 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
- toggleSwitchCB.setToolTipText("Use switch");
936
+ toggleSwitchCB.setToolTipText("Choose a single item");
918937 toggleSwitchCB.addItemListener(this);
919938
920939 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
- autosaveCB.setToolTipText("Auto-save on structure change");
940
+ autosaveCB.setToolTipText("On structure change");
922941 autosaveCB.addItemListener(this);
923942
924943 panel.Return();
....@@ -985,6 +1004,7 @@
9851004 cCheckBox slowCB;
9861005 cCheckBox boxCB;
9871006 cCheckBox zoomBoxCB;
1007
+ cCheckBox freezeCB;
9881008 //cToggleButton trackCB;
9891009 cCheckBox trackCB;
9901010 cCheckBox smoothfocusCB;
....@@ -1102,6 +1122,10 @@
11021122 else if(e.getSource() == shadowCB)
11031123 {
11041124 Globals.COMPUTESHADOWWHENLIVE ^= true;
1125
+ }
1126
+ else if(e.getSource() == freezeCB)
1127
+ {
1128
+ Globals.FREEZEONMOVE ^= true;
11051129 }
11061130 else if(e.getSource() == autosaveCB)
11071131 {
....@@ -1614,6 +1638,20 @@
16141638
16151639 makeSomething(shadow);
16161640 }
1641
+
1642
+ private void ClearUnpinned()
1643
+ {
1644
+ //for (Object3D obj : listUI)
1645
+ for (int i=listUI.size(); --i>=0;)
1646
+ {
1647
+ Object3D obj = listUI.elementAt(i);
1648
+ if (!obj.pinned)
1649
+ {
1650
+ obj.CloseUI();
1651
+ listUI.remove(i);
1652
+ }
1653
+ }
1654
+ }
16171655
16181656 /**
16191657 * applyExample
....@@ -2093,25 +2131,25 @@
20932131 Composite csg = new GroupLeaf();
20942132 csg.count = 5;
20952133 group(csg);
2096
- Composite child = new cGroup();
2134
+ Composite child = new cGroup("Branch");
20972135 csg.addChild(child);
20982136 child.addChild(csg);
20992137 } else
21002138 if (source == doubleItem)
21012139 {
2102
- Composite csg = new GroupLeaf();
2140
+ Composite csg = new GroupLeaf("Fork");
21032141 csg.count = 5;
21042142 group(csg);
2105
- Composite child = new cGroup();
2143
+ Composite child = new cGroup("Branch A");
21062144 csg.addChild(child);
21072145 child.addChild(csg);
2108
- child = new cGroup();
2146
+ child = new cGroup("Branch B");
21092147 csg.addChild(child);
21102148 child.addChild(csg);
21112149 } else
21122150 if (source == tripleItem)
21132151 {
2114
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Trident");
21152153 csg.count = 4;
21162154 group(csg);
21172155 Composite child = new cGroup();
....@@ -2726,15 +2764,28 @@
27262764 } else
27272765 if (source == ungroupItem || source == ungroupButton)
27282766 {
2729
- //ungroup();
2767
+ boolean hasRoot = false;
2768
+
27302769 for (int i=0; i<group.selection.size(); i++)
27312770 {
2732
- Ungroup(group.selection.get(i));
2771
+ if (group.selection.get(i) == group)
2772
+ {
2773
+ hasRoot = true;
2774
+ break;
2775
+ }
27332776 }
27342777
2735
- ClearSelection(false);
2736
-
2737
- refreshContents();
2778
+ if (!hasRoot)
2779
+ {
2780
+ for (int i=0; i<group.selection.size(); i++)
2781
+ {
2782
+ Ungroup(group.selection.get(i));
2783
+ }
2784
+
2785
+ ClearSelection(false);
2786
+
2787
+ refreshContents();
2788
+ }
27382789 } else
27392790 if (source == genUVItem)
27402791 {
....@@ -3326,6 +3377,12 @@
33263377 } else
33273378 if (source == editItem || source == editButton)
33283379 {
3380
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3381
+ {
3382
+ Object3D child = (Object3D)e.nextElement();
3383
+ child.pinned = true;
3384
+ }
3385
+
33293386 EditSelection(false);
33303387 } else
33313388 if (source == uneditButton)
....@@ -3335,6 +3392,7 @@
33353392 Object3D child = (Object3D)e.nextElement();
33363393 if(child.editWindow != null)
33373394 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3395
+ child.pinned = false;
33383396 child.CloseUI();
33393397 listUI.remove(child);
33403398
....@@ -3351,6 +3409,7 @@
33513409 //copy.ClearUI();
33523410 for (Object3D obj : listUI)
33533411 {
3412
+ obj.pinned = false;
33543413 obj.CloseUI();
33553414 }
33563415 listUI.clear();
....@@ -3360,7 +3419,7 @@
33603419 {
33613420 assert(copy == group);
33623421
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3422
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643423
33653424 for (Object3D obj : listUI)
33663425 {
....@@ -3435,6 +3494,11 @@
34353494 currentLayout = sevenButton;
34363495 */
34373496 radio.layout.doClick();
3497
+
3498
+ ClearUnpinned();
3499
+ SetPinStates(group.selection.size() > 0);
3500
+ if (group.selection.size() == 1)
3501
+ EditSelection(false);
34383502 keepparent = group.parent;
34393503 // PARENT = NULL or not???
34403504 //group.parent = null; // ROOT
....@@ -4502,10 +4566,6 @@
45024566 // }
45034567 // }
45044568
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45094569 void EditSelection(boolean newWindow)
45104570 {
45114571 // aConstraints.gridy = 0;
....@@ -4598,7 +4658,8 @@
45984658 //new Exception().printStackTrace();
45994659
46004660 freezemodel = true;
4601
-
4661
+ ClearUnpinned();
4662
+
46024663 /**/
46034664 //switch (event.id)
46044665 {
....@@ -4631,7 +4692,7 @@
46314692 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46324693 // a camera
46334694 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4695
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46354696 {
46364697 CameraPane.camerachangeframe = 0; // don't refuse it
46374698 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +4701,13 @@
46404701 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46414702 }
46424703
4704
+ if (tps != null && tps.length == 1)
4705
+ {
4706
+ EditSelection(false);
4707
+ }
4708
+
4709
+ SetPinStates(tps != null && tps.length > 0);
4710
+
46434711 refreshContents();
46444712 //return true;
46454713 }
....@@ -4649,6 +4717,14 @@
46494717 freezemodel = false;
46504718 }
46514719
4720
+ void SetPinStates(boolean enabled)
4721
+ {
4722
+ editButton.setEnabled(enabled);
4723
+ uneditButton.setEnabled(enabled);
4724
+ unselectButton.setEnabled(enabled);
4725
+ flashSelectionButton.setEnabled(enabled);
4726
+ }
4727
+
46524728 void refreshContents(boolean cp)
46534729 {
46544730 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
....@@ -5472,11 +5548,6 @@
54725548
54735549 cButton restoreCameraButton;
54745550
5475
- cButton minButton;
5476
- cButton maxButton;
5477
- cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
54805551 cButton saveButton;
54815552 cButton oneStepButton;
54825553