Normand Briere
2019-08-20 537f4ac57ae2b34f0a04fa63874c8ca6534c9a6d
GroupEditor.java
....@@ -29,7 +29,7 @@
2929 {
3030 cButton skyboxButton;
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
3434 skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
....@@ -46,7 +46,7 @@
4646 {
4747 cButton textureButton;
4848 final String path = "textures/" + f + "/" + c + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
5050 textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
....@@ -347,7 +347,7 @@
347347
348348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
349349 {
350
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351351
352352 AddSkyboxTab0(skyboxpane);
353353 AddSkyboxTab1(skyboxpane);
....@@ -415,12 +415,14 @@
415415 this.copy = this.group = group;
416416 //selectees = this.group.selectees;
417417
418
+ assert(false);
419
+
418420 if (copy.versionlist == null)
419421 {
420422 copy.versionlist = new Object3D[100];
421423 copy.versionindex = -1;
422424
423
- Save(true);
425
+ //Save(true);
424426 }
425427
426428 if(ui)
....@@ -449,7 +451,7 @@
449451 copy.versionlist = new Object3D[100];
450452 copy.versionindex = -1;
451453
452
- Save(true);
454
+ //Save(true);
453455 }
454456 }
455457
....@@ -540,33 +542,35 @@
540542 // menu.add("-");
541543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
542544 duplicateItem.addActionListener(this);
543
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
544547 cloneItem.addActionListener(this);
545
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
546549 {
547550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
548551 cloneSupportItem.addActionListener(this);
549552 }
553
+ oe.jTree.popup.addSeparator();
550554 menu.add("-");
551
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
552556 cutItem.addActionListener(this);
553
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
554558 copyItem.addActionListener(this);
555559 pasteItem = menu.add(new MenuItem("Paste"));
556560 pasteItem.addActionListener(this);
557561
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"));
560565 pasteIntoItem.addActionListener(this);
561
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
562567 pasteLinkItem.addActionListener(this);
563
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
564569 pasteCloneItem.addActionListener(this);
565
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
566571 // 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();
570574
571575 if (Globals.ADVANCED)
572576 {
....@@ -701,9 +705,8 @@
701705 setMasterItem.addActionListener(this);
702706 }
703707
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
+
707710 backItem = menu.add(new MenuItem("Back"));
708711 backItem.addActionListener(this);
709712 frontItem = menu.add(new MenuItem("Front"));
....@@ -711,13 +714,21 @@
711714 // compositeItem = menu.add(new MenuItem("Composite"));
712715 // compositeItem.addActionListener(this);
713716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
714720 if (Globals.ADVANCED)
715721 {
716722 hideItem = menu.add(new MenuItem("Hidden Group"));
717723 hideItem.addActionListener(this);
718724 }
719
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
720726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
721732
722733 // menu.add("-");
723734 //
....@@ -846,9 +857,9 @@
846857 hideleavesItem.addActionListener(this);
847858 showleavesItem = menu.add(new MenuItem("Show Leaves"));
848859 showleavesItem.addActionListener(this);
849
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
860
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
850861 markleavesItem.addActionListener(this);
851
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
862
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
852863 unmarkleavesItem.addActionListener(this);
853864 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
854865 rewindleavesItem.addActionListener(this);
....@@ -923,7 +934,7 @@
923934
924935 JTabbedPane resourcecontainer;
925936 cGridBag currenttab;
926
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
927938
928939 int tabcount = 0;
929940 int colcount = 0;
....@@ -940,28 +951,29 @@
940951 // System.out.println();
941952
942953 if (//rowcount == 0 ||
943
- path.length == 1)
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
944955 {
945956 currenttab = new cGridBag();
946
- added = false;
947957 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
949962 rowcount = 1;
950963 colcount = 0;
951964 texturecount = 0;
952965 }
953966
954
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
967
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
955968 {
956
- if (!added)
969
+ //if (!added)
957970 {
958
- added = true;
959
- resourcecontainer.add(currenttab);
971
+ //added = true;
960972 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
962974 }
963975
964
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
976
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
965977
966978 if (++colcount >= columns)
967979 {
....@@ -1026,9 +1038,9 @@
10261038 oe.radioPanel.add(dummyButton);
10271039 oe.buttonGroup.add(dummyButton);
10281040 */
1029
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
10301042
1031
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
10321044
10331045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10341046
....@@ -1055,25 +1067,25 @@
10551067 // }
10561068 // });
10571069
1058
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1070
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10591071 collapseButton.setToolTipText("Collapse toolbar");
10601072 collapseButton.addActionListener(this);
10611073
1062
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10631075 maximize3DButton.setToolTipText("Maximize 3D view");
10641076 maximize3DButton.addActionListener(this);
10651077
1066
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10671079 twoButton.setToolTipText("Show 3D view only");
10681080 twoButton.addActionListener(this);
10691081 this.fullscreenLayout = twoButton;
10701082
1071
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721084 threeButton.setToolTipText("Show controls and 3D view");
10731085 threeButton.addActionListener(this);
10741086 if (Globals.ADVANCED)
10751087 {
1076
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771089 sixButton.setToolTipText("Show 3D view and controls");
10781090 sixButton.addActionListener(this);
10791091 }
....@@ -1082,50 +1094,51 @@
10821094 // sevenButton.addActionListener(this);
10831095 //
10841096
1085
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861098 fullButton.setToolTipText("Full-screen window");
10871099 fullButton.addActionListener(this);
10881100
1089
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901102 screenfitButton.setToolTipText("Screen fit");
10911103 screenfitButton.addActionListener(this);
10921104
1093
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941106 restoreCameraButton.setToolTipText("Restore viewpoint");
10951107 restoreCameraButton.addActionListener(this);
10961108
1097
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10981110 saveVersionButton.setToolTipText("Duplicate current version");
10991111 saveVersionButton.addActionListener(this);
11001112
1101
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021114 deleteVersionButton.setToolTipText("Delete current version");
11031115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
11041117
1105
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061119 previousVersionButton.setToolTipText("Previous version");
11071120 previousVersionButton.addActionListener(this);
11081121 previousVersionButton.setEnabled(false);
11091122
11101123 cGridBag updown = new cGridBag().setVertical(true);
1111
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121125 restoreButton.setToolTipText("Undo (restore current version)");
11131126 restoreButton.addActionListener(this);
1114
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
11151128
1116
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171130 replaceButton.setToolTipText("Save (replace current version)");
11181131 replaceButton.addActionListener(this);
1119
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
11201133
1121
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
11221135
1123
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11241137 nextVersionButton.setToolTipText("Next version");
11251138 nextVersionButton.addActionListener(this);
11261139 nextVersionButton.setEnabled(false);
11271140
1128
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1141
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291142 oneStepButton.setToolTipText("Animate one step forward");
11301143 oneStepButton.addActionListener(this);
11311144
....@@ -1148,11 +1161,11 @@
11481161
11491162 if (Globals.ADVANCED)
11501163 {
1151
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11521165 snapobjectButton.addActionListener(this);
11531166 snapobjectButton.setToolTipText("Snap Object");
11541167
1155
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561169 fourButton.addActionListener(this);
11571170 fourButton.setToolTipText("Show control panel only");
11581171 }
....@@ -1160,11 +1173,11 @@
11601173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11611174
11621175
1163
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11641177 rootButton.setToolTipText("Open selection in new tab");
11651178 rootButton.addActionListener(this);
11661179
1167
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681181 closeButton.setToolTipText("Close tab");
11691182 closeButton.addActionListener(this);
11701183 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1173,38 +1186,38 @@
11731186 cGridBag row1 = new cGridBag();
11741187
11751188 // INSERT
1176
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1189
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771190 gridButton.setToolTipText("Create ground");
11781191 gridButton.addActionListener(this);
11791192
1180
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811194 boxButton.setToolTipText("Create box");
11821195 boxButton.addActionListener(this);
11831196
1184
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
- sphereButton.setToolTipText("Create sphere");
1186
- sphereButton.addActionListener(this);
1187
-
1188
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1189
- coneButton.setToolTipText("Create cone");
1190
- coneButton.addActionListener(this);
1191
-
1192
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
- torusButton.setToolTipText("Create torus");
1194
- torusButton.addActionListener(this);
1195
-
1196
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11971198 superButton.setToolTipText("Create superellipsoid");
11981199 superButton.addActionListener(this);
11991200
1201
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1202
+ sphereButton.setToolTipText("Create sphere");
1203
+ sphereButton.addActionListener(this);
1204
+
1205
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ coneButton.setToolTipText("Create cone");
1207
+ coneButton.addActionListener(this);
1208
+
1209
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ torusButton.setToolTipText("Create torus");
1211
+ torusButton.addActionListener(this);
1212
+
12001213 if (Globals.ADVANCED)
12011214 {
1202
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031216 kleinButton.setToolTipText("Create Klein bottle");
12041217 kleinButton.addActionListener(this);
12051218 }
12061219
1207
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081221 particlesButton.setToolTipText("Create particle system");
12091222 particlesButton.addActionListener(this);
12101223
....@@ -1212,31 +1225,31 @@
12121225
12131226 cGridBag row2 = new cGridBag();
12141227
1215
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161229 groupButton.setToolTipText("Create group");
12171230 groupButton.addActionListener(this);
12181231
1219
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201233 compositeButton.setToolTipText("Create composite");
12211234 compositeButton.addActionListener(this);
12221235
1223
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241237 switchButton.setToolTipText("Create item switcher");
12251238 switchButton.addActionListener(this);
12261239
1227
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281241 loopButton.setToolTipText("Create loop");
12291242 loopButton.addActionListener(this);
12301243
1231
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12321245 textureButton.setToolTipText("Create texture");
12331246 textureButton.addActionListener(this);
12341247
1235
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361249 overlayButton.setToolTipText("Create overlay");
12371250 overlayButton.addActionListener(this);
12381251
1239
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12401253 lightButton.setToolTipText("Create light");
12411254 lightButton.addActionListener(this);
12421255
....@@ -1246,6 +1259,11 @@
12461259
12471260 CreateTexturePanel(textures);
12481261
1262
+ int tabCount = resourcecontainer.getTabCount();
1263
+
1264
+ if (tabCount > 0)
1265
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1266
+
12491267 oe.toolboxPanel.add(textures);
12501268
12511269 textures.preferredHeight = 100;
....@@ -1253,11 +1271,11 @@
12531271 CreateSkyboxPanel(oe.skyboxPanel);
12541272
12551273 // EDIT panel
1256
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1274
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571275 editButton.setToolTipText("Pin selection controls");
12581276 editButton.addActionListener(this);
12591277
1260
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12611279 uneditButton.setToolTipText("Unpin and remove selection controls");
12621280 uneditButton.addActionListener(this);
12631281
....@@ -1265,7 +1283,7 @@
12651283 allParamsButton.setToolTipText("Show all controls");
12661284 allParamsButton.addActionListener(this);
12671285
1268
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1286
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12691287 clearPanelButton.setToolTipText("Clear all controls");
12701288 clearPanelButton.addActionListener(this);
12711289
....@@ -1273,7 +1291,7 @@
12731291 //unselectButton.setToolTipText("Unselect");
12741292 //unselectButton.addActionListener(this);
12751293
1276
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1294
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12771295 flashSelectionButton.setToolTipText("Highlight selection");
12781296 flashSelectionButton.addActionListener(this);
12791297
....@@ -1296,6 +1314,8 @@
12961314
12971315 cGridBag jSPPanel = new cGridBag();
12981316
1317
+ jSPPanel.preferredHeight = 20;
1318
+
12991319 JScrollPane jSP;
13001320 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13011321 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1304,11 +1324,11 @@
13041324 oe.treePanel.add(jSPPanel);
13051325 oe.treePanel.Return();
13061326
1307
- oe.treePanel.add(copyOptionsPanel);
1327
+ oe.treePanel.add(versionManagerPanel);
13081328 oe.treePanel.Return();
1309
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1310
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1311
- sliderPane.preferredHeight = 1;
1329
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1330
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1331
+ versionSliderPane.preferredHeight = 3;
13121332
13131333 // mainPanel.setDividerLocation(0.1); //1.0);
13141334 mainPanel.setResizeWeight(0.4);
....@@ -1498,6 +1518,7 @@
14981518
14991519 oe.SetupViews();
15001520
1521
+ if (Globals.DEBUG)
15011522 System.out.println("SetupViews");
15021523 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15031524 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2159,7 +2180,11 @@
21592180 shadow.material = new cMaterial(obj.material);
21602181 shadow.material.diffuse = 0.0001f;
21612182 shadow.material.specular = 0.0001f;
2162
- //shadow.projectedVertices[1].x = 300;
2183
+ shadow.material.opacity = 0.75f;
2184
+
2185
+ AllocProjectedVertices(shadow);
2186
+
2187
+ shadow.projectedVertices[1].x = 300;
21632188
21642189 makeSomething(shadow);
21652190 }
....@@ -2680,27 +2705,35 @@
26802705 } else
26812706 if (source == loopItem || source == loopButton)
26822707 {
2708
+ if (!group.selection.isEmpty())
2709
+ {
26832710 Composite csg = new GroupLeaf();
26842711 csg.count = 5;
2685
- group(csg);
26862712 Composite child = new cGroup("Branch");
26872713 csg.addChild(child);
26882714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
26892717 } else
26902718 if (source == doubleItem)
26912719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
26922722 Composite csg = new GroupLeaf("Fork");
26932723 csg.count = 5;
2694
- group(csg);
26952724 Composite child = new cGroup("Branch A");
26962725 csg.addChild(child);
26972726 child.addChild(csg);
26982727 child = new cGroup("Branch B");
26992728 csg.addChild(child);
27002729 child.addChild(csg);
2730
+ group(csg);
2731
+ }
27012732 } else
27022733 if (source == tripleItem)
27032734 {
2735
+ if (!group.selection.isEmpty())
2736
+ {
27042737 Composite csg = new GroupLeaf("Trident");
27052738 csg.count = 4;
27062739 group(csg);
....@@ -2713,6 +2746,7 @@
27132746 child = new cGroup();
27142747 csg.addChild(child);
27152748 child.addChild(csg);
2749
+ }
27162750 } else
27172751 if (source == computeAOItem)
27182752 {
....@@ -3348,22 +3382,34 @@
33483382 } else
33493383 if (source == ungroupItem || source == ungroupButton)
33503384 {
3351
- boolean hasRoot = false;
3385
+ boolean canUngroup = true;
33523386
33533387 for (int i=0; i<group.selection.size(); i++)
33543388 {
3355
- if (group.selection.get(i) == group)
3389
+ Object3D selectedItem = group.selection.get(i);
3390
+
3391
+ if (selectedItem.Size() == 0)
33563392 {
3357
- hasRoot = true;
3393
+ // Cannot ungroup leaves
3394
+ canUngroup = false;
3395
+ break;
3396
+ }
3397
+
3398
+ if (selectedItem == group)
3399
+ {
3400
+ // Cannot ungroup root
3401
+ canUngroup = false;
33583402 break;
33593403 }
33603404 }
33613405
3362
- if (!hasRoot)
3406
+ if (canUngroup)
33633407 {
33643408 for (int i=0; i<group.selection.size(); i++)
33653409 {
3366
- Ungroup(group.selection.get(i));
3410
+ Object3D selectedItem = group.selection.get(i);
3411
+
3412
+ Ungroup(selectedItem);
33673413 }
33683414
33693415 ClearSelection(false);
....@@ -3927,6 +3973,8 @@
39273973 if (source == closeButton)
39283974 {
39293975 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3976
+ Replace();
3977
+
39303978 cRadio ab;
39313979 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39323980 {
....@@ -4025,6 +4073,8 @@
40254073 } else
40264074 if(source instanceof cRadio)
40274075 {
4076
+ Replace();
4077
+
40284078 group.parent = keepparent;
40294079 group.attributes = 0;
40304080 //group.editWindow = null;
....@@ -4080,10 +4130,21 @@
40804130
40814131 if (copy.versionlist == null)
40824132 {
4083
- copy.versionlist = new Object3D[100];
40844133 copy.versionindex = -1;
40854134
4086
- Save(true);
4135
+ // Cannot work with loops
4136
+ // To fix this issue, we first mark all nodes above the root,
4137
+ // and check if any of these nodes are reachable below the root.
4138
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4139
+
4140
+ if (!copy.HasTags())
4141
+ {
4142
+ copy.versionlist = new Object3D[100];
4143
+
4144
+ Save(true);
4145
+ }
4146
+
4147
+ Grafreed.grafreed.universe.TagObjects(copy, false);
40874148 }
40884149
40894150 SetVersionStates();
....@@ -4231,7 +4292,7 @@
42314292 TouchTransform(obj);
42324293 continue;
42334294 }
4234
- if ((mask&2) != 0) // Scale
4295
+ if ((mask&2) != 0) // Scale/rotation
42354296 {
42364297 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42374298 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4239,10 +4300,6 @@
42394300 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42404301 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42414302 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4242
- }
4243
- if ((mask&4) != 0) // Rotation
4244
- {
4245
- // ?
42464303 }
42474304 if ((mask&1) != 0) // Translation
42484305 {
....@@ -5328,7 +5385,8 @@
53285385 if (group.selection != null)
53295386 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53305387 {
5331
- if (!(e.nextElement() instanceof Composite))
5388
+ Object next = e.nextElement();
5389
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53325390 {
53335391 allComposites = false;
53345392 break;
....@@ -5340,6 +5398,7 @@
53405398
53415399 void refreshContents(boolean cp)
53425400 {
5401
+ if (Globals.ADVANCED)
53435402 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53445403 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53455404 {
....@@ -6233,11 +6292,11 @@
62336292 private MenuItem lookAtItem;
62346293 private MenuItem lookFromItem;
62356294 private MenuItem switchViewItem;
6236
- private MenuItem cutItem;
6295
+ private JMenuItem cutItem;
62376296 private MenuItem undoItem;
62386297 private MenuItem redoItem;
62396298 private JMenuItem duplicateItem;
6240
- private MenuItem cloneItem;
6299
+ private JMenuItem cloneItem;
62416300 private MenuItem cloneSupportItem;
62426301 private MenuItem overwriteGeoItem;
62436302 private MenuItem overwriteMatItem;
....@@ -6258,13 +6317,13 @@
62586317 private MenuItem cloneGeometriesItem;
62596318 private MenuItem shareGeometriesItem;
62606319 private MenuItem mergeGeometriesItem;
6261
- private MenuItem copyItem;
6320
+ private JMenuItem copyItem;
62626321 private MenuItem pasteItem;
6263
- private MenuItem pasteIntoItem;
6264
- private MenuItem pasteLinkItem;
6265
- private MenuItem pasteCloneItem;
6266
- private MenuItem pasteExpandItem;
6267
- private MenuItem deleteItem;
6322
+ private JMenuItem pasteIntoItem;
6323
+ private JMenuItem pasteLinkItem;
6324
+ private JMenuItem pasteCloneItem;
6325
+ private JMenuItem pasteExpandItem;
6326
+ private JMenuItem deleteItem;
62686327 private MenuItem clearAllItem;
62696328 private MenuItem genUVItem;
62706329 private MenuItem genNormalsMESHItem;
....@@ -6319,7 +6378,7 @@
63196378 private MenuItem transformGeometryItem;
63206379 private MenuItem transformChildrenItem;
63216380 private MenuItem hideItem;
6322
- private MenuItem grabItem;
6381
+ private JMenuItem grabItem;
63236382 private MenuItem backItem;
63246383 private MenuItem frontItem;
63256384 private MenuItem cameraItem;
....@@ -6332,7 +6391,7 @@
63326391 private MenuItem switchTransfoItem;
63336392 private MenuItem morphItem;
63346393 private MenuItem linkerItem;
6335
- private MenuItem ungroupItem;
6394
+ private JMenuItem ungroupItem;
63366395 private MenuItem editItem;
63376396 private MenuItem openWindowItem;
63386397 private MenuItem editLeafItem;