.. | .. |
---|
29 | 29 | { |
---|
30 | 30 | cButton skyboxButton; |
---|
31 | 31 | final String path = "cubemaps/" + f + "-skyboxes/" + s; |
---|
32 | | - row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); |
---|
| 32 | + row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF)); |
---|
33 | 33 | //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); |
---|
34 | 34 | skyboxButton.setToolTipText(s.equals("") ? "No background" : s); |
---|
35 | 35 | skyboxButton.addActionListener(new ActionListener() |
---|
.. | .. |
---|
46 | 46 | { |
---|
47 | 47 | cButton textureButton; |
---|
48 | 48 | final String path = "textures/" + f + "/" + c + "/"; // + t; |
---|
49 | | - row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); |
---|
| 49 | + row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF)); |
---|
50 | 50 | textureButton.setToolTipText(c + count); |
---|
51 | 51 | textureButton.addActionListener(new ActionListener() |
---|
52 | 52 | { |
---|
.. | .. |
---|
347 | 347 | |
---|
348 | 348 | public void CreateSkyboxPanel(cGridBag skyboxPanel) |
---|
349 | 349 | { |
---|
350 | | - JTabbedPane skyboxpane = new JTabbedPane(); |
---|
| 350 | + JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT); |
---|
351 | 351 | |
---|
352 | 352 | AddSkyboxTab0(skyboxpane); |
---|
353 | 353 | AddSkyboxTab1(skyboxpane); |
---|
.. | .. |
---|
415 | 415 | this.copy = this.group = group; |
---|
416 | 416 | //selectees = this.group.selectees; |
---|
417 | 417 | |
---|
418 | | - if (copy.versionlist == null) |
---|
419 | | - { |
---|
420 | | - copy.versionlist = new Object3D[100]; |
---|
421 | | - copy.versionindex = -1; |
---|
422 | | - |
---|
423 | | - Save(true); |
---|
424 | | - } |
---|
| 418 | + assert(false); |
---|
| 419 | + |
---|
| 420 | +// if (copy.versionlist == null) |
---|
| 421 | +// { |
---|
| 422 | +// copy.versionlist = new Object3D[100]; |
---|
| 423 | +// copy.versionindex = -1; |
---|
| 424 | +// |
---|
| 425 | +// //Save(true); |
---|
| 426 | +// } |
---|
425 | 427 | |
---|
426 | 428 | if(ui) |
---|
427 | 429 | SetupUI(objEditor); |
---|
.. | .. |
---|
444 | 446 | |
---|
445 | 447 | ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); |
---|
446 | 448 | |
---|
447 | | - if (copy.versionlist == null) |
---|
448 | | - { |
---|
449 | | - copy.versionlist = new Object3D[100]; |
---|
450 | | - copy.versionindex = -1; |
---|
451 | | - |
---|
452 | | - Save(true); |
---|
453 | | - } |
---|
| 449 | +// if (copy.versionlist == null) |
---|
| 450 | +// { |
---|
| 451 | +// copy.versionlist = new Object3D[100]; |
---|
| 452 | +// copy.versionindex = -1; |
---|
| 453 | +// |
---|
| 454 | +// //Save(true); |
---|
| 455 | +// } |
---|
454 | 456 | } |
---|
455 | 457 | |
---|
456 | 458 | void CloneSelection(boolean supports) |
---|
.. | .. |
---|
540 | 542 | // menu.add("-"); |
---|
541 | 543 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
542 | 544 | duplicateItem.addActionListener(this); |
---|
543 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 545 | + |
---|
| 546 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
544 | 547 | cloneItem.addActionListener(this); |
---|
545 | | - if (Globals.ADVANCED) |
---|
| 548 | + //if (Globals.ADVANCED) |
---|
546 | 549 | { |
---|
547 | 550 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
548 | 551 | cloneSupportItem.addActionListener(this); |
---|
549 | 552 | } |
---|
| 553 | + oe.jTree.popup.addSeparator(); |
---|
550 | 554 | menu.add("-"); |
---|
551 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 555 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
552 | 556 | cutItem.addActionListener(this); |
---|
553 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 557 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
554 | 558 | copyItem.addActionListener(this); |
---|
555 | 559 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
556 | 560 | pasteItem.addActionListener(this); |
---|
557 | 561 | |
---|
558 | | - menu.add("-"); |
---|
559 | | - pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
| 562 | + oe.jTree.popup.addSeparator(); |
---|
| 563 | + //menu.add("-"); |
---|
| 564 | + pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into")); |
---|
560 | 565 | pasteIntoItem.addActionListener(this); |
---|
561 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 566 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
562 | 567 | pasteLinkItem.addActionListener(this); |
---|
563 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 568 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
564 | 569 | pasteCloneItem.addActionListener(this); |
---|
565 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 570 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
566 | 571 | // pasteExpandItem.addActionListener(this); |
---|
567 | | - menu.add("-"); |
---|
568 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
569 | | - deleteItem.addActionListener(this); |
---|
| 572 | + //menu.add("-"); |
---|
| 573 | + oe.jTree.popup.addSeparator(); |
---|
570 | 574 | |
---|
571 | 575 | if (Globals.ADVANCED) |
---|
572 | 576 | { |
---|
.. | .. |
---|
701 | 705 | setMasterItem.addActionListener(this); |
---|
702 | 706 | } |
---|
703 | 707 | |
---|
704 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
705 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
706 | | -// grabItem.addActionListener(this); |
---|
| 708 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 709 | + |
---|
707 | 710 | backItem = menu.add(new MenuItem("Back")); |
---|
708 | 711 | backItem.addActionListener(this); |
---|
709 | 712 | frontItem = menu.add(new MenuItem("Front")); |
---|
.. | .. |
---|
711 | 714 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
712 | 715 | // compositeItem.addActionListener(this); |
---|
713 | 716 | |
---|
| 717 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 718 | + grabItem.addActionListener(this); |
---|
| 719 | + |
---|
714 | 720 | if (Globals.ADVANCED) |
---|
715 | 721 | { |
---|
716 | 722 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
717 | 723 | hideItem.addActionListener(this); |
---|
718 | 724 | } |
---|
719 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 725 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
720 | 726 | ungroupItem.addActionListener(this); |
---|
| 727 | + |
---|
| 728 | + oe.jTree.popup.addSeparator(); |
---|
| 729 | + |
---|
| 730 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 731 | + deleteItem.addActionListener(this); |
---|
721 | 732 | |
---|
722 | 733 | // menu.add("-"); |
---|
723 | 734 | // |
---|
.. | .. |
---|
754 | 765 | shadowYItem.addActionListener(this); |
---|
755 | 766 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
756 | 767 | shadowZItem.addActionListener(this); |
---|
757 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
758 | | - attributeItem.addActionListener(this); |
---|
759 | 768 | |
---|
760 | 769 | if (Globals.ADVANCED) |
---|
761 | 770 | { |
---|
| 771 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 772 | + attributeItem.addActionListener(this); |
---|
762 | 773 | menu.add("-"); |
---|
763 | 774 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
764 | 775 | linkerItem.addActionListener(this); |
---|
.. | .. |
---|
768 | 779 | pointflowItem.addActionListener(this); |
---|
769 | 780 | } |
---|
770 | 781 | menu.add("-"); |
---|
| 782 | + textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red")); |
---|
| 783 | + textureRatioRItem.addActionListener(this); |
---|
| 784 | + textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green")); |
---|
| 785 | + textureRatioGItem.addActionListener(this); |
---|
| 786 | + textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue")); |
---|
| 787 | + textureRatioBItem.addActionListener(this); |
---|
| 788 | + menu.add("-"); |
---|
771 | 789 | resetTransformItem = menu.add(new MenuItem("Reset Transform")); |
---|
772 | 790 | resetTransformItem.addActionListener(this); |
---|
773 | 791 | resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); |
---|
774 | 792 | resetCentroidItem.addActionListener(this); |
---|
775 | | - resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY")); |
---|
| 793 | + resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ")); |
---|
776 | 794 | resetCentroidXZItem.addActionListener(this); |
---|
777 | 795 | transformGeometryItem = menu.add(new MenuItem("Transform Geometry")); |
---|
778 | 796 | transformGeometryItem.addActionListener(this); |
---|
.. | .. |
---|
824 | 842 | } |
---|
825 | 843 | |
---|
826 | 844 | oe.menuBar.add(menu = new Menu("Attributes")); |
---|
| 845 | + clearVersionsItem = menu.add(new MenuItem("Clear Versions")); |
---|
| 846 | + clearVersionsItem.addActionListener(this); |
---|
827 | 847 | clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); |
---|
828 | 848 | clearMaterialsItem.addActionListener(this); |
---|
829 | 849 | resetAllItem = menu.add(new MenuItem("Reset All")); |
---|
.. | .. |
---|
846 | 866 | hideleavesItem.addActionListener(this); |
---|
847 | 867 | showleavesItem = menu.add(new MenuItem("Show Leaves")); |
---|
848 | 868 | showleavesItem.addActionListener(this); |
---|
849 | | - markleavesItem = menu.add(new MenuItem("Mark Leaves")); |
---|
| 869 | + markleavesItem = menu.add(new MenuItem("Anim Leaves")); |
---|
850 | 870 | markleavesItem.addActionListener(this); |
---|
851 | | - unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); |
---|
| 871 | + unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves")); |
---|
852 | 872 | unmarkleavesItem.addActionListener(this); |
---|
853 | 873 | rewindleavesItem = menu.add(new MenuItem("Rewind Leaves")); |
---|
854 | 874 | rewindleavesItem.addActionListener(this); |
---|
.. | .. |
---|
923 | 943 | |
---|
924 | 944 | JTabbedPane resourcecontainer; |
---|
925 | 945 | cGridBag currenttab; |
---|
926 | | - boolean added; // patch for jar |
---|
| 946 | + //boolean added; // patch for jar |
---|
927 | 947 | |
---|
| 948 | + int totalcount = 0; |
---|
| 949 | + |
---|
928 | 950 | int tabcount = 0; |
---|
929 | 951 | int colcount = 0; |
---|
930 | 952 | int rowcount = 0; |
---|
.. | .. |
---|
940 | 962 | // System.out.println(); |
---|
941 | 963 | |
---|
942 | 964 | if (//rowcount == 0 || |
---|
943 | | - path.length == 1) |
---|
| 965 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
944 | 966 | { |
---|
945 | 967 | currenttab = new cGridBag(); |
---|
946 | | - added = false; |
---|
947 | 968 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
948 | 969 | currenttab.setName(tabname); |
---|
| 970 | + //added = false; |
---|
| 971 | + resourcecontainer.add(currenttab); |
---|
| 972 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
949 | 973 | rowcount = 1; |
---|
950 | 974 | colcount = 0; |
---|
951 | 975 | texturecount = 0; |
---|
952 | 976 | } |
---|
953 | 977 | |
---|
954 | | - if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
| 978 | + if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png"))) |
---|
955 | 979 | { |
---|
956 | | - if (!added) |
---|
| 980 | + //if (!added) |
---|
957 | 981 | { |
---|
958 | | - added = true; |
---|
959 | | - resourcecontainer.add(currenttab); |
---|
| 982 | + //added = true; |
---|
960 | 983 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
961 | | - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 984 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
962 | 985 | } |
---|
963 | 986 | |
---|
964 | | - AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 987 | + AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); |
---|
| 988 | + totalcount++; |
---|
965 | 989 | |
---|
966 | 990 | if (++colcount >= columns) |
---|
967 | 991 | { |
---|
.. | .. |
---|
987 | 1011 | container.add(resourcecontainer); |
---|
988 | 1012 | |
---|
989 | 1013 | Grafreed.ParseResources("textures", this); |
---|
| 1014 | + |
---|
| 1015 | + // 935. System.out.println("Total = " + totalcount); |
---|
990 | 1016 | } |
---|
991 | 1017 | |
---|
992 | 1018 | void SetupUI2(ObjEditor oe) |
---|
.. | .. |
---|
1026 | 1052 | oe.radioPanel.add(dummyButton); |
---|
1027 | 1053 | oe.buttonGroup.add(dummyButton); |
---|
1028 | 1054 | */ |
---|
1029 | | - cGridBag copyOptionsPanel = new cGridBag(); |
---|
| 1055 | + cGridBag versionManagerPanel = new cGridBag(); |
---|
1030 | 1056 | |
---|
1031 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 1057 | + versionManagerPanel.preferredHeight = 4; |
---|
1032 | 1058 | |
---|
1033 | 1059 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
1034 | 1060 | |
---|
.. | .. |
---|
1055 | 1081 | // } |
---|
1056 | 1082 | // }); |
---|
1057 | 1083 | |
---|
1058 | | - oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1084 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1059 | 1085 | collapseButton.setToolTipText("Collapse toolbar"); |
---|
1060 | 1086 | collapseButton.addActionListener(this); |
---|
1061 | 1087 | |
---|
1062 | | - oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1088 | + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1063 | 1089 | maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
1064 | 1090 | maximize3DButton.addActionListener(this); |
---|
1065 | 1091 | |
---|
1066 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1092 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1067 | 1093 | twoButton.setToolTipText("Show 3D view only"); |
---|
1068 | 1094 | twoButton.addActionListener(this); |
---|
1069 | 1095 | this.fullscreenLayout = twoButton; |
---|
1070 | 1096 | |
---|
1071 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1097 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1072 | 1098 | threeButton.setToolTipText("Show controls and 3D view"); |
---|
1073 | 1099 | threeButton.addActionListener(this); |
---|
1074 | 1100 | if (Globals.ADVANCED) |
---|
1075 | 1101 | { |
---|
1076 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1102 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1077 | 1103 | sixButton.setToolTipText("Show 3D view and controls"); |
---|
1078 | 1104 | sixButton.addActionListener(this); |
---|
1079 | 1105 | } |
---|
.. | .. |
---|
1082 | 1108 | // sevenButton.addActionListener(this); |
---|
1083 | 1109 | // |
---|
1084 | 1110 | |
---|
1085 | | - oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1111 | + oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1086 | 1112 | fullButton.setToolTipText("Full-screen window"); |
---|
1087 | 1113 | fullButton.addActionListener(this); |
---|
1088 | 1114 | |
---|
1089 | | - oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1115 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1090 | 1116 | screenfitButton.setToolTipText("Screen fit"); |
---|
1091 | 1117 | screenfitButton.addActionListener(this); |
---|
1092 | 1118 | |
---|
1093 | | - oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1119 | + oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1094 | 1120 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
1095 | 1121 | restoreCameraButton.addActionListener(this); |
---|
1096 | 1122 | |
---|
1097 | | - copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1123 | + versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1098 | 1124 | saveVersionButton.setToolTipText("Duplicate current version"); |
---|
1099 | 1125 | saveVersionButton.addActionListener(this); |
---|
1100 | 1126 | |
---|
1101 | | - copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1127 | + versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1102 | 1128 | deleteVersionButton.setToolTipText("Delete current version"); |
---|
1103 | 1129 | deleteVersionButton.addActionListener(this); |
---|
| 1130 | + deleteVersionButton.setEnabled(false); |
---|
1104 | 1131 | |
---|
1105 | | - copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1132 | + versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1106 | 1133 | previousVersionButton.setToolTipText("Previous version"); |
---|
1107 | 1134 | previousVersionButton.addActionListener(this); |
---|
1108 | 1135 | previousVersionButton.setEnabled(false); |
---|
1109 | 1136 | |
---|
1110 | 1137 | cGridBag updown = new cGridBag().setVertical(true); |
---|
1111 | | - updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1138 | + updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1112 | 1139 | restoreButton.setToolTipText("Undo (restore current version)"); |
---|
1113 | 1140 | restoreButton.addActionListener(this); |
---|
1114 | | - //restoreButton.setEnabled(false); |
---|
| 1141 | + restoreButton.setEnabled(false); |
---|
1115 | 1142 | |
---|
1116 | | - updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1143 | + updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1117 | 1144 | replaceButton.setToolTipText("Save (replace current version)"); |
---|
1118 | 1145 | replaceButton.addActionListener(this); |
---|
1119 | | - //replaceButton.setEnabled(false); |
---|
| 1146 | + replaceButton.setEnabled(false); |
---|
1120 | 1147 | |
---|
1121 | | - copyOptionsPanel.add(updown); |
---|
| 1148 | + versionManagerPanel.add(updown); |
---|
1122 | 1149 | |
---|
1123 | | - copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1150 | + versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1124 | 1151 | nextVersionButton.setToolTipText("Next version"); |
---|
1125 | 1152 | nextVersionButton.addActionListener(this); |
---|
1126 | 1153 | nextVersionButton.setEnabled(false); |
---|
1127 | 1154 | |
---|
1128 | | - oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1155 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1129 | 1156 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
1130 | 1157 | oneStepButton.addActionListener(this); |
---|
1131 | 1158 | |
---|
.. | .. |
---|
1148 | 1175 | |
---|
1149 | 1176 | if (Globals.ADVANCED) |
---|
1150 | 1177 | { |
---|
1151 | | - oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1178 | + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1152 | 1179 | snapobjectButton.addActionListener(this); |
---|
1153 | 1180 | snapobjectButton.setToolTipText("Snap Object"); |
---|
1154 | 1181 | |
---|
1155 | | - oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1182 | + oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1156 | 1183 | fourButton.addActionListener(this); |
---|
1157 | 1184 | fourButton.setToolTipText("Show control panel only"); |
---|
1158 | 1185 | } |
---|
.. | .. |
---|
1160 | 1187 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
1161 | 1188 | |
---|
1162 | 1189 | |
---|
1163 | | - oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1190 | + oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1164 | 1191 | rootButton.setToolTipText("Open selection in new tab"); |
---|
1165 | 1192 | rootButton.addActionListener(this); |
---|
1166 | 1193 | |
---|
1167 | | - oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1194 | + oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1168 | 1195 | closeButton.setToolTipText("Close tab"); |
---|
1169 | 1196 | closeButton.addActionListener(this); |
---|
1170 | 1197 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
.. | .. |
---|
1173 | 1200 | cGridBag row1 = new cGridBag(); |
---|
1174 | 1201 | |
---|
1175 | 1202 | // INSERT |
---|
1176 | | - row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1203 | + row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1177 | 1204 | gridButton.setToolTipText("Create ground"); |
---|
1178 | 1205 | gridButton.addActionListener(this); |
---|
1179 | 1206 | |
---|
1180 | | - row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1207 | + row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1181 | 1208 | boxButton.setToolTipText("Create box"); |
---|
1182 | 1209 | boxButton.addActionListener(this); |
---|
1183 | 1210 | |
---|
1184 | | - row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1185 | | - sphereButton.setToolTipText("Create sphere"); |
---|
1186 | | - sphereButton.addActionListener(this); |
---|
1187 | | - |
---|
1188 | | - row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1189 | | - coneButton.setToolTipText("Create cone"); |
---|
1190 | | - coneButton.addActionListener(this); |
---|
1191 | | - |
---|
1192 | | - row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1193 | | - torusButton.setToolTipText("Create torus"); |
---|
1194 | | - torusButton.addActionListener(this); |
---|
1195 | | - |
---|
1196 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1211 | + row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1197 | 1212 | superButton.setToolTipText("Create superellipsoid"); |
---|
1198 | 1213 | superButton.addActionListener(this); |
---|
1199 | 1214 | |
---|
1200 | | - if (Globals.ADVANCED) |
---|
| 1215 | + row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1216 | + sphereButton.setToolTipText("Create sphere"); |
---|
| 1217 | + sphereButton.addActionListener(this); |
---|
| 1218 | + |
---|
| 1219 | + row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1220 | + coneButton.setToolTipText("Create cone"); |
---|
| 1221 | + coneButton.addActionListener(this); |
---|
| 1222 | + |
---|
| 1223 | + row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1224 | + torusButton.setToolTipText("Create torus"); |
---|
| 1225 | + torusButton.addActionListener(this); |
---|
| 1226 | + |
---|
| 1227 | + if (false) //Globals.ADVANCED) |
---|
1201 | 1228 | { |
---|
1202 | | - oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1229 | + oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1203 | 1230 | kleinButton.setToolTipText("Create Klein bottle"); |
---|
1204 | 1231 | kleinButton.addActionListener(this); |
---|
1205 | 1232 | } |
---|
1206 | 1233 | |
---|
1207 | | - row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1234 | + row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1208 | 1235 | particlesButton.setToolTipText("Create particle system"); |
---|
1209 | 1236 | particlesButton.addActionListener(this); |
---|
1210 | 1237 | |
---|
.. | .. |
---|
1212 | 1239 | |
---|
1213 | 1240 | cGridBag row2 = new cGridBag(); |
---|
1214 | 1241 | |
---|
1215 | | - row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1242 | + row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1216 | 1243 | groupButton.setToolTipText("Create group"); |
---|
1217 | 1244 | groupButton.addActionListener(this); |
---|
1218 | 1245 | |
---|
1219 | | - row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1246 | + row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1220 | 1247 | compositeButton.setToolTipText("Create composite"); |
---|
1221 | 1248 | compositeButton.addActionListener(this); |
---|
1222 | 1249 | |
---|
1223 | | - row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1250 | + row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1224 | 1251 | switchButton.setToolTipText("Create item switcher"); |
---|
1225 | 1252 | switchButton.addActionListener(this); |
---|
1226 | 1253 | |
---|
1227 | | - row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1254 | + row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1228 | 1255 | loopButton.setToolTipText("Create loop"); |
---|
1229 | 1256 | loopButton.addActionListener(this); |
---|
1230 | 1257 | |
---|
1231 | | - row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1258 | + row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1232 | 1259 | textureButton.setToolTipText("Create texture"); |
---|
1233 | 1260 | textureButton.addActionListener(this); |
---|
1234 | 1261 | |
---|
1235 | | - row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1262 | + row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1236 | 1263 | overlayButton.setToolTipText("Create overlay"); |
---|
1237 | 1264 | overlayButton.addActionListener(this); |
---|
1238 | 1265 | |
---|
1239 | | - row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1266 | + row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1240 | 1267 | lightButton.setToolTipText("Create light"); |
---|
1241 | 1268 | lightButton.addActionListener(this); |
---|
1242 | 1269 | |
---|
.. | .. |
---|
1246 | 1273 | |
---|
1247 | 1274 | CreateTexturePanel(textures); |
---|
1248 | 1275 | |
---|
| 1276 | + int tabCount = resourcecontainer.getTabCount(); |
---|
| 1277 | + |
---|
| 1278 | + if (tabCount > 0) |
---|
| 1279 | + resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount)); |
---|
| 1280 | + |
---|
1249 | 1281 | oe.toolboxPanel.add(textures); |
---|
1250 | 1282 | |
---|
1251 | 1283 | textures.preferredHeight = 100; |
---|
.. | .. |
---|
1253 | 1285 | CreateSkyboxPanel(oe.skyboxPanel); |
---|
1254 | 1286 | |
---|
1255 | 1287 | // EDIT panel |
---|
1256 | | - editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1288 | + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1257 | 1289 | editButton.setToolTipText("Pin selection controls"); |
---|
1258 | 1290 | editButton.addActionListener(this); |
---|
1259 | 1291 | |
---|
1260 | | - editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1292 | + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1261 | 1293 | uneditButton.setToolTipText("Unpin and remove selection controls"); |
---|
1262 | 1294 | uneditButton.addActionListener(this); |
---|
1263 | 1295 | |
---|
.. | .. |
---|
1265 | 1297 | allParamsButton.setToolTipText("Show all controls"); |
---|
1266 | 1298 | allParamsButton.addActionListener(this); |
---|
1267 | 1299 | |
---|
1268 | | - editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1300 | + editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1269 | 1301 | clearPanelButton.setToolTipText("Clear all controls"); |
---|
1270 | 1302 | clearPanelButton.addActionListener(this); |
---|
1271 | 1303 | |
---|
.. | .. |
---|
1273 | 1305 | //unselectButton.setToolTipText("Unselect"); |
---|
1274 | 1306 | //unselectButton.addActionListener(this); |
---|
1275 | 1307 | |
---|
1276 | | - editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1308 | + editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1277 | 1309 | flashSelectionButton.setToolTipText("Highlight selection"); |
---|
1278 | 1310 | flashSelectionButton.addActionListener(this); |
---|
1279 | 1311 | |
---|
.. | .. |
---|
1296 | 1328 | |
---|
1297 | 1329 | cGridBag jSPPanel = new cGridBag(); |
---|
1298 | 1330 | |
---|
| 1331 | + jSPPanel.preferredHeight = 20; |
---|
| 1332 | + |
---|
1299 | 1333 | JScrollPane jSP; |
---|
1300 | 1334 | //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); |
---|
1301 | 1335 | jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); |
---|
.. | .. |
---|
1304 | 1338 | oe.treePanel.add(jSPPanel); |
---|
1305 | 1339 | oe.treePanel.Return(); |
---|
1306 | 1340 | |
---|
1307 | | - oe.treePanel.add(copyOptionsPanel); |
---|
| 1341 | + oe.treePanel.add(versionManagerPanel); |
---|
1308 | 1342 | oe.treePanel.Return(); |
---|
1309 | | - cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
1310 | | - versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
1311 | | - sliderPane.preferredHeight = 1; |
---|
| 1343 | + versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 1344 | + versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); |
---|
| 1345 | + versionSliderPane.preferredHeight = 3; |
---|
1312 | 1346 | |
---|
1313 | 1347 | // mainPanel.setDividerLocation(0.1); //1.0); |
---|
1314 | 1348 | mainPanel.setResizeWeight(0.4); |
---|
.. | .. |
---|
1466 | 1500 | |
---|
1467 | 1501 | void EditObject(Object3D obj) |
---|
1468 | 1502 | { |
---|
1469 | | - assert(obj instanceof Composite); |
---|
| 1503 | + //assert(obj instanceof Composite); |
---|
1470 | 1504 | |
---|
1471 | 1505 | // if (obj.versionlist == null) |
---|
1472 | 1506 | // { |
---|
.. | .. |
---|
1498 | 1532 | |
---|
1499 | 1533 | oe.SetupViews(); |
---|
1500 | 1534 | |
---|
| 1535 | + if (Globals.DEBUG) |
---|
1501 | 1536 | System.out.println("SetupViews"); |
---|
1502 | 1537 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1503 | 1538 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
2101 | 2136 | switch(axis) |
---|
2102 | 2137 | { |
---|
2103 | 2138 | case 0 : |
---|
2104 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
---|
2105 | | - vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z; |
---|
2106 | | - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; |
---|
2107 | | - vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z; |
---|
| 2139 | + vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z; |
---|
| 2140 | + vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z; |
---|
| 2141 | + vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z; |
---|
| 2142 | + vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z; |
---|
2108 | 2143 | norm = cVector.X; |
---|
2109 | 2144 | break; |
---|
2110 | 2145 | case 1 : |
---|
2111 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
---|
2112 | | - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; |
---|
2113 | | - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; |
---|
2114 | | - vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z; |
---|
| 2146 | + vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z; |
---|
| 2147 | + vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z; |
---|
| 2148 | + vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z; |
---|
| 2149 | + vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z; |
---|
2115 | 2150 | norm = cVector.Y; |
---|
2116 | 2151 | break; |
---|
2117 | 2152 | case 2 : |
---|
2118 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
---|
2119 | | - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; |
---|
2120 | | - vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z; |
---|
2121 | | - vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z; |
---|
| 2153 | + vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f; |
---|
| 2154 | + vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f; |
---|
| 2155 | + vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f; |
---|
| 2156 | + vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f; |
---|
2122 | 2157 | norm = cVector.Z; |
---|
2123 | 2158 | break; |
---|
2124 | 2159 | } |
---|
.. | .. |
---|
2159 | 2194 | shadow.material = new cMaterial(obj.material); |
---|
2160 | 2195 | shadow.material.diffuse = 0.0001f; |
---|
2161 | 2196 | shadow.material.specular = 0.0001f; |
---|
2162 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2197 | + shadow.material.opacity = 0.75f; |
---|
| 2198 | + |
---|
| 2199 | + AllocProjectedVertices(shadow); |
---|
| 2200 | + |
---|
| 2201 | + shadow.projectedVertices[1].x = 300; |
---|
2163 | 2202 | |
---|
2164 | 2203 | makeSomething(shadow); |
---|
2165 | 2204 | } |
---|
.. | .. |
---|
2680 | 2719 | } else |
---|
2681 | 2720 | if (source == loopItem || source == loopButton) |
---|
2682 | 2721 | { |
---|
| 2722 | + if (!group.selection.isEmpty()) |
---|
| 2723 | + { |
---|
2683 | 2724 | Composite csg = new GroupLeaf(); |
---|
2684 | 2725 | csg.count = 5; |
---|
2685 | | - group(csg); |
---|
2686 | 2726 | Composite child = new cGroup("Branch"); |
---|
2687 | 2727 | csg.addChild(child); |
---|
2688 | 2728 | child.addChild(csg); |
---|
| 2729 | + group(csg); |
---|
| 2730 | + } |
---|
2689 | 2731 | } else |
---|
2690 | 2732 | if (source == doubleItem) |
---|
2691 | 2733 | { |
---|
| 2734 | + if (!group.selection.isEmpty()) |
---|
| 2735 | + { |
---|
2692 | 2736 | Composite csg = new GroupLeaf("Fork"); |
---|
2693 | 2737 | csg.count = 5; |
---|
2694 | | - group(csg); |
---|
2695 | 2738 | Composite child = new cGroup("Branch A"); |
---|
2696 | 2739 | csg.addChild(child); |
---|
2697 | 2740 | child.addChild(csg); |
---|
2698 | 2741 | child = new cGroup("Branch B"); |
---|
2699 | 2742 | csg.addChild(child); |
---|
2700 | 2743 | child.addChild(csg); |
---|
| 2744 | + group(csg); |
---|
| 2745 | + } |
---|
2701 | 2746 | } else |
---|
2702 | 2747 | if (source == tripleItem) |
---|
2703 | 2748 | { |
---|
| 2749 | + if (!group.selection.isEmpty()) |
---|
| 2750 | + { |
---|
2704 | 2751 | Composite csg = new GroupLeaf("Trident"); |
---|
2705 | 2752 | csg.count = 4; |
---|
2706 | 2753 | group(csg); |
---|
.. | .. |
---|
2713 | 2760 | child = new cGroup(); |
---|
2714 | 2761 | csg.addChild(child); |
---|
2715 | 2762 | child.addChild(csg); |
---|
| 2763 | + } |
---|
2716 | 2764 | } else |
---|
2717 | 2765 | if (source == computeAOItem) |
---|
2718 | 2766 | { |
---|
.. | .. |
---|
3348 | 3396 | } else |
---|
3349 | 3397 | if (source == ungroupItem || source == ungroupButton) |
---|
3350 | 3398 | { |
---|
3351 | | - boolean hasRoot = false; |
---|
| 3399 | + boolean canUngroup = true; |
---|
3352 | 3400 | |
---|
3353 | 3401 | for (int i=0; i<group.selection.size(); i++) |
---|
3354 | 3402 | { |
---|
3355 | | - if (group.selection.get(i) == group) |
---|
| 3403 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3404 | + |
---|
| 3405 | + if (selectedItem.Size() == 0) |
---|
3356 | 3406 | { |
---|
3357 | | - hasRoot = true; |
---|
| 3407 | + // Cannot ungroup leaves |
---|
| 3408 | + canUngroup = false; |
---|
| 3409 | + break; |
---|
| 3410 | + } |
---|
| 3411 | + |
---|
| 3412 | + if (selectedItem == group) |
---|
| 3413 | + { |
---|
| 3414 | + // Cannot ungroup root |
---|
| 3415 | + canUngroup = false; |
---|
3358 | 3416 | break; |
---|
3359 | 3417 | } |
---|
3360 | 3418 | } |
---|
3361 | 3419 | |
---|
3362 | | - if (!hasRoot) |
---|
| 3420 | + if (canUngroup) |
---|
3363 | 3421 | { |
---|
3364 | 3422 | for (int i=0; i<group.selection.size(); i++) |
---|
3365 | 3423 | { |
---|
3366 | | - Ungroup(group.selection.get(i)); |
---|
| 3424 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3425 | + |
---|
| 3426 | + Ungroup(selectedItem); |
---|
3367 | 3427 | } |
---|
3368 | 3428 | |
---|
3369 | 3429 | ClearSelection(false); |
---|
.. | .. |
---|
3414 | 3474 | if (source == clearMaterialsItem) |
---|
3415 | 3475 | { |
---|
3416 | 3476 | ClearMaterials(); |
---|
| 3477 | + } else |
---|
| 3478 | + if (source == clearVersionsItem) |
---|
| 3479 | + { |
---|
| 3480 | + ClearVersions(); |
---|
3417 | 3481 | } else |
---|
3418 | 3482 | if (source == liveleavesItem) |
---|
3419 | 3483 | { |
---|
.. | .. |
---|
3554 | 3618 | if (source == transformChildrenItem) |
---|
3555 | 3619 | { |
---|
3556 | 3620 | TransformChildren(); |
---|
| 3621 | + } else |
---|
| 3622 | + if (source == textureRatioRItem) |
---|
| 3623 | + { |
---|
| 3624 | + TextureRatio(0); |
---|
| 3625 | + } else |
---|
| 3626 | + if (source == textureRatioGItem) |
---|
| 3627 | + { |
---|
| 3628 | + TextureRatio(1); |
---|
| 3629 | + } else |
---|
| 3630 | + if (source == textureRatioBItem) |
---|
| 3631 | + { |
---|
| 3632 | + TextureRatio(2); |
---|
3557 | 3633 | } else |
---|
3558 | 3634 | if (source == resetTransformItem) |
---|
3559 | 3635 | { |
---|
.. | .. |
---|
3927 | 4003 | if (source == closeButton) |
---|
3928 | 4004 | { |
---|
3929 | 4005 | //System.out.println("CLOSE: " + buttonGroup.getSelection()); |
---|
| 4006 | + if (copy.versionlist != null) |
---|
| 4007 | + Replace(); |
---|
| 4008 | + |
---|
3930 | 4009 | cRadio ab; |
---|
3931 | 4010 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3932 | 4011 | { |
---|
.. | .. |
---|
4025 | 4104 | } else |
---|
4026 | 4105 | if(source instanceof cRadio) |
---|
4027 | 4106 | { |
---|
| 4107 | + if (copy.versionlist != null) |
---|
| 4108 | + Replace(); |
---|
| 4109 | + |
---|
4028 | 4110 | group.parent = keepparent; |
---|
4029 | 4111 | group.attributes = 0; |
---|
4030 | 4112 | //group.editWindow = null; |
---|
.. | .. |
---|
4076 | 4158 | */ |
---|
4077 | 4159 | radio.layout.doClick(); |
---|
4078 | 4160 | |
---|
4079 | | - assert(copy instanceof Composite); |
---|
| 4161 | + //assert(copy instanceof Composite); |
---|
4080 | 4162 | |
---|
4081 | 4163 | if (copy.versionlist == null) |
---|
4082 | 4164 | { |
---|
4083 | | - copy.versionlist = new Object3D[100]; |
---|
4084 | 4165 | copy.versionindex = -1; |
---|
4085 | 4166 | |
---|
4086 | | - Save(true); |
---|
| 4167 | + // Cannot work with loops |
---|
| 4168 | + // To fix this issue, we first mark all nodes above the root, |
---|
| 4169 | + // and check if any of these nodes are reachable below the root. |
---|
| 4170 | + Grafreed.grafreed.universe.TagObjects(copy, true); |
---|
| 4171 | + |
---|
| 4172 | + if (copy instanceof Composite && copy.versionlist == null && !copy.HasTags()) |
---|
| 4173 | + { |
---|
| 4174 | + copy.versionlist = new Object3D[100]; |
---|
| 4175 | + |
---|
| 4176 | + //Save(true); |
---|
| 4177 | + } |
---|
| 4178 | + else |
---|
| 4179 | + copy.versionindex = -2; |
---|
| 4180 | + |
---|
| 4181 | + Grafreed.grafreed.universe.TagObjects(copy, false); |
---|
4087 | 4182 | } |
---|
4088 | 4183 | |
---|
4089 | 4184 | SetVersionStates(); |
---|
.. | .. |
---|
4201 | 4296 | refreshContents(); |
---|
4202 | 4297 | } |
---|
4203 | 4298 | |
---|
| 4299 | + void TextureRatio(int axis) |
---|
| 4300 | + { |
---|
| 4301 | + Object3D obj; |
---|
| 4302 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 4303 | + { |
---|
| 4304 | + obj = (Object3D)e.nextElement(); |
---|
| 4305 | + obj.TextureRatio(axis); |
---|
| 4306 | + } |
---|
| 4307 | + |
---|
| 4308 | + refreshContents(); |
---|
| 4309 | + } |
---|
| 4310 | + |
---|
4204 | 4311 | void ResetTransform() |
---|
4205 | 4312 | { |
---|
4206 | 4313 | ResetTransform(-1); |
---|
.. | .. |
---|
4216 | 4323 | if (obj.toParent == null) |
---|
4217 | 4324 | continue; |
---|
4218 | 4325 | |
---|
4219 | | - if (mask == -1) |
---|
4220 | | - { |
---|
4221 | | - if (obj instanceof Camera) // jan 2014 |
---|
4222 | | - { |
---|
4223 | | - LA.matIdentity(obj.toParent); |
---|
4224 | | - LA.matIdentity(obj.fromParent); |
---|
4225 | | - } |
---|
4226 | | - else |
---|
4227 | | - { |
---|
4228 | | - obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
4229 | | - obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
4230 | | - } |
---|
4231 | | - TouchTransform(obj); |
---|
4232 | | - continue; |
---|
4233 | | - } |
---|
4234 | | - if ((mask&2) != 0) // Scale |
---|
4235 | | - { |
---|
4236 | | - obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
4237 | | - obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
4238 | | - obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
4239 | | - obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
4240 | | - obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
4241 | | - obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
4242 | | - } |
---|
4243 | | - if ((mask&4) != 0) // Rotation |
---|
4244 | | - { |
---|
4245 | | - // ? |
---|
4246 | | - } |
---|
4247 | | - if ((mask&1) != 0) // Translation |
---|
4248 | | - { |
---|
4249 | | - if (obj.toParent != null) |
---|
4250 | | - { |
---|
4251 | | - obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
4252 | | - obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
4253 | | - } |
---|
4254 | | - } |
---|
| 4326 | + obj.ResetTransform(mask); |
---|
| 4327 | + |
---|
4255 | 4328 | if (obj.parent == null) |
---|
4256 | 4329 | { |
---|
4257 | 4330 | System.out.println("NULL PARENT!"); |
---|
.. | .. |
---|
4760 | 4833 | { |
---|
4761 | 4834 | Object3D obj = group.selection.get(i); |
---|
4762 | 4835 | |
---|
| 4836 | + if (obj.toParent == null) |
---|
| 4837 | + { |
---|
| 4838 | + obj.toParent = LA.newMatrix(); |
---|
| 4839 | + obj.fromParent = LA.newMatrix(); |
---|
| 4840 | + } |
---|
| 4841 | + |
---|
4763 | 4842 | LA.matTranslate(obj.toParent, i * scale, 0, 0); |
---|
4764 | 4843 | LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0); |
---|
4765 | 4844 | } |
---|
.. | .. |
---|
5051 | 5130 | refreshContents(); |
---|
5052 | 5131 | } |
---|
5053 | 5132 | |
---|
| 5133 | + void ClearVersions() |
---|
| 5134 | + { |
---|
| 5135 | + group.selection.ClearVersions(); |
---|
| 5136 | + refreshContents(); |
---|
| 5137 | + } |
---|
| 5138 | + |
---|
5054 | 5139 | void FlipV(boolean flip) |
---|
5055 | 5140 | { |
---|
5056 | 5141 | group.selection.FlipV(flip); |
---|
.. | .. |
---|
5328 | 5413 | if (group.selection != null) |
---|
5329 | 5414 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
5330 | 5415 | { |
---|
5331 | | - if (!(e.nextElement() instanceof Composite)) |
---|
| 5416 | + Object next = e.nextElement(); |
---|
| 5417 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
5332 | 5418 | { |
---|
5333 | 5419 | allComposites = false; |
---|
5334 | 5420 | break; |
---|
5335 | 5421 | } |
---|
5336 | 5422 | } |
---|
5337 | 5423 | |
---|
5338 | | - rootButton.setEnabled(allComposites); |
---|
| 5424 | + rootButton.setEnabled(true); // allComposites); |
---|
5339 | 5425 | } |
---|
5340 | 5426 | |
---|
5341 | 5427 | void refreshContents(boolean cp) |
---|
5342 | 5428 | { |
---|
| 5429 | + if (Globals.ADVANCED) |
---|
5343 | 5430 | //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5344 | 5431 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5345 | 5432 | { |
---|
.. | .. |
---|
6233 | 6320 | private MenuItem lookAtItem; |
---|
6234 | 6321 | private MenuItem lookFromItem; |
---|
6235 | 6322 | private MenuItem switchViewItem; |
---|
6236 | | - private MenuItem cutItem; |
---|
| 6323 | + private JMenuItem cutItem; |
---|
6237 | 6324 | private MenuItem undoItem; |
---|
6238 | 6325 | private MenuItem redoItem; |
---|
6239 | 6326 | private JMenuItem duplicateItem; |
---|
6240 | | - private MenuItem cloneItem; |
---|
| 6327 | + private JMenuItem cloneItem; |
---|
6241 | 6328 | private MenuItem cloneSupportItem; |
---|
6242 | 6329 | private MenuItem overwriteGeoItem; |
---|
6243 | 6330 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6258 | 6345 | private MenuItem cloneGeometriesItem; |
---|
6259 | 6346 | private MenuItem shareGeometriesItem; |
---|
6260 | 6347 | private MenuItem mergeGeometriesItem; |
---|
6261 | | - private MenuItem copyItem; |
---|
| 6348 | + private JMenuItem copyItem; |
---|
6262 | 6349 | private MenuItem pasteItem; |
---|
6263 | | - private MenuItem pasteIntoItem; |
---|
6264 | | - private MenuItem pasteLinkItem; |
---|
6265 | | - private MenuItem pasteCloneItem; |
---|
6266 | | - private MenuItem pasteExpandItem; |
---|
6267 | | - private MenuItem deleteItem; |
---|
| 6350 | + private JMenuItem pasteIntoItem; |
---|
| 6351 | + private JMenuItem pasteLinkItem; |
---|
| 6352 | + private JMenuItem pasteCloneItem; |
---|
| 6353 | + private JMenuItem pasteExpandItem; |
---|
| 6354 | + private JMenuItem deleteItem; |
---|
6268 | 6355 | private MenuItem clearAllItem; |
---|
6269 | 6356 | private MenuItem genUVItem; |
---|
6270 | 6357 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6290 | 6377 | private MenuItem clipMeshItem; |
---|
6291 | 6378 | private MenuItem smoothMeshItem; |
---|
6292 | 6379 | private MenuItem clearMaterialsItem; |
---|
| 6380 | + private MenuItem clearVersionsItem; |
---|
6293 | 6381 | |
---|
6294 | 6382 | private MenuItem liveleavesItem; |
---|
6295 | 6383 | private MenuItem unliveleavesItem; |
---|
.. | .. |
---|
6313 | 6401 | private MenuItem maxTexturesItem; |
---|
6314 | 6402 | private MenuItem panoTexturesItem; |
---|
6315 | 6403 | |
---|
| 6404 | + private MenuItem textureRatioRItem; |
---|
| 6405 | + private MenuItem textureRatioGItem; |
---|
| 6406 | + private MenuItem textureRatioBItem; |
---|
6316 | 6407 | private MenuItem resetCentroidItem; |
---|
6317 | 6408 | private MenuItem resetCentroidXZItem; |
---|
6318 | 6409 | private MenuItem resetTransformItem; |
---|
6319 | 6410 | private MenuItem transformGeometryItem; |
---|
6320 | 6411 | private MenuItem transformChildrenItem; |
---|
6321 | 6412 | private MenuItem hideItem; |
---|
6322 | | - private MenuItem grabItem; |
---|
| 6413 | + private JMenuItem grabItem; |
---|
6323 | 6414 | private MenuItem backItem; |
---|
6324 | 6415 | private MenuItem frontItem; |
---|
6325 | 6416 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6332 | 6423 | private MenuItem switchTransfoItem; |
---|
6333 | 6424 | private MenuItem morphItem; |
---|
6334 | 6425 | private MenuItem linkerItem; |
---|
6335 | | - private MenuItem ungroupItem; |
---|
| 6426 | + private JMenuItem ungroupItem; |
---|
6336 | 6427 | private MenuItem editItem; |
---|
6337 | 6428 | private MenuItem openWindowItem; |
---|
6338 | 6429 | private MenuItem editLeafItem; |
---|