Normand Briere
2019-09-02 21ac57b36a9e3b909853c7d64ac29b7ad72490a3
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);
....@@ -366,16 +366,6 @@
366366 }
367367
368368 refreshContents();
369
- }
370
-
371
- public void Show3DView()
372
- {
373
- // bug
374
- //gridPanel.setDividerLocation(1.0);
375
- //bigPanel.setDividerLocation(0.0);
376
- bigThree.ClearUI();
377
- bigThree.add(centralPanel);
378
- bigThree.FlushUI();
379369 }
380370
381371 //ObjEditor objEditor;
....@@ -417,13 +407,13 @@
417407
418408 assert(false);
419409
420
- if (copy.versionlist == null)
421
- {
422
- copy.versionlist = new Object3D[100];
423
- copy.versionindex = -1;
424
-
425
- //Save(true);
426
- }
410
+// if (copy.versionlist == null)
411
+// {
412
+// copy.versionlist = new Object3D[100];
413
+// copy.versionindex = -1;
414
+//
415
+// //Save(true);
416
+// }
427417
428418 if(ui)
429419 SetupUI(objEditor);
....@@ -446,13 +436,13 @@
446436
447437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
448438
449
- if (copy.versionlist == null)
450
- {
451
- copy.versionlist = new Object3D[100];
452
- copy.versionindex = -1;
453
-
454
- //Save(true);
455
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
456446 }
457447
458448 void CloneSelection(boolean supports)
....@@ -765,9 +755,9 @@
765755 shadowYItem.addActionListener(this);
766756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
767757 shadowZItem.addActionListener(this);
758
+
768759 attributeItem = menu.add(new MenuItem("Attribute"));
769760 attributeItem.addActionListener(this);
770
-
771761 if (Globals.ADVANCED)
772762 {
773763 menu.add("-");
....@@ -779,11 +769,18 @@
779769 pointflowItem.addActionListener(this);
780770 }
781771 menu.add("-");
772
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
773
+ textureRatioRItem.addActionListener(this);
774
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
775
+ textureRatioGItem.addActionListener(this);
776
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
777
+ textureRatioBItem.addActionListener(this);
778
+ menu.add("-");
782779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
783780 resetTransformItem.addActionListener(this);
784781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
785782 resetCentroidItem.addActionListener(this);
786
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
787784 resetCentroidXZItem.addActionListener(this);
788785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
789786 transformGeometryItem.addActionListener(this);
....@@ -835,6 +832,8 @@
835832 }
836833
837834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
838837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
839838 clearMaterialsItem.addActionListener(this);
840839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -857,9 +856,9 @@
857856 hideleavesItem.addActionListener(this);
858857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
859858 showleavesItem.addActionListener(this);
860
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
861860 markleavesItem.addActionListener(this);
862
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
863862 unmarkleavesItem.addActionListener(this);
864863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
865864 rewindleavesItem.addActionListener(this);
....@@ -936,6 +935,8 @@
936935 cGridBag currenttab;
937936 //boolean added; // patch for jar
938937
938
+ int totalcount = 0;
939
+
939940 int tabcount = 0;
940941 int colcount = 0;
941942 int rowcount = 0;
....@@ -964,7 +965,7 @@
964965 texturecount = 0;
965966 }
966967
967
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
968969 {
969970 //if (!added)
970971 {
....@@ -973,7 +974,8 @@
973974 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
974975 }
975976
976
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
977979
978980 if (++colcount >= columns)
979981 {
....@@ -999,6 +1001,8 @@
9991001 container.add(resourcecontainer);
10001002
10011003 Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
10021006 }
10031007
10041008 void SetupUI2(ObjEditor oe)
....@@ -1038,9 +1042,9 @@
10381042 oe.radioPanel.add(dummyButton);
10391043 oe.buttonGroup.add(dummyButton);
10401044 */
1041
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
10421046
1043
- copyOptionsPanel.preferredHeight = 2;
1047
+ versionManagerPanel.preferredHeight = 4;
10441048
10451049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10461050
....@@ -1067,25 +1071,29 @@
10671071 // }
10681072 // });
10691073
1070
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ fullScreenButton.setToolTipText("Full-screen window");
1076
+ fullScreenButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10711079 collapseButton.setToolTipText("Collapse toolbar");
10721080 collapseButton.addActionListener(this);
10731081
1074
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
- maximize3DButton.setToolTipText("Maximize 3D view");
1076
- maximize3DButton.addActionListener(this);
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
10771085
1078
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10791087 twoButton.setToolTipText("Show 3D view only");
10801088 twoButton.addActionListener(this);
10811089 this.fullscreenLayout = twoButton;
10821090
1083
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841092 threeButton.setToolTipText("Show controls and 3D view");
10851093 threeButton.addActionListener(this);
10861094 if (Globals.ADVANCED)
10871095 {
1088
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10891097 sixButton.setToolTipText("Show 3D view and controls");
10901098 sixButton.addActionListener(this);
10911099 }
....@@ -1094,51 +1102,47 @@
10941102 // sevenButton.addActionListener(this);
10951103 //
10961104
1097
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1098
- fullButton.setToolTipText("Full-screen window");
1099
- fullButton.addActionListener(this);
1100
-
1101
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021106 screenfitButton.setToolTipText("Screen fit");
11031107 screenfitButton.addActionListener(this);
11041108
1105
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061110 restoreCameraButton.setToolTipText("Restore viewpoint");
11071111 restoreCameraButton.addActionListener(this);
11081112
1109
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11101114 saveVersionButton.setToolTipText("Duplicate current version");
11111115 saveVersionButton.addActionListener(this);
11121116
1113
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11141118 deleteVersionButton.setToolTipText("Delete current version");
11151119 deleteVersionButton.addActionListener(this);
11161120 deleteVersionButton.setEnabled(false);
11171121
1118
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11191123 previousVersionButton.setToolTipText("Previous version");
11201124 previousVersionButton.addActionListener(this);
11211125 previousVersionButton.setEnabled(false);
11221126
11231127 cGridBag updown = new cGridBag().setVertical(true);
1124
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11251129 restoreButton.setToolTipText("Undo (restore current version)");
11261130 restoreButton.addActionListener(this);
11271131 restoreButton.setEnabled(false);
11281132
1129
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11301134 replaceButton.setToolTipText("Save (replace current version)");
11311135 replaceButton.addActionListener(this);
11321136 replaceButton.setEnabled(false);
11331137
1134
- copyOptionsPanel.add(updown);
1138
+ versionManagerPanel.add(updown);
11351139
1136
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11371141 nextVersionButton.setToolTipText("Next version");
11381142 nextVersionButton.addActionListener(this);
11391143 nextVersionButton.setEnabled(false);
11401144
1141
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11421146 oneStepButton.setToolTipText("Animate one step forward");
11431147 oneStepButton.addActionListener(this);
11441148
....@@ -1161,11 +1165,11 @@
11611165
11621166 if (Globals.ADVANCED)
11631167 {
1164
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11651169 snapobjectButton.addActionListener(this);
11661170 snapobjectButton.setToolTipText("Snap Object");
11671171
1168
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1172
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691173 fourButton.addActionListener(this);
11701174 fourButton.setToolTipText("Show control panel only");
11711175 }
....@@ -1173,11 +1177,11 @@
11731177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11741178
11751179
1176
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771181 rootButton.setToolTipText("Open selection in new tab");
11781182 rootButton.addActionListener(this);
11791183
1180
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811185 closeButton.setToolTipText("Close tab");
11821186 closeButton.addActionListener(this);
11831187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1186,38 +1190,38 @@
11861190 cGridBag row1 = new cGridBag();
11871191
11881192 // INSERT
1189
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11901194 gridButton.setToolTipText("Create ground");
11911195 gridButton.addActionListener(this);
11921196
1193
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11941198 boxButton.setToolTipText("Create box");
11951199 boxButton.addActionListener(this);
11961200
1197
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11981202 superButton.setToolTipText("Create superellipsoid");
11991203 superButton.addActionListener(this);
12001204
1201
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1205
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12021206 sphereButton.setToolTipText("Create sphere");
12031207 sphereButton.addActionListener(this);
12041208
1205
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1209
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12061210 coneButton.setToolTipText("Create cone");
12071211 coneButton.addActionListener(this);
12081212
1209
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1213
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12101214 torusButton.setToolTipText("Create torus");
12111215 torusButton.addActionListener(this);
12121216
1213
- if (Globals.ADVANCED)
1217
+ if (false) //Globals.ADVANCED)
12141218 {
1215
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161220 kleinButton.setToolTipText("Create Klein bottle");
12171221 kleinButton.addActionListener(this);
12181222 }
12191223
1220
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12211225 particlesButton.setToolTipText("Create particle system");
12221226 particlesButton.addActionListener(this);
12231227
....@@ -1225,31 +1229,31 @@
12251229
12261230 cGridBag row2 = new cGridBag();
12271231
1228
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12291233 groupButton.setToolTipText("Create group");
12301234 groupButton.addActionListener(this);
12311235
1232
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12331237 compositeButton.setToolTipText("Create composite");
12341238 compositeButton.addActionListener(this);
12351239
1236
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12371241 switchButton.setToolTipText("Create item switcher");
12381242 switchButton.addActionListener(this);
12391243
1240
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12411245 loopButton.setToolTipText("Create loop");
12421246 loopButton.addActionListener(this);
12431247
1244
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451249 textureButton.setToolTipText("Create texture");
12461250 textureButton.addActionListener(this);
12471251
1248
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491253 overlayButton.setToolTipText("Create overlay");
12501254 overlayButton.addActionListener(this);
12511255
1252
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1256
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12531257 lightButton.setToolTipText("Create light");
12541258 lightButton.addActionListener(this);
12551259
....@@ -1259,6 +1263,11 @@
12591263
12601264 CreateTexturePanel(textures);
12611265
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
12621271 oe.toolboxPanel.add(textures);
12631272
12641273 textures.preferredHeight = 100;
....@@ -1266,11 +1275,11 @@
12661275 CreateSkyboxPanel(oe.skyboxPanel);
12671276
12681277 // EDIT panel
1269
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12701279 editButton.setToolTipText("Pin selection controls");
12711280 editButton.addActionListener(this);
12721281
1273
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12741283 uneditButton.setToolTipText("Unpin and remove selection controls");
12751284 uneditButton.addActionListener(this);
12761285
....@@ -1278,7 +1287,7 @@
12781287 allParamsButton.setToolTipText("Show all controls");
12791288 allParamsButton.addActionListener(this);
12801289
1281
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12821291 clearPanelButton.setToolTipText("Clear all controls");
12831292 clearPanelButton.addActionListener(this);
12841293
....@@ -1286,7 +1295,7 @@
12861295 //unselectButton.setToolTipText("Unselect");
12871296 //unselectButton.addActionListener(this);
12881297
1289
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12901299 flashSelectionButton.setToolTipText("Highlight selection");
12911300 flashSelectionButton.addActionListener(this);
12921301
....@@ -1309,6 +1318,8 @@
13091318
13101319 cGridBag jSPPanel = new cGridBag();
13111320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
13121323 JScrollPane jSP;
13131324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13141325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1317,11 +1328,11 @@
13171328 oe.treePanel.add(jSPPanel);
13181329 oe.treePanel.Return();
13191330
1320
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
13211332 oe.treePanel.Return();
1322
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1323
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1324
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
13251336
13261337 // mainPanel.setDividerLocation(0.1); //1.0);
13271338 mainPanel.setResizeWeight(0.4);
....@@ -1479,7 +1490,7 @@
14791490
14801491 void EditObject(Object3D obj)
14811492 {
1482
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14831494
14841495 // if (obj.versionlist == null)
14851496 // {
....@@ -2115,24 +2126,24 @@
21152126 switch(axis)
21162127 {
21172128 case 0 :
2118
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2119
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2120
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2121
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2129
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2130
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2131
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2132
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21222133 norm = cVector.X;
21232134 break;
21242135 case 1 :
2125
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2126
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2127
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2128
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2136
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2137
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2138
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2139
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21292140 norm = cVector.Y;
21302141 break;
21312142 case 2 :
2132
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2133
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2134
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2135
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2143
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2144
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2145
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2146
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21362147 norm = cVector.Z;
21372148 break;
21382149 }
....@@ -2701,11 +2712,11 @@
27012712 if (!group.selection.isEmpty())
27022713 {
27032714 Composite csg = new GroupLeaf();
2715
+ group(csg);
27042716 csg.count = 5;
27052717 Composite child = new cGroup("Branch");
27062718 csg.addChild(child);
27072719 child.addChild(csg);
2708
- group(csg);
27092720 }
27102721 } else
27112722 if (source == doubleItem)
....@@ -2713,6 +2724,7 @@
27132724 if (!group.selection.isEmpty())
27142725 {
27152726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27162728 csg.count = 5;
27172729 Composite child = new cGroup("Branch A");
27182730 csg.addChild(child);
....@@ -2720,7 +2732,6 @@
27202732 child = new cGroup("Branch B");
27212733 csg.addChild(child);
27222734 child.addChild(csg);
2723
- group(csg);
27242735 }
27252736 } else
27262737 if (source == tripleItem)
....@@ -2786,7 +2797,7 @@
27862797 {
27872798 Maximize();
27882799 } else
2789
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27902801 {
27912802 ToggleFullScreen();
27922803 } else
....@@ -2795,13 +2806,13 @@
27952806 this.expandedLayout = radio.layout;
27962807 CollapseToolbar();
27972808 } else
2798
- if (source == maximize3DButton)
2799
- {
2800
- this.expandedLayout = radio.layout;
2801
- radio.layout = twoButton;
2802
- Show3DView();
2803
- CollapseToolbar();
2804
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
28052816 if (source == previousVersionButton)
28062817 {
28072818 // Go to previous version
....@@ -3454,6 +3465,10 @@
34543465 {
34553466 ClearMaterials();
34563467 } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
3471
+ } else
34573472 if (source == liveleavesItem)
34583473 {
34593474 LiveLeaves(true);
....@@ -3593,6 +3608,18 @@
35933608 if (source == transformChildrenItem)
35943609 {
35953610 TransformChildren();
3611
+ } else
3612
+ if (source == textureRatioRItem)
3613
+ {
3614
+ TextureRatio(0);
3615
+ } else
3616
+ if (source == textureRatioGItem)
3617
+ {
3618
+ TextureRatio(1);
3619
+ } else
3620
+ if (source == textureRatioBItem)
3621
+ {
3622
+ TextureRatio(2);
35963623 } else
35973624 if (source == resetTransformItem)
35983625 {
....@@ -3966,6 +3993,9 @@
39663993 if (source == closeButton)
39673994 {
39683995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
39693999 cRadio ab;
39704000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39714001 {
....@@ -4064,6 +4094,9 @@
40644094 } else
40654095 if(source instanceof cRadio)
40664096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
40674100 group.parent = keepparent;
40684101 group.attributes = 0;
40694102 //group.editWindow = null;
....@@ -4115,17 +4148,28 @@
41154148 */
41164149 radio.layout.doClick();
41174150
4118
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41194152
41204153 if (copy.versionlist == null)
41214154 {
4122
- copy.versionlist = new Object3D[100];
41234155 copy.versionindex = -1;
41244156
41254157 // Cannot work with loops
4126
- // To fix this issue, first mark all nodes above the root,
4158
+ // To fix this issue, we first mark all nodes above the root,
41274159 // and check if any of these nodes are reachable below the root.
4128
- //Save(true);
4160
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4161
+
4162
+ if (copy instanceof Composite && !copy.HasTags())
4163
+ {
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
4166
+
4167
+ //Save(true);
4168
+ }
4169
+ else
4170
+ copy.versionindex = -2;
4171
+
4172
+ Grafreed.grafreed.universe.TagObjects(copy, false);
41294173 }
41304174
41314175 SetVersionStates();
....@@ -4243,6 +4287,18 @@
42434287 refreshContents();
42444288 }
42454289
4290
+ void TextureRatio(int axis)
4291
+ {
4292
+ Object3D obj;
4293
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4294
+ {
4295
+ obj = (Object3D)e.nextElement();
4296
+ obj.TextureRatio(axis);
4297
+ }
4298
+
4299
+ refreshContents();
4300
+ }
4301
+
42464302 void ResetTransform()
42474303 {
42484304 ResetTransform(-1);
....@@ -4258,42 +4314,8 @@
42584314 if (obj.toParent == null)
42594315 continue;
42604316
4261
- if (mask == -1)
4262
- {
4263
- if (obj instanceof Camera) // jan 2014
4264
- {
4265
- LA.matIdentity(obj.toParent);
4266
- LA.matIdentity(obj.fromParent);
4267
- }
4268
- else
4269
- {
4270
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4271
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4272
- }
4273
- TouchTransform(obj);
4274
- continue;
4275
- }
4276
- if ((mask&2) != 0) // Scale
4277
- {
4278
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4279
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4280
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4281
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4282
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4283
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4284
- }
4285
- if ((mask&4) != 0) // Rotation
4286
- {
4287
- // ?
4288
- }
4289
- if ((mask&1) != 0) // Translation
4290
- {
4291
- if (obj.toParent != null)
4292
- {
4293
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4294
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4295
- }
4296
- }
4317
+ obj.ResetTransform(mask);
4318
+
42974319 if (obj.parent == null)
42984320 {
42994321 System.out.println("NULL PARENT!");
....@@ -4802,6 +4824,12 @@
48024824 {
48034825 Object3D obj = group.selection.get(i);
48044826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
48054833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48064834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48074835 }
....@@ -5093,6 +5121,12 @@
50935121 refreshContents();
50945122 }
50955123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50965130 void FlipV(boolean flip)
50975131 {
50985132 group.selection.FlipV(flip);
....@@ -5331,7 +5365,7 @@
53315365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53325366 // a camera
53335367 {
5334
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5368
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
53355369 {
53365370 CameraPane.camerachangeframe = 0; // don't refuse it
53375371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5378,11 +5412,12 @@
53785412 }
53795413 }
53805414
5381
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
53825416 }
53835417
53845418 void refreshContents(boolean cp)
53855419 {
5420
+ if (Globals.SHOWINFO)
53865421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53875422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53885423 {
....@@ -6333,6 +6368,7 @@
63336368 private MenuItem clipMeshItem;
63346369 private MenuItem smoothMeshItem;
63356370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63366372
63376373 private MenuItem liveleavesItem;
63386374 private MenuItem unliveleavesItem;
....@@ -6356,6 +6392,9 @@
63566392 private MenuItem maxTexturesItem;
63576393 private MenuItem panoTexturesItem;
63586394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63596398 private MenuItem resetCentroidItem;
63606399 private MenuItem resetCentroidXZItem;
63616400 private MenuItem resetTransformItem;