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);
....@@ -930,6 +938,8 @@
930938 cGridBag currenttab;
931939 //boolean added; // patch for jar
932940
941
+ int totalcount = 0;
942
+
933943 int tabcount = 0;
934944 int colcount = 0;
935945 int rowcount = 0;
....@@ -958,7 +968,7 @@
958968 texturecount = 0;
959969 }
960970
961
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
971
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
962972 {
963973 //if (!added)
964974 {
....@@ -967,7 +977,8 @@
967977 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
968978 }
969979
970
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
980
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981
+ totalcount++;
971982
972983 if (++colcount >= columns)
973984 {
....@@ -993,6 +1004,8 @@
9931004 container.add(resourcecontainer);
9941005
9951006 Grafreed.ParseResources("textures", this);
1007
+
1008
+ // 935. System.out.println("Total = " + totalcount);
9961009 }
9971010
9981011 void SetupUI2(ObjEditor oe)
....@@ -1032,9 +1045,9 @@
10321045 oe.radioPanel.add(dummyButton);
10331046 oe.buttonGroup.add(dummyButton);
10341047 */
1035
- cGridBag copyOptionsPanel = new cGridBag();
1048
+ cGridBag versionManagerPanel = new cGridBag();
10361049
1037
- copyOptionsPanel.preferredHeight = 2;
1050
+ versionManagerPanel.preferredHeight = 4;
10381051
10391052 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10401053
....@@ -1061,25 +1074,25 @@
10611074 // }
10621075 // });
10631076
1064
- 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);
10651078 collapseButton.setToolTipText("Collapse toolbar");
10661079 collapseButton.addActionListener(this);
10671080
1068
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10691082 maximize3DButton.setToolTipText("Maximize 3D view");
10701083 maximize3DButton.addActionListener(this);
10711084
1072
- 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);
10731086 twoButton.setToolTipText("Show 3D view only");
10741087 twoButton.addActionListener(this);
10751088 this.fullscreenLayout = twoButton;
10761089
1077
- 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);
10781091 threeButton.setToolTipText("Show controls and 3D view");
10791092 threeButton.addActionListener(this);
10801093 if (Globals.ADVANCED)
10811094 {
1082
- 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);
10831096 sixButton.setToolTipText("Show 3D view and controls");
10841097 sixButton.addActionListener(this);
10851098 }
....@@ -1088,50 +1101,51 @@
10881101 // sevenButton.addActionListener(this);
10891102 //
10901103
1091
- 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);
10921105 fullButton.setToolTipText("Full-screen window");
10931106 fullButton.addActionListener(this);
10941107
1095
- 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);
10961109 screenfitButton.setToolTipText("Screen fit");
10971110 screenfitButton.addActionListener(this);
10981111
1099
- 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);
11001113 restoreCameraButton.setToolTipText("Restore viewpoint");
11011114 restoreCameraButton.addActionListener(this);
11021115
1103
- 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);
11041117 saveVersionButton.setToolTipText("Duplicate current version");
11051118 saveVersionButton.addActionListener(this);
11061119
1107
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11081121 deleteVersionButton.setToolTipText("Delete current version");
11091122 deleteVersionButton.addActionListener(this);
1123
+ deleteVersionButton.setEnabled(false);
11101124
1111
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121126 previousVersionButton.setToolTipText("Previous version");
11131127 previousVersionButton.addActionListener(this);
11141128 previousVersionButton.setEnabled(false);
11151129
11161130 cGridBag updown = new cGridBag().setVertical(true);
1117
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1131
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11181132 restoreButton.setToolTipText("Undo (restore current version)");
11191133 restoreButton.addActionListener(this);
1120
- //restoreButton.setEnabled(false);
1134
+ restoreButton.setEnabled(false);
11211135
1122
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11231137 replaceButton.setToolTipText("Save (replace current version)");
11241138 replaceButton.addActionListener(this);
1125
- //replaceButton.setEnabled(false);
1139
+ replaceButton.setEnabled(false);
11261140
1127
- copyOptionsPanel.add(updown);
1141
+ versionManagerPanel.add(updown);
11281142
1129
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11301144 nextVersionButton.setToolTipText("Next version");
11311145 nextVersionButton.addActionListener(this);
11321146 nextVersionButton.setEnabled(false);
11331147
1134
- 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);
11351149 oneStepButton.setToolTipText("Animate one step forward");
11361150 oneStepButton.addActionListener(this);
11371151
....@@ -1154,11 +1168,11 @@
11541168
11551169 if (Globals.ADVANCED)
11561170 {
1157
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11581172 snapobjectButton.addActionListener(this);
11591173 snapobjectButton.setToolTipText("Snap Object");
11601174
1161
- 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);
11621176 fourButton.addActionListener(this);
11631177 fourButton.setToolTipText("Show control panel only");
11641178 }
....@@ -1166,11 +1180,11 @@
11661180 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11671181
11681182
1169
- 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);
11701184 rootButton.setToolTipText("Open selection in new tab");
11711185 rootButton.addActionListener(this);
11721186
1173
- 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);
11741188 closeButton.setToolTipText("Close tab");
11751189 closeButton.addActionListener(this);
11761190 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1179,38 +1193,38 @@
11791193 cGridBag row1 = new cGridBag();
11801194
11811195 // INSERT
1182
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11831197 gridButton.setToolTipText("Create ground");
11841198 gridButton.addActionListener(this);
11851199
1186
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1200
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11871201 boxButton.setToolTipText("Create box");
11881202 boxButton.addActionListener(this);
11891203
1190
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911205 superButton.setToolTipText("Create superellipsoid");
11921206 superButton.addActionListener(this);
11931207
1194
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11951209 sphereButton.setToolTipText("Create sphere");
11961210 sphereButton.addActionListener(this);
11971211
1198
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1212
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991213 coneButton.setToolTipText("Create cone");
12001214 coneButton.addActionListener(this);
12011215
1202
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031217 torusButton.setToolTipText("Create torus");
12041218 torusButton.addActionListener(this);
12051219
12061220 if (Globals.ADVANCED)
12071221 {
1208
- 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);
12091223 kleinButton.setToolTipText("Create Klein bottle");
12101224 kleinButton.addActionListener(this);
12111225 }
12121226
1213
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12141228 particlesButton.setToolTipText("Create particle system");
12151229 particlesButton.addActionListener(this);
12161230
....@@ -1218,31 +1232,31 @@
12181232
12191233 cGridBag row2 = new cGridBag();
12201234
1221
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1235
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12221236 groupButton.setToolTipText("Create group");
12231237 groupButton.addActionListener(this);
12241238
1225
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1239
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12261240 compositeButton.setToolTipText("Create composite");
12271241 compositeButton.addActionListener(this);
12281242
1229
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1243
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12301244 switchButton.setToolTipText("Create item switcher");
12311245 switchButton.addActionListener(this);
12321246
1233
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1247
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12341248 loopButton.setToolTipText("Create loop");
12351249 loopButton.addActionListener(this);
12361250
1237
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1251
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12381252 textureButton.setToolTipText("Create texture");
12391253 textureButton.addActionListener(this);
12401254
1241
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1255
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12421256 overlayButton.setToolTipText("Create overlay");
12431257 overlayButton.addActionListener(this);
12441258
1245
- 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);
12461260 lightButton.setToolTipText("Create light");
12471261 lightButton.addActionListener(this);
12481262
....@@ -1252,6 +1266,11 @@
12521266
12531267 CreateTexturePanel(textures);
12541268
1269
+ int tabCount = resourcecontainer.getTabCount();
1270
+
1271
+ if (tabCount > 0)
1272
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1273
+
12551274 oe.toolboxPanel.add(textures);
12561275
12571276 textures.preferredHeight = 100;
....@@ -1259,11 +1278,11 @@
12591278 CreateSkyboxPanel(oe.skyboxPanel);
12601279
12611280 // EDIT panel
1262
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1281
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12631282 editButton.setToolTipText("Pin selection controls");
12641283 editButton.addActionListener(this);
12651284
1266
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1285
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12671286 uneditButton.setToolTipText("Unpin and remove selection controls");
12681287 uneditButton.addActionListener(this);
12691288
....@@ -1271,7 +1290,7 @@
12711290 allParamsButton.setToolTipText("Show all controls");
12721291 allParamsButton.addActionListener(this);
12731292
1274
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1293
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12751294 clearPanelButton.setToolTipText("Clear all controls");
12761295 clearPanelButton.addActionListener(this);
12771296
....@@ -1279,7 +1298,7 @@
12791298 //unselectButton.setToolTipText("Unselect");
12801299 //unselectButton.addActionListener(this);
12811300
1282
- 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);
12831302 flashSelectionButton.setToolTipText("Highlight selection");
12841303 flashSelectionButton.addActionListener(this);
12851304
....@@ -1302,6 +1321,8 @@
13021321
13031322 cGridBag jSPPanel = new cGridBag();
13041323
1324
+ jSPPanel.preferredHeight = 20;
1325
+
13051326 JScrollPane jSP;
13061327 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13071328 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1310,11 +1331,11 @@
13101331 oe.treePanel.add(jSPPanel);
13111332 oe.treePanel.Return();
13121333
1313
- oe.treePanel.add(copyOptionsPanel);
1334
+ oe.treePanel.add(versionManagerPanel);
13141335 oe.treePanel.Return();
1315
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1316
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1317
- sliderPane.preferredHeight = 1;
1336
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1337
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1338
+ versionSliderPane.preferredHeight = 3;
13181339
13191340 // mainPanel.setDividerLocation(0.1); //1.0);
13201341 mainPanel.setResizeWeight(0.4);
....@@ -1504,6 +1525,7 @@
15041525
15051526 oe.SetupViews();
15061527
1528
+ if (Globals.DEBUG)
15071529 System.out.println("SetupViews");
15081530 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15091531 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2107,24 +2129,24 @@
21072129 switch(axis)
21082130 {
21092131 case 0 :
2110
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2111
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2112
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2113
- 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;
21142136 norm = cVector.X;
21152137 break;
21162138 case 1 :
2117
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2118
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2119
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2120
- 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;
21212143 norm = cVector.Y;
21222144 break;
21232145 case 2 :
2124
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2125
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2126
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2127
- 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;
21282150 norm = cVector.Z;
21292151 break;
21302152 }
....@@ -3446,6 +3468,10 @@
34463468 {
34473469 ClearMaterials();
34483470 } else
3471
+ if (source == clearVersionsItem)
3472
+ {
3473
+ ClearVersions();
3474
+ } else
34493475 if (source == liveleavesItem)
34503476 {
34513477 LiveLeaves(true);
....@@ -3958,6 +3984,8 @@
39583984 if (source == closeButton)
39593985 {
39603986 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
+ Replace();
3988
+
39613989 cRadio ab;
39623990 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39633991 {
....@@ -4056,6 +4084,8 @@
40564084 } else
40574085 if(source instanceof cRadio)
40584086 {
4087
+ Replace();
4088
+
40594089 group.parent = keepparent;
40604090 group.attributes = 0;
40614091 //group.editWindow = null;
....@@ -4111,10 +4141,23 @@
41114141
41124142 if (copy.versionlist == null)
41134143 {
4114
- copy.versionlist = new Object3D[100];
41154144 copy.versionindex = -1;
41164145
4117
- 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);
41184161 }
41194162
41204163 SetVersionStates();
....@@ -4262,7 +4305,7 @@
42624305 TouchTransform(obj);
42634306 continue;
42644307 }
4265
- if ((mask&2) != 0) // Scale
4308
+ if ((mask&2) != 0) // Scale/rotation
42664309 {
42674310 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42684311 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4270,10 +4313,6 @@
42704313 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42714314 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42724315 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4273
- }
4274
- if ((mask&4) != 0) // Rotation
4275
- {
4276
- // ?
42774316 }
42784317 if ((mask&1) != 0) // Translation
42794318 {
....@@ -5082,6 +5121,12 @@
50825121 refreshContents();
50835122 }
50845123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50855130 void FlipV(boolean flip)
50865131 {
50875132 group.selection.FlipV(flip);
....@@ -5359,7 +5404,8 @@
53595404 if (group.selection != null)
53605405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53615406 {
5362
- if (!(e.nextElement() instanceof Composite))
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53635409 {
53645410 allComposites = false;
53655411 break;
....@@ -5371,6 +5417,7 @@
53715417
53725418 void refreshContents(boolean cp)
53735419 {
5420
+ if (Globals.ADVANCED)
53745421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53755422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53765423 {
....@@ -6321,6 +6368,7 @@
63216368 private MenuItem clipMeshItem;
63226369 private MenuItem smoothMeshItem;
63236370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63246372
63256373 private MenuItem liveleavesItem;
63266374 private MenuItem unliveleavesItem;
....@@ -6350,7 +6398,7 @@
63506398 private MenuItem transformGeometryItem;
63516399 private MenuItem transformChildrenItem;
63526400 private MenuItem hideItem;
6353
- private MenuItem grabItem;
6401
+ private JMenuItem grabItem;
63546402 private MenuItem backItem;
63556403 private MenuItem frontItem;
63566404 private MenuItem cameraItem;