.. | .. |
---|
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 | } |
---|
.. | .. |
---|
80 | 86 | SetupViews(objEditor); |
---|
81 | 87 | |
---|
82 | 88 | ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); |
---|
| 89 | + |
---|
| 90 | + if (copy.versions == null) |
---|
| 91 | + { |
---|
| 92 | + copy.versions = new byte[100][]; |
---|
| 93 | + copy.versionindex = -1; |
---|
| 94 | + |
---|
| 95 | + Save(true); |
---|
| 96 | + } |
---|
83 | 97 | } |
---|
84 | 98 | |
---|
85 | 99 | void CloneSelection(boolean supports) |
---|
86 | 100 | { |
---|
| 101 | + if (Globals.REPLACEONMAKE) |
---|
| 102 | + Save(); |
---|
| 103 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 104 | + Globals.REPLACEONMAKE = false; |
---|
87 | 105 | // Object3D keep = GrafreeD.clipboard; |
---|
88 | 106 | //Object3D obj; |
---|
89 | 107 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
94 | 112 | |
---|
95 | 113 | makeSomething(clone, i==group.selection.size()-1); |
---|
96 | 114 | } |
---|
| 115 | + Globals.REPLACEONMAKE = keep; |
---|
97 | 116 | } |
---|
98 | 117 | |
---|
99 | 118 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
189 | 208 | // pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
190 | 209 | // pasteExpandItem.addActionListener(this); |
---|
191 | 210 | menu.add("-"); |
---|
192 | | - clearItem = menu.add(new MenuItem("Clear")); |
---|
193 | | - clearItem.addActionListener(this); |
---|
| 211 | + deleteItem = menu.add(new MenuItem("Delete")); |
---|
| 212 | + deleteItem.addActionListener(this); |
---|
194 | 213 | |
---|
195 | 214 | if (Globals.ADVANCED) |
---|
196 | 215 | { |
---|
.. | .. |
---|
220 | 239 | // toggleSwitchItem.addItemListener(this); |
---|
221 | 240 | // toggleSwitchItem.setState(CameraPane.SWITCH); |
---|
222 | 241 | |
---|
223 | | - cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles")); |
---|
| 242 | + cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles")); |
---|
224 | 243 | toggleHandleItem.addItemListener(this); |
---|
225 | 244 | toggleHandleItem.setState(CameraPane.HANDLES); |
---|
226 | 245 | |
---|
.. | .. |
---|
380 | 399 | shadowYItem.addActionListener(this); |
---|
381 | 400 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
382 | 401 | shadowZItem.addActionListener(this); |
---|
| 402 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 403 | + attributeItem.addActionListener(this); |
---|
| 404 | + |
---|
383 | 405 | if (Globals.ADVANCED) |
---|
384 | 406 | { |
---|
385 | 407 | menu.add("-"); |
---|
386 | 408 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
387 | 409 | linkerItem.addActionListener(this); |
---|
388 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
389 | | - attributeItem.addActionListener(this); |
---|
390 | 410 | templateItem = menu.add(new MenuItem("Template")); |
---|
391 | 411 | templateItem.addActionListener(this); |
---|
392 | 412 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
415 | 435 | genNormalsMESHItem.addActionListener(this); |
---|
416 | 436 | if (Globals.ADVANCED) |
---|
417 | 437 | { |
---|
418 | | - genNormalsMINEItem = menu.add(new MenuItem("My Normals")); |
---|
| 438 | + genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals")); |
---|
419 | 439 | genNormalsMINEItem.addActionListener(this); |
---|
420 | 440 | } |
---|
421 | 441 | stripifyItem = menu.add(new MenuItem("Stripify")); |
---|
.. | .. |
---|
508 | 528 | attachBumpItem.addActionListener(this); |
---|
509 | 529 | pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump")); |
---|
510 | 530 | pigmentBumpItem.addActionListener(this); |
---|
| 531 | + //embedTexturesItem |
---|
511 | 532 | detachPigmentItem = menu.add(new MenuItem("Detach Pigment")); |
---|
512 | 533 | detachPigmentItem.addActionListener(this); |
---|
513 | 534 | detachBumpItem = menu.add(new MenuItem("Detach Bump")); |
---|
514 | 535 | detachBumpItem.addActionListener(this); |
---|
| 536 | + embedTexturesItem = menu.add(new MenuItem("Embed Textures")); |
---|
| 537 | + embedTexturesItem.addActionListener(this); |
---|
| 538 | + deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures")); |
---|
| 539 | + deEmbedTexturesItem.addActionListener(this); |
---|
515 | 540 | menu.add("-"); |
---|
516 | 541 | sortbysizeItem = menu.add(new MenuItem("Sort by size")); |
---|
517 | 542 | sortbysizeItem.addActionListener(this); |
---|
.. | .. |
---|
538 | 563 | buildToolsMenu(menu); |
---|
539 | 564 | } |
---|
540 | 565 | |
---|
| 566 | + |
---|
541 | 567 | void SetupUI2(ObjEditor oe) |
---|
542 | 568 | { |
---|
543 | 569 | // June 2019 |
---|
.. | .. |
---|
582 | 608 | */ |
---|
583 | 609 | cGridBag copyOptionsPanel = new cGridBag(); |
---|
584 | 610 | |
---|
585 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 611 | + copyOptionsPanel.preferredHeight = 1; |
---|
586 | 612 | |
---|
587 | 613 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
588 | 614 | |
---|
.. | .. |
---|
590 | 616 | //minButton.setToolTipText("Minimize window"); |
---|
591 | 617 | //minButton.addActionListener(this); |
---|
592 | 618 | |
---|
593 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
594 | | - maxButton.setToolTipText("Maximize window"); |
---|
595 | | - maxButton.addActionListener(this); |
---|
| 619 | + if (Globals.ADVANCED) |
---|
| 620 | + { |
---|
| 621 | + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 622 | + maxButton.setToolTipText("Maximize window"); |
---|
| 623 | + maxButton.addActionListener(this); |
---|
| 624 | + } |
---|
596 | 625 | |
---|
597 | 626 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
598 | 627 | fullButton.setToolTipText("Full-screen window"); |
---|
599 | 628 | fullButton.addActionListener(this); |
---|
600 | 629 | |
---|
| 630 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 631 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 632 | + screenfitButton.addActionListener(this); |
---|
| 633 | + |
---|
601 | 634 | oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
602 | 635 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
603 | 636 | restoreCameraButton.addActionListener(this); |
---|
604 | 637 | |
---|
| 638 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 639 | + saveButton.setToolTipText("New version"); |
---|
| 640 | + saveButton.addActionListener(this); |
---|
| 641 | + |
---|
605 | 642 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
606 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 643 | + undoButton.setToolTipText("Previous version"); |
---|
607 | 644 | undoButton.addActionListener(this); |
---|
608 | 645 | undoButton.setEnabled(false); |
---|
609 | 646 | |
---|
| 647 | + cGridBag updown = new cGridBag().setVertical(true); |
---|
| 648 | + updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 649 | + restoreButton.setToolTipText("Restore current"); |
---|
| 650 | + restoreButton.addActionListener(this); |
---|
| 651 | + restoreButton.setEnabled(false); |
---|
| 652 | + |
---|
| 653 | + updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 654 | + replaceButton.setToolTipText("Replace current"); |
---|
| 655 | + replaceButton.addActionListener(this); |
---|
| 656 | + replaceButton.setEnabled(false); |
---|
| 657 | + |
---|
| 658 | + copyOptionsPanel.add(updown); |
---|
| 659 | + |
---|
610 | 660 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
611 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 661 | + redoButton.setToolTipText("Next version"); |
---|
612 | 662 | redoButton.addActionListener(this); |
---|
613 | 663 | redoButton.setEnabled(false); |
---|
614 | 664 | |
---|
615 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
616 | | - saveButton.setToolTipText("Save changes"); |
---|
617 | | - saveButton.addActionListener(this); |
---|
618 | | - |
---|
619 | | - copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 665 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
620 | 666 | liveCB.setToolTipText("Enable animation"); |
---|
621 | 667 | liveCB.addItemListener(this); |
---|
622 | 668 | |
---|
623 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 669 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
624 | 670 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
625 | 671 | oneStepButton.addActionListener(this); |
---|
626 | 672 | |
---|
627 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 673 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
628 | 674 | fastCB.setToolTipText("Fast mode"); |
---|
629 | 675 | fastCB.addItemListener(this); |
---|
630 | 676 | |
---|
631 | 677 | //oe.toolboxPanel.Return(); |
---|
632 | 678 | |
---|
633 | | - copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
634 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
635 | | - screenfitButton.addActionListener(this); |
---|
636 | | - |
---|
637 | 679 | // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
638 | 680 | // trackCB.setToolTipText("Enable tracking"); |
---|
639 | 681 | // trackCB.addItemListener(this); |
---|
.. | .. |
---|
650 | 692 | |
---|
651 | 693 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
652 | 694 | |
---|
653 | | - oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
654 | | - twoButton.setToolTipText("Show center view only"); |
---|
655 | | - twoButton.addActionListener(this); |
---|
656 | | - this.fullscreenLayout = twoButton; |
---|
657 | | - |
---|
658 | 695 | oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
659 | 696 | fourButton.addActionListener(this); |
---|
660 | 697 | fourButton.setToolTipText("Show left panel only"); |
---|
| 698 | + |
---|
| 699 | + oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 700 | + twoButton.setToolTipText("Show right view only"); |
---|
| 701 | + twoButton.addActionListener(this); |
---|
| 702 | + this.fullscreenLayout = twoButton; |
---|
| 703 | + |
---|
661 | 704 | oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
662 | | - sixButton.setToolTipText("2-column layout left"); |
---|
| 705 | + sixButton.setToolTipText("Show left and right"); |
---|
663 | 706 | sixButton.addActionListener(this); |
---|
664 | | - oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
665 | | - threeButton.setToolTipText("2-column layout right"); |
---|
666 | | - threeButton.addActionListener(this); |
---|
667 | | - oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
668 | | - sevenButton.setToolTipText("3-column layout"); |
---|
669 | | - sevenButton.addActionListener(this); |
---|
| 707 | +// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 708 | +// threeButton.setToolTipText("2-column layout right"); |
---|
| 709 | +// threeButton.addActionListener(this); |
---|
| 710 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 711 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 712 | +// sevenButton.addActionListener(this); |
---|
670 | 713 | // |
---|
671 | 714 | |
---|
672 | | - oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
673 | | - rootButton.setToolTipText("Edit selection in new tab"); |
---|
| 715 | + oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 716 | + rootButton.setToolTipText("Open selection in new tab"); |
---|
674 | 717 | rootButton.addActionListener(this); |
---|
675 | 718 | |
---|
676 | 719 | oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
726 | 769 | compositeButton.addActionListener(this); |
---|
727 | 770 | |
---|
728 | 771 | oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
729 | | - switchButton.setToolTipText("Create switch"); |
---|
| 772 | + switchButton.setToolTipText("Create item switcher"); |
---|
730 | 773 | switchButton.addActionListener(this); |
---|
731 | 774 | |
---|
732 | 775 | oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
811 | 854 | |
---|
812 | 855 | oe.treePanel.add(copyOptionsPanel); |
---|
813 | 856 | oe.treePanel.Return(); |
---|
| 857 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 858 | + versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 859 | + sliderPane.preferredHeight = 1; |
---|
814 | 860 | |
---|
815 | 861 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
816 | 862 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
833 | 879 | dgr.addDragGestureListener(this); |
---|
834 | 880 | }catch(Exception e) {} |
---|
835 | 881 | */ |
---|
836 | | - radio.layout = sevenButton; |
---|
| 882 | + radio.layout = sixButton; // sevenButton; |
---|
837 | 883 | oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
838 | 884 | } |
---|
839 | 885 | |
---|
.. | .. |
---|
863 | 909 | |
---|
864 | 910 | if (true) // Globals.ADVANCED) |
---|
865 | 911 | { |
---|
866 | | - panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
867 | | - supportCB.setToolTipText("Enable rigging"); |
---|
868 | | - supportCB.addItemListener(this); |
---|
| 912 | +// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints); |
---|
| 913 | +// supportCB.setToolTipText("Enable rigging"); |
---|
| 914 | +// supportCB.addItemListener(this); |
---|
| 915 | + |
---|
| 916 | + panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints); |
---|
| 917 | + freezeCB.setToolTipText("Fast moving camera"); |
---|
| 918 | + freezeCB.addItemListener(this); |
---|
869 | 919 | |
---|
870 | 920 | // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints); |
---|
871 | 921 | // localCB.addItemListener(this); |
---|
.. | .. |
---|
929 | 979 | toggleTextureCB.addItemListener(this); |
---|
930 | 980 | |
---|
931 | 981 | panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints); |
---|
932 | | - toggleSwitchCB.setToolTipText("Use switch"); |
---|
| 982 | + toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
933 | 983 | toggleSwitchCB.addItemListener(this); |
---|
934 | 984 | |
---|
935 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
936 | | - autosaveCB.setToolTipText("On structure change"); |
---|
937 | | - autosaveCB.addItemListener(this); |
---|
| 985 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 986 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 987 | + autokeepCB.addItemListener(this); |
---|
938 | 988 | |
---|
939 | 989 | panel.Return(); |
---|
940 | 990 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
963 | 1013 | { |
---|
964 | 1014 | cRadio radioButton = new cRadio(obj.name); |
---|
965 | 1015 | |
---|
966 | | - // Patch to avoid bug with transparency. |
---|
| 1016 | + // June 2019. Patch to avoid bug with transparency. |
---|
967 | 1017 | radioButton.hadMaterial = obj.material != null; |
---|
968 | 1018 | if (!radioButton.hadMaterial) |
---|
969 | 1019 | { |
---|
.. | .. |
---|
971 | 1021 | } |
---|
972 | 1022 | |
---|
973 | 1023 | radioButton.SetObject(obj); |
---|
974 | | - radioButton.layout = sevenButton; |
---|
| 1024 | + radioButton.layout = sixButton; // sevenButton; |
---|
975 | 1025 | radioButton.SetCamera(cameraView.renderCamera, false); |
---|
976 | 1026 | radioButton.addActionListener(this); |
---|
977 | 1027 | radioPanel.add(radioButton); |
---|
.. | .. |
---|
1000 | 1050 | cCheckBox slowCB; |
---|
1001 | 1051 | cCheckBox boxCB; |
---|
1002 | 1052 | cCheckBox zoomBoxCB; |
---|
| 1053 | + cCheckBox freezeCB; |
---|
1003 | 1054 | //cToggleButton trackCB; |
---|
1004 | 1055 | cCheckBox trackCB; |
---|
1005 | 1056 | cCheckBox smoothfocusCB; |
---|
.. | .. |
---|
1010 | 1061 | |
---|
1011 | 1062 | cCheckBox oeilCB; |
---|
1012 | 1063 | cCheckBox shadowCB; |
---|
1013 | | - cCheckBox autosaveCB; |
---|
| 1064 | + cCheckBox autokeepCB; |
---|
1014 | 1065 | cCheckBox lookAtCB; |
---|
1015 | 1066 | |
---|
1016 | 1067 | // static int COLOR = 1; |
---|
.. | .. |
---|
1118 | 1169 | { |
---|
1119 | 1170 | Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
1120 | 1171 | } |
---|
1121 | | - else if(e.getSource() == autosaveCB) |
---|
| 1172 | + else if(e.getSource() == freezeCB) |
---|
1122 | 1173 | { |
---|
1123 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1174 | + Globals.FREEZEONMOVE ^= true; |
---|
| 1175 | + } |
---|
| 1176 | + else if(e.getSource() == autokeepCB) |
---|
| 1177 | + { |
---|
| 1178 | + Globals.REPLACEONMAKE ^= true; |
---|
1124 | 1179 | } |
---|
1125 | 1180 | else if(e.getSource() == lookAtCB) |
---|
1126 | 1181 | { |
---|
.. | .. |
---|
1202 | 1257 | } |
---|
1203 | 1258 | } |
---|
1204 | 1259 | |
---|
1205 | | - String string = (String) object; |
---|
1206 | | - |
---|
1207 | 1260 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1208 | 1261 | // if( object instanceof java.io.File[]) |
---|
1209 | 1262 | // { |
---|
.. | .. |
---|
1211 | 1264 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1212 | 1265 | // return; |
---|
1213 | 1266 | // } |
---|
| 1267 | + |
---|
| 1268 | + String string = object.toString(); |
---|
1214 | 1269 | |
---|
1215 | 1270 | // File path for Mac and Windows |
---|
1216 | 1271 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1460 | 1515 | animationItem.addItemListener(this); |
---|
1461 | 1516 | animationItem.setState(Globals.ANIMATION); |
---|
1462 | 1517 | |
---|
| 1518 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1519 | + archiveItem.addActionListener(this); |
---|
| 1520 | + |
---|
1463 | 1521 | menu.add("-"); |
---|
1464 | 1522 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1465 | 1523 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1472 | 1530 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1473 | 1531 | reduce34MorphItem.addActionListener(this); |
---|
1474 | 1532 | menu.add("-"); |
---|
| 1533 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1534 | + memoryItem.addActionListener(this); |
---|
1475 | 1535 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1476 | 1536 | computeAOItem.addActionListener(this); |
---|
1477 | 1537 | |
---|
.. | .. |
---|
1480 | 1540 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1481 | 1541 | mirrorItem.addActionListener(this); |
---|
1482 | 1542 | menu.add("-"); |
---|
1483 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1484 | | - memoryItem.addActionListener(this); |
---|
1485 | 1543 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1486 | 1544 | analyzeItem.addActionListener(this); |
---|
1487 | 1545 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
1642 | 1700 | listUI.remove(i); |
---|
1643 | 1701 | } |
---|
1644 | 1702 | } |
---|
| 1703 | + } |
---|
| 1704 | + |
---|
| 1705 | + private void EditElement(Object3D elem, boolean newWindow) |
---|
| 1706 | + { |
---|
| 1707 | + // if (!(elem instanceof Composite)) |
---|
| 1708 | + // newWindow = false; |
---|
| 1709 | + listUI.add(elem); |
---|
| 1710 | + elem.openEditWindow(this, newWindow); //, false); |
---|
| 1711 | + System.out.println("edit : " + elem); |
---|
| 1712 | + elem.editWindow.refreshContents(true); // ? new |
---|
1645 | 1713 | } |
---|
1646 | 1714 | |
---|
1647 | 1715 | /** |
---|
.. | .. |
---|
2122 | 2190 | Composite csg = new GroupLeaf(); |
---|
2123 | 2191 | csg.count = 5; |
---|
2124 | 2192 | group(csg); |
---|
2125 | | - Composite child = new cGroup(); |
---|
| 2193 | + Composite child = new cGroup("Branch"); |
---|
2126 | 2194 | csg.addChild(child); |
---|
2127 | 2195 | child.addChild(csg); |
---|
2128 | 2196 | } else |
---|
2129 | 2197 | if (source == doubleItem) |
---|
2130 | 2198 | { |
---|
2131 | | - Composite csg = new GroupLeaf(); |
---|
| 2199 | + Composite csg = new GroupLeaf("Fork"); |
---|
2132 | 2200 | csg.count = 5; |
---|
2133 | 2201 | group(csg); |
---|
2134 | | - Composite child = new cGroup(); |
---|
| 2202 | + Composite child = new cGroup("Branch A"); |
---|
2135 | 2203 | csg.addChild(child); |
---|
2136 | 2204 | child.addChild(csg); |
---|
2137 | | - child = new cGroup(); |
---|
| 2205 | + child = new cGroup("Branch B"); |
---|
2138 | 2206 | csg.addChild(child); |
---|
2139 | 2207 | child.addChild(csg); |
---|
2140 | 2208 | } else |
---|
2141 | 2209 | if (source == tripleItem) |
---|
2142 | 2210 | { |
---|
2143 | | - Composite csg = new GroupLeaf(); |
---|
| 2211 | + Composite csg = new GroupLeaf("Trident"); |
---|
2144 | 2212 | csg.count = 4; |
---|
2145 | 2213 | group(csg); |
---|
2146 | 2214 | Composite child = new cGroup(); |
---|
.. | .. |
---|
2204 | 2272 | } else |
---|
2205 | 2273 | if (source == undoButton) |
---|
2206 | 2274 | { |
---|
| 2275 | + // Go to previous version |
---|
| 2276 | + //if (!Undo()) |
---|
| 2277 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2207 | 2278 | Undo(); |
---|
| 2279 | + } else |
---|
| 2280 | + if (source == restoreButton) |
---|
| 2281 | + { |
---|
| 2282 | + // Restore current version |
---|
| 2283 | + Restore(); |
---|
| 2284 | + } else |
---|
| 2285 | + if (source == replaceButton) |
---|
| 2286 | + { |
---|
| 2287 | + // Overwrite current version |
---|
| 2288 | + Replace(); |
---|
2208 | 2289 | } else |
---|
2209 | 2290 | if (source == redoButton) |
---|
2210 | 2291 | { |
---|
| 2292 | + // Go to next version |
---|
2211 | 2293 | Redo(); |
---|
2212 | 2294 | } else |
---|
2213 | 2295 | if (source == saveButton) |
---|
2214 | 2296 | { |
---|
2215 | | - Save(); |
---|
| 2297 | + // Save a new version |
---|
| 2298 | + if (!Save(true)) |
---|
| 2299 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2216 | 2300 | } else |
---|
2217 | 2301 | if (source == oneStepButton) |
---|
2218 | 2302 | { |
---|
.. | .. |
---|
2221 | 2305 | } else |
---|
2222 | 2306 | if (source == screenfitButton) |
---|
2223 | 2307 | { |
---|
2224 | | - //Reload(lastConverter, lastFilename, true); |
---|
2225 | 2308 | ScreenFit(); |
---|
2226 | 2309 | } else |
---|
2227 | 2310 | if (source == screenfitpointButton) |
---|
2228 | 2311 | { |
---|
2229 | | - //Reload(lastConverter, lastFilename, true); |
---|
2230 | 2312 | ScreenFitPoint(); |
---|
2231 | 2313 | } else |
---|
2232 | 2314 | if (source == snapobjectButton) |
---|
2233 | 2315 | { |
---|
2234 | | - //Reload(lastConverter, lastFilename, true); |
---|
2235 | 2316 | SnapObject(); |
---|
2236 | 2317 | } else |
---|
2237 | 2318 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
2595 | 2676 | { |
---|
2596 | 2677 | StepAll(); |
---|
2597 | 2678 | } else |
---|
2598 | | - if (source == clearItem) // || event.getSource() == clearButton) |
---|
| 2679 | + if (source == deleteItem) // || event.getSource() == clearButton) |
---|
2599 | 2680 | { |
---|
2600 | 2681 | //int indices[] = jList.getSelectedIndices(); |
---|
2601 | 2682 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
.. | .. |
---|
2755 | 2836 | } else |
---|
2756 | 2837 | if (source == ungroupItem || source == ungroupButton) |
---|
2757 | 2838 | { |
---|
2758 | | - //ungroup(); |
---|
| 2839 | + boolean hasRoot = false; |
---|
| 2840 | + |
---|
2759 | 2841 | for (int i=0; i<group.selection.size(); i++) |
---|
2760 | 2842 | { |
---|
2761 | | - Ungroup(group.selection.get(i)); |
---|
| 2843 | + if (group.selection.get(i) == group) |
---|
| 2844 | + { |
---|
| 2845 | + hasRoot = true; |
---|
| 2846 | + break; |
---|
| 2847 | + } |
---|
2762 | 2848 | } |
---|
2763 | 2849 | |
---|
2764 | | - ClearSelection(false); |
---|
2765 | | - |
---|
2766 | | - refreshContents(); |
---|
| 2850 | + if (!hasRoot) |
---|
| 2851 | + { |
---|
| 2852 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 2853 | + { |
---|
| 2854 | + Ungroup(group.selection.get(i)); |
---|
| 2855 | + } |
---|
| 2856 | + |
---|
| 2857 | + ClearSelection(false); |
---|
| 2858 | + |
---|
| 2859 | + refreshContents(); |
---|
| 2860 | + } |
---|
2767 | 2861 | } else |
---|
2768 | 2862 | if (source == genUVItem) |
---|
2769 | 2863 | { |
---|
.. | .. |
---|
3064 | 3158 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3065 | 3159 | { |
---|
3066 | 3160 | obj = (Object3D)e.nextElement(); |
---|
3067 | | - obj.SetBumpTexture(null); |
---|
| 3161 | + obj.ResetBumpTexture(); |
---|
3068 | 3162 | } |
---|
3069 | 3163 | |
---|
3070 | 3164 | refreshContents(); |
---|
.. | .. |
---|
3078 | 3172 | obj.SetBumpTexture(obj.GetPigmentTexture()); |
---|
3079 | 3173 | } |
---|
3080 | 3174 | |
---|
| 3175 | + refreshContents(); |
---|
| 3176 | + } else |
---|
| 3177 | + if (source == embedTexturesItem) |
---|
| 3178 | + { |
---|
| 3179 | + Object3D obj; |
---|
| 3180 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 3181 | + { |
---|
| 3182 | + obj = (Object3D)e.nextElement(); |
---|
| 3183 | + obj.EmbedTextures(true); |
---|
| 3184 | + } |
---|
| 3185 | + |
---|
| 3186 | + refreshContents(); |
---|
| 3187 | + } else |
---|
| 3188 | + if (source == deEmbedTexturesItem) |
---|
| 3189 | + { |
---|
| 3190 | + Object3D obj; |
---|
| 3191 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 3192 | + { |
---|
| 3193 | + obj = (Object3D)e.nextElement(); |
---|
| 3194 | + obj.EmbedTextures(false); |
---|
| 3195 | + } |
---|
| 3196 | + |
---|
| 3197 | + CameraPane.texturepigment.clear(); |
---|
| 3198 | + CameraPane.texturebump.clear(); |
---|
| 3199 | + |
---|
3081 | 3200 | refreshContents(); |
---|
3082 | 3201 | } else |
---|
3083 | 3202 | if (source == flashSelectionButton) |
---|
.. | .. |
---|
3446 | 3565 | } |
---|
3447 | 3566 | |
---|
3448 | 3567 | copy = group; |
---|
| 3568 | + |
---|
| 3569 | + SetUndoStates(); |
---|
| 3570 | + |
---|
3449 | 3571 | //Globals.theRenderer.object = group; |
---|
3450 | 3572 | if(!useclient) |
---|
3451 | 3573 | { |
---|
.. | .. |
---|
3474 | 3596 | radio.layout.doClick(); |
---|
3475 | 3597 | |
---|
3476 | 3598 | ClearUnpinned(); |
---|
3477 | | - SetPinStates(group.selection.size() > 0); |
---|
3478 | | - if (group.selection.size() == 1) |
---|
| 3599 | + //Grafreed.Assert(group != null); |
---|
| 3600 | + //Grafreed.Assert(group.selection != null); |
---|
| 3601 | + SetPinStates(group.selection == null || group.selection.size() > 0); |
---|
| 3602 | + if (group.selection == null || group.selection.size() == 1) |
---|
3479 | 3603 | EditSelection(false); |
---|
3480 | 3604 | keepparent = group.parent; |
---|
3481 | 3605 | // PARENT = NULL or not??? |
---|
.. | .. |
---|
4069 | 4193 | |
---|
4070 | 4194 | try |
---|
4071 | 4195 | { |
---|
4072 | | - texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres); |
---|
| 4196 | + texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres); |
---|
4073 | 4197 | } |
---|
4074 | 4198 | catch (Exception e) |
---|
4075 | 4199 | { |
---|
.. | .. |
---|
4546 | 4670 | |
---|
4547 | 4671 | void EditSelection(boolean newWindow) |
---|
4548 | 4672 | { |
---|
| 4673 | + if (group.selection == null) |
---|
| 4674 | + { |
---|
| 4675 | + EditElement(group, newWindow); // ? new |
---|
| 4676 | + return; |
---|
| 4677 | + } |
---|
| 4678 | + |
---|
4549 | 4679 | // aConstraints.gridy = 0; |
---|
4550 | 4680 | for (int i=0; i<group.selection.size(); i++) |
---|
4551 | 4681 | { |
---|
.. | .. |
---|
4556 | 4686 | Object3D elem = (Object3D)group.selection.elementAt(i); |
---|
4557 | 4687 | if(elem != group || !newWindow) |
---|
4558 | 4688 | { |
---|
4559 | | - // if (!(elem instanceof Composite)) |
---|
4560 | | - // newWindow = false; |
---|
4561 | | - listUI.add(elem); |
---|
4562 | | - elem.openEditWindow(this, newWindow); //, false); |
---|
4563 | | - System.out.println("edit : " + elem); |
---|
4564 | | - elem.editWindow.refreshContents(true); // ? new |
---|
| 4689 | + EditElement(elem, newWindow); // ? new |
---|
4565 | 4690 | } |
---|
4566 | 4691 | } |
---|
4567 | 4692 | } |
---|
.. | .. |
---|
4705 | 4830 | |
---|
4706 | 4831 | void refreshContents(boolean cp) |
---|
4707 | 4832 | { |
---|
4708 | | - if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
4709 | | - if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING) |
---|
| 4833 | + if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
| 4834 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4710 | 4835 | { |
---|
4711 | 4836 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4712 | 4837 | |
---|
.. | .. |
---|
4805 | 4930 | |
---|
4806 | 4931 | if (cut) |
---|
4807 | 4932 | { |
---|
4808 | | - if (Globals.SAVEONMAKE) |
---|
4809 | | - Save(); |
---|
| 4933 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4934 | +// Save(); |
---|
4810 | 4935 | //int indices[] = jList.getSelectedIndices(); |
---|
4811 | 4936 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4812 | 4937 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4909 | 5034 | |
---|
4910 | 5035 | void paste(boolean expand) |
---|
4911 | 5036 | { |
---|
| 5037 | + if (Globals.REPLACEONMAKE) |
---|
| 5038 | + Save(); |
---|
| 5039 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5040 | + Globals.REPLACEONMAKE = false; |
---|
4912 | 5041 | // if (GrafreeD.clipboard == null) |
---|
4913 | 5042 | // return; |
---|
4914 | 5043 | boolean first = true; |
---|
.. | .. |
---|
4968 | 5097 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4969 | 5098 | } |
---|
4970 | 5099 | |
---|
| 5100 | + Globals.REPLACEONMAKE = keep; |
---|
4971 | 5101 | ResetModel(); |
---|
4972 | 5102 | refreshContents(); |
---|
4973 | 5103 | } |
---|
.. | .. |
---|
5103 | 5233 | |
---|
5104 | 5234 | void group(Object3D csg, boolean grab) |
---|
5105 | 5235 | { |
---|
| 5236 | + if (Globals.REPLACEONMAKE) |
---|
| 5237 | + Save(); |
---|
| 5238 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5239 | + Globals.REPLACEONMAKE = false; |
---|
5106 | 5240 | if (//false) // why?? |
---|
5107 | 5241 | !group.selection.isEmpty()) |
---|
5108 | 5242 | { |
---|
.. | .. |
---|
5216 | 5350 | //node.add(csg); |
---|
5217 | 5351 | //makeSomething(node); |
---|
5218 | 5352 | makeSomething(csg); |
---|
| 5353 | + Globals.REPLACEONMAKE = keep; |
---|
5219 | 5354 | } |
---|
5220 | 5355 | |
---|
5221 | 5356 | void Ungroup(Object3D g) |
---|
5222 | 5357 | { |
---|
| 5358 | + if (Globals.REPLACEONMAKE) |
---|
| 5359 | + Save(); |
---|
| 5360 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5361 | + Globals.REPLACEONMAKE = false; |
---|
5223 | 5362 | if (g instanceof HiddenObject) |
---|
5224 | 5363 | { |
---|
5225 | 5364 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5236 | 5375 | objEditor.makeSomething(g.get(i), false); |
---|
5237 | 5376 | } |
---|
5238 | 5377 | } |
---|
| 5378 | + Globals.REPLACEONMAKE = keep; |
---|
5239 | 5379 | } |
---|
5240 | 5380 | |
---|
5241 | 5381 | void ungroup() |
---|
.. | .. |
---|
5526 | 5666 | |
---|
5527 | 5667 | cButton restoreCameraButton; |
---|
5528 | 5668 | |
---|
5529 | | - cButton minButton; |
---|
5530 | | - cButton maxButton; |
---|
5531 | | - cButton fullButton; |
---|
5532 | 5669 | cButton saveButton; |
---|
5533 | 5670 | cButton oneStepButton; |
---|
5534 | 5671 | |
---|
.. | .. |
---|
5602 | 5739 | private MenuItem pasteLinkItem; |
---|
5603 | 5740 | private MenuItem pasteCloneItem; |
---|
5604 | 5741 | private MenuItem pasteExpandItem; |
---|
5605 | | - private MenuItem clearItem; |
---|
| 5742 | + private MenuItem deleteItem; |
---|
5606 | 5743 | private MenuItem clearAllItem; |
---|
5607 | 5744 | private MenuItem genUVItem; |
---|
5608 | 5745 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
5686 | 5823 | private MenuItem attachBumpItem; |
---|
5687 | 5824 | private MenuItem detachBumpItem; |
---|
5688 | 5825 | private MenuItem pigmentBumpItem; |
---|
| 5826 | + private MenuItem embedTexturesItem; |
---|
| 5827 | + private MenuItem deEmbedTexturesItem; |
---|
5689 | 5828 | |
---|
5690 | 5829 | private MenuItem particleItem; |
---|
5691 | 5830 | private MenuItem ragdollItem; |
---|