Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
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,13 +415,15 @@
415415 this.copy = this.group = group;
416416 //selectees = this.group.selectees;
417417
418
- if (copy.versionlist == null)
419
- {
420
- copy.versionlist = new Object3D[100];
421
- copy.versionindex = -1;
422
-
423
- Save(true);
424
- }
418
+ assert(false);
419
+
420
+// if (copy.versionlist == null)
421
+// {
422
+// copy.versionlist = new Object3D[100];
423
+// copy.versionindex = -1;
424
+//
425
+// //Save(true);
426
+// }
425427
426428 if(ui)
427429 SetupUI(objEditor);
....@@ -444,13 +446,13 @@
444446
445447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
446448
447
- if (copy.versionlist == null)
448
- {
449
- copy.versionlist = new Object3D[100];
450
- copy.versionindex = -1;
451
-
452
- Save(true);
453
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
454456 }
455457
456458 void CloneSelection(boolean supports)
....@@ -569,9 +571,6 @@
569571 // pasteExpandItem.addActionListener(this);
570572 //menu.add("-");
571573 oe.jTree.popup.addSeparator();
572
-
573
- deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
- deleteItem.addActionListener(this);
575574
576575 if (Globals.ADVANCED)
577576 {
....@@ -706,15 +705,17 @@
706705 setMasterItem.addActionListener(this);
707706 }
708707
709
- oe.menuBar.add(menu = new Menu("Group"));
710
-// grabItem = menu.add(new MenuItem("Grab"));
711
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
712710 backItem = menu.add(new MenuItem("Back"));
713711 backItem.addActionListener(this);
714712 frontItem = menu.add(new MenuItem("Front"));
715713 frontItem.addActionListener(this);
716714 // compositeItem = menu.add(new MenuItem("Composite"));
717715 // compositeItem.addActionListener(this);
716
+
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
718719
719720 if (Globals.ADVANCED)
720721 {
....@@ -723,6 +724,11 @@
723724 }
724725 ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
726732
727733 // menu.add("-");
728734 //
....@@ -829,6 +835,8 @@
829835 }
830836
831837 oe.menuBar.add(menu = new Menu("Attributes"));
838
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
839
+ clearVersionsItem.addActionListener(this);
832840 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
833841 clearMaterialsItem.addActionListener(this);
834842 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -851,9 +859,9 @@
851859 hideleavesItem.addActionListener(this);
852860 showleavesItem = menu.add(new MenuItem("Show Leaves"));
853861 showleavesItem.addActionListener(this);
854
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
862
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
855863 markleavesItem.addActionListener(this);
856
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
864
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
857865 unmarkleavesItem.addActionListener(this);
858866 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
859867 rewindleavesItem.addActionListener(this);
....@@ -928,8 +936,10 @@
928936
929937 JTabbedPane resourcecontainer;
930938 cGridBag currenttab;
931
- boolean added; // patch for jar
939
+ //boolean added; // patch for jar
932940
941
+ int totalcount = 0;
942
+
933943 int tabcount = 0;
934944 int colcount = 0;
935945 int rowcount = 0;
....@@ -940,33 +950,35 @@
940950
941951 public void ResourceCallBack(String[] path)
942952 {
943
- for (int i = 0; i < path.length; i++)
944
- System.out.print(path[i] + "/");
945
- System.out.println();
953
+// for (int i = 0; i < path.length; i++)
954
+// System.out.print(path[i] + "/");
955
+// System.out.println();
946956
947957 if (//rowcount == 0 ||
948
- path.length == 1)
958
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949959 {
950960 currenttab = new cGridBag();
951
- added = false;
952961 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
953962 currenttab.setName(tabname);
963
+ //added = false;
964
+ resourcecontainer.add(currenttab);
965
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
954966 rowcount = 1;
955967 colcount = 0;
956968 texturecount = 0;
957969 }
958970
959
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
971
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
960972 {
961
- if (!added)
973
+ //if (!added)
962974 {
963
- added = true;
964
- resourcecontainer.add(currenttab);
975
+ //added = true;
965976 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
977
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
967978 }
968979
969
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
980
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981
+ totalcount++;
970982
971983 if (++colcount >= columns)
972984 {
....@@ -992,6 +1004,8 @@
9921004 container.add(resourcecontainer);
9931005
9941006 Grafreed.ParseResources("textures", this);
1007
+
1008
+ // 935. System.out.println("Total = " + totalcount);
9951009 }
9961010
9971011 void SetupUI2(ObjEditor oe)
....@@ -1031,9 +1045,9 @@
10311045 oe.radioPanel.add(dummyButton);
10321046 oe.buttonGroup.add(dummyButton);
10331047 */
1034
- cGridBag copyOptionsPanel = new cGridBag();
1048
+ cGridBag versionManagerPanel = new cGridBag();
10351049
1036
- copyOptionsPanel.preferredHeight = 2;
1050
+ versionManagerPanel.preferredHeight = 4;
10371051
10381052 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10391053
....@@ -1060,25 +1074,25 @@
10601074 // }
10611075 // });
10621076
1063
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10641078 collapseButton.setToolTipText("Collapse toolbar");
10651079 collapseButton.addActionListener(this);
10661080
1067
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681082 maximize3DButton.setToolTipText("Maximize 3D view");
10691083 maximize3DButton.addActionListener(this);
10701084
1071
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1085
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721086 twoButton.setToolTipText("Show 3D view only");
10731087 twoButton.addActionListener(this);
10741088 this.fullscreenLayout = twoButton;
10751089
1076
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1090
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771091 threeButton.setToolTipText("Show controls and 3D view");
10781092 threeButton.addActionListener(this);
10791093 if (Globals.ADVANCED)
10801094 {
1081
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10821096 sixButton.setToolTipText("Show 3D view and controls");
10831097 sixButton.addActionListener(this);
10841098 }
....@@ -1087,50 +1101,51 @@
10871101 // sevenButton.addActionListener(this);
10881102 //
10891103
1090
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1104
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10911105 fullButton.setToolTipText("Full-screen window");
10921106 fullButton.addActionListener(this);
10931107
1094
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10951109 screenfitButton.setToolTipText("Screen fit");
10961110 screenfitButton.addActionListener(this);
10971111
1098
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10991113 restoreCameraButton.setToolTipText("Restore viewpoint");
11001114 restoreCameraButton.addActionListener(this);
11011115
1102
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1116
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031117 saveVersionButton.setToolTipText("Duplicate current version");
11041118 saveVersionButton.addActionListener(this);
11051119
1106
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11071121 deleteVersionButton.setToolTipText("Delete current version");
11081122 deleteVersionButton.addActionListener(this);
1123
+ deleteVersionButton.setEnabled(false);
11091124
1110
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11111126 previousVersionButton.setToolTipText("Previous version");
11121127 previousVersionButton.addActionListener(this);
11131128 previousVersionButton.setEnabled(false);
11141129
11151130 cGridBag updown = new cGridBag().setVertical(true);
1116
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1131
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171132 restoreButton.setToolTipText("Undo (restore current version)");
11181133 restoreButton.addActionListener(this);
1119
- //restoreButton.setEnabled(false);
1134
+ restoreButton.setEnabled(false);
11201135
1121
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11221137 replaceButton.setToolTipText("Save (replace current version)");
11231138 replaceButton.addActionListener(this);
1124
- //replaceButton.setEnabled(false);
1139
+ replaceButton.setEnabled(false);
11251140
1126
- copyOptionsPanel.add(updown);
1141
+ versionManagerPanel.add(updown);
11271142
1128
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291144 nextVersionButton.setToolTipText("Next version");
11301145 nextVersionButton.addActionListener(this);
11311146 nextVersionButton.setEnabled(false);
11321147
1133
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11341149 oneStepButton.setToolTipText("Animate one step forward");
11351150 oneStepButton.addActionListener(this);
11361151
....@@ -1153,11 +1168,11 @@
11531168
11541169 if (Globals.ADVANCED)
11551170 {
1156
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11571172 snapobjectButton.addActionListener(this);
11581173 snapobjectButton.setToolTipText("Snap Object");
11591174
1160
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11611176 fourButton.addActionListener(this);
11621177 fourButton.setToolTipText("Show control panel only");
11631178 }
....@@ -1165,11 +1180,11 @@
11651180 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11661181
11671182
1168
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691184 rootButton.setToolTipText("Open selection in new tab");
11701185 rootButton.addActionListener(this);
11711186
1172
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11731188 closeButton.setToolTipText("Close tab");
11741189 closeButton.addActionListener(this);
11751190 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1178,38 +1193,38 @@
11781193 cGridBag row1 = new cGridBag();
11791194
11801195 // INSERT
1181
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11821197 gridButton.setToolTipText("Create ground");
11831198 gridButton.addActionListener(this);
11841199
1185
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1200
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11861201 boxButton.setToolTipText("Create box");
11871202 boxButton.addActionListener(this);
11881203
1189
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1190
- sphereButton.setToolTipText("Create sphere");
1191
- sphereButton.addActionListener(this);
1192
-
1193
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
- coneButton.setToolTipText("Create cone");
1195
- coneButton.addActionListener(this);
1196
-
1197
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
- torusButton.setToolTipText("Create torus");
1199
- torusButton.addActionListener(this);
1200
-
1201
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12021205 superButton.setToolTipText("Create superellipsoid");
12031206 superButton.addActionListener(this);
12041207
1208
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1209
+ sphereButton.setToolTipText("Create sphere");
1210
+ sphereButton.addActionListener(this);
1211
+
1212
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1213
+ coneButton.setToolTipText("Create cone");
1214
+ coneButton.addActionListener(this);
1215
+
1216
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1217
+ torusButton.setToolTipText("Create torus");
1218
+ torusButton.addActionListener(this);
1219
+
12051220 if (Globals.ADVANCED)
12061221 {
1207
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081223 kleinButton.setToolTipText("Create Klein bottle");
12091224 kleinButton.addActionListener(this);
12101225 }
12111226
1212
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12131228 particlesButton.setToolTipText("Create particle system");
12141229 particlesButton.addActionListener(this);
12151230
....@@ -1217,31 +1232,31 @@
12171232
12181233 cGridBag row2 = new cGridBag();
12191234
1220
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1235
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12211236 groupButton.setToolTipText("Create group");
12221237 groupButton.addActionListener(this);
12231238
1224
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1239
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12251240 compositeButton.setToolTipText("Create composite");
12261241 compositeButton.addActionListener(this);
12271242
1228
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1243
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12291244 switchButton.setToolTipText("Create item switcher");
12301245 switchButton.addActionListener(this);
12311246
1232
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1247
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12331248 loopButton.setToolTipText("Create loop");
12341249 loopButton.addActionListener(this);
12351250
1236
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1251
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12371252 textureButton.setToolTipText("Create texture");
12381253 textureButton.addActionListener(this);
12391254
1240
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1255
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12411256 overlayButton.setToolTipText("Create overlay");
12421257 overlayButton.addActionListener(this);
12431258
1244
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1259
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451260 lightButton.setToolTipText("Create light");
12461261 lightButton.addActionListener(this);
12471262
....@@ -1251,6 +1266,11 @@
12511266
12521267 CreateTexturePanel(textures);
12531268
1269
+ int tabCount = resourcecontainer.getTabCount();
1270
+
1271
+ if (tabCount > 0)
1272
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1273
+
12541274 oe.toolboxPanel.add(textures);
12551275
12561276 textures.preferredHeight = 100;
....@@ -1258,11 +1278,11 @@
12581278 CreateSkyboxPanel(oe.skyboxPanel);
12591279
12601280 // EDIT panel
1261
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1281
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12621282 editButton.setToolTipText("Pin selection controls");
12631283 editButton.addActionListener(this);
12641284
1265
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1285
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12661286 uneditButton.setToolTipText("Unpin and remove selection controls");
12671287 uneditButton.addActionListener(this);
12681288
....@@ -1270,7 +1290,7 @@
12701290 allParamsButton.setToolTipText("Show all controls");
12711291 allParamsButton.addActionListener(this);
12721292
1273
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1293
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12741294 clearPanelButton.setToolTipText("Clear all controls");
12751295 clearPanelButton.addActionListener(this);
12761296
....@@ -1278,7 +1298,7 @@
12781298 //unselectButton.setToolTipText("Unselect");
12791299 //unselectButton.addActionListener(this);
12801300
1281
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1301
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12821302 flashSelectionButton.setToolTipText("Highlight selection");
12831303 flashSelectionButton.addActionListener(this);
12841304
....@@ -1301,6 +1321,8 @@
13011321
13021322 cGridBag jSPPanel = new cGridBag();
13031323
1324
+ jSPPanel.preferredHeight = 20;
1325
+
13041326 JScrollPane jSP;
13051327 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13061328 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1309,11 +1331,11 @@
13091331 oe.treePanel.add(jSPPanel);
13101332 oe.treePanel.Return();
13111333
1312
- oe.treePanel.add(copyOptionsPanel);
1334
+ oe.treePanel.add(versionManagerPanel);
13131335 oe.treePanel.Return();
1314
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1315
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1316
- sliderPane.preferredHeight = 1;
1336
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1337
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1338
+ versionSliderPane.preferredHeight = 3;
13171339
13181340 // mainPanel.setDividerLocation(0.1); //1.0);
13191341 mainPanel.setResizeWeight(0.4);
....@@ -1503,6 +1525,7 @@
15031525
15041526 oe.SetupViews();
15051527
1528
+ if (Globals.DEBUG)
15061529 System.out.println("SetupViews");
15071530 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15081531 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2106,24 +2129,24 @@
21062129 switch(axis)
21072130 {
21082131 case 0 :
2109
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2110
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2111
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2112
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2132
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2133
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2134
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2135
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21132136 norm = cVector.X;
21142137 break;
21152138 case 1 :
2116
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2117
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2118
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2119
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2139
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2140
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2141
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2142
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21202143 norm = cVector.Y;
21212144 break;
21222145 case 2 :
2123
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2124
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2125
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2126
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2146
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2147
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2148
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2149
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21272150 norm = cVector.Z;
21282151 break;
21292152 }
....@@ -2164,7 +2187,11 @@
21642187 shadow.material = new cMaterial(obj.material);
21652188 shadow.material.diffuse = 0.0001f;
21662189 shadow.material.specular = 0.0001f;
2167
- //shadow.projectedVertices[1].x = 300;
2190
+ shadow.material.opacity = 0.75f;
2191
+
2192
+ AllocProjectedVertices(shadow);
2193
+
2194
+ shadow.projectedVertices[1].x = 300;
21682195
21692196 makeSomething(shadow);
21702197 }
....@@ -3441,6 +3468,10 @@
34413468 {
34423469 ClearMaterials();
34433470 } else
3471
+ if (source == clearVersionsItem)
3472
+ {
3473
+ ClearVersions();
3474
+ } else
34443475 if (source == liveleavesItem)
34453476 {
34463477 LiveLeaves(true);
....@@ -3953,6 +3984,8 @@
39533984 if (source == closeButton)
39543985 {
39553986 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
+ Replace();
3988
+
39563989 cRadio ab;
39573990 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39583991 {
....@@ -4051,6 +4084,8 @@
40514084 } else
40524085 if(source instanceof cRadio)
40534086 {
4087
+ Replace();
4088
+
40544089 group.parent = keepparent;
40554090 group.attributes = 0;
40564091 //group.editWindow = null;
....@@ -4106,10 +4141,23 @@
41064141
41074142 if (copy.versionlist == null)
41084143 {
4109
- copy.versionlist = new Object3D[100];
41104144 copy.versionindex = -1;
41114145
4112
- Save(true);
4146
+ // Cannot work with loops
4147
+ // To fix this issue, we first mark all nodes above the root,
4148
+ // and check if any of these nodes are reachable below the root.
4149
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4150
+
4151
+ if (copy.versionlist == null && !copy.HasTags())
4152
+ {
4153
+ copy.versionlist = new Object3D[100];
4154
+
4155
+ //Save(true);
4156
+ }
4157
+ else
4158
+ copy.versionindex = -2;
4159
+
4160
+ Grafreed.grafreed.universe.TagObjects(copy, false);
41134161 }
41144162
41154163 SetVersionStates();
....@@ -4257,7 +4305,7 @@
42574305 TouchTransform(obj);
42584306 continue;
42594307 }
4260
- if ((mask&2) != 0) // Scale
4308
+ if ((mask&2) != 0) // Scale/rotation
42614309 {
42624310 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42634311 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4265,10 +4313,6 @@
42654313 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42664314 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42674315 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4268
- }
4269
- if ((mask&4) != 0) // Rotation
4270
- {
4271
- // ?
42724316 }
42734317 if ((mask&1) != 0) // Translation
42744318 {
....@@ -5077,6 +5121,12 @@
50775121 refreshContents();
50785122 }
50795123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50805130 void FlipV(boolean flip)
50815131 {
50825132 group.selection.FlipV(flip);
....@@ -5354,7 +5404,8 @@
53545404 if (group.selection != null)
53555405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53565406 {
5357
- if (!(e.nextElement() instanceof Composite))
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53585409 {
53595410 allComposites = false;
53605411 break;
....@@ -5366,6 +5417,7 @@
53665417
53675418 void refreshContents(boolean cp)
53685419 {
5420
+ if (Globals.ADVANCED)
53695421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53705422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53715423 {
....@@ -6316,6 +6368,7 @@
63166368 private MenuItem clipMeshItem;
63176369 private MenuItem smoothMeshItem;
63186370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63196372
63206373 private MenuItem liveleavesItem;
63216374 private MenuItem unliveleavesItem;
....@@ -6345,7 +6398,7 @@
63456398 private MenuItem transformGeometryItem;
63466399 private MenuItem transformChildrenItem;
63476400 private MenuItem hideItem;
6348
- private MenuItem grabItem;
6401
+ private JMenuItem grabItem;
63496402 private MenuItem backItem;
63506403 private MenuItem frontItem;
63516404 private MenuItem cameraItem;