.. | .. |
---|
84 | 84 | |
---|
85 | 85 | void CloneSelection(boolean supports) |
---|
86 | 86 | { |
---|
| 87 | + if (Globals.REPLACEONMAKE) |
---|
| 88 | + Save(); |
---|
| 89 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 90 | + Globals.REPLACEONMAKE = 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.REPLACEONMAKE = 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")); |
---|
.. | .. |
---|
538 | 544 | buildToolsMenu(menu); |
---|
539 | 545 | } |
---|
540 | 546 | |
---|
| 547 | + |
---|
541 | 548 | void SetupUI2(ObjEditor oe) |
---|
542 | 549 | { |
---|
543 | 550 | // June 2019 |
---|
.. | .. |
---|
582 | 589 | */ |
---|
583 | 590 | cGridBag copyOptionsPanel = new cGridBag(); |
---|
584 | 591 | |
---|
585 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 592 | + copyOptionsPanel.preferredHeight = 1; |
---|
586 | 593 | |
---|
587 | 594 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
588 | 595 | |
---|
.. | .. |
---|
590 | 597 | //minButton.setToolTipText("Minimize window"); |
---|
591 | 598 | //minButton.addActionListener(this); |
---|
592 | 599 | |
---|
593 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
594 | | - maxButton.setToolTipText("Maximize window"); |
---|
595 | | - maxButton.addActionListener(this); |
---|
| 600 | + if (Globals.ADVANCED) |
---|
| 601 | + { |
---|
| 602 | + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 603 | + maxButton.setToolTipText("Maximize window"); |
---|
| 604 | + maxButton.addActionListener(this); |
---|
| 605 | + } |
---|
596 | 606 | |
---|
597 | 607 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
598 | 608 | fullButton.setToolTipText("Full-screen window"); |
---|
599 | 609 | fullButton.addActionListener(this); |
---|
600 | 610 | |
---|
| 611 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 612 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 613 | + screenfitButton.addActionListener(this); |
---|
| 614 | + |
---|
601 | 615 | oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
602 | 616 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
603 | 617 | restoreCameraButton.addActionListener(this); |
---|
604 | 618 | |
---|
| 619 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 620 | + saveButton.setToolTipText("New version"); |
---|
| 621 | + saveButton.addActionListener(this); |
---|
| 622 | + |
---|
605 | 623 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
606 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 624 | + undoButton.setToolTipText("Previous version"); |
---|
607 | 625 | undoButton.addActionListener(this); |
---|
| 626 | + undoButton.setEnabled(false); |
---|
| 627 | + |
---|
| 628 | + cGridBag updown = new cGridBag().setVertical(true); |
---|
| 629 | + updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 630 | + restoreButton.setToolTipText("Restore current"); |
---|
| 631 | + restoreButton.addActionListener(this); |
---|
| 632 | + restoreButton.setEnabled(false); |
---|
| 633 | + |
---|
| 634 | + updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 635 | + replaceButton.setToolTipText("Replace current"); |
---|
| 636 | + replaceButton.addActionListener(this); |
---|
| 637 | + replaceButton.setEnabled(false); |
---|
| 638 | + |
---|
| 639 | + copyOptionsPanel.add(updown); |
---|
608 | 640 | |
---|
609 | 641 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
610 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 642 | + redoButton.setToolTipText("Next version"); |
---|
611 | 643 | redoButton.addActionListener(this); |
---|
| 644 | + redoButton.setEnabled(false); |
---|
612 | 645 | |
---|
613 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
614 | | - saveButton.setToolTipText("Save changes"); |
---|
615 | | - saveButton.addActionListener(this); |
---|
616 | | - |
---|
617 | | - copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 646 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
618 | 647 | liveCB.setToolTipText("Enable animation"); |
---|
619 | 648 | liveCB.addItemListener(this); |
---|
620 | 649 | |
---|
621 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 650 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
622 | 651 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
623 | 652 | oneStepButton.addActionListener(this); |
---|
624 | 653 | |
---|
625 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 654 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
626 | 655 | fastCB.setToolTipText("Fast mode"); |
---|
627 | 656 | fastCB.addItemListener(this); |
---|
628 | 657 | |
---|
629 | 658 | //oe.toolboxPanel.Return(); |
---|
630 | 659 | |
---|
631 | | - copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
632 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
633 | | - screenfitButton.addActionListener(this); |
---|
634 | | - |
---|
635 | 660 | // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
636 | 661 | // trackCB.setToolTipText("Enable tracking"); |
---|
637 | 662 | // trackCB.addItemListener(this); |
---|
.. | .. |
---|
724 | 749 | compositeButton.addActionListener(this); |
---|
725 | 750 | |
---|
726 | 751 | oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
727 | | - switchButton.setToolTipText("Create switch"); |
---|
| 752 | + switchButton.setToolTipText("Create item switcher"); |
---|
728 | 753 | switchButton.addActionListener(this); |
---|
729 | 754 | |
---|
730 | 755 | oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
743 | 768 | lightButton.setToolTipText("Create light"); |
---|
744 | 769 | lightButton.addActionListener(this); |
---|
745 | 770 | |
---|
| 771 | + for (int i=6; --i>=0;) |
---|
| 772 | + { |
---|
| 773 | + oe.toolboxPanel.Return(); |
---|
| 774 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 775 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 776 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 777 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 778 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 779 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 780 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 781 | + } |
---|
| 782 | + |
---|
746 | 783 | // EDIT panel |
---|
747 | | - editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
748 | | - editButton.setToolTipText("Edit selection"); |
---|
| 784 | + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 785 | + editButton.setToolTipText("Pin selection controls"); |
---|
749 | 786 | editButton.addActionListener(this); |
---|
750 | 787 | |
---|
751 | | - editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
752 | | - uneditButton.setToolTipText("Unedit selection"); |
---|
| 788 | + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 789 | + uneditButton.setToolTipText("Remove selection controls"); |
---|
753 | 790 | uneditButton.addActionListener(this); |
---|
754 | 791 | |
---|
755 | 792 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
756 | | - allParamsButton.setToolTipText("Edit all params"); |
---|
| 793 | + allParamsButton.setToolTipText("Show all controle"); |
---|
757 | 794 | allParamsButton.addActionListener(this); |
---|
758 | 795 | |
---|
759 | 796 | editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
770 | 807 | |
---|
771 | 808 | editCommandsPanel.preferredHeight = 1; |
---|
772 | 809 | |
---|
| 810 | + SetPinStates(false); |
---|
773 | 811 | // oe.treePanel.add(commandsPanel); |
---|
774 | 812 | // oe.treePanel.Return(); |
---|
775 | 813 | |
---|
.. | .. |
---|
796 | 834 | |
---|
797 | 835 | oe.treePanel.add(copyOptionsPanel); |
---|
798 | 836 | oe.treePanel.Return(); |
---|
| 837 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0); |
---|
| 838 | + versionField = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 839 | + sliderPane.preferredHeight = 1; |
---|
799 | 840 | |
---|
800 | 841 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
801 | 842 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
843 | 884 | boxCB.addItemListener(this); |
---|
844 | 885 | |
---|
845 | 886 | panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); |
---|
846 | | - zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); |
---|
| 887 | + zoomBoxCB.setToolTipText("Display only for wheel"); |
---|
847 | 888 | zoomBoxCB.addItemListener(this); |
---|
848 | 889 | |
---|
849 | 890 | if (true) // Globals.ADVANCED) |
---|
850 | 891 | { |
---|
851 | | - panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
852 | | - supportCB.setToolTipText("Enable rigging"); |
---|
853 | | - supportCB.addItemListener(this); |
---|
| 892 | +// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
| 893 | +// supportCB.setToolTipText("Enable rigging"); |
---|
| 894 | +// supportCB.addItemListener(this); |
---|
| 895 | + |
---|
| 896 | + panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints); |
---|
| 897 | + freezeCB.setToolTipText("Fast moving camera"); |
---|
| 898 | + freezeCB.addItemListener(this); |
---|
854 | 899 | |
---|
855 | 900 | // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); |
---|
856 | 901 | // localCB.addItemListener(this); |
---|
.. | .. |
---|
905 | 950 | oeilCB.addItemListener(this); |
---|
906 | 951 | |
---|
907 | 952 | panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); |
---|
908 | | - shadowCB.setToolTipText("Compute shadows when live"); |
---|
| 953 | + shadowCB.setToolTipText("When live compute shadows"); |
---|
909 | 954 | shadowCB.addItemListener(this); |
---|
910 | 955 | |
---|
911 | 956 | panel.Return(); |
---|
.. | .. |
---|
914 | 959 | toggleTextureCB.addItemListener(this); |
---|
915 | 960 | |
---|
916 | 961 | panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); |
---|
917 | | - toggleSwitchCB.setToolTipText("Use switch"); |
---|
| 962 | + toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
918 | 963 | toggleSwitchCB.addItemListener(this); |
---|
919 | 964 | |
---|
920 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
921 | | - autosaveCB.setToolTipText("Auto-save on structure change"); |
---|
922 | | - autosaveCB.addItemListener(this); |
---|
| 965 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 966 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 967 | + autokeepCB.addItemListener(this); |
---|
923 | 968 | |
---|
924 | 969 | panel.Return(); |
---|
925 | 970 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
948 | 993 | { |
---|
949 | 994 | cRadio radioButton = new cRadio(obj.name); |
---|
950 | 995 | |
---|
951 | | - // Patch to avoid bug with transparency. |
---|
| 996 | + // June 2019. Patch to avoid bug with transparency. |
---|
952 | 997 | radioButton.hadMaterial = obj.material != null; |
---|
953 | 998 | if (!radioButton.hadMaterial) |
---|
954 | 999 | { |
---|
.. | .. |
---|
985 | 1030 | cCheckBox slowCB; |
---|
986 | 1031 | cCheckBox boxCB; |
---|
987 | 1032 | cCheckBox zoomBoxCB; |
---|
| 1033 | + cCheckBox freezeCB; |
---|
988 | 1034 | //cToggleButton trackCB; |
---|
989 | 1035 | cCheckBox trackCB; |
---|
990 | 1036 | cCheckBox smoothfocusCB; |
---|
.. | .. |
---|
995 | 1041 | |
---|
996 | 1042 | cCheckBox oeilCB; |
---|
997 | 1043 | cCheckBox shadowCB; |
---|
998 | | - cCheckBox autosaveCB; |
---|
| 1044 | + cCheckBox autokeepCB; |
---|
999 | 1045 | cCheckBox lookAtCB; |
---|
1000 | 1046 | |
---|
1001 | 1047 | // static int COLOR = 1; |
---|
.. | .. |
---|
1103 | 1149 | { |
---|
1104 | 1150 | Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
1105 | 1151 | } |
---|
1106 | | - else if(e.getSource() == autosaveCB) |
---|
| 1152 | + else if(e.getSource() == freezeCB) |
---|
1107 | 1153 | { |
---|
1108 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1154 | + Globals.FREEZEONMOVE ^= true; |
---|
| 1155 | + } |
---|
| 1156 | + else if(e.getSource() == autokeepCB) |
---|
| 1157 | + { |
---|
| 1158 | + Globals.REPLACEONMAKE ^= true; |
---|
1109 | 1159 | } |
---|
1110 | 1160 | else if(e.getSource() == lookAtCB) |
---|
1111 | 1161 | { |
---|
.. | .. |
---|
1187 | 1237 | } |
---|
1188 | 1238 | } |
---|
1189 | 1239 | |
---|
1190 | | - String string = (String) object; |
---|
1191 | | - |
---|
1192 | 1240 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1193 | 1241 | // if( object instanceof java.io.File[]) |
---|
1194 | 1242 | // { |
---|
.. | .. |
---|
1196 | 1244 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1197 | 1245 | // return; |
---|
1198 | 1246 | // } |
---|
| 1247 | + |
---|
| 1248 | + String string = object.toString(); |
---|
1199 | 1249 | |
---|
1200 | 1250 | // File path for Mac and Windows |
---|
1201 | 1251 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1445 | 1495 | animationItem.addItemListener(this); |
---|
1446 | 1496 | animationItem.setState(Globals.ANIMATION); |
---|
1447 | 1497 | |
---|
| 1498 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1499 | + archiveItem.addActionListener(this); |
---|
| 1500 | + |
---|
1448 | 1501 | menu.add("-"); |
---|
1449 | 1502 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1450 | 1503 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1457 | 1510 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1458 | 1511 | reduce34MorphItem.addActionListener(this); |
---|
1459 | 1512 | menu.add("-"); |
---|
| 1513 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1514 | + memoryItem.addActionListener(this); |
---|
1460 | 1515 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1461 | 1516 | computeAOItem.addActionListener(this); |
---|
1462 | 1517 | |
---|
.. | .. |
---|
1465 | 1520 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1466 | 1521 | mirrorItem.addActionListener(this); |
---|
1467 | 1522 | menu.add("-"); |
---|
1468 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1469 | | - memoryItem.addActionListener(this); |
---|
1470 | 1523 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1471 | 1524 | analyzeItem.addActionListener(this); |
---|
1472 | 1525 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
1614 | 1667 | |
---|
1615 | 1668 | makeSomething(shadow); |
---|
1616 | 1669 | } |
---|
| 1670 | + |
---|
| 1671 | + private void ClearUnpinned() |
---|
| 1672 | + { |
---|
| 1673 | + //for (Object3D obj : listUI) |
---|
| 1674 | + for (int i=listUI.size(); --i>=0;) |
---|
| 1675 | + { |
---|
| 1676 | + Object3D obj = listUI.elementAt(i); |
---|
| 1677 | + if (!obj.pinned) |
---|
| 1678 | + { |
---|
| 1679 | + obj.CloseUI(); |
---|
| 1680 | + listUI.remove(i); |
---|
| 1681 | + } |
---|
| 1682 | + } |
---|
| 1683 | + } |
---|
1617 | 1684 | |
---|
1618 | 1685 | /** |
---|
1619 | 1686 | * applyExample |
---|
.. | .. |
---|
2093 | 2160 | Composite csg = new GroupLeaf(); |
---|
2094 | 2161 | csg.count = 5; |
---|
2095 | 2162 | group(csg); |
---|
2096 | | - Composite child = new cGroup(); |
---|
| 2163 | + Composite child = new cGroup("Branch"); |
---|
2097 | 2164 | csg.addChild(child); |
---|
2098 | 2165 | child.addChild(csg); |
---|
2099 | 2166 | } else |
---|
2100 | 2167 | if (source == doubleItem) |
---|
2101 | 2168 | { |
---|
2102 | | - Composite csg = new GroupLeaf(); |
---|
| 2169 | + Composite csg = new GroupLeaf("Fork"); |
---|
2103 | 2170 | csg.count = 5; |
---|
2104 | 2171 | group(csg); |
---|
2105 | | - Composite child = new cGroup(); |
---|
| 2172 | + Composite child = new cGroup("Branch A"); |
---|
2106 | 2173 | csg.addChild(child); |
---|
2107 | 2174 | child.addChild(csg); |
---|
2108 | | - child = new cGroup(); |
---|
| 2175 | + child = new cGroup("Branch B"); |
---|
2109 | 2176 | csg.addChild(child); |
---|
2110 | 2177 | child.addChild(csg); |
---|
2111 | 2178 | } else |
---|
2112 | 2179 | if (source == tripleItem) |
---|
2113 | 2180 | { |
---|
2114 | | - Composite csg = new GroupLeaf(); |
---|
| 2181 | + Composite csg = new GroupLeaf("Trident"); |
---|
2115 | 2182 | csg.count = 4; |
---|
2116 | 2183 | group(csg); |
---|
2117 | 2184 | Composite child = new cGroup(); |
---|
.. | .. |
---|
2175 | 2242 | } else |
---|
2176 | 2243 | if (source == undoButton) |
---|
2177 | 2244 | { |
---|
| 2245 | + // Go to previous version |
---|
| 2246 | + //if (!Undo()) |
---|
| 2247 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2178 | 2248 | Undo(); |
---|
| 2249 | + } else |
---|
| 2250 | + if (source == restoreButton) |
---|
| 2251 | + { |
---|
| 2252 | + // Restore current version |
---|
| 2253 | + Restore(); |
---|
| 2254 | + } else |
---|
| 2255 | + if (source == replaceButton) |
---|
| 2256 | + { |
---|
| 2257 | + // Overwrite current version |
---|
| 2258 | + Replace(); |
---|
2179 | 2259 | } else |
---|
2180 | 2260 | if (source == redoButton) |
---|
2181 | 2261 | { |
---|
| 2262 | + // Go to next version |
---|
2182 | 2263 | Redo(); |
---|
2183 | 2264 | } else |
---|
2184 | 2265 | if (source == saveButton) |
---|
2185 | 2266 | { |
---|
2186 | | - Save(); |
---|
| 2267 | + // Save a new version |
---|
| 2268 | + if (!Save(true)) |
---|
| 2269 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2187 | 2270 | } else |
---|
2188 | 2271 | if (source == oneStepButton) |
---|
2189 | 2272 | { |
---|
.. | .. |
---|
2192 | 2275 | } else |
---|
2193 | 2276 | if (source == screenfitButton) |
---|
2194 | 2277 | { |
---|
2195 | | - //Reload(lastConverter, lastFilename, true); |
---|
2196 | 2278 | ScreenFit(); |
---|
2197 | 2279 | } else |
---|
2198 | 2280 | if (source == screenfitpointButton) |
---|
2199 | 2281 | { |
---|
2200 | | - //Reload(lastConverter, lastFilename, true); |
---|
2201 | 2282 | ScreenFitPoint(); |
---|
2202 | 2283 | } else |
---|
2203 | 2284 | if (source == snapobjectButton) |
---|
2204 | 2285 | { |
---|
2205 | | - //Reload(lastConverter, lastFilename, true); |
---|
2206 | 2286 | SnapObject(); |
---|
2207 | 2287 | } else |
---|
2208 | 2288 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
2726 | 2806 | } else |
---|
2727 | 2807 | if (source == ungroupItem || source == ungroupButton) |
---|
2728 | 2808 | { |
---|
2729 | | - //ungroup(); |
---|
| 2809 | + boolean hasRoot = false; |
---|
| 2810 | + |
---|
2730 | 2811 | for (int i=0; i<group.selection.size(); i++) |
---|
2731 | 2812 | { |
---|
2732 | | - Ungroup(group.selection.get(i)); |
---|
| 2813 | + if (group.selection.get(i) == group) |
---|
| 2814 | + { |
---|
| 2815 | + hasRoot = true; |
---|
| 2816 | + break; |
---|
| 2817 | + } |
---|
2733 | 2818 | } |
---|
2734 | 2819 | |
---|
2735 | | - ClearSelection(false); |
---|
2736 | | - |
---|
2737 | | - refreshContents(); |
---|
| 2820 | + if (!hasRoot) |
---|
| 2821 | + { |
---|
| 2822 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 2823 | + { |
---|
| 2824 | + Ungroup(group.selection.get(i)); |
---|
| 2825 | + } |
---|
| 2826 | + |
---|
| 2827 | + ClearSelection(false); |
---|
| 2828 | + |
---|
| 2829 | + refreshContents(); |
---|
| 2830 | + } |
---|
2738 | 2831 | } else |
---|
2739 | 2832 | if (source == genUVItem) |
---|
2740 | 2833 | { |
---|
.. | .. |
---|
3326 | 3419 | } else |
---|
3327 | 3420 | if (source == editItem || source == editButton) |
---|
3328 | 3421 | { |
---|
| 3422 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 3423 | + { |
---|
| 3424 | + Object3D child = (Object3D)e.nextElement(); |
---|
| 3425 | + child.pinned = true; |
---|
| 3426 | + } |
---|
| 3427 | + |
---|
3329 | 3428 | EditSelection(false); |
---|
3330 | 3429 | } else |
---|
3331 | 3430 | if (source == uneditButton) |
---|
.. | .. |
---|
3335 | 3434 | Object3D child = (Object3D)e.nextElement(); |
---|
3336 | 3435 | if(child.editWindow != null) |
---|
3337 | 3436 | objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 3437 | + child.pinned = false; |
---|
3338 | 3438 | child.CloseUI(); |
---|
3339 | 3439 | listUI.remove(child); |
---|
3340 | 3440 | |
---|
.. | .. |
---|
3351 | 3451 | //copy.ClearUI(); |
---|
3352 | 3452 | for (Object3D obj : listUI) |
---|
3353 | 3453 | { |
---|
| 3454 | + obj.pinned = false; |
---|
3354 | 3455 | obj.CloseUI(); |
---|
3355 | 3456 | } |
---|
3356 | 3457 | listUI.clear(); |
---|
.. | .. |
---|
3360 | 3461 | { |
---|
3361 | 3462 | assert(copy == group); |
---|
3362 | 3463 | |
---|
3363 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 3464 | + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3364 | 3465 | |
---|
3365 | 3466 | for (Object3D obj : listUI) |
---|
3366 | 3467 | { |
---|
.. | .. |
---|
3409 | 3510 | } |
---|
3410 | 3511 | |
---|
3411 | 3512 | copy = group; |
---|
| 3513 | + |
---|
| 3514 | + SetUndoStates(); |
---|
| 3515 | + |
---|
3412 | 3516 | //Globals.theRenderer.object = group; |
---|
3413 | 3517 | if(!useclient) |
---|
3414 | 3518 | { |
---|
.. | .. |
---|
3435 | 3539 | currentLayout = sevenButton; |
---|
3436 | 3540 | */ |
---|
3437 | 3541 | radio.layout.doClick(); |
---|
| 3542 | + |
---|
| 3543 | + ClearUnpinned(); |
---|
| 3544 | + SetPinStates(group.selection.size() > 0); |
---|
| 3545 | + if (group.selection.size() == 1) |
---|
| 3546 | + EditSelection(false); |
---|
3438 | 3547 | keepparent = group.parent; |
---|
3439 | 3548 | // PARENT = NULL or not??? |
---|
3440 | 3549 | //group.parent = null; // ROOT |
---|
.. | .. |
---|
4502 | 4611 | // } |
---|
4503 | 4612 | // } |
---|
4504 | 4613 | |
---|
4505 | | - static boolean allparams = true; |
---|
4506 | | - |
---|
4507 | | - static Vector<Object3D> listUI = new Vector<Object3D>(); |
---|
4508 | | - |
---|
4509 | 4614 | void EditSelection(boolean newWindow) |
---|
4510 | 4615 | { |
---|
4511 | 4616 | // aConstraints.gridy = 0; |
---|
.. | .. |
---|
4598 | 4703 | //new Exception().printStackTrace(); |
---|
4599 | 4704 | |
---|
4600 | 4705 | freezemodel = true; |
---|
4601 | | - |
---|
| 4706 | + ClearUnpinned(); |
---|
| 4707 | + |
---|
4602 | 4708 | /**/ |
---|
4603 | 4709 | //switch (event.id) |
---|
4604 | 4710 | { |
---|
.. | .. |
---|
4631 | 4737 | if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) |
---|
4632 | 4738 | // a camera |
---|
4633 | 4739 | { |
---|
4634 | | - if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) |
---|
| 4740 | + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace |
---|
4635 | 4741 | { |
---|
4636 | 4742 | CameraPane.camerachangeframe = 0; // don't refuse it |
---|
4637 | 4743 | Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); |
---|
.. | .. |
---|
4640 | 4746 | // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; |
---|
4641 | 4747 | } |
---|
4642 | 4748 | |
---|
| 4749 | + if (tps != null && tps.length == 1) |
---|
| 4750 | + { |
---|
| 4751 | + EditSelection(false); |
---|
| 4752 | + } |
---|
| 4753 | + |
---|
| 4754 | + SetPinStates(tps != null && tps.length > 0); |
---|
| 4755 | + |
---|
4643 | 4756 | refreshContents(); |
---|
4644 | 4757 | //return true; |
---|
4645 | 4758 | } |
---|
.. | .. |
---|
4649 | 4762 | freezemodel = false; |
---|
4650 | 4763 | } |
---|
4651 | 4764 | |
---|
| 4765 | + void SetPinStates(boolean enabled) |
---|
| 4766 | + { |
---|
| 4767 | + editButton.setEnabled(enabled); |
---|
| 4768 | + uneditButton.setEnabled(enabled); |
---|
| 4769 | + unselectButton.setEnabled(enabled); |
---|
| 4770 | + flashSelectionButton.setEnabled(enabled); |
---|
| 4771 | + } |
---|
| 4772 | + |
---|
4652 | 4773 | void refreshContents(boolean cp) |
---|
4653 | 4774 | { |
---|
4654 | 4775 | if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
4655 | | - if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING) |
---|
| 4776 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4656 | 4777 | { |
---|
4657 | 4778 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4658 | 4779 | |
---|
.. | .. |
---|
4751 | 4872 | |
---|
4752 | 4873 | if (cut) |
---|
4753 | 4874 | { |
---|
4754 | | - if (Globals.SAVEONMAKE) |
---|
4755 | | - Save(); |
---|
| 4875 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4876 | +// Save(); |
---|
4756 | 4877 | //int indices[] = jList.getSelectedIndices(); |
---|
4757 | 4878 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4758 | 4879 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4855 | 4976 | |
---|
4856 | 4977 | void paste(boolean expand) |
---|
4857 | 4978 | { |
---|
| 4979 | + if (Globals.REPLACEONMAKE) |
---|
| 4980 | + Save(); |
---|
| 4981 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4982 | + Globals.REPLACEONMAKE = false; |
---|
4858 | 4983 | // if (GrafreeD.clipboard == null) |
---|
4859 | 4984 | // return; |
---|
4860 | 4985 | boolean first = true; |
---|
.. | .. |
---|
4914 | 5039 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4915 | 5040 | } |
---|
4916 | 5041 | |
---|
| 5042 | + Globals.REPLACEONMAKE = keep; |
---|
4917 | 5043 | ResetModel(); |
---|
4918 | 5044 | refreshContents(); |
---|
4919 | 5045 | } |
---|
.. | .. |
---|
5049 | 5175 | |
---|
5050 | 5176 | void group(Object3D csg, boolean grab) |
---|
5051 | 5177 | { |
---|
| 5178 | + if (Globals.REPLACEONMAKE) |
---|
| 5179 | + Save(); |
---|
| 5180 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5181 | + Globals.REPLACEONMAKE = false; |
---|
5052 | 5182 | if (//false) // why?? |
---|
5053 | 5183 | !group.selection.isEmpty()) |
---|
5054 | 5184 | { |
---|
.. | .. |
---|
5162 | 5292 | //node.add(csg); |
---|
5163 | 5293 | //makeSomething(node); |
---|
5164 | 5294 | makeSomething(csg); |
---|
| 5295 | + Globals.REPLACEONMAKE = keep; |
---|
5165 | 5296 | } |
---|
5166 | 5297 | |
---|
5167 | 5298 | void Ungroup(Object3D g) |
---|
5168 | 5299 | { |
---|
| 5300 | + if (Globals.REPLACEONMAKE) |
---|
| 5301 | + Save(); |
---|
| 5302 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5303 | + Globals.REPLACEONMAKE = false; |
---|
5169 | 5304 | if (g instanceof HiddenObject) |
---|
5170 | 5305 | { |
---|
5171 | 5306 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5182 | 5317 | objEditor.makeSomething(g.get(i), false); |
---|
5183 | 5318 | } |
---|
5184 | 5319 | } |
---|
| 5320 | + Globals.REPLACEONMAKE = keep; |
---|
5185 | 5321 | } |
---|
5186 | 5322 | |
---|
5187 | 5323 | void ungroup() |
---|
.. | .. |
---|
5472 | 5608 | |
---|
5473 | 5609 | cButton restoreCameraButton; |
---|
5474 | 5610 | |
---|
5475 | | - cButton minButton; |
---|
5476 | | - cButton maxButton; |
---|
5477 | | - cButton fullButton; |
---|
5478 | | - cButton undoButton; |
---|
5479 | | - cButton redoButton; |
---|
5480 | 5611 | cButton saveButton; |
---|
5481 | 5612 | cButton oneStepButton; |
---|
5482 | 5613 | |
---|