.. | .. |
---|
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 | |
---|
.. | .. |
---|
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 | // |
---|
.. | .. |
---|
923 | 934 | |
---|
924 | 935 | JTabbedPane resourcecontainer; |
---|
925 | 936 | cGridBag currenttab; |
---|
926 | | - boolean added; // patch for jar |
---|
| 937 | + //boolean added; // patch for jar |
---|
927 | 938 | |
---|
928 | 939 | int tabcount = 0; |
---|
929 | 940 | int colcount = 0; |
---|
.. | .. |
---|
940 | 951 | // System.out.println(); |
---|
941 | 952 | |
---|
942 | 953 | if (//rowcount == 0 || |
---|
943 | | - path.length == 1) |
---|
| 954 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
944 | 955 | { |
---|
945 | 956 | currenttab = new cGridBag(); |
---|
946 | | - added = false; |
---|
947 | 957 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
948 | 958 | currenttab.setName(tabname); |
---|
| 959 | + //added = false; |
---|
| 960 | + resourcecontainer.add(currenttab); |
---|
| 961 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
949 | 962 | rowcount = 1; |
---|
950 | 963 | colcount = 0; |
---|
951 | 964 | texturecount = 0; |
---|
.. | .. |
---|
953 | 966 | |
---|
954 | 967 | if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
955 | 968 | { |
---|
956 | | - if (!added) |
---|
| 969 | + //if (!added) |
---|
957 | 970 | { |
---|
958 | | - added = true; |
---|
959 | | - resourcecontainer.add(currenttab); |
---|
| 971 | + //added = true; |
---|
960 | 972 | String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
961 | | - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 973 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
962 | 974 | } |
---|
963 | 975 | |
---|
964 | 976 | AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
.. | .. |
---|
1043 | 1055 | // maxButton.addActionListener(this); |
---|
1044 | 1056 | } |
---|
1045 | 1057 | |
---|
1046 | | -// cButton gcButton; |
---|
1047 | | -// |
---|
| 1058 | + cButton gcButton; |
---|
| 1059 | + |
---|
1048 | 1060 | // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1049 | 1061 | // gcButton.setToolTipText("Garbage collect"); |
---|
1050 | 1062 | // gcButton.addActionListener(new ActionListener() |
---|
.. | .. |
---|
1059 | 1071 | collapseButton.setToolTipText("Collapse toolbar"); |
---|
1060 | 1072 | collapseButton.addActionListener(this); |
---|
1061 | 1073 | |
---|
1062 | | - oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1074 | + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1063 | 1075 | maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
1064 | 1076 | maximize3DButton.addActionListener(this); |
---|
1065 | 1077 | |
---|
.. | .. |
---|
1101 | 1113 | copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1102 | 1114 | deleteVersionButton.setToolTipText("Delete current version"); |
---|
1103 | 1115 | deleteVersionButton.addActionListener(this); |
---|
| 1116 | + deleteVersionButton.setEnabled(false); |
---|
1104 | 1117 | |
---|
1105 | 1118 | copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1106 | 1119 | previousVersionButton.setToolTipText("Previous version"); |
---|
.. | .. |
---|
1111 | 1124 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1112 | 1125 | restoreButton.setToolTipText("Undo (restore current version)"); |
---|
1113 | 1126 | restoreButton.addActionListener(this); |
---|
1114 | | - //restoreButton.setEnabled(false); |
---|
| 1127 | + restoreButton.setEnabled(false); |
---|
1115 | 1128 | |
---|
1116 | 1129 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1117 | 1130 | replaceButton.setToolTipText("Save (replace current version)"); |
---|
1118 | 1131 | replaceButton.addActionListener(this); |
---|
1119 | | - //replaceButton.setEnabled(false); |
---|
| 1132 | + replaceButton.setEnabled(false); |
---|
1120 | 1133 | |
---|
1121 | 1134 | copyOptionsPanel.add(updown); |
---|
1122 | 1135 | |
---|
.. | .. |
---|
1181 | 1194 | boxButton.setToolTipText("Create box"); |
---|
1182 | 1195 | boxButton.addActionListener(this); |
---|
1183 | 1196 | |
---|
| 1197 | + row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1198 | + superButton.setToolTipText("Create superellipsoid"); |
---|
| 1199 | + superButton.addActionListener(this); |
---|
| 1200 | + |
---|
1184 | 1201 | row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1185 | 1202 | sphereButton.setToolTipText("Create sphere"); |
---|
1186 | 1203 | sphereButton.addActionListener(this); |
---|
.. | .. |
---|
1192 | 1209 | row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1193 | 1210 | torusButton.setToolTipText("Create torus"); |
---|
1194 | 1211 | torusButton.addActionListener(this); |
---|
1195 | | - |
---|
1196 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1197 | | - superButton.setToolTipText("Create superellipsoid"); |
---|
1198 | | - superButton.addActionListener(this); |
---|
1199 | 1212 | |
---|
1200 | 1213 | if (Globals.ADVANCED) |
---|
1201 | 1214 | { |
---|
.. | .. |
---|
1245 | 1258 | cGridBag textures = new cGridBag(); |
---|
1246 | 1259 | |
---|
1247 | 1260 | CreateTexturePanel(textures); |
---|
| 1261 | + |
---|
| 1262 | + resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount())); |
---|
1248 | 1263 | |
---|
1249 | 1264 | oe.toolboxPanel.add(textures); |
---|
1250 | 1265 | |
---|
.. | .. |
---|
1498 | 1513 | |
---|
1499 | 1514 | oe.SetupViews(); |
---|
1500 | 1515 | |
---|
| 1516 | + if (Globals.DEBUG) |
---|
1501 | 1517 | System.out.println("SetupViews"); |
---|
1502 | 1518 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1503 | 1519 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
2159 | 2175 | shadow.material = new cMaterial(obj.material); |
---|
2160 | 2176 | shadow.material.diffuse = 0.0001f; |
---|
2161 | 2177 | shadow.material.specular = 0.0001f; |
---|
2162 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2178 | + shadow.material.opacity = 0.75f; |
---|
| 2179 | + |
---|
| 2180 | + AllocProjectedVertices(shadow); |
---|
| 2181 | + |
---|
| 2182 | + shadow.projectedVertices[1].x = 300; |
---|
2163 | 2183 | |
---|
2164 | 2184 | makeSomething(shadow); |
---|
2165 | 2185 | } |
---|
.. | .. |
---|
2680 | 2700 | } else |
---|
2681 | 2701 | if (source == loopItem || source == loopButton) |
---|
2682 | 2702 | { |
---|
| 2703 | + if (!group.selection.isEmpty()) |
---|
| 2704 | + { |
---|
2683 | 2705 | Composite csg = new GroupLeaf(); |
---|
2684 | 2706 | csg.count = 5; |
---|
2685 | | - group(csg); |
---|
2686 | 2707 | Composite child = new cGroup("Branch"); |
---|
2687 | 2708 | csg.addChild(child); |
---|
2688 | 2709 | child.addChild(csg); |
---|
| 2710 | + group(csg); |
---|
| 2711 | + } |
---|
2689 | 2712 | } else |
---|
2690 | 2713 | if (source == doubleItem) |
---|
2691 | 2714 | { |
---|
| 2715 | + if (!group.selection.isEmpty()) |
---|
| 2716 | + { |
---|
2692 | 2717 | Composite csg = new GroupLeaf("Fork"); |
---|
2693 | 2718 | csg.count = 5; |
---|
2694 | | - group(csg); |
---|
2695 | 2719 | Composite child = new cGroup("Branch A"); |
---|
2696 | 2720 | csg.addChild(child); |
---|
2697 | 2721 | child.addChild(csg); |
---|
2698 | 2722 | child = new cGroup("Branch B"); |
---|
2699 | 2723 | csg.addChild(child); |
---|
2700 | 2724 | child.addChild(csg); |
---|
| 2725 | + group(csg); |
---|
| 2726 | + } |
---|
2701 | 2727 | } else |
---|
2702 | 2728 | if (source == tripleItem) |
---|
2703 | 2729 | { |
---|
| 2730 | + if (!group.selection.isEmpty()) |
---|
| 2731 | + { |
---|
2704 | 2732 | Composite csg = new GroupLeaf("Trident"); |
---|
2705 | 2733 | csg.count = 4; |
---|
2706 | 2734 | group(csg); |
---|
.. | .. |
---|
2713 | 2741 | child = new cGroup(); |
---|
2714 | 2742 | csg.addChild(child); |
---|
2715 | 2743 | child.addChild(csg); |
---|
| 2744 | + } |
---|
2716 | 2745 | } else |
---|
2717 | 2746 | if (source == computeAOItem) |
---|
2718 | 2747 | { |
---|
.. | .. |
---|
3348 | 3377 | } else |
---|
3349 | 3378 | if (source == ungroupItem || source == ungroupButton) |
---|
3350 | 3379 | { |
---|
3351 | | - boolean hasRoot = false; |
---|
| 3380 | + boolean canUngroup = true; |
---|
3352 | 3381 | |
---|
3353 | 3382 | for (int i=0; i<group.selection.size(); i++) |
---|
3354 | 3383 | { |
---|
3355 | | - if (group.selection.get(i) == group) |
---|
| 3384 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3385 | + |
---|
| 3386 | + if (selectedItem.Size() == 0) |
---|
3356 | 3387 | { |
---|
3357 | | - hasRoot = true; |
---|
| 3388 | + // Cannot ungroup leaves |
---|
| 3389 | + canUngroup = false; |
---|
| 3390 | + break; |
---|
| 3391 | + } |
---|
| 3392 | + |
---|
| 3393 | + if (selectedItem == group) |
---|
| 3394 | + { |
---|
| 3395 | + // Cannot ungroup root |
---|
| 3396 | + canUngroup = false; |
---|
3358 | 3397 | break; |
---|
3359 | 3398 | } |
---|
3360 | 3399 | } |
---|
3361 | 3400 | |
---|
3362 | | - if (!hasRoot) |
---|
| 3401 | + if (canUngroup) |
---|
3363 | 3402 | { |
---|
3364 | 3403 | for (int i=0; i<group.selection.size(); i++) |
---|
3365 | 3404 | { |
---|
3366 | | - Ungroup(group.selection.get(i)); |
---|
| 3405 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3406 | + |
---|
| 3407 | + Ungroup(selectedItem); |
---|
3367 | 3408 | } |
---|
3368 | 3409 | |
---|
3369 | 3410 | ClearSelection(false); |
---|
.. | .. |
---|
4083 | 4124 | copy.versionlist = new Object3D[100]; |
---|
4084 | 4125 | copy.versionindex = -1; |
---|
4085 | 4126 | |
---|
4086 | | - Save(true); |
---|
| 4127 | + // Cannot work with loops |
---|
| 4128 | + // To fix this issue, first mark all nodes above the root, |
---|
| 4129 | + // and check if any of these nodes are reachable below the root. |
---|
| 4130 | + //Save(true); |
---|
4087 | 4131 | } |
---|
4088 | 4132 | |
---|
4089 | 4133 | SetVersionStates(); |
---|
.. | .. |
---|
5325 | 5369 | |
---|
5326 | 5370 | boolean allComposites = true; |
---|
5327 | 5371 | |
---|
| 5372 | + if (group.selection != null) |
---|
5328 | 5373 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
5329 | 5374 | { |
---|
5330 | | - if (!(e.nextElement() instanceof Composite)) |
---|
| 5375 | + Object next = e.nextElement(); |
---|
| 5376 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
5331 | 5377 | { |
---|
5332 | 5378 | allComposites = false; |
---|
5333 | 5379 | break; |
---|
.. | .. |
---|
6232 | 6278 | private MenuItem lookAtItem; |
---|
6233 | 6279 | private MenuItem lookFromItem; |
---|
6234 | 6280 | private MenuItem switchViewItem; |
---|
6235 | | - private MenuItem cutItem; |
---|
| 6281 | + private JMenuItem cutItem; |
---|
6236 | 6282 | private MenuItem undoItem; |
---|
6237 | 6283 | private MenuItem redoItem; |
---|
6238 | 6284 | private JMenuItem duplicateItem; |
---|
6239 | | - private MenuItem cloneItem; |
---|
| 6285 | + private JMenuItem cloneItem; |
---|
6240 | 6286 | private MenuItem cloneSupportItem; |
---|
6241 | 6287 | private MenuItem overwriteGeoItem; |
---|
6242 | 6288 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6257 | 6303 | private MenuItem cloneGeometriesItem; |
---|
6258 | 6304 | private MenuItem shareGeometriesItem; |
---|
6259 | 6305 | private MenuItem mergeGeometriesItem; |
---|
6260 | | - private MenuItem copyItem; |
---|
| 6306 | + private JMenuItem copyItem; |
---|
6261 | 6307 | private MenuItem pasteItem; |
---|
6262 | | - private MenuItem pasteIntoItem; |
---|
6263 | | - private MenuItem pasteLinkItem; |
---|
6264 | | - private MenuItem pasteCloneItem; |
---|
6265 | | - private MenuItem pasteExpandItem; |
---|
6266 | | - private MenuItem deleteItem; |
---|
| 6308 | + private JMenuItem pasteIntoItem; |
---|
| 6309 | + private JMenuItem pasteLinkItem; |
---|
| 6310 | + private JMenuItem pasteCloneItem; |
---|
| 6311 | + private JMenuItem pasteExpandItem; |
---|
| 6312 | + private JMenuItem deleteItem; |
---|
6267 | 6313 | private MenuItem clearAllItem; |
---|
6268 | 6314 | private MenuItem genUVItem; |
---|
6269 | 6315 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6318 | 6364 | private MenuItem transformGeometryItem; |
---|
6319 | 6365 | private MenuItem transformChildrenItem; |
---|
6320 | 6366 | private MenuItem hideItem; |
---|
6321 | | - private MenuItem grabItem; |
---|
| 6367 | + private JMenuItem grabItem; |
---|
6322 | 6368 | private MenuItem backItem; |
---|
6323 | 6369 | private MenuItem frontItem; |
---|
6324 | 6370 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6331 | 6377 | private MenuItem switchTransfoItem; |
---|
6332 | 6378 | private MenuItem morphItem; |
---|
6333 | 6379 | private MenuItem linkerItem; |
---|
6334 | | - private MenuItem ungroupItem; |
---|
| 6380 | + private JMenuItem ungroupItem; |
---|
6335 | 6381 | private MenuItem editItem; |
---|
6336 | 6382 | private MenuItem openWindowItem; |
---|
6337 | 6383 | private MenuItem editLeafItem; |
---|