.. | .. |
---|
60 | 60 | this.copy = this.group = group; |
---|
61 | 61 | //selectees = this.group.selectees; |
---|
62 | 62 | |
---|
| 63 | + if (copy.versions == null) |
---|
| 64 | + { |
---|
| 65 | + copy.versions = new byte[100][]; |
---|
| 66 | + copy.versionindex = -1; |
---|
| 67 | + } |
---|
| 68 | + |
---|
63 | 69 | if(ui) |
---|
64 | 70 | SetupUI(objEditor); |
---|
65 | 71 | } |
---|
.. | .. |
---|
74 | 80 | this.copy = this.group = copy; |
---|
75 | 81 | //selectees = this.group.selectees; |
---|
76 | 82 | |
---|
| 83 | + if (copy.versions == null) |
---|
| 84 | + { |
---|
| 85 | + copy.versions = new byte[100][]; |
---|
| 86 | + copy.versionindex = -1; |
---|
| 87 | + } |
---|
| 88 | + |
---|
77 | 89 | SetupMenu2(this); //objEditor); |
---|
78 | 90 | SetupUI2(objEditor); |
---|
79 | 91 | objEditor.SetupUI(true); |
---|
.. | .. |
---|
84 | 96 | |
---|
85 | 97 | void CloneSelection(boolean supports) |
---|
86 | 98 | { |
---|
| 99 | + if (Globals.REPLACEONMAKE) |
---|
| 100 | + Save(); |
---|
| 101 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 102 | + Globals.REPLACEONMAKE = false; |
---|
87 | 103 | // Object3D keep = GrafreeD.clipboard; |
---|
88 | 104 | //Object3D obj; |
---|
89 | 105 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
94 | 110 | |
---|
95 | 111 | makeSomething(clone, i==group.selection.size()-1); |
---|
96 | 112 | } |
---|
| 113 | + Globals.REPLACEONMAKE = keep; |
---|
97 | 114 | } |
---|
98 | 115 | |
---|
99 | 116 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
220 | 237 | // toggleSwitchItem.addItemListener(this); |
---|
221 | 238 | // toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
222 | 239 | |
---|
223 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
| 240 | + cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles")); |
---|
224 | 241 | toggleHandleItem.addItemListener(this); |
---|
225 | 242 | toggleHandleItem.setState(CameraPane.HANDLES); |
---|
226 | 243 | |
---|
.. | .. |
---|
380 | 397 | shadowYItem.addActionListener(this); |
---|
381 | 398 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
382 | 399 | shadowZItem.addActionListener(this); |
---|
| 400 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 401 | + attributeItem.addActionListener(this); |
---|
| 402 | + |
---|
383 | 403 | if (Globals.ADVANCED) |
---|
384 | 404 | { |
---|
385 | 405 | menu.add("-"); |
---|
386 | 406 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
387 | 407 | linkerItem.addActionListener(this); |
---|
388 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
389 | | - attributeItem.addActionListener(this); |
---|
390 | 408 | templateItem = menu.add(new MenuItem("Template")); |
---|
391 | 409 | templateItem.addActionListener(this); |
---|
392 | 410 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
538 | 556 | buildToolsMenu(menu); |
---|
539 | 557 | } |
---|
540 | 558 | |
---|
| 559 | + |
---|
541 | 560 | void SetupUI2(ObjEditor oe) |
---|
542 | 561 | { |
---|
543 | 562 | // June 2019 |
---|
.. | .. |
---|
582 | 601 | */ |
---|
583 | 602 | cGridBag copyOptionsPanel = new cGridBag(); |
---|
584 | 603 | |
---|
585 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 604 | + copyOptionsPanel.preferredHeight = 1; |
---|
586 | 605 | |
---|
587 | 606 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
588 | 607 | |
---|
.. | .. |
---|
590 | 609 | //minButton.setToolTipText("Minimize window"); |
---|
591 | 610 | //minButton.addActionListener(this); |
---|
592 | 611 | |
---|
593 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
594 | | - maxButton.setToolTipText("Maximize window"); |
---|
595 | | - maxButton.addActionListener(this); |
---|
| 612 | + if (Globals.ADVANCED) |
---|
| 613 | + { |
---|
| 614 | + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 615 | + maxButton.setToolTipText("Maximize window"); |
---|
| 616 | + maxButton.addActionListener(this); |
---|
| 617 | + } |
---|
596 | 618 | |
---|
597 | 619 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
598 | 620 | fullButton.setToolTipText("Full-screen window"); |
---|
599 | 621 | fullButton.addActionListener(this); |
---|
600 | 622 | |
---|
| 623 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 624 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 625 | + screenfitButton.addActionListener(this); |
---|
| 626 | + |
---|
601 | 627 | oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
602 | 628 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
603 | 629 | restoreCameraButton.addActionListener(this); |
---|
604 | 630 | |
---|
| 631 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 632 | + saveButton.setToolTipText("New version"); |
---|
| 633 | + saveButton.addActionListener(this); |
---|
| 634 | + |
---|
605 | 635 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
606 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 636 | + undoButton.setToolTipText("Previous version"); |
---|
607 | 637 | undoButton.addActionListener(this); |
---|
| 638 | + undoButton.setEnabled(false); |
---|
| 639 | + |
---|
| 640 | + cGridBag updown = new cGridBag().setVertical(true); |
---|
| 641 | + updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 642 | + restoreButton.setToolTipText("Restore current"); |
---|
| 643 | + restoreButton.addActionListener(this); |
---|
| 644 | + restoreButton.setEnabled(false); |
---|
| 645 | + |
---|
| 646 | + updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 647 | + replaceButton.setToolTipText("Replace current"); |
---|
| 648 | + replaceButton.addActionListener(this); |
---|
| 649 | + replaceButton.setEnabled(false); |
---|
| 650 | + |
---|
| 651 | + copyOptionsPanel.add(updown); |
---|
608 | 652 | |
---|
609 | 653 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
610 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 654 | + redoButton.setToolTipText("Next version"); |
---|
611 | 655 | redoButton.addActionListener(this); |
---|
| 656 | + redoButton.setEnabled(false); |
---|
612 | 657 | |
---|
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); |
---|
| 658 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
618 | 659 | liveCB.setToolTipText("Enable animation"); |
---|
619 | 660 | liveCB.addItemListener(this); |
---|
620 | 661 | |
---|
621 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 662 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
622 | 663 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
623 | 664 | oneStepButton.addActionListener(this); |
---|
624 | 665 | |
---|
625 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 666 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
626 | 667 | fastCB.setToolTipText("Fast mode"); |
---|
627 | 668 | fastCB.addItemListener(this); |
---|
628 | 669 | |
---|
629 | 670 | //oe.toolboxPanel.Return(); |
---|
630 | 671 | |
---|
631 | | - copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
632 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
633 | | - screenfitButton.addActionListener(this); |
---|
634 | | - |
---|
635 | 672 | // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
636 | 673 | // trackCB.setToolTipText("Enable tracking"); |
---|
637 | 674 | // trackCB.addItemListener(this); |
---|
.. | .. |
---|
724 | 761 | compositeButton.addActionListener(this); |
---|
725 | 762 | |
---|
726 | 763 | oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
727 | | - switchButton.setToolTipText("Create switch"); |
---|
| 764 | + switchButton.setToolTipText("Create item switcher"); |
---|
728 | 765 | switchButton.addActionListener(this); |
---|
729 | 766 | |
---|
730 | 767 | oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
743 | 780 | lightButton.setToolTipText("Create light"); |
---|
744 | 781 | lightButton.addActionListener(this); |
---|
745 | 782 | |
---|
| 783 | + for (int i=6; --i>=0;) |
---|
| 784 | + { |
---|
| 785 | + oe.toolboxPanel.Return(); |
---|
| 786 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 787 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 788 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 789 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 790 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 791 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 792 | + oe.toolboxPanel.add(new cGridBag()); |
---|
| 793 | + } |
---|
| 794 | + |
---|
746 | 795 | // EDIT panel |
---|
747 | | - editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
748 | | - editButton.setToolTipText("Edit selection"); |
---|
| 796 | + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 797 | + editButton.setToolTipText("Pin selection controls"); |
---|
749 | 798 | editButton.addActionListener(this); |
---|
750 | 799 | |
---|
751 | | - editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
752 | | - uneditButton.setToolTipText("Unedit selection"); |
---|
| 800 | + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 801 | + uneditButton.setToolTipText("Remove selection controls"); |
---|
753 | 802 | uneditButton.addActionListener(this); |
---|
754 | 803 | |
---|
755 | 804 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
756 | | - allParamsButton.setToolTipText("Edit all params"); |
---|
| 805 | + allParamsButton.setToolTipText("Show all controle"); |
---|
757 | 806 | allParamsButton.addActionListener(this); |
---|
758 | 807 | |
---|
759 | 808 | editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
770 | 819 | |
---|
771 | 820 | editCommandsPanel.preferredHeight = 1; |
---|
772 | 821 | |
---|
| 822 | + SetPinStates(false); |
---|
773 | 823 | // oe.treePanel.add(commandsPanel); |
---|
774 | 824 | // oe.treePanel.Return(); |
---|
775 | 825 | |
---|
.. | .. |
---|
796 | 846 | |
---|
797 | 847 | oe.treePanel.add(copyOptionsPanel); |
---|
798 | 848 | oe.treePanel.Return(); |
---|
| 849 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 850 | + versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 851 | + sliderPane.preferredHeight = 1; |
---|
799 | 852 | |
---|
800 | 853 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
801 | 854 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
843 | 896 | boxCB.addItemListener(this); |
---|
844 | 897 | |
---|
845 | 898 | panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints); |
---|
846 | | - zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel"); |
---|
| 899 | + zoomBoxCB.setToolTipText("Display only for wheel"); |
---|
847 | 900 | zoomBoxCB.addItemListener(this); |
---|
848 | 901 | |
---|
849 | 902 | if (true) // Globals.ADVANCED) |
---|
850 | 903 | { |
---|
851 | | - panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
852 | | - supportCB.setToolTipText("Enable rigging"); |
---|
853 | | - supportCB.addItemListener(this); |
---|
| 904 | +// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
| 905 | +// supportCB.setToolTipText("Enable rigging"); |
---|
| 906 | +// supportCB.addItemListener(this); |
---|
| 907 | + |
---|
| 908 | + panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints); |
---|
| 909 | + freezeCB.setToolTipText("Fast moving camera"); |
---|
| 910 | + freezeCB.addItemListener(this); |
---|
854 | 911 | |
---|
855 | 912 | // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); |
---|
856 | 913 | // localCB.addItemListener(this); |
---|
.. | .. |
---|
905 | 962 | oeilCB.addItemListener(this); |
---|
906 | 963 | |
---|
907 | 964 | panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); |
---|
908 | | - shadowCB.setToolTipText("Compute shadows when live"); |
---|
| 965 | + shadowCB.setToolTipText("When live compute shadows"); |
---|
909 | 966 | shadowCB.addItemListener(this); |
---|
910 | 967 | |
---|
911 | 968 | panel.Return(); |
---|
.. | .. |
---|
914 | 971 | toggleTextureCB.addItemListener(this); |
---|
915 | 972 | |
---|
916 | 973 | panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); |
---|
917 | | - toggleSwitchCB.setToolTipText("Use switch"); |
---|
| 974 | + toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
918 | 975 | toggleSwitchCB.addItemListener(this); |
---|
919 | 976 | |
---|
920 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
921 | | - autosaveCB.setToolTipText("Auto-save on structure change"); |
---|
922 | | - autosaveCB.addItemListener(this); |
---|
| 977 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 978 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 979 | + autokeepCB.addItemListener(this); |
---|
923 | 980 | |
---|
924 | 981 | panel.Return(); |
---|
925 | 982 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
948 | 1005 | { |
---|
949 | 1006 | cRadio radioButton = new cRadio(obj.name); |
---|
950 | 1007 | |
---|
951 | | - // Patch to avoid bug with transparency. |
---|
| 1008 | + // June 2019. Patch to avoid bug with transparency. |
---|
952 | 1009 | radioButton.hadMaterial = obj.material != null; |
---|
953 | 1010 | if (!radioButton.hadMaterial) |
---|
954 | 1011 | { |
---|
.. | .. |
---|
985 | 1042 | cCheckBox slowCB; |
---|
986 | 1043 | cCheckBox boxCB; |
---|
987 | 1044 | cCheckBox zoomBoxCB; |
---|
| 1045 | + cCheckBox freezeCB; |
---|
988 | 1046 | //cToggleButton trackCB; |
---|
989 | 1047 | cCheckBox trackCB; |
---|
990 | 1048 | cCheckBox smoothfocusCB; |
---|
.. | .. |
---|
995 | 1053 | |
---|
996 | 1054 | cCheckBox oeilCB; |
---|
997 | 1055 | cCheckBox shadowCB; |
---|
998 | | - cCheckBox autosaveCB; |
---|
| 1056 | + cCheckBox autokeepCB; |
---|
999 | 1057 | cCheckBox lookAtCB; |
---|
1000 | 1058 | |
---|
1001 | 1059 | // static int COLOR = 1; |
---|
.. | .. |
---|
1103 | 1161 | { |
---|
1104 | 1162 | Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
1105 | 1163 | } |
---|
1106 | | - else if(e.getSource() == autosaveCB) |
---|
| 1164 | + else if(e.getSource() == freezeCB) |
---|
1107 | 1165 | { |
---|
1108 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1166 | + Globals.FREEZEONMOVE ^= true; |
---|
| 1167 | + } |
---|
| 1168 | + else if(e.getSource() == autokeepCB) |
---|
| 1169 | + { |
---|
| 1170 | + Globals.REPLACEONMAKE ^= true; |
---|
1109 | 1171 | } |
---|
1110 | 1172 | else if(e.getSource() == lookAtCB) |
---|
1111 | 1173 | { |
---|
.. | .. |
---|
1187 | 1249 | } |
---|
1188 | 1250 | } |
---|
1189 | 1251 | |
---|
1190 | | - String string = (String) object; |
---|
1191 | | - |
---|
1192 | 1252 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1193 | 1253 | // if( object instanceof java.io.File[]) |
---|
1194 | 1254 | // { |
---|
.. | .. |
---|
1196 | 1256 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1197 | 1257 | // return; |
---|
1198 | 1258 | // } |
---|
| 1259 | + |
---|
| 1260 | + String string = object.toString(); |
---|
1199 | 1261 | |
---|
1200 | 1262 | // File path for Mac and Windows |
---|
1201 | 1263 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1445 | 1507 | animationItem.addItemListener(this); |
---|
1446 | 1508 | animationItem.setState(Globals.ANIMATION); |
---|
1447 | 1509 | |
---|
| 1510 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1511 | + archiveItem.addActionListener(this); |
---|
| 1512 | + |
---|
1448 | 1513 | menu.add("-"); |
---|
1449 | 1514 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1450 | 1515 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1457 | 1522 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1458 | 1523 | reduce34MorphItem.addActionListener(this); |
---|
1459 | 1524 | menu.add("-"); |
---|
| 1525 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1526 | + memoryItem.addActionListener(this); |
---|
1460 | 1527 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1461 | 1528 | computeAOItem.addActionListener(this); |
---|
1462 | 1529 | |
---|
.. | .. |
---|
1465 | 1532 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1466 | 1533 | mirrorItem.addActionListener(this); |
---|
1467 | 1534 | menu.add("-"); |
---|
1468 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1469 | | - memoryItem.addActionListener(this); |
---|
1470 | 1535 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1471 | 1536 | analyzeItem.addActionListener(this); |
---|
1472 | 1537 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
1614 | 1679 | |
---|
1615 | 1680 | makeSomething(shadow); |
---|
1616 | 1681 | } |
---|
| 1682 | + |
---|
| 1683 | + private void ClearUnpinned() |
---|
| 1684 | + { |
---|
| 1685 | + //for (Object3D obj : listUI) |
---|
| 1686 | + for (int i=listUI.size(); --i>=0;) |
---|
| 1687 | + { |
---|
| 1688 | + Object3D obj = listUI.elementAt(i); |
---|
| 1689 | + if (!obj.pinned) |
---|
| 1690 | + { |
---|
| 1691 | + obj.CloseUI(); |
---|
| 1692 | + listUI.remove(i); |
---|
| 1693 | + } |
---|
| 1694 | + } |
---|
| 1695 | + } |
---|
1617 | 1696 | |
---|
1618 | 1697 | /** |
---|
1619 | 1698 | * applyExample |
---|
.. | .. |
---|
2093 | 2172 | Composite csg = new GroupLeaf(); |
---|
2094 | 2173 | csg.count = 5; |
---|
2095 | 2174 | group(csg); |
---|
2096 | | - Composite child = new cGroup(); |
---|
| 2175 | + Composite child = new cGroup("Branch"); |
---|
2097 | 2176 | csg.addChild(child); |
---|
2098 | 2177 | child.addChild(csg); |
---|
2099 | 2178 | } else |
---|
2100 | 2179 | if (source == doubleItem) |
---|
2101 | 2180 | { |
---|
2102 | | - Composite csg = new GroupLeaf(); |
---|
| 2181 | + Composite csg = new GroupLeaf("Fork"); |
---|
2103 | 2182 | csg.count = 5; |
---|
2104 | 2183 | group(csg); |
---|
2105 | | - Composite child = new cGroup(); |
---|
| 2184 | + Composite child = new cGroup("Branch A"); |
---|
2106 | 2185 | csg.addChild(child); |
---|
2107 | 2186 | child.addChild(csg); |
---|
2108 | | - child = new cGroup(); |
---|
| 2187 | + child = new cGroup("Branch B"); |
---|
2109 | 2188 | csg.addChild(child); |
---|
2110 | 2189 | child.addChild(csg); |
---|
2111 | 2190 | } else |
---|
2112 | 2191 | if (source == tripleItem) |
---|
2113 | 2192 | { |
---|
2114 | | - Composite csg = new GroupLeaf(); |
---|
| 2193 | + Composite csg = new GroupLeaf("Trident"); |
---|
2115 | 2194 | csg.count = 4; |
---|
2116 | 2195 | group(csg); |
---|
2117 | 2196 | Composite child = new cGroup(); |
---|
.. | .. |
---|
2175 | 2254 | } else |
---|
2176 | 2255 | if (source == undoButton) |
---|
2177 | 2256 | { |
---|
| 2257 | + // Go to previous version |
---|
| 2258 | + //if (!Undo()) |
---|
| 2259 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2178 | 2260 | Undo(); |
---|
| 2261 | + } else |
---|
| 2262 | + if (source == restoreButton) |
---|
| 2263 | + { |
---|
| 2264 | + // Restore current version |
---|
| 2265 | + Restore(); |
---|
| 2266 | + } else |
---|
| 2267 | + if (source == replaceButton) |
---|
| 2268 | + { |
---|
| 2269 | + // Overwrite current version |
---|
| 2270 | + Replace(); |
---|
2179 | 2271 | } else |
---|
2180 | 2272 | if (source == redoButton) |
---|
2181 | 2273 | { |
---|
| 2274 | + // Go to next version |
---|
2182 | 2275 | Redo(); |
---|
2183 | 2276 | } else |
---|
2184 | 2277 | if (source == saveButton) |
---|
2185 | 2278 | { |
---|
2186 | | - Save(); |
---|
| 2279 | + // Save a new version |
---|
| 2280 | + if (!Save(true)) |
---|
| 2281 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2187 | 2282 | } else |
---|
2188 | 2283 | if (source == oneStepButton) |
---|
2189 | 2284 | { |
---|
.. | .. |
---|
2192 | 2287 | } else |
---|
2193 | 2288 | if (source == screenfitButton) |
---|
2194 | 2289 | { |
---|
2195 | | - //Reload(lastConverter, lastFilename, true); |
---|
2196 | 2290 | ScreenFit(); |
---|
2197 | 2291 | } else |
---|
2198 | 2292 | if (source == screenfitpointButton) |
---|
2199 | 2293 | { |
---|
2200 | | - //Reload(lastConverter, lastFilename, true); |
---|
2201 | 2294 | ScreenFitPoint(); |
---|
2202 | 2295 | } else |
---|
2203 | 2296 | if (source == snapobjectButton) |
---|
2204 | 2297 | { |
---|
2205 | | - //Reload(lastConverter, lastFilename, true); |
---|
2206 | 2298 | SnapObject(); |
---|
2207 | 2299 | } else |
---|
2208 | 2300 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
2726 | 2818 | } else |
---|
2727 | 2819 | if (source == ungroupItem || source == ungroupButton) |
---|
2728 | 2820 | { |
---|
2729 | | - //ungroup(); |
---|
| 2821 | + boolean hasRoot = false; |
---|
| 2822 | + |
---|
2730 | 2823 | for (int i=0; i<group.selection.size(); i++) |
---|
2731 | 2824 | { |
---|
2732 | | - Ungroup(group.selection.get(i)); |
---|
| 2825 | + if (group.selection.get(i) == group) |
---|
| 2826 | + { |
---|
| 2827 | + hasRoot = true; |
---|
| 2828 | + break; |
---|
| 2829 | + } |
---|
2733 | 2830 | } |
---|
2734 | 2831 | |
---|
2735 | | - ClearSelection(false); |
---|
2736 | | - |
---|
2737 | | - refreshContents(); |
---|
| 2832 | + if (!hasRoot) |
---|
| 2833 | + { |
---|
| 2834 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 2835 | + { |
---|
| 2836 | + Ungroup(group.selection.get(i)); |
---|
| 2837 | + } |
---|
| 2838 | + |
---|
| 2839 | + ClearSelection(false); |
---|
| 2840 | + |
---|
| 2841 | + refreshContents(); |
---|
| 2842 | + } |
---|
2738 | 2843 | } else |
---|
2739 | 2844 | if (source == genUVItem) |
---|
2740 | 2845 | { |
---|
.. | .. |
---|
3326 | 3431 | } else |
---|
3327 | 3432 | if (source == editItem || source == editButton) |
---|
3328 | 3433 | { |
---|
| 3434 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 3435 | + { |
---|
| 3436 | + Object3D child = (Object3D)e.nextElement(); |
---|
| 3437 | + child.pinned = true; |
---|
| 3438 | + } |
---|
| 3439 | + |
---|
3329 | 3440 | EditSelection(false); |
---|
3330 | 3441 | } else |
---|
3331 | 3442 | if (source == uneditButton) |
---|
.. | .. |
---|
3335 | 3446 | Object3D child = (Object3D)e.nextElement(); |
---|
3336 | 3447 | if(child.editWindow != null) |
---|
3337 | 3448 | objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 3449 | + child.pinned = false; |
---|
3338 | 3450 | child.CloseUI(); |
---|
3339 | 3451 | listUI.remove(child); |
---|
3340 | 3452 | |
---|
.. | .. |
---|
3351 | 3463 | //copy.ClearUI(); |
---|
3352 | 3464 | for (Object3D obj : listUI) |
---|
3353 | 3465 | { |
---|
| 3466 | + obj.pinned = false; |
---|
3354 | 3467 | obj.CloseUI(); |
---|
3355 | 3468 | } |
---|
3356 | 3469 | listUI.clear(); |
---|
.. | .. |
---|
3360 | 3473 | { |
---|
3361 | 3474 | assert(copy == group); |
---|
3362 | 3475 | |
---|
3363 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 3476 | + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3364 | 3477 | |
---|
3365 | 3478 | for (Object3D obj : listUI) |
---|
3366 | 3479 | { |
---|
.. | .. |
---|
3409 | 3522 | } |
---|
3410 | 3523 | |
---|
3411 | 3524 | copy = group; |
---|
| 3525 | + |
---|
| 3526 | + SetUndoStates(); |
---|
| 3527 | + |
---|
3412 | 3528 | //Globals.theRenderer.object = group; |
---|
3413 | 3529 | if(!useclient) |
---|
3414 | 3530 | { |
---|
.. | .. |
---|
3435 | 3551 | currentLayout = sevenButton; |
---|
3436 | 3552 | */ |
---|
3437 | 3553 | radio.layout.doClick(); |
---|
| 3554 | + |
---|
| 3555 | + ClearUnpinned(); |
---|
| 3556 | + Grafreed.Assert(group != null); |
---|
| 3557 | + Grafreed.Assert(group.selection != null); |
---|
| 3558 | + SetPinStates(group.selection.size() > 0); |
---|
| 3559 | + if (group.selection.size() == 1) |
---|
| 3560 | + EditSelection(false); |
---|
3438 | 3561 | keepparent = group.parent; |
---|
3439 | 3562 | // PARENT = NULL or not??? |
---|
3440 | 3563 | //group.parent = null; // ROOT |
---|
.. | .. |
---|
4502 | 4625 | // } |
---|
4503 | 4626 | // } |
---|
4504 | 4627 | |
---|
4505 | | - static boolean allparams = true; |
---|
4506 | | - |
---|
4507 | | - static Vector<Object3D> listUI = new Vector<Object3D>(); |
---|
4508 | | - |
---|
4509 | 4628 | void EditSelection(boolean newWindow) |
---|
4510 | 4629 | { |
---|
4511 | 4630 | // aConstraints.gridy = 0; |
---|
.. | .. |
---|
4598 | 4717 | //new Exception().printStackTrace(); |
---|
4599 | 4718 | |
---|
4600 | 4719 | freezemodel = true; |
---|
4601 | | - |
---|
| 4720 | + ClearUnpinned(); |
---|
| 4721 | + |
---|
4602 | 4722 | /**/ |
---|
4603 | 4723 | //switch (event.id) |
---|
4604 | 4724 | { |
---|
.. | .. |
---|
4631 | 4751 | if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) |
---|
4632 | 4752 | // a camera |
---|
4633 | 4753 | { |
---|
4634 | | - if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) |
---|
| 4754 | + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace |
---|
4635 | 4755 | { |
---|
4636 | 4756 | CameraPane.camerachangeframe = 0; // don't refuse it |
---|
4637 | 4757 | Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); |
---|
.. | .. |
---|
4640 | 4760 | // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; |
---|
4641 | 4761 | } |
---|
4642 | 4762 | |
---|
| 4763 | + if (tps != null && tps.length == 1) |
---|
| 4764 | + { |
---|
| 4765 | + EditSelection(false); |
---|
| 4766 | + } |
---|
| 4767 | + |
---|
| 4768 | + SetPinStates(tps != null && tps.length > 0); |
---|
| 4769 | + |
---|
4643 | 4770 | refreshContents(); |
---|
4644 | 4771 | //return true; |
---|
4645 | 4772 | } |
---|
.. | .. |
---|
4649 | 4776 | freezemodel = false; |
---|
4650 | 4777 | } |
---|
4651 | 4778 | |
---|
| 4779 | + void SetPinStates(boolean enabled) |
---|
| 4780 | + { |
---|
| 4781 | + editButton.setEnabled(enabled); |
---|
| 4782 | + uneditButton.setEnabled(enabled); |
---|
| 4783 | + unselectButton.setEnabled(enabled); |
---|
| 4784 | + flashSelectionButton.setEnabled(enabled); |
---|
| 4785 | + } |
---|
| 4786 | + |
---|
4652 | 4787 | void refreshContents(boolean cp) |
---|
4653 | 4788 | { |
---|
4654 | 4789 | if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
4655 | | - if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING) |
---|
| 4790 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4656 | 4791 | { |
---|
4657 | 4792 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4658 | 4793 | |
---|
.. | .. |
---|
4751 | 4886 | |
---|
4752 | 4887 | if (cut) |
---|
4753 | 4888 | { |
---|
4754 | | - if (Globals.SAVEONMAKE) |
---|
4755 | | - Save(); |
---|
| 4889 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4890 | +// Save(); |
---|
4756 | 4891 | //int indices[] = jList.getSelectedIndices(); |
---|
4757 | 4892 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4758 | 4893 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4855 | 4990 | |
---|
4856 | 4991 | void paste(boolean expand) |
---|
4857 | 4992 | { |
---|
| 4993 | + if (Globals.REPLACEONMAKE) |
---|
| 4994 | + Save(); |
---|
| 4995 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4996 | + Globals.REPLACEONMAKE = false; |
---|
4858 | 4997 | // if (GrafreeD.clipboard == null) |
---|
4859 | 4998 | // return; |
---|
4860 | 4999 | boolean first = true; |
---|
.. | .. |
---|
4914 | 5053 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4915 | 5054 | } |
---|
4916 | 5055 | |
---|
| 5056 | + Globals.REPLACEONMAKE = keep; |
---|
4917 | 5057 | ResetModel(); |
---|
4918 | 5058 | refreshContents(); |
---|
4919 | 5059 | } |
---|
.. | .. |
---|
5049 | 5189 | |
---|
5050 | 5190 | void group(Object3D csg, boolean grab) |
---|
5051 | 5191 | { |
---|
| 5192 | + if (Globals.REPLACEONMAKE) |
---|
| 5193 | + Save(); |
---|
| 5194 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5195 | + Globals.REPLACEONMAKE = false; |
---|
5052 | 5196 | if (//false) // why?? |
---|
5053 | 5197 | !group.selection.isEmpty()) |
---|
5054 | 5198 | { |
---|
.. | .. |
---|
5162 | 5306 | //node.add(csg); |
---|
5163 | 5307 | //makeSomething(node); |
---|
5164 | 5308 | makeSomething(csg); |
---|
| 5309 | + Globals.REPLACEONMAKE = keep; |
---|
5165 | 5310 | } |
---|
5166 | 5311 | |
---|
5167 | 5312 | void Ungroup(Object3D g) |
---|
5168 | 5313 | { |
---|
| 5314 | + if (Globals.REPLACEONMAKE) |
---|
| 5315 | + Save(); |
---|
| 5316 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5317 | + Globals.REPLACEONMAKE = false; |
---|
5169 | 5318 | if (g instanceof HiddenObject) |
---|
5170 | 5319 | { |
---|
5171 | 5320 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5182 | 5331 | objEditor.makeSomething(g.get(i), false); |
---|
5183 | 5332 | } |
---|
5184 | 5333 | } |
---|
| 5334 | + Globals.REPLACEONMAKE = keep; |
---|
5185 | 5335 | } |
---|
5186 | 5336 | |
---|
5187 | 5337 | void ungroup() |
---|
.. | .. |
---|
5472 | 5622 | |
---|
5473 | 5623 | cButton restoreCameraButton; |
---|
5474 | 5624 | |
---|
5475 | | - cButton minButton; |
---|
5476 | | - cButton maxButton; |
---|
5477 | | - cButton fullButton; |
---|
5478 | | - cButton undoButton; |
---|
5479 | | - cButton redoButton; |
---|
5480 | 5625 | cButton saveButton; |
---|
5481 | 5626 | cButton oneStepButton; |
---|
5482 | 5627 | |
---|