.. | .. |
---|
415 | 415 | this.copy = this.group = group; |
---|
416 | 416 | //selectees = this.group.selectees; |
---|
417 | 417 | |
---|
| 418 | + assert(false); |
---|
| 419 | + |
---|
418 | 420 | if (copy.versionlist == null) |
---|
419 | 421 | { |
---|
420 | 422 | copy.versionlist = new Object3D[100]; |
---|
421 | 423 | copy.versionindex = -1; |
---|
422 | 424 | |
---|
423 | | - Save(true); |
---|
| 425 | + //Save(true); |
---|
424 | 426 | } |
---|
425 | 427 | |
---|
426 | 428 | if(ui) |
---|
.. | .. |
---|
449 | 451 | copy.versionlist = new Object3D[100]; |
---|
450 | 452 | copy.versionindex = -1; |
---|
451 | 453 | |
---|
452 | | - Save(true); |
---|
| 454 | + //Save(true); |
---|
453 | 455 | } |
---|
454 | 456 | } |
---|
455 | 457 | |
---|
.. | .. |
---|
569 | 571 | // pasteExpandItem.addActionListener(this); |
---|
570 | 572 | //menu.add("-"); |
---|
571 | 573 | oe.jTree.popup.addSeparator(); |
---|
572 | | - |
---|
573 | | - deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
574 | | - deleteItem.addActionListener(this); |
---|
575 | 574 | |
---|
576 | 575 | if (Globals.ADVANCED) |
---|
577 | 576 | { |
---|
.. | .. |
---|
706 | 705 | setMasterItem.addActionListener(this); |
---|
707 | 706 | } |
---|
708 | 707 | |
---|
709 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
710 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
711 | | -// grabItem.addActionListener(this); |
---|
| 708 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 709 | + |
---|
712 | 710 | backItem = menu.add(new MenuItem("Back")); |
---|
713 | 711 | backItem.addActionListener(this); |
---|
714 | 712 | frontItem = menu.add(new MenuItem("Front")); |
---|
715 | 713 | frontItem.addActionListener(this); |
---|
716 | 714 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
717 | 715 | // compositeItem.addActionListener(this); |
---|
| 716 | + |
---|
| 717 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 718 | + grabItem.addActionListener(this); |
---|
718 | 719 | |
---|
719 | 720 | if (Globals.ADVANCED) |
---|
720 | 721 | { |
---|
.. | .. |
---|
723 | 724 | } |
---|
724 | 725 | ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
725 | 726 | ungroupItem.addActionListener(this); |
---|
| 727 | + |
---|
| 728 | + oe.jTree.popup.addSeparator(); |
---|
| 729 | + |
---|
| 730 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 731 | + deleteItem.addActionListener(this); |
---|
726 | 732 | |
---|
727 | 733 | // menu.add("-"); |
---|
728 | 734 | // |
---|
.. | .. |
---|
928 | 934 | |
---|
929 | 935 | JTabbedPane resourcecontainer; |
---|
930 | 936 | cGridBag currenttab; |
---|
931 | | - boolean added; // patch for jar |
---|
| 937 | + //boolean added; // patch for jar |
---|
932 | 938 | |
---|
933 | 939 | int tabcount = 0; |
---|
934 | 940 | int colcount = 0; |
---|
.. | .. |
---|
940 | 946 | |
---|
941 | 947 | public void ResourceCallBack(String[] path) |
---|
942 | 948 | { |
---|
943 | | - for (int i = 0; i < path.length; i++) |
---|
944 | | - System.out.print(path[i] + "/"); |
---|
945 | | - System.out.println(); |
---|
| 949 | +// for (int i = 0; i < path.length; i++) |
---|
| 950 | +// System.out.print(path[i] + "/"); |
---|
| 951 | +// System.out.println(); |
---|
946 | 952 | |
---|
947 | 953 | if (//rowcount == 0 || |
---|
948 | | - path.length == 1) |
---|
| 954 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
949 | 955 | { |
---|
950 | 956 | currenttab = new cGridBag(); |
---|
951 | | - added = false; |
---|
952 | 957 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
953 | 958 | currenttab.setName(tabname); |
---|
| 959 | + //added = false; |
---|
| 960 | + resourcecontainer.add(currenttab); |
---|
| 961 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
954 | 962 | rowcount = 1; |
---|
955 | 963 | colcount = 0; |
---|
956 | 964 | texturecount = 0; |
---|
.. | .. |
---|
958 | 966 | |
---|
959 | 967 | if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
960 | 968 | { |
---|
961 | | - if (!added) |
---|
| 969 | + //if (!added) |
---|
962 | 970 | { |
---|
963 | | - added = true; |
---|
964 | | - resourcecontainer.add(currenttab); |
---|
| 971 | + //added = true; |
---|
965 | 972 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
966 | | - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 973 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
967 | 974 | } |
---|
968 | 975 | |
---|
969 | 976 | AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
.. | .. |
---|
1031 | 1038 | oe.radioPanel.add(dummyButton); |
---|
1032 | 1039 | oe.buttonGroup.add(dummyButton); |
---|
1033 | 1040 | */ |
---|
1034 | | - cGridBag copyOptionsPanel = new cGridBag(); |
---|
| 1041 | + cGridBag versionManagerPanel = new cGridBag(); |
---|
1035 | 1042 | |
---|
1036 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 1043 | + versionManagerPanel.preferredHeight = 4; |
---|
1037 | 1044 | |
---|
1038 | 1045 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
1039 | 1046 | |
---|
.. | .. |
---|
1064 | 1071 | collapseButton.setToolTipText("Collapse toolbar"); |
---|
1065 | 1072 | collapseButton.addActionListener(this); |
---|
1066 | 1073 | |
---|
1067 | | - oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1074 | + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1068 | 1075 | maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
1069 | 1076 | maximize3DButton.addActionListener(this); |
---|
1070 | 1077 | |
---|
.. | .. |
---|
1099 | 1106 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
1100 | 1107 | restoreCameraButton.addActionListener(this); |
---|
1101 | 1108 | |
---|
1102 | | - 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); |
---|
1103 | 1110 | saveVersionButton.setToolTipText("Duplicate current version"); |
---|
1104 | 1111 | saveVersionButton.addActionListener(this); |
---|
1105 | 1112 | |
---|
1106 | | - copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1113 | + versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1107 | 1114 | deleteVersionButton.setToolTipText("Delete current version"); |
---|
1108 | 1115 | deleteVersionButton.addActionListener(this); |
---|
| 1116 | + deleteVersionButton.setEnabled(false); |
---|
1109 | 1117 | |
---|
1110 | | - copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1118 | + versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1111 | 1119 | previousVersionButton.setToolTipText("Previous version"); |
---|
1112 | 1120 | previousVersionButton.addActionListener(this); |
---|
1113 | 1121 | previousVersionButton.setEnabled(false); |
---|
.. | .. |
---|
1116 | 1124 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1117 | 1125 | restoreButton.setToolTipText("Undo (restore current version)"); |
---|
1118 | 1126 | restoreButton.addActionListener(this); |
---|
1119 | | - //restoreButton.setEnabled(false); |
---|
| 1127 | + restoreButton.setEnabled(false); |
---|
1120 | 1128 | |
---|
1121 | 1129 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1122 | 1130 | replaceButton.setToolTipText("Save (replace current version)"); |
---|
1123 | 1131 | replaceButton.addActionListener(this); |
---|
1124 | | - //replaceButton.setEnabled(false); |
---|
| 1132 | + replaceButton.setEnabled(false); |
---|
1125 | 1133 | |
---|
1126 | | - copyOptionsPanel.add(updown); |
---|
| 1134 | + versionManagerPanel.add(updown); |
---|
1127 | 1135 | |
---|
1128 | | - copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1136 | + versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1129 | 1137 | nextVersionButton.setToolTipText("Next version"); |
---|
1130 | 1138 | nextVersionButton.addActionListener(this); |
---|
1131 | 1139 | nextVersionButton.setEnabled(false); |
---|
.. | .. |
---|
1186 | 1194 | boxButton.setToolTipText("Create box"); |
---|
1187 | 1195 | boxButton.addActionListener(this); |
---|
1188 | 1196 | |
---|
| 1197 | + row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1198 | + superButton.setToolTipText("Create superellipsoid"); |
---|
| 1199 | + superButton.addActionListener(this); |
---|
| 1200 | + |
---|
1189 | 1201 | row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1190 | 1202 | sphereButton.setToolTipText("Create sphere"); |
---|
1191 | 1203 | sphereButton.addActionListener(this); |
---|
.. | .. |
---|
1197 | 1209 | row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1198 | 1210 | torusButton.setToolTipText("Create torus"); |
---|
1199 | 1211 | torusButton.addActionListener(this); |
---|
1200 | | - |
---|
1201 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1202 | | - superButton.setToolTipText("Create superellipsoid"); |
---|
1203 | | - superButton.addActionListener(this); |
---|
1204 | 1212 | |
---|
1205 | 1213 | if (Globals.ADVANCED) |
---|
1206 | 1214 | { |
---|
.. | .. |
---|
1250 | 1258 | cGridBag textures = new cGridBag(); |
---|
1251 | 1259 | |
---|
1252 | 1260 | CreateTexturePanel(textures); |
---|
| 1261 | + |
---|
| 1262 | + resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); |
---|
1253 | 1263 | |
---|
1254 | 1264 | oe.toolboxPanel.add(textures); |
---|
1255 | 1265 | |
---|
.. | .. |
---|
1301 | 1311 | |
---|
1302 | 1312 | cGridBag jSPPanel = new cGridBag(); |
---|
1303 | 1313 | |
---|
| 1314 | + jSPPanel.preferredHeight = 20; |
---|
| 1315 | + |
---|
1304 | 1316 | JScrollPane jSP; |
---|
1305 | 1317 | //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); |
---|
1306 | 1318 | jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); |
---|
.. | .. |
---|
1309 | 1321 | oe.treePanel.add(jSPPanel); |
---|
1310 | 1322 | oe.treePanel.Return(); |
---|
1311 | 1323 | |
---|
1312 | | - oe.treePanel.add(copyOptionsPanel); |
---|
| 1324 | + oe.treePanel.add(versionManagerPanel); |
---|
1313 | 1325 | oe.treePanel.Return(); |
---|
1314 | | - cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
1315 | | - versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
1316 | | - sliderPane.preferredHeight = 1; |
---|
| 1326 | + versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 1327 | + versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); |
---|
| 1328 | + versionSliderPane.preferredHeight = 3; |
---|
1317 | 1329 | |
---|
1318 | 1330 | // mainPanel.setDividerLocation(0.1); //1.0); |
---|
1319 | 1331 | mainPanel.setResizeWeight(0.4); |
---|
.. | .. |
---|
1503 | 1515 | |
---|
1504 | 1516 | oe.SetupViews(); |
---|
1505 | 1517 | |
---|
| 1518 | + if (Globals.DEBUG) |
---|
1506 | 1519 | System.out.println("SetupViews"); |
---|
1507 | 1520 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1508 | 1521 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
2164 | 2177 | shadow.material = new cMaterial(obj.material); |
---|
2165 | 2178 | shadow.material.diffuse = 0.0001f; |
---|
2166 | 2179 | shadow.material.specular = 0.0001f; |
---|
2167 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2180 | + shadow.material.opacity = 0.75f; |
---|
| 2181 | + |
---|
| 2182 | + AllocProjectedVertices(shadow); |
---|
| 2183 | + |
---|
| 2184 | + shadow.projectedVertices[1].x = 300; |
---|
2168 | 2185 | |
---|
2169 | 2186 | makeSomething(shadow); |
---|
2170 | 2187 | } |
---|
.. | .. |
---|
3953 | 3970 | if (source == closeButton) |
---|
3954 | 3971 | { |
---|
3955 | 3972 | //System.out.println("CLOSE: " + buttonGroup.getSelection()); |
---|
| 3973 | + Replace(); |
---|
| 3974 | + |
---|
3956 | 3975 | cRadio ab; |
---|
3957 | 3976 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3958 | 3977 | { |
---|
.. | .. |
---|
4051 | 4070 | } else |
---|
4052 | 4071 | if(source instanceof cRadio) |
---|
4053 | 4072 | { |
---|
| 4073 | + Replace(); |
---|
| 4074 | + |
---|
4054 | 4075 | group.parent = keepparent; |
---|
4055 | 4076 | group.attributes = 0; |
---|
4056 | 4077 | //group.editWindow = null; |
---|
.. | .. |
---|
4106 | 4127 | |
---|
4107 | 4128 | if (copy.versionlist == null) |
---|
4108 | 4129 | { |
---|
4109 | | - copy.versionlist = new Object3D[100]; |
---|
4110 | 4130 | copy.versionindex = -1; |
---|
4111 | 4131 | |
---|
4112 | | - Save(true); |
---|
| 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); |
---|
4113 | 4145 | } |
---|
4114 | 4146 | |
---|
4115 | 4147 | SetVersionStates(); |
---|
.. | .. |
---|
4257 | 4289 | TouchTransform(obj); |
---|
4258 | 4290 | continue; |
---|
4259 | 4291 | } |
---|
4260 | | - if ((mask&2) != 0) // Scale |
---|
| 4292 | + if ((mask&2) != 0) // Scale/rotation |
---|
4261 | 4293 | { |
---|
4262 | 4294 | obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
4263 | 4295 | obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
.. | .. |
---|
4265 | 4297 | obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
4266 | 4298 | obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
4267 | 4299 | obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
4268 | | - } |
---|
4269 | | - if ((mask&4) != 0) // Rotation |
---|
4270 | | - { |
---|
4271 | | - // ? |
---|
4272 | 4300 | } |
---|
4273 | 4301 | if ((mask&1) != 0) // Translation |
---|
4274 | 4302 | { |
---|
.. | .. |
---|
5354 | 5382 | if (group.selection != null) |
---|
5355 | 5383 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
5356 | 5384 | { |
---|
5357 | | - if (!(e.nextElement() instanceof Composite)) |
---|
| 5385 | + Object next = e.nextElement(); |
---|
| 5386 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
5358 | 5387 | { |
---|
5359 | 5388 | allComposites = false; |
---|
5360 | 5389 | break; |
---|
.. | .. |
---|
5366 | 5395 | |
---|
5367 | 5396 | void refreshContents(boolean cp) |
---|
5368 | 5397 | { |
---|
| 5398 | + if (false) |
---|
5369 | 5399 | //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5370 | 5400 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5371 | 5401 | { |
---|
.. | .. |
---|
6345 | 6375 | private MenuItem transformGeometryItem; |
---|
6346 | 6376 | private MenuItem transformChildrenItem; |
---|
6347 | 6377 | private MenuItem hideItem; |
---|
6348 | | - private MenuItem grabItem; |
---|
| 6378 | + private JMenuItem grabItem; |
---|
6349 | 6379 | private MenuItem backItem; |
---|
6350 | 6380 | private MenuItem frontItem; |
---|
6351 | 6381 | private MenuItem cameraItem; |
---|