.. | .. |
---|
84 | 84 | |
---|
85 | 85 | void CloneSelection(boolean supports) |
---|
86 | 86 | { |
---|
| 87 | + if (Globals.SAVEONMAKE) |
---|
| 88 | + Save(); |
---|
| 89 | + boolean keep = Globals.SAVEONMAKE; |
---|
| 90 | + Globals.SAVEONMAKE = false; |
---|
87 | 91 | // Object3D keep = GrafreeD.clipboard; |
---|
88 | 92 | //Object3D obj; |
---|
89 | 93 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
94 | 98 | |
---|
95 | 99 | makeSomething(clone, i==group.selection.size()-1); |
---|
96 | 100 | } |
---|
| 101 | + Globals.SAVEONMAKE = keep; |
---|
97 | 102 | } |
---|
98 | 103 | |
---|
99 | 104 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
220 | 225 | // toggleSwitchItem.addItemListener(this); |
---|
221 | 226 | // toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
222 | 227 | |
---|
223 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
| 228 | + cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles")); |
---|
224 | 229 | toggleHandleItem.addItemListener(this); |
---|
225 | 230 | toggleHandleItem.setState(CameraPane.HANDLES); |
---|
226 | 231 | |
---|
.. | .. |
---|
380 | 385 | shadowYItem.addActionListener(this); |
---|
381 | 386 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
382 | 387 | shadowZItem.addActionListener(this); |
---|
| 388 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 389 | + attributeItem.addActionListener(this); |
---|
| 390 | + |
---|
383 | 391 | if (Globals.ADVANCED) |
---|
384 | 392 | { |
---|
385 | 393 | menu.add("-"); |
---|
386 | 394 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
387 | 395 | linkerItem.addActionListener(this); |
---|
388 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
389 | | - attributeItem.addActionListener(this); |
---|
390 | 396 | templateItem = menu.add(new MenuItem("Template")); |
---|
391 | 397 | templateItem.addActionListener(this); |
---|
392 | 398 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
582 | 588 | */ |
---|
583 | 589 | cGridBag copyOptionsPanel = new cGridBag(); |
---|
584 | 590 | |
---|
585 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 591 | + copyOptionsPanel.preferredHeight = 1; |
---|
586 | 592 | |
---|
587 | 593 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
588 | 594 | |
---|
.. | .. |
---|
590 | 596 | //minButton.setToolTipText("Minimize window"); |
---|
591 | 597 | //minButton.addActionListener(this); |
---|
592 | 598 | |
---|
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 | + } |
---|
596 | 605 | |
---|
597 | 606 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
598 | 607 | fullButton.setToolTipText("Full-screen window"); |
---|
599 | 608 | fullButton.addActionListener(this); |
---|
600 | 609 | |
---|
| 610 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 611 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 612 | + screenfitButton.addActionListener(this); |
---|
| 613 | + |
---|
601 | 614 | oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
602 | 615 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
603 | 616 | restoreCameraButton.addActionListener(this); |
---|
.. | .. |
---|
630 | 643 | |
---|
631 | 644 | //oe.toolboxPanel.Return(); |
---|
632 | 645 | |
---|
633 | | - copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
634 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
635 | | - screenfitButton.addActionListener(this); |
---|
636 | | - |
---|
637 | 646 | // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
638 | 647 | // trackCB.setToolTipText("Enable tracking"); |
---|
639 | 648 | // trackCB.addItemListener(this); |
---|
.. | .. |
---|
726 | 735 | compositeButton.addActionListener(this); |
---|
727 | 736 | |
---|
728 | 737 | oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
729 | | - switchButton.setToolTipText("Create switch"); |
---|
| 738 | + switchButton.setToolTipText("Create item switcher"); |
---|
730 | 739 | switchButton.addActionListener(this); |
---|
731 | 740 | |
---|
732 | 741 | oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
863 | 872 | |
---|
864 | 873 | if (true) // Globals.ADVANCED) |
---|
865 | 874 | { |
---|
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); |
---|
869 | 882 | |
---|
870 | 883 | // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); |
---|
871 | 884 | // localCB.addItemListener(this); |
---|
.. | .. |
---|
929 | 942 | toggleTextureCB.addItemListener(this); |
---|
930 | 943 | |
---|
931 | 944 | panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); |
---|
932 | | - toggleSwitchCB.setToolTipText("Use switch"); |
---|
| 945 | + toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
933 | 946 | toggleSwitchCB.addItemListener(this); |
---|
934 | 947 | |
---|
935 | 948 | panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
.. | .. |
---|
963 | 976 | { |
---|
964 | 977 | cRadio radioButton = new cRadio(obj.name); |
---|
965 | 978 | |
---|
966 | | - // Patch to avoid bug with transparency. |
---|
| 979 | + // June 2019. Patch to avoid bug with transparency. |
---|
967 | 980 | radioButton.hadMaterial = obj.material != null; |
---|
968 | 981 | if (!radioButton.hadMaterial) |
---|
969 | 982 | { |
---|
.. | .. |
---|
1000 | 1013 | cCheckBox slowCB; |
---|
1001 | 1014 | cCheckBox boxCB; |
---|
1002 | 1015 | cCheckBox zoomBoxCB; |
---|
| 1016 | + cCheckBox freezeCB; |
---|
1003 | 1017 | //cToggleButton trackCB; |
---|
1004 | 1018 | cCheckBox trackCB; |
---|
1005 | 1019 | cCheckBox smoothfocusCB; |
---|
.. | .. |
---|
1118 | 1132 | { |
---|
1119 | 1133 | Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
1120 | 1134 | } |
---|
| 1135 | + else if(e.getSource() == freezeCB) |
---|
| 1136 | + { |
---|
| 1137 | + Globals.FREEZEONMOVE ^= true; |
---|
| 1138 | + } |
---|
1121 | 1139 | else if(e.getSource() == autosaveCB) |
---|
1122 | 1140 | { |
---|
1123 | 1141 | Globals.SAVEONMAKE ^= true; |
---|
.. | .. |
---|
1202 | 1220 | } |
---|
1203 | 1221 | } |
---|
1204 | 1222 | |
---|
1205 | | - String string = (String) object; |
---|
1206 | | - |
---|
1207 | 1223 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1208 | 1224 | // if( object instanceof java.io.File[]) |
---|
1209 | 1225 | // { |
---|
.. | .. |
---|
1211 | 1227 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1212 | 1228 | // return; |
---|
1213 | 1229 | // } |
---|
| 1230 | + |
---|
| 1231 | + String string = object.toString(); |
---|
1214 | 1232 | |
---|
1215 | 1233 | // File path for Mac and Windows |
---|
1216 | 1234 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1460 | 1478 | animationItem.addItemListener(this); |
---|
1461 | 1479 | animationItem.setState(Globals.ANIMATION); |
---|
1462 | 1480 | |
---|
| 1481 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1482 | + archiveItem.addActionListener(this); |
---|
| 1483 | + |
---|
1463 | 1484 | menu.add("-"); |
---|
1464 | 1485 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1465 | 1486 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1472 | 1493 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1473 | 1494 | reduce34MorphItem.addActionListener(this); |
---|
1474 | 1495 | menu.add("-"); |
---|
| 1496 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1497 | + memoryItem.addActionListener(this); |
---|
1475 | 1498 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1476 | 1499 | computeAOItem.addActionListener(this); |
---|
1477 | 1500 | |
---|
.. | .. |
---|
1480 | 1503 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1481 | 1504 | mirrorItem.addActionListener(this); |
---|
1482 | 1505 | menu.add("-"); |
---|
1483 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1484 | | - memoryItem.addActionListener(this); |
---|
1485 | 1506 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1486 | 1507 | analyzeItem.addActionListener(this); |
---|
1487 | 1508 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
2122 | 2143 | Composite csg = new GroupLeaf(); |
---|
2123 | 2144 | csg.count = 5; |
---|
2124 | 2145 | group(csg); |
---|
2125 | | - Composite child = new cGroup(); |
---|
| 2146 | + Composite child = new cGroup("Branch"); |
---|
2126 | 2147 | csg.addChild(child); |
---|
2127 | 2148 | child.addChild(csg); |
---|
2128 | 2149 | } else |
---|
2129 | 2150 | if (source == doubleItem) |
---|
2130 | 2151 | { |
---|
2131 | | - Composite csg = new GroupLeaf(); |
---|
| 2152 | + Composite csg = new GroupLeaf("Fork"); |
---|
2132 | 2153 | csg.count = 5; |
---|
2133 | 2154 | group(csg); |
---|
2134 | | - Composite child = new cGroup(); |
---|
| 2155 | + Composite child = new cGroup("Branch A"); |
---|
2135 | 2156 | csg.addChild(child); |
---|
2136 | 2157 | child.addChild(csg); |
---|
2137 | | - child = new cGroup(); |
---|
| 2158 | + child = new cGroup("Branch B"); |
---|
2138 | 2159 | csg.addChild(child); |
---|
2139 | 2160 | child.addChild(csg); |
---|
2140 | 2161 | } else |
---|
2141 | 2162 | if (source == tripleItem) |
---|
2142 | 2163 | { |
---|
2143 | | - Composite csg = new GroupLeaf(); |
---|
| 2164 | + Composite csg = new GroupLeaf("Trident"); |
---|
2144 | 2165 | csg.count = 4; |
---|
2145 | 2166 | group(csg); |
---|
2146 | 2167 | Composite child = new cGroup(); |
---|
.. | .. |
---|
2204 | 2225 | } else |
---|
2205 | 2226 | if (source == undoButton) |
---|
2206 | 2227 | { |
---|
2207 | | - Undo(); |
---|
| 2228 | + if (!Undo()) |
---|
| 2229 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2208 | 2230 | } else |
---|
2209 | 2231 | if (source == redoButton) |
---|
2210 | 2232 | { |
---|
.. | .. |
---|
2212 | 2234 | } else |
---|
2213 | 2235 | if (source == saveButton) |
---|
2214 | 2236 | { |
---|
2215 | | - Save(); |
---|
| 2237 | + if (!Save(true)) |
---|
| 2238 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2216 | 2239 | } else |
---|
2217 | 2240 | if (source == oneStepButton) |
---|
2218 | 2241 | { |
---|
.. | .. |
---|
2221 | 2244 | } else |
---|
2222 | 2245 | if (source == screenfitButton) |
---|
2223 | 2246 | { |
---|
2224 | | - //Reload(lastConverter, lastFilename, true); |
---|
2225 | 2247 | ScreenFit(); |
---|
2226 | 2248 | } else |
---|
2227 | 2249 | if (source == screenfitpointButton) |
---|
2228 | 2250 | { |
---|
2229 | | - //Reload(lastConverter, lastFilename, true); |
---|
2230 | 2251 | ScreenFitPoint(); |
---|
2231 | 2252 | } else |
---|
2232 | 2253 | if (source == snapobjectButton) |
---|
2233 | 2254 | { |
---|
2234 | | - //Reload(lastConverter, lastFilename, true); |
---|
2235 | 2255 | SnapObject(); |
---|
2236 | 2256 | } else |
---|
2237 | 2257 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
2755 | 2775 | } else |
---|
2756 | 2776 | if (source == ungroupItem || source == ungroupButton) |
---|
2757 | 2777 | { |
---|
2758 | | - //ungroup(); |
---|
| 2778 | + boolean hasRoot = false; |
---|
| 2779 | + |
---|
2759 | 2780 | for (int i=0; i<group.selection.size(); i++) |
---|
2760 | 2781 | { |
---|
2761 | | - Ungroup(group.selection.get(i)); |
---|
| 2782 | + if (group.selection.get(i) == group) |
---|
| 2783 | + { |
---|
| 2784 | + hasRoot = true; |
---|
| 2785 | + break; |
---|
| 2786 | + } |
---|
2762 | 2787 | } |
---|
2763 | 2788 | |
---|
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 | + } |
---|
2767 | 2800 | } else |
---|
2768 | 2801 | if (source == genUVItem) |
---|
2769 | 2802 | { |
---|
.. | .. |
---|
4706 | 4739 | void refreshContents(boolean cp) |
---|
4707 | 4740 | { |
---|
4708 | 4741 | if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
4709 | | - if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING) |
---|
| 4742 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4710 | 4743 | { |
---|
4711 | 4744 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4712 | 4745 | |
---|
.. | .. |
---|
4805 | 4838 | |
---|
4806 | 4839 | if (cut) |
---|
4807 | 4840 | { |
---|
4808 | | - if (Globals.SAVEONMAKE) |
---|
4809 | | - Save(); |
---|
| 4841 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4842 | +// Save(); |
---|
4810 | 4843 | //int indices[] = jList.getSelectedIndices(); |
---|
4811 | 4844 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4812 | 4845 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4909 | 4942 | |
---|
4910 | 4943 | void paste(boolean expand) |
---|
4911 | 4944 | { |
---|
| 4945 | + if (Globals.SAVEONMAKE) |
---|
| 4946 | + Save(); |
---|
| 4947 | + boolean keep = Globals.SAVEONMAKE; |
---|
| 4948 | + Globals.SAVEONMAKE = false; |
---|
4912 | 4949 | // if (GrafreeD.clipboard == null) |
---|
4913 | 4950 | // return; |
---|
4914 | 4951 | boolean first = true; |
---|
.. | .. |
---|
4968 | 5005 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4969 | 5006 | } |
---|
4970 | 5007 | |
---|
| 5008 | + Globals.SAVEONMAKE = keep; |
---|
4971 | 5009 | ResetModel(); |
---|
4972 | 5010 | refreshContents(); |
---|
4973 | 5011 | } |
---|
.. | .. |
---|
5103 | 5141 | |
---|
5104 | 5142 | void group(Object3D csg, boolean grab) |
---|
5105 | 5143 | { |
---|
| 5144 | + if (Globals.SAVEONMAKE) |
---|
| 5145 | + Save(); |
---|
| 5146 | + boolean keep = Globals.SAVEONMAKE; |
---|
| 5147 | + Globals.SAVEONMAKE = false; |
---|
5106 | 5148 | if (//false) // why?? |
---|
5107 | 5149 | !group.selection.isEmpty()) |
---|
5108 | 5150 | { |
---|
.. | .. |
---|
5216 | 5258 | //node.add(csg); |
---|
5217 | 5259 | //makeSomething(node); |
---|
5218 | 5260 | makeSomething(csg); |
---|
| 5261 | + Globals.SAVEONMAKE = keep; |
---|
5219 | 5262 | } |
---|
5220 | 5263 | |
---|
5221 | 5264 | void Ungroup(Object3D g) |
---|
5222 | 5265 | { |
---|
| 5266 | + if (Globals.SAVEONMAKE) |
---|
| 5267 | + Save(); |
---|
| 5268 | + boolean keep = Globals.SAVEONMAKE; |
---|
| 5269 | + Globals.SAVEONMAKE = false; |
---|
5223 | 5270 | if (g instanceof HiddenObject) |
---|
5224 | 5271 | { |
---|
5225 | 5272 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5236 | 5283 | objEditor.makeSomething(g.get(i), false); |
---|
5237 | 5284 | } |
---|
5238 | 5285 | } |
---|
| 5286 | + Globals.SAVEONMAKE = keep; |
---|
5239 | 5287 | } |
---|
5240 | 5288 | |
---|
5241 | 5289 | void ungroup() |
---|
.. | .. |
---|
5526 | 5574 | |
---|
5527 | 5575 | cButton restoreCameraButton; |
---|
5528 | 5576 | |
---|
5529 | | - cButton minButton; |
---|
5530 | | - cButton maxButton; |
---|
5531 | | - cButton fullButton; |
---|
5532 | 5577 | cButton saveButton; |
---|
5533 | 5578 | cButton oneStepButton; |
---|
5534 | 5579 | |
---|