Normand Briere
2019-08-19 22e8ab6479334206f97b0093f6c5ffd14610cce3
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,12 +951,14 @@
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;
....@@ -953,12 +966,11 @@
953966
954967 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
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
964976 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -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
....@@ -1043,8 +1055,8 @@
10431055 // maxButton.addActionListener(this);
10441056 }
10451057
1046
-// cButton gcButton;
1047
-//
1058
+ cButton gcButton;
1059
+
10481060 // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10491061 // gcButton.setToolTipText("Garbage collect");
10501062 // gcButton.addActionListener(new ActionListener()
....@@ -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,8 @@
12461259
12471260 CreateTexturePanel(textures);
12481261
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
1263
+
12491264 oe.toolboxPanel.add(textures);
12501265
12511266 textures.preferredHeight = 100;
....@@ -1253,11 +1268,11 @@
12531268 CreateSkyboxPanel(oe.skyboxPanel);
12541269
12551270 // EDIT panel
1256
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1271
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571272 editButton.setToolTipText("Pin selection controls");
12581273 editButton.addActionListener(this);
12591274
1260
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1275
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12611276 uneditButton.setToolTipText("Unpin and remove selection controls");
12621277 uneditButton.addActionListener(this);
12631278
....@@ -1265,7 +1280,7 @@
12651280 allParamsButton.setToolTipText("Show all controls");
12661281 allParamsButton.addActionListener(this);
12671282
1268
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12691284 clearPanelButton.setToolTipText("Clear all controls");
12701285 clearPanelButton.addActionListener(this);
12711286
....@@ -1273,7 +1288,7 @@
12731288 //unselectButton.setToolTipText("Unselect");
12741289 //unselectButton.addActionListener(this);
12751290
1276
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12771292 flashSelectionButton.setToolTipText("Highlight selection");
12781293 flashSelectionButton.addActionListener(this);
12791294
....@@ -1296,6 +1311,8 @@
12961311
12971312 cGridBag jSPPanel = new cGridBag();
12981313
1314
+ jSPPanel.preferredHeight = 20;
1315
+
12991316 JScrollPane jSP;
13001317 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13011318 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1304,11 +1321,11 @@
13041321 oe.treePanel.add(jSPPanel);
13051322 oe.treePanel.Return();
13061323
1307
- oe.treePanel.add(copyOptionsPanel);
1324
+ oe.treePanel.add(versionManagerPanel);
13081325 oe.treePanel.Return();
1309
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1310
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1311
- sliderPane.preferredHeight = 1;
1326
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1327
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1328
+ versionSliderPane.preferredHeight = 3;
13121329
13131330 // mainPanel.setDividerLocation(0.1); //1.0);
13141331 mainPanel.setResizeWeight(0.4);
....@@ -1498,6 +1515,7 @@
14981515
14991516 oe.SetupViews();
15001517
1518
+ if (Globals.DEBUG)
15011519 System.out.println("SetupViews");
15021520 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15031521 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2159,7 +2177,11 @@
21592177 shadow.material = new cMaterial(obj.material);
21602178 shadow.material.diffuse = 0.0001f;
21612179 shadow.material.specular = 0.0001f;
2162
- //shadow.projectedVertices[1].x = 300;
2180
+ shadow.material.opacity = 0.75f;
2181
+
2182
+ AllocProjectedVertices(shadow);
2183
+
2184
+ shadow.projectedVertices[1].x = 300;
21632185
21642186 makeSomething(shadow);
21652187 }
....@@ -2680,27 +2702,35 @@
26802702 } else
26812703 if (source == loopItem || source == loopButton)
26822704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
26832707 Composite csg = new GroupLeaf();
26842708 csg.count = 5;
2685
- group(csg);
26862709 Composite child = new cGroup("Branch");
26872710 csg.addChild(child);
26882711 child.addChild(csg);
2712
+ group(csg);
2713
+ }
26892714 } else
26902715 if (source == doubleItem)
26912716 {
2717
+ if (!group.selection.isEmpty())
2718
+ {
26922719 Composite csg = new GroupLeaf("Fork");
26932720 csg.count = 5;
2694
- group(csg);
26952721 Composite child = new cGroup("Branch A");
26962722 csg.addChild(child);
26972723 child.addChild(csg);
26982724 child = new cGroup("Branch B");
26992725 csg.addChild(child);
27002726 child.addChild(csg);
2727
+ group(csg);
2728
+ }
27012729 } else
27022730 if (source == tripleItem)
27032731 {
2732
+ if (!group.selection.isEmpty())
2733
+ {
27042734 Composite csg = new GroupLeaf("Trident");
27052735 csg.count = 4;
27062736 group(csg);
....@@ -2713,6 +2743,7 @@
27132743 child = new cGroup();
27142744 csg.addChild(child);
27152745 child.addChild(csg);
2746
+ }
27162747 } else
27172748 if (source == computeAOItem)
27182749 {
....@@ -3348,22 +3379,34 @@
33483379 } else
33493380 if (source == ungroupItem || source == ungroupButton)
33503381 {
3351
- boolean hasRoot = false;
3382
+ boolean canUngroup = true;
33523383
33533384 for (int i=0; i<group.selection.size(); i++)
33543385 {
3355
- if (group.selection.get(i) == group)
3386
+ Object3D selectedItem = group.selection.get(i);
3387
+
3388
+ if (selectedItem.Size() == 0)
33563389 {
3357
- hasRoot = true;
3390
+ // Cannot ungroup leaves
3391
+ canUngroup = false;
3392
+ break;
3393
+ }
3394
+
3395
+ if (selectedItem == group)
3396
+ {
3397
+ // Cannot ungroup root
3398
+ canUngroup = false;
33583399 break;
33593400 }
33603401 }
33613402
3362
- if (!hasRoot)
3403
+ if (canUngroup)
33633404 {
33643405 for (int i=0; i<group.selection.size(); i++)
33653406 {
3366
- Ungroup(group.selection.get(i));
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ Ungroup(selectedItem);
33673410 }
33683411
33693412 ClearSelection(false);
....@@ -3927,6 +3970,8 @@
39273970 if (source == closeButton)
39283971 {
39293972 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
+ Replace();
3974
+
39303975 cRadio ab;
39313976 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39323977 {
....@@ -4025,6 +4070,8 @@
40254070 } else
40264071 if(source instanceof cRadio)
40274072 {
4073
+ Replace();
4074
+
40284075 group.parent = keepparent;
40294076 group.attributes = 0;
40304077 //group.editWindow = null;
....@@ -4080,10 +4127,21 @@
40804127
40814128 if (copy.versionlist == null)
40824129 {
4083
- copy.versionlist = new Object3D[100];
40844130 copy.versionindex = -1;
40854131
4086
- 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);
40874145 }
40884146
40894147 SetVersionStates();
....@@ -4231,7 +4289,7 @@
42314289 TouchTransform(obj);
42324290 continue;
42334291 }
4234
- if ((mask&2) != 0) // Scale
4292
+ if ((mask&2) != 0) // Scale/rotation
42354293 {
42364294 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42374295 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4239,10 +4297,6 @@
42394297 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42404298 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42414299 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4242
- }
4243
- if ((mask&4) != 0) // Rotation
4244
- {
4245
- // ?
42464300 }
42474301 if ((mask&1) != 0) // Translation
42484302 {
....@@ -5325,9 +5379,11 @@
53255379
53265380 boolean allComposites = true;
53275381
5382
+ if (group.selection != null)
53285383 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53295384 {
5330
- if (!(e.nextElement() instanceof Composite))
5385
+ Object next = e.nextElement();
5386
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53315387 {
53325388 allComposites = false;
53335389 break;
....@@ -5339,6 +5395,7 @@
53395395
53405396 void refreshContents(boolean cp)
53415397 {
5398
+ if (Globals.ADVANCED)
53425399 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53435400 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53445401 {
....@@ -6232,11 +6289,11 @@
62326289 private MenuItem lookAtItem;
62336290 private MenuItem lookFromItem;
62346291 private MenuItem switchViewItem;
6235
- private MenuItem cutItem;
6292
+ private JMenuItem cutItem;
62366293 private MenuItem undoItem;
62376294 private MenuItem redoItem;
62386295 private JMenuItem duplicateItem;
6239
- private MenuItem cloneItem;
6296
+ private JMenuItem cloneItem;
62406297 private MenuItem cloneSupportItem;
62416298 private MenuItem overwriteGeoItem;
62426299 private MenuItem overwriteMatItem;
....@@ -6257,13 +6314,13 @@
62576314 private MenuItem cloneGeometriesItem;
62586315 private MenuItem shareGeometriesItem;
62596316 private MenuItem mergeGeometriesItem;
6260
- private MenuItem copyItem;
6317
+ private JMenuItem copyItem;
62616318 private MenuItem pasteItem;
6262
- private MenuItem pasteIntoItem;
6263
- private MenuItem pasteLinkItem;
6264
- private MenuItem pasteCloneItem;
6265
- private MenuItem pasteExpandItem;
6266
- private MenuItem deleteItem;
6319
+ private JMenuItem pasteIntoItem;
6320
+ private JMenuItem pasteLinkItem;
6321
+ private JMenuItem pasteCloneItem;
6322
+ private JMenuItem pasteExpandItem;
6323
+ private JMenuItem deleteItem;
62676324 private MenuItem clearAllItem;
62686325 private MenuItem genUVItem;
62696326 private MenuItem genNormalsMESHItem;
....@@ -6318,7 +6375,7 @@
63186375 private MenuItem transformGeometryItem;
63196376 private MenuItem transformChildrenItem;
63206377 private MenuItem hideItem;
6321
- private MenuItem grabItem;
6378
+ private JMenuItem grabItem;
63226379 private MenuItem backItem;
63236380 private MenuItem frontItem;
63246381 private MenuItem cameraItem;
....@@ -6331,7 +6388,7 @@
63316388 private MenuItem switchTransfoItem;
63326389 private MenuItem morphItem;
63336390 private MenuItem linkerItem;
6334
- private MenuItem ungroupItem;
6391
+ private JMenuItem ungroupItem;
63356392 private MenuItem editItem;
63366393 private MenuItem openWindowItem;
63376394 private MenuItem editLeafItem;