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)
....@@ -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/square.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
- versionManagerPanel.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
- versionManagerPanel.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
- versionManagerPanel.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
11341138 versionManagerPanel.add(updown);
11351139
1136
- versionManagerPanel.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,7 +1263,10 @@
12591263
12601264 CreateTexturePanel(textures);
12611265
1262
- resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
12631270
12641271 oe.toolboxPanel.add(textures);
12651272
....@@ -1268,11 +1275,11 @@
12681275 CreateSkyboxPanel(oe.skyboxPanel);
12691276
12701277 // EDIT panel
1271
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12721279 editButton.setToolTipText("Pin selection controls");
12731280 editButton.addActionListener(this);
12741281
1275
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12761283 uneditButton.setToolTipText("Unpin and remove selection controls");
12771284 uneditButton.addActionListener(this);
12781285
....@@ -1280,7 +1287,7 @@
12801287 allParamsButton.setToolTipText("Show all controls");
12811288 allParamsButton.addActionListener(this);
12821289
1283
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12841291 clearPanelButton.setToolTipText("Clear all controls");
12851292 clearPanelButton.addActionListener(this);
12861293
....@@ -1288,7 +1295,7 @@
12881295 //unselectButton.setToolTipText("Unselect");
12891296 //unselectButton.addActionListener(this);
12901297
1291
- 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);
12921299 flashSelectionButton.setToolTipText("Highlight selection");
12931300 flashSelectionButton.addActionListener(this);
12941301
....@@ -1483,7 +1490,7 @@
14831490
14841491 void EditObject(Object3D obj)
14851492 {
1486
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14871494
14881495 // if (obj.versionlist == null)
14891496 // {
....@@ -2119,24 +2126,24 @@
21192126 switch(axis)
21202127 {
21212128 case 0 :
2122
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2123
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2124
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2125
- 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;
21262133 norm = cVector.X;
21272134 break;
21282135 case 1 :
2129
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2130
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2131
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2132
- 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;
21332140 norm = cVector.Y;
21342141 break;
21352142 case 2 :
2136
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2137
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2138
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2139
- 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;
21402147 norm = cVector.Z;
21412148 break;
21422149 }
....@@ -2705,11 +2712,11 @@
27052712 if (!group.selection.isEmpty())
27062713 {
27072714 Composite csg = new GroupLeaf();
2715
+ group(csg);
27082716 csg.count = 5;
27092717 Composite child = new cGroup("Branch");
27102718 csg.addChild(child);
27112719 child.addChild(csg);
2712
- group(csg);
27132720 }
27142721 } else
27152722 if (source == doubleItem)
....@@ -2717,6 +2724,7 @@
27172724 if (!group.selection.isEmpty())
27182725 {
27192726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27202728 csg.count = 5;
27212729 Composite child = new cGroup("Branch A");
27222730 csg.addChild(child);
....@@ -2724,7 +2732,6 @@
27242732 child = new cGroup("Branch B");
27252733 csg.addChild(child);
27262734 child.addChild(csg);
2727
- group(csg);
27282735 }
27292736 } else
27302737 if (source == tripleItem)
....@@ -2790,7 +2797,7 @@
27902797 {
27912798 Maximize();
27922799 } else
2793
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27942801 {
27952802 ToggleFullScreen();
27962803 } else
....@@ -2799,13 +2806,13 @@
27992806 this.expandedLayout = radio.layout;
28002807 CollapseToolbar();
28012808 } else
2802
- if (source == maximize3DButton)
2803
- {
2804
- this.expandedLayout = radio.layout;
2805
- radio.layout = twoButton;
2806
- Show3DView();
2807
- CollapseToolbar();
2808
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
28092816 if (source == previousVersionButton)
28102817 {
28112818 // Go to previous version
....@@ -3458,6 +3465,10 @@
34583465 {
34593466 ClearMaterials();
34603467 } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
3471
+ } else
34613472 if (source == liveleavesItem)
34623473 {
34633474 LiveLeaves(true);
....@@ -3597,6 +3608,18 @@
35973608 if (source == transformChildrenItem)
35983609 {
35993610 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);
36003623 } else
36013624 if (source == resetTransformItem)
36023625 {
....@@ -3970,7 +3993,8 @@
39703993 if (source == closeButton)
39713994 {
39723995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
- Replace();
3996
+ if (copy.versionlist != null)
3997
+ Replace();
39743998
39753999 cRadio ab;
39764000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
....@@ -4070,7 +4094,8 @@
40704094 } else
40714095 if(source instanceof cRadio)
40724096 {
4073
- Replace();
4097
+ if (copy.versionlist != null)
4098
+ Replace();
40744099
40754100 group.parent = keepparent;
40764101 group.attributes = 0;
....@@ -4123,7 +4148,7 @@
41234148 */
41244149 radio.layout.doClick();
41254150
4126
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41274152
41284153 if (copy.versionlist == null)
41294154 {
....@@ -4134,12 +4159,15 @@
41344159 // and check if any of these nodes are reachable below the root.
41354160 Grafreed.grafreed.universe.TagObjects(copy, true);
41364161
4137
- if (!copy.HasTags())
4162
+ if (copy instanceof Composite && !copy.HasTags())
41384163 {
4139
- copy.versionlist = new Object3D[100];
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
41404166
4141
- Save(true);
4167
+ //Save(true);
41424168 }
4169
+ else
4170
+ copy.versionindex = -2;
41434171
41444172 Grafreed.grafreed.universe.TagObjects(copy, false);
41454173 }
....@@ -4259,6 +4287,18 @@
42594287 refreshContents();
42604288 }
42614289
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
+
42624302 void ResetTransform()
42634303 {
42644304 ResetTransform(-1);
....@@ -4274,38 +4314,8 @@
42744314 if (obj.toParent == null)
42754315 continue;
42764316
4277
- if (mask == -1)
4278
- {
4279
- if (obj instanceof Camera) // jan 2014
4280
- {
4281
- LA.matIdentity(obj.toParent);
4282
- LA.matIdentity(obj.fromParent);
4283
- }
4284
- else
4285
- {
4286
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4287
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4288
- }
4289
- TouchTransform(obj);
4290
- continue;
4291
- }
4292
- if ((mask&2) != 0) // Scale/rotation
4293
- {
4294
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4295
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4296
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4297
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4298
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4299
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4300
- }
4301
- if ((mask&1) != 0) // Translation
4302
- {
4303
- if (obj.toParent != null)
4304
- {
4305
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4306
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4307
- }
4308
- }
4317
+ obj.ResetTransform(mask);
4318
+
43094319 if (obj.parent == null)
43104320 {
43114321 System.out.println("NULL PARENT!");
....@@ -4814,6 +4824,12 @@
48144824 {
48154825 Object3D obj = group.selection.get(i);
48164826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
48174833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48184834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48194835 }
....@@ -5105,6 +5121,12 @@
51055121 refreshContents();
51065122 }
51075123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
51085130 void FlipV(boolean flip)
51095131 {
51105132 group.selection.FlipV(flip);
....@@ -5343,7 +5365,7 @@
53435365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53445366 // a camera
53455367 {
5346
- 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
53475369 {
53485370 CameraPane.camerachangeframe = 0; // don't refuse it
53495371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5390,12 +5412,12 @@
53905412 }
53915413 }
53925414
5393
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
53945416 }
53955417
53965418 void refreshContents(boolean cp)
53975419 {
5398
- if (false)
5420
+ if (Globals.SHOWINFO)
53995421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
54005422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
54015423 {
....@@ -6346,6 +6368,7 @@
63466368 private MenuItem clipMeshItem;
63476369 private MenuItem smoothMeshItem;
63486370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63496372
63506373 private MenuItem liveleavesItem;
63516374 private MenuItem unliveleavesItem;
....@@ -6369,6 +6392,9 @@
63696392 private MenuItem maxTexturesItem;
63706393 private MenuItem panoTexturesItem;
63716394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63726398 private MenuItem resetCentroidItem;
63736399 private MenuItem resetCentroidXZItem;
63746400 private MenuItem resetTransformItem;