Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.SAVEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -220,7 +225,7 @@
220225 // toggleSwitchItem.addItemListener(this);
221226 // toggleSwitchItem.setState(CameraPane.SWITCH);
222227
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
228
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224229 toggleHandleItem.addItemListener(this);
225230 toggleHandleItem.setState(CameraPane.HANDLES);
226231
....@@ -380,13 +385,14 @@
380385 shadowYItem.addActionListener(this);
381386 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
383391 if (Globals.ADVANCED)
384392 {
385393 menu.add("-");
386394 linkerItem = menu.add(new MenuItem("Linker"));
387395 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390396 templateItem = menu.add(new MenuItem("Template"));
391397 templateItem.addActionListener(this);
392398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -582,7 +588,7 @@
582588 */
583589 cGridBag copyOptionsPanel = new cGridBag();
584590
585
- copyOptionsPanel.preferredHeight = 2;
591
+ copyOptionsPanel.preferredHeight = 1;
586592
587593 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588594
....@@ -590,14 +596,21 @@
590596 //minButton.setToolTipText("Minimize window");
591597 //minButton.addActionListener(this);
592598
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
596605
597606 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598607 fullButton.setToolTipText("Full-screen window");
599608 fullButton.addActionListener(this);
600609
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
601614 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602615 restoreCameraButton.setToolTipText("Restore viewpoint");
603616 restoreCameraButton.addActionListener(this);
....@@ -630,10 +643,6 @@
630643
631644 //oe.toolboxPanel.Return();
632645
633
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- screenfitButton.setToolTipText("Screen fit");
635
- screenfitButton.addActionListener(this);
636
-
637646 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638647 // trackCB.setToolTipText("Enable tracking");
639648 // trackCB.addItemListener(this);
....@@ -726,7 +735,7 @@
726735 compositeButton.addActionListener(this);
727736
728737 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
- switchButton.setToolTipText("Create switch");
738
+ switchButton.setToolTipText("Create item switcher");
730739 switchButton.addActionListener(this);
731740
732741 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -863,9 +872,13 @@
863872
864873 if (true) // Globals.ADVANCED)
865874 {
866
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
867
- supportCB.setToolTipText("Enable rigging");
868
- supportCB.addItemListener(this);
875
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
876
+// supportCB.setToolTipText("Enable rigging");
877
+// supportCB.addItemListener(this);
878
+
879
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
880
+ freezeCB.setToolTipText("Fast moving camera");
881
+ freezeCB.addItemListener(this);
869882
870883 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
871884 // localCB.addItemListener(this);
....@@ -929,7 +942,7 @@
929942 toggleTextureCB.addItemListener(this);
930943
931944 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
932
- toggleSwitchCB.setToolTipText("Use switch");
945
+ toggleSwitchCB.setToolTipText("Choose a single item");
933946 toggleSwitchCB.addItemListener(this);
934947
935948 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
....@@ -963,7 +976,7 @@
963976 {
964977 cRadio radioButton = new cRadio(obj.name);
965978
966
- // Patch to avoid bug with transparency.
979
+ // June 2019. Patch to avoid bug with transparency.
967980 radioButton.hadMaterial = obj.material != null;
968981 if (!radioButton.hadMaterial)
969982 {
....@@ -1000,6 +1013,7 @@
10001013 cCheckBox slowCB;
10011014 cCheckBox boxCB;
10021015 cCheckBox zoomBoxCB;
1016
+ cCheckBox freezeCB;
10031017 //cToggleButton trackCB;
10041018 cCheckBox trackCB;
10051019 cCheckBox smoothfocusCB;
....@@ -1118,6 +1132,10 @@
11181132 {
11191133 Globals.COMPUTESHADOWWHENLIVE ^= true;
11201134 }
1135
+ else if(e.getSource() == freezeCB)
1136
+ {
1137
+ Globals.FREEZEONMOVE ^= true;
1138
+ }
11211139 else if(e.getSource() == autosaveCB)
11221140 {
11231141 Globals.SAVEONMAKE ^= true;
....@@ -1202,8 +1220,6 @@
12021220 }
12031221 }
12041222
1205
- String string = (String) object;
1206
-
12071223 System.out.println("Transfer = " + object + "; drop : " + target);
12081224 // if( object instanceof java.io.File[])
12091225 // {
....@@ -1211,6 +1227,8 @@
12111227 // objEditor.DropFile((java.io.File[]) object, true);
12121228 // return;
12131229 // }
1230
+
1231
+ String string = object.toString();
12141232
12151233 // File path for Mac and Windows
12161234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1460,6 +1478,9 @@
14601478 animationItem.addItemListener(this);
14611479 animationItem.setState(Globals.ANIMATION);
14621480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
14631484 menu.add("-");
14641485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14651486 parseverticesItem.addActionListener(this);
....@@ -1472,6 +1493,8 @@
14721493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14731494 reduce34MorphItem.addActionListener(this);
14741495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
14751498 menu.add(computeAOItem = new MenuItem("Compute AO"));
14761499 computeAOItem.addActionListener(this);
14771500
....@@ -1480,8 +1503,6 @@
14801503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14811504 mirrorItem.addActionListener(this);
14821505 menu.add("-");
1483
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1484
- memoryItem.addActionListener(this);
14851506 menu.add(analyzeItem = new MenuItem("Analyze"));
14861507 analyzeItem.addActionListener(this);
14871508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -2122,25 +2143,25 @@
21222143 Composite csg = new GroupLeaf();
21232144 csg.count = 5;
21242145 group(csg);
2125
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch");
21262147 csg.addChild(child);
21272148 child.addChild(csg);
21282149 } else
21292150 if (source == doubleItem)
21302151 {
2131
- Composite csg = new GroupLeaf();
2152
+ Composite csg = new GroupLeaf("Fork");
21322153 csg.count = 5;
21332154 group(csg);
2134
- Composite child = new cGroup();
2155
+ Composite child = new cGroup("Branch A");
21352156 csg.addChild(child);
21362157 child.addChild(csg);
2137
- child = new cGroup();
2158
+ child = new cGroup("Branch B");
21382159 csg.addChild(child);
21392160 child.addChild(csg);
21402161 } else
21412162 if (source == tripleItem)
21422163 {
2143
- Composite csg = new GroupLeaf();
2164
+ Composite csg = new GroupLeaf("Trident");
21442165 csg.count = 4;
21452166 group(csg);
21462167 Composite child = new cGroup();
....@@ -2204,7 +2225,8 @@
22042225 } else
22052226 if (source == undoButton)
22062227 {
2207
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
22082230 } else
22092231 if (source == redoButton)
22102232 {
....@@ -2212,7 +2234,8 @@
22122234 } else
22132235 if (source == saveButton)
22142236 {
2215
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
22162239 } else
22172240 if (source == oneStepButton)
22182241 {
....@@ -2221,17 +2244,14 @@
22212244 } else
22222245 if (source == screenfitButton)
22232246 {
2224
- //Reload(lastConverter, lastFilename, true);
22252247 ScreenFit();
22262248 } else
22272249 if (source == screenfitpointButton)
22282250 {
2229
- //Reload(lastConverter, lastFilename, true);
22302251 ScreenFitPoint();
22312252 } else
22322253 if (source == snapobjectButton)
22332254 {
2234
- //Reload(lastConverter, lastFilename, true);
22352255 SnapObject();
22362256 } else
22372257 // if (event.getSource() == recompileButton)
....@@ -2755,15 +2775,28 @@
27552775 } else
27562776 if (source == ungroupItem || source == ungroupButton)
27572777 {
2758
- //ungroup();
2778
+ boolean hasRoot = false;
2779
+
27592780 for (int i=0; i<group.selection.size(); i++)
27602781 {
2761
- Ungroup(group.selection.get(i));
2782
+ if (group.selection.get(i) == group)
2783
+ {
2784
+ hasRoot = true;
2785
+ break;
2786
+ }
27622787 }
27632788
2764
- ClearSelection(false);
2765
-
2766
- refreshContents();
2789
+ if (!hasRoot)
2790
+ {
2791
+ for (int i=0; i<group.selection.size(); i++)
2792
+ {
2793
+ Ungroup(group.selection.get(i));
2794
+ }
2795
+
2796
+ ClearSelection(false);
2797
+
2798
+ refreshContents();
2799
+ }
27672800 } else
27682801 if (source == genUVItem)
27692802 {
....@@ -4706,7 +4739,7 @@
47064739 void refreshContents(boolean cp)
47074740 {
47084741 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4709
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47104743 {
47114744 objEditor.ClearInfo(); // .GetMaterial());
47124745
....@@ -4805,8 +4838,8 @@
48054838
48064839 if (cut)
48074840 {
4808
- if (Globals.SAVEONMAKE)
4809
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
48104843 //int indices[] = jList.getSelectedIndices();
48114844 //for (int i = indices.length - 1; i >= 0; i--)
48124845 //jList.remove(indices[i]);
....@@ -4909,6 +4942,10 @@
49094942
49104943 void paste(boolean expand)
49114944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
49124949 // if (GrafreeD.clipboard == null)
49134950 // return;
49144951 boolean first = true;
....@@ -4968,6 +5005,7 @@
49685005 Grafreed.clipboard.get(0).parent = keepparent;
49695006 }
49705007
5008
+ Globals.SAVEONMAKE = keep;
49715009 ResetModel();
49725010 refreshContents();
49735011 }
....@@ -5103,6 +5141,10 @@
51035141
51045142 void group(Object3D csg, boolean grab)
51055143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
51065148 if (//false) // why??
51075149 !group.selection.isEmpty())
51085150 {
....@@ -5216,10 +5258,15 @@
52165258 //node.add(csg);
52175259 //makeSomething(node);
52185260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
52195262 }
52205263
52215264 void Ungroup(Object3D g)
52225265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
52235270 if (g instanceof HiddenObject)
52245271 {
52255272 HiddenObject h = (HiddenObject) g;
....@@ -5236,6 +5283,7 @@
52365283 objEditor.makeSomething(g.get(i), false);
52375284 }
52385285 }
5286
+ Globals.SAVEONMAKE = keep;
52395287 }
52405288
52415289 void ungroup()
....@@ -5526,9 +5574,6 @@
55265574
55275575 cButton restoreCameraButton;
55285576
5529
- cButton minButton;
5530
- cButton maxButton;
5531
- cButton fullButton;
55325577 cButton saveButton;
55335578 cButton oneStepButton;
55345579