.. | .. |
---|
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 |
---|
.. | .. |
---|
42 | 42 | }); |
---|
43 | 43 | } |
---|
44 | 44 | |
---|
45 | | - public void AddTextureButton(String f, final String t, cGridBag row) |
---|
| 45 | + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) |
---|
46 | 46 | { |
---|
47 | 47 | cButton textureButton; |
---|
48 | | - final String path = "textures/" + f + "/"; // + t; |
---|
| 48 | + final String path = "textures/" + f + "/" + c + "/"; // + t; |
---|
49 | 49 | row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); |
---|
50 | | - textureButton.setToolTipText(f + "s"); |
---|
| 50 | + textureButton.setToolTipText(c + count); |
---|
51 | 51 | textureButton.addActionListener(new ActionListener() |
---|
52 | 52 | { |
---|
53 | 53 | @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) |
---|
.. | .. |
---|
350 | 359 | |
---|
351 | 360 | public void ChangeTexture(String texture) |
---|
352 | 361 | { |
---|
353 | | - cameraView.repaint(); |
---|
| 362 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 363 | + { |
---|
| 364 | + Object3D obj = group.selection.get(i); |
---|
| 365 | + obj.SetPigmentTexture("@" + texture); |
---|
| 366 | + } |
---|
| 367 | + |
---|
| 368 | + refreshContents(); |
---|
| 369 | + } |
---|
| 370 | + |
---|
| 371 | + public void Show3DView() |
---|
| 372 | + { |
---|
| 373 | + // bug |
---|
| 374 | + //gridPanel.setDividerLocation(1.0); |
---|
| 375 | + //bigPanel.setDividerLocation(0.0); |
---|
| 376 | + bigThree.ClearUI(); |
---|
| 377 | + bigThree.add(centralPanel); |
---|
| 378 | + bigThree.FlushUI(); |
---|
354 | 379 | } |
---|
355 | 380 | |
---|
356 | 381 | //ObjEditor objEditor; |
---|
.. | .. |
---|
394 | 419 | { |
---|
395 | 420 | copy.versionlist = new Object3D[100]; |
---|
396 | 421 | copy.versionindex = -1; |
---|
| 422 | + |
---|
| 423 | + Save(true); |
---|
397 | 424 | } |
---|
398 | 425 | |
---|
399 | 426 | if(ui) |
---|
.. | .. |
---|
513 | 540 | // menu.add("-"); |
---|
514 | 541 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
515 | 542 | duplicateItem.addActionListener(this); |
---|
516 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 543 | + |
---|
| 544 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
517 | 545 | cloneItem.addActionListener(this); |
---|
518 | | - if (Globals.ADVANCED) |
---|
| 546 | + //if (Globals.ADVANCED) |
---|
519 | 547 | { |
---|
520 | 548 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
521 | 549 | cloneSupportItem.addActionListener(this); |
---|
522 | 550 | } |
---|
| 551 | + oe.jTree.popup.addSeparator(); |
---|
523 | 552 | menu.add("-"); |
---|
524 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 553 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
525 | 554 | cutItem.addActionListener(this); |
---|
526 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 555 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
527 | 556 | copyItem.addActionListener(this); |
---|
528 | 557 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
529 | 558 | pasteItem.addActionListener(this); |
---|
530 | 559 | |
---|
531 | | - menu.add("-"); |
---|
532 | | - pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
| 560 | + oe.jTree.popup.addSeparator(); |
---|
| 561 | + //menu.add("-"); |
---|
| 562 | + pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into")); |
---|
533 | 563 | pasteIntoItem.addActionListener(this); |
---|
534 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 564 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
535 | 565 | pasteLinkItem.addActionListener(this); |
---|
536 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 566 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
537 | 567 | pasteCloneItem.addActionListener(this); |
---|
538 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
| 568 | +// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
539 | 569 | // pasteExpandItem.addActionListener(this); |
---|
540 | | - menu.add("-"); |
---|
541 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
542 | | - deleteItem.addActionListener(this); |
---|
| 570 | + //menu.add("-"); |
---|
| 571 | + oe.jTree.popup.addSeparator(); |
---|
543 | 572 | |
---|
544 | 573 | if (Globals.ADVANCED) |
---|
545 | 574 | { |
---|
.. | .. |
---|
625 | 654 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
626 | 655 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
627 | 656 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
628 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
629 | 657 | oe.cameraMenu.add("-"); |
---|
630 | 658 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
631 | 659 | openWindowItem.addActionListener(this); |
---|
632 | | - editLeafItem.addActionListener(this); |
---|
633 | 660 | lookAtItem.addActionListener(this); |
---|
634 | 661 | //lookFromItem.addActinoListener(this); |
---|
635 | 662 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
676 | 703 | setMasterItem.addActionListener(this); |
---|
677 | 704 | } |
---|
678 | 705 | |
---|
679 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
680 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
681 | | -// grabItem.addActionListener(this); |
---|
| 706 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 707 | + |
---|
682 | 708 | backItem = menu.add(new MenuItem("Back")); |
---|
683 | 709 | backItem.addActionListener(this); |
---|
684 | 710 | frontItem = menu.add(new MenuItem("Front")); |
---|
.. | .. |
---|
686 | 712 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
687 | 713 | // compositeItem.addActionListener(this); |
---|
688 | 714 | |
---|
| 715 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 716 | + grabItem.addActionListener(this); |
---|
| 717 | + |
---|
689 | 718 | if (Globals.ADVANCED) |
---|
690 | 719 | { |
---|
691 | 720 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
692 | 721 | hideItem.addActionListener(this); |
---|
693 | 722 | } |
---|
694 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 723 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
695 | 724 | ungroupItem.addActionListener(this); |
---|
| 725 | + |
---|
| 726 | + oe.jTree.popup.addSeparator(); |
---|
| 727 | + |
---|
| 728 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 729 | + deleteItem.addActionListener(this); |
---|
696 | 730 | |
---|
697 | 731 | // menu.add("-"); |
---|
698 | 732 | // |
---|
.. | .. |
---|
877 | 911 | shareGeometriesItem.addActionListener(this); |
---|
878 | 912 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
879 | 913 | mergeGeometriesItem.addActionListener(this); |
---|
| 914 | + menu.add("-"); |
---|
| 915 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 916 | + editLeafItem.addActionListener(this); |
---|
880 | 917 | if (Globals.ADVANCED) |
---|
881 | 918 | { |
---|
882 | 919 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
895 | 932 | |
---|
896 | 933 | JTabbedPane resourcecontainer; |
---|
897 | 934 | cGridBag currenttab; |
---|
898 | | - boolean added; // patch for jar |
---|
| 935 | + //boolean added; // patch for jar |
---|
899 | 936 | |
---|
900 | 937 | int tabcount = 0; |
---|
901 | 938 | int colcount = 0; |
---|
902 | 939 | int rowcount = 0; |
---|
| 940 | + int texturecount = 0; |
---|
903 | 941 | |
---|
904 | 942 | int columns = 5; |
---|
905 | 943 | int rows = 7; |
---|
906 | 944 | |
---|
907 | 945 | public void ResourceCallBack(String[] path) |
---|
908 | 946 | { |
---|
909 | | - for (int i = 0; i < path.length; i++) |
---|
910 | | - System.out.print(path[i] + "/"); |
---|
911 | | - System.out.println(); |
---|
912 | | - if (rowcount == 0) |
---|
| 947 | +// for (int i = 0; i < path.length; i++) |
---|
| 948 | +// System.out.print(path[i] + "/"); |
---|
| 949 | +// System.out.println(); |
---|
| 950 | + |
---|
| 951 | + if (//rowcount == 0 || |
---|
| 952 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
913 | 953 | { |
---|
914 | 954 | currenttab = new cGridBag(); |
---|
915 | | - added = false; |
---|
916 | | - String tabname = String.valueOf((char)('A'+tabcount)); |
---|
| 955 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
917 | 956 | currenttab.setName(tabname); |
---|
| 957 | + //added = false; |
---|
| 958 | + resourcecontainer.add(currenttab); |
---|
| 959 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
918 | 960 | rowcount = 1; |
---|
| 961 | + colcount = 0; |
---|
| 962 | + texturecount = 0; |
---|
919 | 963 | } |
---|
920 | 964 | |
---|
921 | | - if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg")) |
---|
| 965 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
922 | 966 | { |
---|
923 | | - if (!added) |
---|
| 967 | + //if (!added) |
---|
924 | 968 | { |
---|
925 | | - added = true; |
---|
926 | | - resourcecontainer.add(currenttab); |
---|
927 | | - String tabname = String.valueOf((char)('A'+tabcount)); |
---|
928 | | - resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 969 | + //added = true; |
---|
| 970 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 971 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
929 | 972 | } |
---|
930 | 973 | |
---|
931 | | - AddTextureButton(path[0], path[1], currenttab); |
---|
| 974 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 975 | + |
---|
932 | 976 | if (++colcount >= columns) |
---|
933 | 977 | { |
---|
934 | 978 | colcount = 0; |
---|
.. | .. |
---|
949 | 993 | |
---|
950 | 994 | void CreateTexturePanel(cGridBag container) |
---|
951 | 995 | { |
---|
952 | | - resourcecontainer = new JTabbedPane(); |
---|
| 996 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
953 | 997 | container.add(resourcecontainer); |
---|
954 | 998 | |
---|
955 | 999 | Grafreed.ParseResources("textures", this); |
---|
.. | .. |
---|
972 | 1016 | //new Exception().printStackTrace(); |
---|
973 | 1017 | |
---|
974 | 1018 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
975 | | - oe.aConstraints.weightx = 1; |
---|
976 | | - oe.aConstraints.weighty = 0; |
---|
977 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
978 | | - oe.aConstraints.gridwidth = 100; |
---|
979 | | - oe.aConstraints.gridheight = 1; |
---|
980 | 1019 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
981 | 1020 | |
---|
982 | 1021 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
1009 | 1048 | |
---|
1010 | 1049 | if (Globals.ADVANCED) |
---|
1011 | 1050 | { |
---|
1012 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1013 | | - maxButton.setToolTipText("Maximize window"); |
---|
1014 | | - maxButton.addActionListener(this); |
---|
| 1051 | +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1052 | +// maxButton.setToolTipText("Maximize window"); |
---|
| 1053 | +// maxButton.addActionListener(this); |
---|
1015 | 1054 | } |
---|
| 1055 | + |
---|
| 1056 | + cButton gcButton; |
---|
| 1057 | + |
---|
| 1058 | +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1059 | +// gcButton.setToolTipText("Garbage collect"); |
---|
| 1060 | +// gcButton.addActionListener(new ActionListener() |
---|
| 1061 | +// { |
---|
| 1062 | +// public void actionPerformed(ActionEvent e) |
---|
| 1063 | +// { |
---|
| 1064 | +// System.gc(); |
---|
| 1065 | +// } |
---|
| 1066 | +// }); |
---|
| 1067 | + |
---|
| 1068 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1069 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1070 | + collapseButton.addActionListener(this); |
---|
| 1071 | + |
---|
| 1072 | + oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1073 | + maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1074 | + maximize3DButton.addActionListener(this); |
---|
| 1075 | + |
---|
| 1076 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1077 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1078 | + twoButton.addActionListener(this); |
---|
| 1079 | + this.fullscreenLayout = twoButton; |
---|
| 1080 | + |
---|
| 1081 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1082 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1083 | + threeButton.addActionListener(this); |
---|
| 1084 | + if (Globals.ADVANCED) |
---|
| 1085 | + { |
---|
| 1086 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1087 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1088 | + sixButton.addActionListener(this); |
---|
| 1089 | + } |
---|
| 1090 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1091 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1092 | +// sevenButton.addActionListener(this); |
---|
| 1093 | + // |
---|
1016 | 1094 | |
---|
1017 | 1095 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1018 | 1096 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
1057 | 1135 | nextVersionButton.addActionListener(this); |
---|
1058 | 1136 | nextVersionButton.setEnabled(false); |
---|
1059 | 1137 | |
---|
1060 | | - oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
1061 | | - liveCB.setToolTipText("Enable animation"); |
---|
1062 | | - liveCB.addItemListener(this); |
---|
1063 | | - |
---|
1064 | 1138 | oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1065 | 1139 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
1066 | 1140 | oneStepButton.addActionListener(this); |
---|
1067 | 1141 | |
---|
| 1142 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 1143 | + liveCB.setToolTipText("Enable animation"); |
---|
| 1144 | + liveCB.addItemListener(this); |
---|
| 1145 | + |
---|
1068 | 1146 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
1069 | 1147 | fastCB.setToolTipText("Fast mode"); |
---|
1070 | 1148 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
1091 | 1169 | |
---|
1092 | 1170 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
1093 | 1171 | |
---|
1094 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1095 | | - twoButton.setToolTipText("Show 3D view only"); |
---|
1096 | | - twoButton.addActionListener(this); |
---|
1097 | | - this.fullscreenLayout = twoButton; |
---|
1098 | | - |
---|
1099 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1100 | | - threeButton.setToolTipText("Show controls and 3D view"); |
---|
1101 | | - threeButton.addActionListener(this); |
---|
1102 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1103 | | - sixButton.setToolTipText("Show 3D view and controls"); |
---|
1104 | | - sixButton.addActionListener(this); |
---|
1105 | | -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1106 | | -// sevenButton.setToolTipText("3-column layout"); |
---|
1107 | | -// sevenButton.addActionListener(this); |
---|
1108 | | - // |
---|
1109 | 1172 | |
---|
1110 | 1173 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1111 | 1174 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1121 | 1184 | |
---|
1122 | 1185 | // INSERT |
---|
1123 | 1186 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1124 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1187 | + gridButton.setToolTipText("Create ground"); |
---|
1125 | 1188 | gridButton.addActionListener(this); |
---|
1126 | 1189 | |
---|
1127 | 1190 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1128 | 1191 | boxButton.setToolTipText("Create box"); |
---|
1129 | 1192 | boxButton.addActionListener(this); |
---|
| 1193 | + |
---|
| 1194 | + row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1195 | + superButton.setToolTipText("Create superellipsoid"); |
---|
| 1196 | + superButton.addActionListener(this); |
---|
1130 | 1197 | |
---|
1131 | 1198 | row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1132 | 1199 | sphereButton.setToolTipText("Create sphere"); |
---|
.. | .. |
---|
1139 | 1206 | row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1140 | 1207 | torusButton.setToolTipText("Create torus"); |
---|
1141 | 1208 | torusButton.addActionListener(this); |
---|
1142 | | - |
---|
1143 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1144 | | - superButton.setToolTipText("Create superellipsoid"); |
---|
1145 | | - superButton.addActionListener(this); |
---|
1146 | 1209 | |
---|
1147 | 1210 | if (Globals.ADVANCED) |
---|
1148 | 1211 | { |
---|
.. | .. |
---|
1413 | 1476 | |
---|
1414 | 1477 | void EditObject(Object3D obj) |
---|
1415 | 1478 | { |
---|
| 1479 | + assert(obj instanceof Composite); |
---|
| 1480 | + |
---|
| 1481 | +// if (obj.versionlist == null) |
---|
| 1482 | +// { |
---|
| 1483 | +// obj.versionlist = new Object3D[100]; |
---|
| 1484 | +// obj.versionindex = -1; |
---|
| 1485 | +// } |
---|
| 1486 | + |
---|
1416 | 1487 | cRadio radioButton = new cRadio(obj.name); |
---|
1417 | 1488 | |
---|
1418 | 1489 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1437 | 1508 | |
---|
1438 | 1509 | oe.SetupViews(); |
---|
1439 | 1510 | |
---|
| 1511 | + if (Globals.DEBUG) |
---|
1440 | 1512 | System.out.println("SetupViews"); |
---|
1441 | 1513 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1442 | 1514 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
1803 | 1875 | TreePath path; |
---|
1804 | 1876 | |
---|
1805 | 1877 | public TransferableTreePath(TreePath tp) { |
---|
1806 | | - path = tp; |
---|
| 1878 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1879 | + for (int i=0; i<objs.length; i++) |
---|
| 1880 | + { |
---|
| 1881 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1882 | + } |
---|
| 1883 | + path = new TreePath(objs); |
---|
1807 | 1884 | } |
---|
1808 | 1885 | |
---|
1809 | 1886 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
2093 | 2170 | shadow.material = new cMaterial(obj.material); |
---|
2094 | 2171 | shadow.material.diffuse = 0.0001f; |
---|
2095 | 2172 | shadow.material.specular = 0.0001f; |
---|
2096 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2173 | + shadow.material.opacity = 0.75f; |
---|
| 2174 | + |
---|
| 2175 | + AllocProjectedVertices(shadow); |
---|
| 2176 | + |
---|
| 2177 | + shadow.projectedVertices[1].x = 300; |
---|
2097 | 2178 | |
---|
2098 | 2179 | makeSomething(shadow); |
---|
2099 | 2180 | } |
---|
.. | .. |
---|
2614 | 2695 | } else |
---|
2615 | 2696 | if (source == loopItem || source == loopButton) |
---|
2616 | 2697 | { |
---|
| 2698 | + if (!group.selection.isEmpty()) |
---|
| 2699 | + { |
---|
2617 | 2700 | Composite csg = new GroupLeaf(); |
---|
2618 | 2701 | csg.count = 5; |
---|
2619 | | - group(csg); |
---|
2620 | 2702 | Composite child = new cGroup("Branch"); |
---|
2621 | 2703 | csg.addChild(child); |
---|
2622 | 2704 | child.addChild(csg); |
---|
| 2705 | + group(csg); |
---|
| 2706 | + } |
---|
2623 | 2707 | } else |
---|
2624 | 2708 | if (source == doubleItem) |
---|
2625 | 2709 | { |
---|
| 2710 | + if (!group.selection.isEmpty()) |
---|
| 2711 | + { |
---|
2626 | 2712 | Composite csg = new GroupLeaf("Fork"); |
---|
2627 | 2713 | csg.count = 5; |
---|
2628 | | - group(csg); |
---|
2629 | 2714 | Composite child = new cGroup("Branch A"); |
---|
2630 | 2715 | csg.addChild(child); |
---|
2631 | 2716 | child.addChild(csg); |
---|
2632 | 2717 | child = new cGroup("Branch B"); |
---|
2633 | 2718 | csg.addChild(child); |
---|
2634 | 2719 | child.addChild(csg); |
---|
| 2720 | + group(csg); |
---|
| 2721 | + } |
---|
2635 | 2722 | } else |
---|
2636 | 2723 | if (source == tripleItem) |
---|
2637 | 2724 | { |
---|
| 2725 | + if (!group.selection.isEmpty()) |
---|
| 2726 | + { |
---|
2638 | 2727 | Composite csg = new GroupLeaf("Trident"); |
---|
2639 | 2728 | csg.count = 4; |
---|
2640 | 2729 | group(csg); |
---|
.. | .. |
---|
2647 | 2736 | child = new cGroup(); |
---|
2648 | 2737 | csg.addChild(child); |
---|
2649 | 2738 | child.addChild(csg); |
---|
| 2739 | + } |
---|
2650 | 2740 | } else |
---|
2651 | 2741 | if (source == computeAOItem) |
---|
2652 | 2742 | { |
---|
.. | .. |
---|
2696 | 2786 | if (source == fullButton) |
---|
2697 | 2787 | { |
---|
2698 | 2788 | ToggleFullScreen(); |
---|
| 2789 | + } else |
---|
| 2790 | + if (source == collapseButton) |
---|
| 2791 | + { |
---|
| 2792 | + this.expandedLayout = radio.layout; |
---|
| 2793 | + CollapseToolbar(); |
---|
| 2794 | + } else |
---|
| 2795 | + if (source == maximize3DButton) |
---|
| 2796 | + { |
---|
| 2797 | + this.expandedLayout = radio.layout; |
---|
| 2798 | + radio.layout = twoButton; |
---|
| 2799 | + Show3DView(); |
---|
| 2800 | + CollapseToolbar(); |
---|
2699 | 2801 | } else |
---|
2700 | 2802 | if (source == previousVersionButton) |
---|
2701 | 2803 | { |
---|
.. | .. |
---|
3270 | 3372 | } else |
---|
3271 | 3373 | if (source == ungroupItem || source == ungroupButton) |
---|
3272 | 3374 | { |
---|
3273 | | - boolean hasRoot = false; |
---|
| 3375 | + boolean canUngroup = true; |
---|
3274 | 3376 | |
---|
3275 | 3377 | for (int i=0; i<group.selection.size(); i++) |
---|
3276 | 3378 | { |
---|
3277 | | - if (group.selection.get(i) == group) |
---|
| 3379 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3380 | + |
---|
| 3381 | + if (selectedItem.Size() == 0) |
---|
3278 | 3382 | { |
---|
3279 | | - hasRoot = true; |
---|
| 3383 | + // Cannot ungroup leaves |
---|
| 3384 | + canUngroup = false; |
---|
| 3385 | + break; |
---|
| 3386 | + } |
---|
| 3387 | + |
---|
| 3388 | + if (selectedItem == group) |
---|
| 3389 | + { |
---|
| 3390 | + // Cannot ungroup root |
---|
| 3391 | + canUngroup = false; |
---|
3280 | 3392 | break; |
---|
3281 | 3393 | } |
---|
3282 | 3394 | } |
---|
3283 | 3395 | |
---|
3284 | | - if (!hasRoot) |
---|
| 3396 | + if (canUngroup) |
---|
3285 | 3397 | { |
---|
3286 | 3398 | for (int i=0; i<group.selection.size(); i++) |
---|
3287 | 3399 | { |
---|
3288 | | - Ungroup(group.selection.get(i)); |
---|
| 3400 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3401 | + |
---|
| 3402 | + Ungroup(selectedItem); |
---|
3289 | 3403 | } |
---|
3290 | 3404 | |
---|
3291 | 3405 | ClearSelection(false); |
---|
.. | .. |
---|
3648 | 3762 | if (CameraPane.FULLSCREEN) |
---|
3649 | 3763 | fullscreenLayout = radio.layout; |
---|
3650 | 3764 | |
---|
3651 | | - // bug |
---|
3652 | | - //gridPanel.setDividerLocation(1.0); |
---|
3653 | | - //bigPanel.setDividerLocation(0.0); |
---|
3654 | | -// bigThree.remove(scenePanel); |
---|
3655 | | -// bigThree.remove(centralPanel); |
---|
3656 | | -// bigThree.remove(XYZPanel); |
---|
3657 | | -// aWindowConstraints.gridx = 0; |
---|
3658 | | -// aWindowConstraints.gridy = 0; |
---|
3659 | | -// aWindowConstraints.gridwidth = 1; |
---|
3660 | | -// // aConstraints.gridheight = 3; |
---|
3661 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3662 | | -// aWindowConstraints.weightx = 0; |
---|
3663 | | -// aWindowConstraints.weighty = 1; |
---|
3664 | | -// //bigThree.add(jtp, aWindowConstraints); |
---|
3665 | | -// aWindowConstraints.weightx = 1; |
---|
3666 | | -// aWindowConstraints.gridwidth = 3; |
---|
3667 | | -// // aConstraints.gridheight = 3; |
---|
3668 | | -// aWindowConstraints.gridx = 1; |
---|
3669 | | -// aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
3670 | | -// bigThree.add(centralPanel, aWindowConstraints); |
---|
3671 | | -// aWindowConstraints.weightx = 0; |
---|
3672 | | -// aWindowConstraints.gridx = 4; |
---|
3673 | | -// aWindowConstraints.gridwidth = 1; |
---|
3674 | | -// // aConstraints.gridheight = 3; |
---|
3675 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3676 | | -// //bigThree.add(XYZPanel, aWindowConstraints); |
---|
3677 | | -// scenePanel.setVisible(false); |
---|
3678 | | -// centralPanel.setVisible(true); |
---|
3679 | | -// XYZPanel.setVisible(false); |
---|
3680 | | - bigThree.ClearUI(); |
---|
3681 | | - bigThree.add(centralPanel); |
---|
3682 | | - bigThree.FlushUI(); |
---|
| 3765 | + Show3DView(); |
---|
3683 | 3766 | |
---|
3684 | 3767 | cameraView.requestFocusInWindow(); |
---|
3685 | 3768 | |
---|
.. | .. |
---|
3865 | 3948 | } else |
---|
3866 | 3949 | if (source == rootButton) |
---|
3867 | 3950 | { |
---|
| 3951 | + Replace(); |
---|
3868 | 3952 | Object3D obj; |
---|
3869 | 3953 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3870 | 3954 | { |
---|
.. | .. |
---|
4001 | 4085 | |
---|
4002 | 4086 | copy = group; |
---|
4003 | 4087 | |
---|
4004 | | - SetUndoStates(); |
---|
4005 | | - |
---|
4006 | 4088 | //Globals.theRenderer.object = group; |
---|
4007 | 4089 | if(!useclient) |
---|
4008 | 4090 | { |
---|
.. | .. |
---|
4030 | 4112 | */ |
---|
4031 | 4113 | radio.layout.doClick(); |
---|
4032 | 4114 | |
---|
| 4115 | + assert(copy instanceof Composite); |
---|
| 4116 | + |
---|
| 4117 | + if (copy.versionlist == null) |
---|
| 4118 | + { |
---|
| 4119 | + copy.versionlist = new Object3D[100]; |
---|
| 4120 | + copy.versionindex = -1; |
---|
| 4121 | + |
---|
| 4122 | + // Cannot work with loops |
---|
| 4123 | + // To fix this issue, first mark all nodes above the root, |
---|
| 4124 | + // and check if any of these nodes are reachable below the root. |
---|
| 4125 | + //Save(true); |
---|
| 4126 | + } |
---|
| 4127 | + |
---|
| 4128 | + SetVersionStates(); |
---|
| 4129 | + |
---|
4033 | 4130 | ClearUnpinned(); |
---|
4034 | 4131 | |
---|
4035 | 4132 | //Grafreed.Assert(group != null); |
---|
.. | .. |
---|
5264 | 5361 | flashSelectionButton.setEnabled(enabled); |
---|
5265 | 5362 | |
---|
5266 | 5363 | clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5364 | + |
---|
| 5365 | + boolean allComposites = true; |
---|
| 5366 | + |
---|
| 5367 | + if (group.selection != null) |
---|
| 5368 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5369 | + { |
---|
| 5370 | + Object next = e.nextElement(); |
---|
| 5371 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
| 5372 | + { |
---|
| 5373 | + allComposites = false; |
---|
| 5374 | + break; |
---|
| 5375 | + } |
---|
| 5376 | + } |
---|
| 5377 | + |
---|
| 5378 | + rootButton.setEnabled(allComposites); |
---|
5267 | 5379 | } |
---|
5268 | 5380 | |
---|
5269 | 5381 | void refreshContents(boolean cp) |
---|
.. | .. |
---|
5278 | 5390 | Object3D child = (Object3D) group.selection.get(i); |
---|
5279 | 5391 | |
---|
5280 | 5392 | objEditor.AddInfo(child, this, true); |
---|
5281 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5393 | +// System.err.println("info : " + child.GetPath()); |
---|
5282 | 5394 | } |
---|
5283 | 5395 | |
---|
5284 | 5396 | objEditor.SetText(); // jan 2014 |
---|
.. | .. |
---|
6161 | 6273 | private MenuItem lookAtItem; |
---|
6162 | 6274 | private MenuItem lookFromItem; |
---|
6163 | 6275 | private MenuItem switchViewItem; |
---|
6164 | | - private MenuItem cutItem; |
---|
| 6276 | + private JMenuItem cutItem; |
---|
6165 | 6277 | private MenuItem undoItem; |
---|
6166 | 6278 | private MenuItem redoItem; |
---|
6167 | 6279 | private JMenuItem duplicateItem; |
---|
6168 | | - private MenuItem cloneItem; |
---|
| 6280 | + private JMenuItem cloneItem; |
---|
6169 | 6281 | private MenuItem cloneSupportItem; |
---|
6170 | 6282 | private MenuItem overwriteGeoItem; |
---|
6171 | 6283 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6186 | 6298 | private MenuItem cloneGeometriesItem; |
---|
6187 | 6299 | private MenuItem shareGeometriesItem; |
---|
6188 | 6300 | private MenuItem mergeGeometriesItem; |
---|
6189 | | - private MenuItem copyItem; |
---|
| 6301 | + private JMenuItem copyItem; |
---|
6190 | 6302 | private MenuItem pasteItem; |
---|
6191 | | - private MenuItem pasteIntoItem; |
---|
6192 | | - private MenuItem pasteLinkItem; |
---|
6193 | | - private MenuItem pasteCloneItem; |
---|
6194 | | - private MenuItem pasteExpandItem; |
---|
6195 | | - private MenuItem deleteItem; |
---|
| 6303 | + private JMenuItem pasteIntoItem; |
---|
| 6304 | + private JMenuItem pasteLinkItem; |
---|
| 6305 | + private JMenuItem pasteCloneItem; |
---|
| 6306 | + private JMenuItem pasteExpandItem; |
---|
| 6307 | + private JMenuItem deleteItem; |
---|
6196 | 6308 | private MenuItem clearAllItem; |
---|
6197 | 6309 | private MenuItem genUVItem; |
---|
6198 | 6310 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6247 | 6359 | private MenuItem transformGeometryItem; |
---|
6248 | 6360 | private MenuItem transformChildrenItem; |
---|
6249 | 6361 | private MenuItem hideItem; |
---|
6250 | | - private MenuItem grabItem; |
---|
| 6362 | + private JMenuItem grabItem; |
---|
6251 | 6363 | private MenuItem backItem; |
---|
6252 | 6364 | private MenuItem frontItem; |
---|
6253 | 6365 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6260 | 6372 | private MenuItem switchTransfoItem; |
---|
6261 | 6373 | private MenuItem morphItem; |
---|
6262 | 6374 | private MenuItem linkerItem; |
---|
6263 | | - private MenuItem ungroupItem; |
---|
| 6375 | + private JMenuItem ungroupItem; |
---|
6264 | 6376 | private MenuItem editItem; |
---|
6265 | 6377 | private MenuItem openWindowItem; |
---|
6266 | 6378 | private MenuItem editLeafItem; |
---|