.. | .. |
---|
31 | 31 | final String path = "cubemaps/" + f + "-skyboxes/" + s; |
---|
32 | 32 | row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); |
---|
33 | 33 | //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); |
---|
34 | | - skyboxButton.setToolTipText(s); |
---|
| 34 | + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); |
---|
35 | 35 | skyboxButton.addActionListener(new ActionListener() |
---|
36 | 36 | { |
---|
37 | 37 | @Override |
---|
.. | .. |
---|
73 | 73 | cGridBag row5 = new cGridBag(); |
---|
74 | 74 | cGridBag row6 = new cGridBag(); |
---|
75 | 75 | |
---|
76 | | - AddSkyboxButton("default", "rgb", row0); |
---|
| 76 | + AddSkyboxButton("default", "", row0); |
---|
77 | 77 | //AddSkyboxButton("default", "cornell", row0); |
---|
78 | 78 | AddSkyboxButton("penguins", "dust", row0); |
---|
79 | 79 | AddSkyboxButton("penguins", "tropic", row0); |
---|
.. | .. |
---|
330 | 330 | |
---|
331 | 331 | public void ChangeSkybox(String skybox) |
---|
332 | 332 | { |
---|
333 | | - //cameraView.envyoff = false; |
---|
334 | | - group.skyboxname = skybox; |
---|
335 | | - group.skyboxext = "jpg"; |
---|
336 | | - cameraView.repaint(); |
---|
| 333 | + if (skybox.endsWith("/")) |
---|
| 334 | + { |
---|
| 335 | + group.skyboxname = null; |
---|
| 336 | + group.skyboxext = null; |
---|
| 337 | + cameraView.repaint(); |
---|
| 338 | + } |
---|
| 339 | + else |
---|
| 340 | + { |
---|
| 341 | + //cameraView.envyoff = false; |
---|
| 342 | + group.skyboxname = skybox; |
---|
| 343 | + group.skyboxext = "jpg"; |
---|
| 344 | + cameraView.repaint(); |
---|
| 345 | + } |
---|
337 | 346 | } |
---|
338 | 347 | |
---|
339 | 348 | public void CreateSkyboxPanel(cGridBag skyboxPanel) |
---|
.. | .. |
---|
406 | 415 | this.copy = this.group = group; |
---|
407 | 416 | //selectees = this.group.selectees; |
---|
408 | 417 | |
---|
| 418 | + assert(false); |
---|
| 419 | + |
---|
409 | 420 | if (copy.versionlist == null) |
---|
410 | 421 | { |
---|
411 | 422 | copy.versionlist = new Object3D[100]; |
---|
412 | 423 | copy.versionindex = -1; |
---|
| 424 | + |
---|
| 425 | + //Save(true); |
---|
413 | 426 | } |
---|
414 | 427 | |
---|
415 | 428 | if(ui) |
---|
.. | .. |
---|
438 | 451 | copy.versionlist = new Object3D[100]; |
---|
439 | 452 | copy.versionindex = -1; |
---|
440 | 453 | |
---|
441 | | - Save(true); |
---|
| 454 | + //Save(true); |
---|
442 | 455 | } |
---|
443 | 456 | } |
---|
444 | 457 | |
---|
.. | .. |
---|
529 | 542 | // menu.add("-"); |
---|
530 | 543 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
531 | 544 | duplicateItem.addActionListener(this); |
---|
532 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 545 | + |
---|
| 546 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
533 | 547 | cloneItem.addActionListener(this); |
---|
534 | | - if (Globals.ADVANCED) |
---|
| 548 | + //if (Globals.ADVANCED) |
---|
535 | 549 | { |
---|
536 | 550 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
537 | 551 | cloneSupportItem.addActionListener(this); |
---|
538 | 552 | } |
---|
| 553 | + oe.jTree.popup.addSeparator(); |
---|
539 | 554 | menu.add("-"); |
---|
540 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 555 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
541 | 556 | cutItem.addActionListener(this); |
---|
542 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 557 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
543 | 558 | copyItem.addActionListener(this); |
---|
544 | 559 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
545 | 560 | pasteItem.addActionListener(this); |
---|
546 | 561 | |
---|
547 | | - menu.add("-"); |
---|
548 | | - 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")); |
---|
549 | 565 | pasteIntoItem.addActionListener(this); |
---|
550 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 566 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
551 | 567 | pasteLinkItem.addActionListener(this); |
---|
552 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 568 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
553 | 569 | pasteCloneItem.addActionListener(this); |
---|
554 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 570 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
555 | 571 | // pasteExpandItem.addActionListener(this); |
---|
556 | | - menu.add("-"); |
---|
557 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
558 | | - deleteItem.addActionListener(this); |
---|
| 572 | + //menu.add("-"); |
---|
| 573 | + oe.jTree.popup.addSeparator(); |
---|
559 | 574 | |
---|
560 | 575 | if (Globals.ADVANCED) |
---|
561 | 576 | { |
---|
.. | .. |
---|
641 | 656 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
642 | 657 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
643 | 658 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
644 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
645 | 659 | oe.cameraMenu.add("-"); |
---|
646 | 660 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
647 | 661 | openWindowItem.addActionListener(this); |
---|
648 | | - editLeafItem.addActionListener(this); |
---|
649 | 662 | lookAtItem.addActionListener(this); |
---|
650 | 663 | //lookFromItem.addActinoListener(this); |
---|
651 | 664 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
692 | 705 | setMasterItem.addActionListener(this); |
---|
693 | 706 | } |
---|
694 | 707 | |
---|
695 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
696 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
697 | | -// grabItem.addActionListener(this); |
---|
| 708 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 709 | + |
---|
698 | 710 | backItem = menu.add(new MenuItem("Back")); |
---|
699 | 711 | backItem.addActionListener(this); |
---|
700 | 712 | frontItem = menu.add(new MenuItem("Front")); |
---|
.. | .. |
---|
702 | 714 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
703 | 715 | // compositeItem.addActionListener(this); |
---|
704 | 716 | |
---|
| 717 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 718 | + grabItem.addActionListener(this); |
---|
| 719 | + |
---|
705 | 720 | if (Globals.ADVANCED) |
---|
706 | 721 | { |
---|
707 | 722 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
708 | 723 | hideItem.addActionListener(this); |
---|
709 | 724 | } |
---|
710 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 725 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
711 | 726 | ungroupItem.addActionListener(this); |
---|
| 727 | + |
---|
| 728 | + oe.jTree.popup.addSeparator(); |
---|
| 729 | + |
---|
| 730 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 731 | + deleteItem.addActionListener(this); |
---|
712 | 732 | |
---|
713 | 733 | // menu.add("-"); |
---|
714 | 734 | // |
---|
.. | .. |
---|
893 | 913 | shareGeometriesItem.addActionListener(this); |
---|
894 | 914 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
895 | 915 | mergeGeometriesItem.addActionListener(this); |
---|
| 916 | + menu.add("-"); |
---|
| 917 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 918 | + editLeafItem.addActionListener(this); |
---|
896 | 919 | if (Globals.ADVANCED) |
---|
897 | 920 | { |
---|
898 | 921 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
911 | 934 | |
---|
912 | 935 | JTabbedPane resourcecontainer; |
---|
913 | 936 | cGridBag currenttab; |
---|
914 | | - boolean added; // patch for jar |
---|
| 937 | + //boolean added; // patch for jar |
---|
915 | 938 | |
---|
916 | 939 | int tabcount = 0; |
---|
917 | 940 | int colcount = 0; |
---|
.. | .. |
---|
928 | 951 | // System.out.println(); |
---|
929 | 952 | |
---|
930 | 953 | if (//rowcount == 0 || |
---|
931 | | - path.length == 1) |
---|
| 954 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
932 | 955 | { |
---|
933 | 956 | currenttab = new cGridBag(); |
---|
934 | | - added = false; |
---|
935 | 957 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
936 | 958 | currenttab.setName(tabname); |
---|
| 959 | + //added = false; |
---|
| 960 | + resourcecontainer.add(currenttab); |
---|
| 961 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
937 | 962 | rowcount = 1; |
---|
938 | 963 | colcount = 0; |
---|
939 | 964 | texturecount = 0; |
---|
.. | .. |
---|
941 | 966 | |
---|
942 | 967 | if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
943 | 968 | { |
---|
944 | | - if (!added) |
---|
| 969 | + //if (!added) |
---|
945 | 970 | { |
---|
946 | | - added = true; |
---|
947 | | - resourcecontainer.add(currenttab); |
---|
| 971 | + //added = true; |
---|
948 | 972 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
949 | | - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 973 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
950 | 974 | } |
---|
951 | 975 | |
---|
952 | 976 | AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
.. | .. |
---|
1014 | 1038 | oe.radioPanel.add(dummyButton); |
---|
1015 | 1039 | oe.buttonGroup.add(dummyButton); |
---|
1016 | 1040 | */ |
---|
1017 | | - cGridBag copyOptionsPanel = new cGridBag(); |
---|
| 1041 | + cGridBag versionManagerPanel = new cGridBag(); |
---|
1018 | 1042 | |
---|
1019 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 1043 | + versionManagerPanel.preferredHeight = 4; |
---|
1020 | 1044 | |
---|
1021 | 1045 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
1022 | 1046 | |
---|
.. | .. |
---|
1026 | 1050 | |
---|
1027 | 1051 | if (Globals.ADVANCED) |
---|
1028 | 1052 | { |
---|
1029 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1030 | | - maxButton.setToolTipText("Maximize window"); |
---|
1031 | | - maxButton.addActionListener(this); |
---|
| 1053 | +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1054 | +// maxButton.setToolTipText("Maximize window"); |
---|
| 1055 | +// maxButton.addActionListener(this); |
---|
1032 | 1056 | } |
---|
1033 | 1057 | |
---|
1034 | 1058 | cButton gcButton; |
---|
1035 | 1059 | |
---|
1036 | | - oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1037 | | - gcButton.setToolTipText("Garbage collect"); |
---|
1038 | | - gcButton.addActionListener(new ActionListener() |
---|
1039 | | - { |
---|
1040 | | - public void actionPerformed(ActionEvent e) |
---|
1041 | | - { |
---|
1042 | | - System.gc(); |
---|
1043 | | - } |
---|
1044 | | - }); |
---|
| 1060 | +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1061 | +// gcButton.setToolTipText("Garbage collect"); |
---|
| 1062 | +// gcButton.addActionListener(new ActionListener() |
---|
| 1063 | +// { |
---|
| 1064 | +// public void actionPerformed(ActionEvent e) |
---|
| 1065 | +// { |
---|
| 1066 | +// System.gc(); |
---|
| 1067 | +// } |
---|
| 1068 | +// }); |
---|
1045 | 1069 | |
---|
1046 | 1070 | oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1047 | 1071 | collapseButton.setToolTipText("Collapse toolbar"); |
---|
1048 | 1072 | collapseButton.addActionListener(this); |
---|
1049 | 1073 | |
---|
1050 | | - oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1074 | + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1051 | 1075 | maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
1052 | 1076 | maximize3DButton.addActionListener(this); |
---|
1053 | 1077 | |
---|
.. | .. |
---|
1082 | 1106 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
1083 | 1107 | restoreCameraButton.addActionListener(this); |
---|
1084 | 1108 | |
---|
1085 | | - copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1109 | + versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1086 | 1110 | saveVersionButton.setToolTipText("Duplicate current version"); |
---|
1087 | 1111 | saveVersionButton.addActionListener(this); |
---|
1088 | 1112 | |
---|
1089 | | - copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1113 | + versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1090 | 1114 | deleteVersionButton.setToolTipText("Delete current version"); |
---|
1091 | 1115 | deleteVersionButton.addActionListener(this); |
---|
| 1116 | + deleteVersionButton.setEnabled(false); |
---|
1092 | 1117 | |
---|
1093 | | - copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1118 | + versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1094 | 1119 | previousVersionButton.setToolTipText("Previous version"); |
---|
1095 | 1120 | previousVersionButton.addActionListener(this); |
---|
1096 | 1121 | previousVersionButton.setEnabled(false); |
---|
.. | .. |
---|
1099 | 1124 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1100 | 1125 | restoreButton.setToolTipText("Undo (restore current version)"); |
---|
1101 | 1126 | restoreButton.addActionListener(this); |
---|
1102 | | - //restoreButton.setEnabled(false); |
---|
| 1127 | + restoreButton.setEnabled(false); |
---|
1103 | 1128 | |
---|
1104 | 1129 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1105 | 1130 | replaceButton.setToolTipText("Save (replace current version)"); |
---|
1106 | 1131 | replaceButton.addActionListener(this); |
---|
1107 | | - //replaceButton.setEnabled(false); |
---|
| 1132 | + replaceButton.setEnabled(false); |
---|
1108 | 1133 | |
---|
1109 | | - copyOptionsPanel.add(updown); |
---|
| 1134 | + versionManagerPanel.add(updown); |
---|
1110 | 1135 | |
---|
1111 | | - copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1136 | + versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1112 | 1137 | nextVersionButton.setToolTipText("Next version"); |
---|
1113 | 1138 | nextVersionButton.addActionListener(this); |
---|
1114 | 1139 | nextVersionButton.setEnabled(false); |
---|
.. | .. |
---|
1162 | 1187 | |
---|
1163 | 1188 | // INSERT |
---|
1164 | 1189 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1165 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1190 | + gridButton.setToolTipText("Create ground"); |
---|
1166 | 1191 | gridButton.addActionListener(this); |
---|
1167 | 1192 | |
---|
1168 | 1193 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1169 | 1194 | boxButton.setToolTipText("Create box"); |
---|
1170 | 1195 | boxButton.addActionListener(this); |
---|
| 1196 | + |
---|
| 1197 | + row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1198 | + superButton.setToolTipText("Create superellipsoid"); |
---|
| 1199 | + superButton.addActionListener(this); |
---|
1171 | 1200 | |
---|
1172 | 1201 | row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1173 | 1202 | sphereButton.setToolTipText("Create sphere"); |
---|
.. | .. |
---|
1180 | 1209 | row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1181 | 1210 | torusButton.setToolTipText("Create torus"); |
---|
1182 | 1211 | torusButton.addActionListener(this); |
---|
1183 | | - |
---|
1184 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1185 | | - superButton.setToolTipText("Create superellipsoid"); |
---|
1186 | | - superButton.addActionListener(this); |
---|
1187 | 1212 | |
---|
1188 | 1213 | if (Globals.ADVANCED) |
---|
1189 | 1214 | { |
---|
.. | .. |
---|
1233 | 1258 | cGridBag textures = new cGridBag(); |
---|
1234 | 1259 | |
---|
1235 | 1260 | CreateTexturePanel(textures); |
---|
| 1261 | + |
---|
| 1262 | + resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); |
---|
1236 | 1263 | |
---|
1237 | 1264 | oe.toolboxPanel.add(textures); |
---|
1238 | 1265 | |
---|
.. | .. |
---|
1284 | 1311 | |
---|
1285 | 1312 | cGridBag jSPPanel = new cGridBag(); |
---|
1286 | 1313 | |
---|
| 1314 | + jSPPanel.preferredHeight = 20; |
---|
| 1315 | + |
---|
1287 | 1316 | JScrollPane jSP; |
---|
1288 | 1317 | //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); |
---|
1289 | 1318 | jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); |
---|
.. | .. |
---|
1292 | 1321 | oe.treePanel.add(jSPPanel); |
---|
1293 | 1322 | oe.treePanel.Return(); |
---|
1294 | 1323 | |
---|
1295 | | - oe.treePanel.add(copyOptionsPanel); |
---|
| 1324 | + oe.treePanel.add(versionManagerPanel); |
---|
1296 | 1325 | oe.treePanel.Return(); |
---|
1297 | | - cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
1298 | | - versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
1299 | | - sliderPane.preferredHeight = 1; |
---|
| 1326 | + versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 1327 | + versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); |
---|
| 1328 | + versionSliderPane.preferredHeight = 3; |
---|
1300 | 1329 | |
---|
1301 | 1330 | // mainPanel.setDividerLocation(0.1); //1.0); |
---|
1302 | 1331 | mainPanel.setResizeWeight(0.4); |
---|
.. | .. |
---|
1454 | 1483 | |
---|
1455 | 1484 | void EditObject(Object3D obj) |
---|
1456 | 1485 | { |
---|
| 1486 | + assert(obj instanceof Composite); |
---|
| 1487 | + |
---|
| 1488 | +// if (obj.versionlist == null) |
---|
| 1489 | +// { |
---|
| 1490 | +// obj.versionlist = new Object3D[100]; |
---|
| 1491 | +// obj.versionindex = -1; |
---|
| 1492 | +// } |
---|
| 1493 | + |
---|
1457 | 1494 | cRadio radioButton = new cRadio(obj.name); |
---|
1458 | 1495 | |
---|
1459 | 1496 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1478 | 1515 | |
---|
1479 | 1516 | oe.SetupViews(); |
---|
1480 | 1517 | |
---|
| 1518 | + if (Globals.DEBUG) |
---|
1481 | 1519 | System.out.println("SetupViews"); |
---|
1482 | 1520 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1483 | 1521 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
2139 | 2177 | shadow.material = new cMaterial(obj.material); |
---|
2140 | 2178 | shadow.material.diffuse = 0.0001f; |
---|
2141 | 2179 | shadow.material.specular = 0.0001f; |
---|
2142 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2180 | + shadow.material.opacity = 0.75f; |
---|
| 2181 | + |
---|
| 2182 | + AllocProjectedVertices(shadow); |
---|
| 2183 | + |
---|
| 2184 | + shadow.projectedVertices[1].x = 300; |
---|
2143 | 2185 | |
---|
2144 | 2186 | makeSomething(shadow); |
---|
2145 | 2187 | } |
---|
.. | .. |
---|
2660 | 2702 | } else |
---|
2661 | 2703 | if (source == loopItem || source == loopButton) |
---|
2662 | 2704 | { |
---|
| 2705 | + if (!group.selection.isEmpty()) |
---|
| 2706 | + { |
---|
2663 | 2707 | Composite csg = new GroupLeaf(); |
---|
2664 | 2708 | csg.count = 5; |
---|
2665 | | - group(csg); |
---|
2666 | 2709 | Composite child = new cGroup("Branch"); |
---|
2667 | 2710 | csg.addChild(child); |
---|
2668 | 2711 | child.addChild(csg); |
---|
| 2712 | + group(csg); |
---|
| 2713 | + } |
---|
2669 | 2714 | } else |
---|
2670 | 2715 | if (source == doubleItem) |
---|
2671 | 2716 | { |
---|
| 2717 | + if (!group.selection.isEmpty()) |
---|
| 2718 | + { |
---|
2672 | 2719 | Composite csg = new GroupLeaf("Fork"); |
---|
2673 | 2720 | csg.count = 5; |
---|
2674 | | - group(csg); |
---|
2675 | 2721 | Composite child = new cGroup("Branch A"); |
---|
2676 | 2722 | csg.addChild(child); |
---|
2677 | 2723 | child.addChild(csg); |
---|
2678 | 2724 | child = new cGroup("Branch B"); |
---|
2679 | 2725 | csg.addChild(child); |
---|
2680 | 2726 | child.addChild(csg); |
---|
| 2727 | + group(csg); |
---|
| 2728 | + } |
---|
2681 | 2729 | } else |
---|
2682 | 2730 | if (source == tripleItem) |
---|
2683 | 2731 | { |
---|
| 2732 | + if (!group.selection.isEmpty()) |
---|
| 2733 | + { |
---|
2684 | 2734 | Composite csg = new GroupLeaf("Trident"); |
---|
2685 | 2735 | csg.count = 4; |
---|
2686 | 2736 | group(csg); |
---|
.. | .. |
---|
2693 | 2743 | child = new cGroup(); |
---|
2694 | 2744 | csg.addChild(child); |
---|
2695 | 2745 | child.addChild(csg); |
---|
| 2746 | + } |
---|
2696 | 2747 | } else |
---|
2697 | 2748 | if (source == computeAOItem) |
---|
2698 | 2749 | { |
---|
.. | .. |
---|
3328 | 3379 | } else |
---|
3329 | 3380 | if (source == ungroupItem || source == ungroupButton) |
---|
3330 | 3381 | { |
---|
3331 | | - boolean hasRoot = false; |
---|
| 3382 | + boolean canUngroup = true; |
---|
3332 | 3383 | |
---|
3333 | 3384 | for (int i=0; i<group.selection.size(); i++) |
---|
3334 | 3385 | { |
---|
3335 | | - if (group.selection.get(i) == group) |
---|
| 3386 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3387 | + |
---|
| 3388 | + if (selectedItem.Size() == 0) |
---|
3336 | 3389 | { |
---|
3337 | | - hasRoot = true; |
---|
| 3390 | + // Cannot ungroup leaves |
---|
| 3391 | + canUngroup = false; |
---|
| 3392 | + break; |
---|
| 3393 | + } |
---|
| 3394 | + |
---|
| 3395 | + if (selectedItem == group) |
---|
| 3396 | + { |
---|
| 3397 | + // Cannot ungroup root |
---|
| 3398 | + canUngroup = false; |
---|
3338 | 3399 | break; |
---|
3339 | 3400 | } |
---|
3340 | 3401 | } |
---|
3341 | 3402 | |
---|
3342 | | - if (!hasRoot) |
---|
| 3403 | + if (canUngroup) |
---|
3343 | 3404 | { |
---|
3344 | 3405 | for (int i=0; i<group.selection.size(); i++) |
---|
3345 | 3406 | { |
---|
3346 | | - Ungroup(group.selection.get(i)); |
---|
| 3407 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3408 | + |
---|
| 3409 | + Ungroup(selectedItem); |
---|
3347 | 3410 | } |
---|
3348 | 3411 | |
---|
3349 | 3412 | ClearSelection(false); |
---|
.. | .. |
---|
3892 | 3955 | } else |
---|
3893 | 3956 | if (source == rootButton) |
---|
3894 | 3957 | { |
---|
| 3958 | + Replace(); |
---|
3895 | 3959 | Object3D obj; |
---|
3896 | 3960 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3897 | 3961 | { |
---|
.. | .. |
---|
3906 | 3970 | if (source == closeButton) |
---|
3907 | 3971 | { |
---|
3908 | 3972 | //System.out.println("CLOSE: " + buttonGroup.getSelection()); |
---|
| 3973 | + Replace(); |
---|
| 3974 | + |
---|
3909 | 3975 | cRadio ab; |
---|
3910 | 3976 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3911 | 3977 | { |
---|
.. | .. |
---|
4004 | 4070 | } else |
---|
4005 | 4071 | if(source instanceof cRadio) |
---|
4006 | 4072 | { |
---|
| 4073 | + Replace(); |
---|
| 4074 | + |
---|
4007 | 4075 | group.parent = keepparent; |
---|
4008 | 4076 | group.attributes = 0; |
---|
4009 | 4077 | //group.editWindow = null; |
---|
.. | .. |
---|
4028 | 4096 | |
---|
4029 | 4097 | copy = group; |
---|
4030 | 4098 | |
---|
4031 | | - SetUndoStates(); |
---|
4032 | | - |
---|
4033 | 4099 | //Globals.theRenderer.object = group; |
---|
4034 | 4100 | if(!useclient) |
---|
4035 | 4101 | { |
---|
.. | .. |
---|
4057 | 4123 | */ |
---|
4058 | 4124 | radio.layout.doClick(); |
---|
4059 | 4125 | |
---|
| 4126 | + assert(copy instanceof Composite); |
---|
| 4127 | + |
---|
| 4128 | + if (copy.versionlist == null) |
---|
| 4129 | + { |
---|
| 4130 | + copy.versionindex = -1; |
---|
| 4131 | + |
---|
| 4132 | + // Cannot work with loops |
---|
| 4133 | + // To fix this issue, we first mark all nodes above the root, |
---|
| 4134 | + // and check if any of these nodes are reachable below the root. |
---|
| 4135 | + Grafreed.grafreed.universe.TagObjects(copy, true); |
---|
| 4136 | + |
---|
| 4137 | + if (!copy.HasTags()) |
---|
| 4138 | + { |
---|
| 4139 | + copy.versionlist = new Object3D[100]; |
---|
| 4140 | + |
---|
| 4141 | + Save(true); |
---|
| 4142 | + } |
---|
| 4143 | + |
---|
| 4144 | + Grafreed.grafreed.universe.TagObjects(copy, false); |
---|
| 4145 | + } |
---|
| 4146 | + |
---|
| 4147 | + SetVersionStates(); |
---|
| 4148 | + |
---|
4060 | 4149 | ClearUnpinned(); |
---|
4061 | 4150 | |
---|
4062 | 4151 | //Grafreed.Assert(group != null); |
---|
.. | .. |
---|
4200 | 4289 | TouchTransform(obj); |
---|
4201 | 4290 | continue; |
---|
4202 | 4291 | } |
---|
4203 | | - if ((mask&2) != 0) // Scale |
---|
| 4292 | + if ((mask&2) != 0) // Scale/rotation |
---|
4204 | 4293 | { |
---|
4205 | 4294 | obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
4206 | 4295 | obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
.. | .. |
---|
4208 | 4297 | obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
4209 | 4298 | obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
4210 | 4299 | obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
4211 | | - } |
---|
4212 | | - if ((mask&4) != 0) // Rotation |
---|
4213 | | - { |
---|
4214 | | - // ? |
---|
4215 | 4300 | } |
---|
4216 | 4301 | if ((mask&1) != 0) // Translation |
---|
4217 | 4302 | { |
---|
.. | .. |
---|
5291 | 5376 | flashSelectionButton.setEnabled(enabled); |
---|
5292 | 5377 | |
---|
5293 | 5378 | clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5379 | + |
---|
| 5380 | + boolean allComposites = true; |
---|
| 5381 | + |
---|
| 5382 | + if (group.selection != null) |
---|
| 5383 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5384 | + { |
---|
| 5385 | + Object next = e.nextElement(); |
---|
| 5386 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
| 5387 | + { |
---|
| 5388 | + allComposites = false; |
---|
| 5389 | + break; |
---|
| 5390 | + } |
---|
| 5391 | + } |
---|
| 5392 | + |
---|
| 5393 | + rootButton.setEnabled(allComposites); |
---|
5294 | 5394 | } |
---|
5295 | 5395 | |
---|
5296 | 5396 | void refreshContents(boolean cp) |
---|
5297 | 5397 | { |
---|
| 5398 | + if (false) |
---|
5298 | 5399 | //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5299 | 5400 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5300 | 5401 | { |
---|
.. | .. |
---|
6188 | 6289 | private MenuItem lookAtItem; |
---|
6189 | 6290 | private MenuItem lookFromItem; |
---|
6190 | 6291 | private MenuItem switchViewItem; |
---|
6191 | | - private MenuItem cutItem; |
---|
| 6292 | + private JMenuItem cutItem; |
---|
6192 | 6293 | private MenuItem undoItem; |
---|
6193 | 6294 | private MenuItem redoItem; |
---|
6194 | 6295 | private JMenuItem duplicateItem; |
---|
6195 | | - private MenuItem cloneItem; |
---|
| 6296 | + private JMenuItem cloneItem; |
---|
6196 | 6297 | private MenuItem cloneSupportItem; |
---|
6197 | 6298 | private MenuItem overwriteGeoItem; |
---|
6198 | 6299 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6213 | 6314 | private MenuItem cloneGeometriesItem; |
---|
6214 | 6315 | private MenuItem shareGeometriesItem; |
---|
6215 | 6316 | private MenuItem mergeGeometriesItem; |
---|
6216 | | - private MenuItem copyItem; |
---|
| 6317 | + private JMenuItem copyItem; |
---|
6217 | 6318 | private MenuItem pasteItem; |
---|
6218 | | - private MenuItem pasteIntoItem; |
---|
6219 | | - private MenuItem pasteLinkItem; |
---|
6220 | | - private MenuItem pasteCloneItem; |
---|
6221 | | - private MenuItem pasteExpandItem; |
---|
6222 | | - private MenuItem deleteItem; |
---|
| 6319 | + private JMenuItem pasteIntoItem; |
---|
| 6320 | + private JMenuItem pasteLinkItem; |
---|
| 6321 | + private JMenuItem pasteCloneItem; |
---|
| 6322 | + private JMenuItem pasteExpandItem; |
---|
| 6323 | + private JMenuItem deleteItem; |
---|
6223 | 6324 | private MenuItem clearAllItem; |
---|
6224 | 6325 | private MenuItem genUVItem; |
---|
6225 | 6326 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6274 | 6375 | private MenuItem transformGeometryItem; |
---|
6275 | 6376 | private MenuItem transformChildrenItem; |
---|
6276 | 6377 | private MenuItem hideItem; |
---|
6277 | | - private MenuItem grabItem; |
---|
| 6378 | + private JMenuItem grabItem; |
---|
6278 | 6379 | private MenuItem backItem; |
---|
6279 | 6380 | private MenuItem frontItem; |
---|
6280 | 6381 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6287 | 6388 | private MenuItem switchTransfoItem; |
---|
6288 | 6389 | private MenuItem morphItem; |
---|
6289 | 6390 | private MenuItem linkerItem; |
---|
6290 | | - private MenuItem ungroupItem; |
---|
| 6391 | + private JMenuItem ungroupItem; |
---|
6291 | 6392 | private MenuItem editItem; |
---|
6292 | 6393 | private MenuItem openWindowItem; |
---|
6293 | 6394 | private MenuItem editLeafItem; |
---|