Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
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,8 +934,10 @@
923934
924935 JTabbedPane resourcecontainer;
925936 cGridBag currenttab;
926
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
927938
939
+ int totalcount = 0;
940
+
928941 int tabcount = 0;
929942 int colcount = 0;
930943 int rowcount = 0;
....@@ -940,28 +953,30 @@
940953 // System.out.println();
941954
942955 if (//rowcount == 0 ||
943
- path.length == 1)
956
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
944957 {
945958 currenttab = new cGridBag();
946
- added = false;
947959 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948960 currenttab.setName(tabname);
961
+ //added = false;
962
+ resourcecontainer.add(currenttab);
963
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
949964 rowcount = 1;
950965 colcount = 0;
951966 texturecount = 0;
952967 }
953968
954
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
969
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
955970 {
956
- if (!added)
971
+ //if (!added)
957972 {
958
- added = true;
959
- resourcecontainer.add(currenttab);
973
+ //added = true;
960974 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
975
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
962976 }
963977
964
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
978
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
979
+ totalcount++;
965980
966981 if (++colcount >= columns)
967982 {
....@@ -987,6 +1002,8 @@
9871002 container.add(resourcecontainer);
9881003
9891004 Grafreed.ParseResources("textures", this);
1005
+
1006
+ // 935. System.out.println("Total = " + totalcount);
9901007 }
9911008
9921009 void SetupUI2(ObjEditor oe)
....@@ -1026,9 +1043,9 @@
10261043 oe.radioPanel.add(dummyButton);
10271044 oe.buttonGroup.add(dummyButton);
10281045 */
1029
- cGridBag copyOptionsPanel = new cGridBag();
1046
+ cGridBag versionManagerPanel = new cGridBag();
10301047
1031
- copyOptionsPanel.preferredHeight = 2;
1048
+ versionManagerPanel.preferredHeight = 4;
10321049
10331050 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10341051
....@@ -1055,25 +1072,25 @@
10551072 // }
10561073 // });
10571074
1058
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10591076 collapseButton.setToolTipText("Collapse toolbar");
10601077 collapseButton.addActionListener(this);
10611078
1062
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1079
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10631080 maximize3DButton.setToolTipText("Maximize 3D view");
10641081 maximize3DButton.addActionListener(this);
10651082
1066
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10671084 twoButton.setToolTipText("Show 3D view only");
10681085 twoButton.addActionListener(this);
10691086 this.fullscreenLayout = twoButton;
10701087
1071
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721089 threeButton.setToolTipText("Show controls and 3D view");
10731090 threeButton.addActionListener(this);
10741091 if (Globals.ADVANCED)
10751092 {
1076
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771094 sixButton.setToolTipText("Show 3D view and controls");
10781095 sixButton.addActionListener(this);
10791096 }
....@@ -1082,50 +1099,51 @@
10821099 // sevenButton.addActionListener(this);
10831100 //
10841101
1085
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861103 fullButton.setToolTipText("Full-screen window");
10871104 fullButton.addActionListener(this);
10881105
1089
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901107 screenfitButton.setToolTipText("Screen fit");
10911108 screenfitButton.addActionListener(this);
10921109
1093
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1110
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941111 restoreCameraButton.setToolTipText("Restore viewpoint");
10951112 restoreCameraButton.addActionListener(this);
10961113
1097
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1114
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10981115 saveVersionButton.setToolTipText("Duplicate current version");
10991116 saveVersionButton.addActionListener(this);
11001117
1101
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021119 deleteVersionButton.setToolTipText("Delete current version");
11031120 deleteVersionButton.addActionListener(this);
1121
+ deleteVersionButton.setEnabled(false);
11041122
1105
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061124 previousVersionButton.setToolTipText("Previous version");
11071125 previousVersionButton.addActionListener(this);
11081126 previousVersionButton.setEnabled(false);
11091127
11101128 cGridBag updown = new cGridBag().setVertical(true);
1111
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121130 restoreButton.setToolTipText("Undo (restore current version)");
11131131 restoreButton.addActionListener(this);
1114
- //restoreButton.setEnabled(false);
1132
+ restoreButton.setEnabled(false);
11151133
1116
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171135 replaceButton.setToolTipText("Save (replace current version)");
11181136 replaceButton.addActionListener(this);
1119
- //replaceButton.setEnabled(false);
1137
+ replaceButton.setEnabled(false);
11201138
1121
- copyOptionsPanel.add(updown);
1139
+ versionManagerPanel.add(updown);
11221140
1123
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1141
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11241142 nextVersionButton.setToolTipText("Next version");
11251143 nextVersionButton.addActionListener(this);
11261144 nextVersionButton.setEnabled(false);
11271145
1128
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1146
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291147 oneStepButton.setToolTipText("Animate one step forward");
11301148 oneStepButton.addActionListener(this);
11311149
....@@ -1148,11 +1166,11 @@
11481166
11491167 if (Globals.ADVANCED)
11501168 {
1151
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1169
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11521170 snapobjectButton.addActionListener(this);
11531171 snapobjectButton.setToolTipText("Snap Object");
11541172
1155
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1173
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561174 fourButton.addActionListener(this);
11571175 fourButton.setToolTipText("Show control panel only");
11581176 }
....@@ -1160,11 +1178,11 @@
11601178 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11611179
11621180
1163
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1181
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11641182 rootButton.setToolTipText("Open selection in new tab");
11651183 rootButton.addActionListener(this);
11661184
1167
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681186 closeButton.setToolTipText("Close tab");
11691187 closeButton.addActionListener(this);
11701188 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1173,38 +1191,38 @@
11731191 cGridBag row1 = new cGridBag();
11741192
11751193 // INSERT
1176
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771195 gridButton.setToolTipText("Create ground");
11781196 gridButton.addActionListener(this);
11791197
1180
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811199 boxButton.setToolTipText("Create box");
11821200 boxButton.addActionListener(this);
11831201
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);
1202
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11971203 superButton.setToolTipText("Create superellipsoid");
11981204 superButton.addActionListener(this);
11991205
1206
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ sphereButton.setToolTipText("Create sphere");
1208
+ sphereButton.addActionListener(this);
1209
+
1210
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1211
+ coneButton.setToolTipText("Create cone");
1212
+ coneButton.addActionListener(this);
1213
+
1214
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1215
+ torusButton.setToolTipText("Create torus");
1216
+ torusButton.addActionListener(this);
1217
+
12001218 if (Globals.ADVANCED)
12011219 {
1202
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031221 kleinButton.setToolTipText("Create Klein bottle");
12041222 kleinButton.addActionListener(this);
12051223 }
12061224
1207
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1225
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081226 particlesButton.setToolTipText("Create particle system");
12091227 particlesButton.addActionListener(this);
12101228
....@@ -1212,31 +1230,31 @@
12121230
12131231 cGridBag row2 = new cGridBag();
12141232
1215
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1233
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161234 groupButton.setToolTipText("Create group");
12171235 groupButton.addActionListener(this);
12181236
1219
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201238 compositeButton.setToolTipText("Create composite");
12211239 compositeButton.addActionListener(this);
12221240
1223
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1241
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241242 switchButton.setToolTipText("Create item switcher");
12251243 switchButton.addActionListener(this);
12261244
1227
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1245
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281246 loopButton.setToolTipText("Create loop");
12291247 loopButton.addActionListener(this);
12301248
1231
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1249
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12321250 textureButton.setToolTipText("Create texture");
12331251 textureButton.addActionListener(this);
12341252
1235
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1253
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361254 overlayButton.setToolTipText("Create overlay");
12371255 overlayButton.addActionListener(this);
12381256
1239
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1257
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12401258 lightButton.setToolTipText("Create light");
12411259 lightButton.addActionListener(this);
12421260
....@@ -1246,6 +1264,11 @@
12461264
12471265 CreateTexturePanel(textures);
12481266
1267
+ int tabCount = resourcecontainer.getTabCount();
1268
+
1269
+ if (tabCount > 0)
1270
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1271
+
12491272 oe.toolboxPanel.add(textures);
12501273
12511274 textures.preferredHeight = 100;
....@@ -1253,11 +1276,11 @@
12531276 CreateSkyboxPanel(oe.skyboxPanel);
12541277
12551278 // EDIT panel
1256
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1279
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571280 editButton.setToolTipText("Pin selection controls");
12581281 editButton.addActionListener(this);
12591282
1260
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12611284 uneditButton.setToolTipText("Unpin and remove selection controls");
12621285 uneditButton.addActionListener(this);
12631286
....@@ -1265,7 +1288,7 @@
12651288 allParamsButton.setToolTipText("Show all controls");
12661289 allParamsButton.addActionListener(this);
12671290
1268
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12691292 clearPanelButton.setToolTipText("Clear all controls");
12701293 clearPanelButton.addActionListener(this);
12711294
....@@ -1273,7 +1296,7 @@
12731296 //unselectButton.setToolTipText("Unselect");
12741297 //unselectButton.addActionListener(this);
12751298
1276
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1299
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12771300 flashSelectionButton.setToolTipText("Highlight selection");
12781301 flashSelectionButton.addActionListener(this);
12791302
....@@ -1296,6 +1319,8 @@
12961319
12971320 cGridBag jSPPanel = new cGridBag();
12981321
1322
+ jSPPanel.preferredHeight = 20;
1323
+
12991324 JScrollPane jSP;
13001325 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13011326 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1304,11 +1329,11 @@
13041329 oe.treePanel.add(jSPPanel);
13051330 oe.treePanel.Return();
13061331
1307
- oe.treePanel.add(copyOptionsPanel);
1332
+ oe.treePanel.add(versionManagerPanel);
13081333 oe.treePanel.Return();
1309
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1310
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1311
- sliderPane.preferredHeight = 1;
1334
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1335
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1336
+ versionSliderPane.preferredHeight = 3;
13121337
13131338 // mainPanel.setDividerLocation(0.1); //1.0);
13141339 mainPanel.setResizeWeight(0.4);
....@@ -1498,6 +1523,7 @@
14981523
14991524 oe.SetupViews();
15001525
1526
+ if (Globals.DEBUG)
15011527 System.out.println("SetupViews");
15021528 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15031529 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2159,7 +2185,11 @@
21592185 shadow.material = new cMaterial(obj.material);
21602186 shadow.material.diffuse = 0.0001f;
21612187 shadow.material.specular = 0.0001f;
2162
- //shadow.projectedVertices[1].x = 300;
2188
+ shadow.material.opacity = 0.75f;
2189
+
2190
+ AllocProjectedVertices(shadow);
2191
+
2192
+ shadow.projectedVertices[1].x = 300;
21632193
21642194 makeSomething(shadow);
21652195 }
....@@ -2680,27 +2710,35 @@
26802710 } else
26812711 if (source == loopItem || source == loopButton)
26822712 {
2713
+ if (!group.selection.isEmpty())
2714
+ {
26832715 Composite csg = new GroupLeaf();
26842716 csg.count = 5;
2685
- group(csg);
26862717 Composite child = new cGroup("Branch");
26872718 csg.addChild(child);
26882719 child.addChild(csg);
2720
+ group(csg);
2721
+ }
26892722 } else
26902723 if (source == doubleItem)
26912724 {
2725
+ if (!group.selection.isEmpty())
2726
+ {
26922727 Composite csg = new GroupLeaf("Fork");
26932728 csg.count = 5;
2694
- group(csg);
26952729 Composite child = new cGroup("Branch A");
26962730 csg.addChild(child);
26972731 child.addChild(csg);
26982732 child = new cGroup("Branch B");
26992733 csg.addChild(child);
27002734 child.addChild(csg);
2735
+ group(csg);
2736
+ }
27012737 } else
27022738 if (source == tripleItem)
27032739 {
2740
+ if (!group.selection.isEmpty())
2741
+ {
27042742 Composite csg = new GroupLeaf("Trident");
27052743 csg.count = 4;
27062744 group(csg);
....@@ -2713,6 +2751,7 @@
27132751 child = new cGroup();
27142752 csg.addChild(child);
27152753 child.addChild(csg);
2754
+ }
27162755 } else
27172756 if (source == computeAOItem)
27182757 {
....@@ -3348,22 +3387,34 @@
33483387 } else
33493388 if (source == ungroupItem || source == ungroupButton)
33503389 {
3351
- boolean hasRoot = false;
3390
+ boolean canUngroup = true;
33523391
33533392 for (int i=0; i<group.selection.size(); i++)
33543393 {
3355
- if (group.selection.get(i) == group)
3394
+ Object3D selectedItem = group.selection.get(i);
3395
+
3396
+ if (selectedItem.Size() == 0)
33563397 {
3357
- hasRoot = true;
3398
+ // Cannot ungroup leaves
3399
+ canUngroup = false;
3400
+ break;
3401
+ }
3402
+
3403
+ if (selectedItem == group)
3404
+ {
3405
+ // Cannot ungroup root
3406
+ canUngroup = false;
33583407 break;
33593408 }
33603409 }
33613410
3362
- if (!hasRoot)
3411
+ if (canUngroup)
33633412 {
33643413 for (int i=0; i<group.selection.size(); i++)
33653414 {
3366
- Ungroup(group.selection.get(i));
3415
+ Object3D selectedItem = group.selection.get(i);
3416
+
3417
+ Ungroup(selectedItem);
33673418 }
33683419
33693420 ClearSelection(false);
....@@ -3927,6 +3978,8 @@
39273978 if (source == closeButton)
39283979 {
39293980 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3981
+ Replace();
3982
+
39303983 cRadio ab;
39313984 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39323985 {
....@@ -4025,6 +4078,8 @@
40254078 } else
40264079 if(source instanceof cRadio)
40274080 {
4081
+ Replace();
4082
+
40284083 group.parent = keepparent;
40294084 group.attributes = 0;
40304085 //group.editWindow = null;
....@@ -4080,10 +4135,21 @@
40804135
40814136 if (copy.versionlist == null)
40824137 {
4083
- copy.versionlist = new Object3D[100];
40844138 copy.versionindex = -1;
40854139
4086
- Save(true);
4140
+ // Cannot work with loops
4141
+ // To fix this issue, we first mark all nodes above the root,
4142
+ // and check if any of these nodes are reachable below the root.
4143
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4144
+
4145
+ if (!copy.HasTags())
4146
+ {
4147
+ copy.versionlist = new Object3D[100];
4148
+
4149
+ Save(true);
4150
+ }
4151
+
4152
+ Grafreed.grafreed.universe.TagObjects(copy, false);
40874153 }
40884154
40894155 SetVersionStates();
....@@ -4231,7 +4297,7 @@
42314297 TouchTransform(obj);
42324298 continue;
42334299 }
4234
- if ((mask&2) != 0) // Scale
4300
+ if ((mask&2) != 0) // Scale/rotation
42354301 {
42364302 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42374303 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4239,10 +4305,6 @@
42394305 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42404306 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42414307 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4242
- }
4243
- if ((mask&4) != 0) // Rotation
4244
- {
4245
- // ?
42464308 }
42474309 if ((mask&1) != 0) // Translation
42484310 {
....@@ -5328,7 +5390,8 @@
53285390 if (group.selection != null)
53295391 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53305392 {
5331
- if (!(e.nextElement() instanceof Composite))
5393
+ Object next = e.nextElement();
5394
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53325395 {
53335396 allComposites = false;
53345397 break;
....@@ -5340,6 +5403,7 @@
53405403
53415404 void refreshContents(boolean cp)
53425405 {
5406
+ if (Globals.ADVANCED)
53435407 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53445408 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53455409 {
....@@ -6233,11 +6297,11 @@
62336297 private MenuItem lookAtItem;
62346298 private MenuItem lookFromItem;
62356299 private MenuItem switchViewItem;
6236
- private MenuItem cutItem;
6300
+ private JMenuItem cutItem;
62376301 private MenuItem undoItem;
62386302 private MenuItem redoItem;
62396303 private JMenuItem duplicateItem;
6240
- private MenuItem cloneItem;
6304
+ private JMenuItem cloneItem;
62416305 private MenuItem cloneSupportItem;
62426306 private MenuItem overwriteGeoItem;
62436307 private MenuItem overwriteMatItem;
....@@ -6258,13 +6322,13 @@
62586322 private MenuItem cloneGeometriesItem;
62596323 private MenuItem shareGeometriesItem;
62606324 private MenuItem mergeGeometriesItem;
6261
- private MenuItem copyItem;
6325
+ private JMenuItem copyItem;
62626326 private MenuItem pasteItem;
6263
- private MenuItem pasteIntoItem;
6264
- private MenuItem pasteLinkItem;
6265
- private MenuItem pasteCloneItem;
6266
- private MenuItem pasteExpandItem;
6267
- private MenuItem deleteItem;
6327
+ private JMenuItem pasteIntoItem;
6328
+ private JMenuItem pasteLinkItem;
6329
+ private JMenuItem pasteCloneItem;
6330
+ private JMenuItem pasteExpandItem;
6331
+ private JMenuItem deleteItem;
62686332 private MenuItem clearAllItem;
62696333 private MenuItem genUVItem;
62706334 private MenuItem genNormalsMESHItem;
....@@ -6319,7 +6383,7 @@
63196383 private MenuItem transformGeometryItem;
63206384 private MenuItem transformChildrenItem;
63216385 private MenuItem hideItem;
6322
- private MenuItem grabItem;
6386
+ private JMenuItem grabItem;
63236387 private MenuItem backItem;
63246388 private MenuItem frontItem;
63256389 private MenuItem cameraItem;
....@@ -6332,7 +6396,7 @@
63326396 private MenuItem switchTransfoItem;
63336397 private MenuItem morphItem;
63346398 private MenuItem linkerItem;
6335
- private MenuItem ungroupItem;
6399
+ private JMenuItem ungroupItem;
63366400 private MenuItem editItem;
63376401 private MenuItem openWindowItem;
63386402 private MenuItem editLeafItem;