Normand Briere
2019-08-26 6266c8a4b2485b29a7d5bcb217460d7aad3e1c4a
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);
....@@ -417,13 +417,13 @@
417417
418418 assert(false);
419419
420
- if (copy.versionlist == null)
421
- {
422
- copy.versionlist = new Object3D[100];
423
- copy.versionindex = -1;
424
-
425
- //Save(true);
426
- }
420
+// if (copy.versionlist == null)
421
+// {
422
+// copy.versionlist = new Object3D[100];
423
+// copy.versionindex = -1;
424
+//
425
+// //Save(true);
426
+// }
427427
428428 if(ui)
429429 SetupUI(objEditor);
....@@ -446,13 +446,13 @@
446446
447447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
448448
449
- if (copy.versionlist == null)
450
- {
451
- copy.versionlist = new Object3D[100];
452
- copy.versionindex = -1;
453
-
454
- //Save(true);
455
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
456456 }
457457
458458 void CloneSelection(boolean supports)
....@@ -765,11 +765,11 @@
765765 shadowYItem.addActionListener(this);
766766 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
767767 shadowZItem.addActionListener(this);
768
- attributeItem = menu.add(new MenuItem("Attribute"));
769
- attributeItem.addActionListener(this);
770768
771769 if (Globals.ADVANCED)
772770 {
771
+ attributeItem = menu.add(new MenuItem("Attribute"));
772
+ attributeItem.addActionListener(this);
773773 menu.add("-");
774774 linkerItem = menu.add(new MenuItem("Linker"));
775775 linkerItem.addActionListener(this);
....@@ -779,11 +779,18 @@
779779 pointflowItem.addActionListener(this);
780780 }
781781 menu.add("-");
782
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
783
+ textureRatioRItem.addActionListener(this);
784
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
785
+ textureRatioGItem.addActionListener(this);
786
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
787
+ textureRatioBItem.addActionListener(this);
788
+ menu.add("-");
782789 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
783790 resetTransformItem.addActionListener(this);
784791 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
785792 resetCentroidItem.addActionListener(this);
786
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
793
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
787794 resetCentroidXZItem.addActionListener(this);
788795 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
789796 transformGeometryItem.addActionListener(this);
....@@ -835,6 +842,8 @@
835842 }
836843
837844 oe.menuBar.add(menu = new Menu("Attributes"));
845
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
846
+ clearVersionsItem.addActionListener(this);
838847 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
839848 clearMaterialsItem.addActionListener(this);
840849 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -857,9 +866,9 @@
857866 hideleavesItem.addActionListener(this);
858867 showleavesItem = menu.add(new MenuItem("Show Leaves"));
859868 showleavesItem.addActionListener(this);
860
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
869
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
861870 markleavesItem.addActionListener(this);
862
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
871
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
863872 unmarkleavesItem.addActionListener(this);
864873 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
865874 rewindleavesItem.addActionListener(this);
....@@ -936,6 +945,8 @@
936945 cGridBag currenttab;
937946 //boolean added; // patch for jar
938947
948
+ int totalcount = 0;
949
+
939950 int tabcount = 0;
940951 int colcount = 0;
941952 int rowcount = 0;
....@@ -964,7 +975,7 @@
964975 texturecount = 0;
965976 }
966977
967
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
978
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
968979 {
969980 //if (!added)
970981 {
....@@ -973,7 +984,8 @@
973984 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
974985 }
975986
976
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
987
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
988
+ totalcount++;
977989
978990 if (++colcount >= columns)
979991 {
....@@ -999,6 +1011,8 @@
9991011 container.add(resourcecontainer);
10001012
10011013 Grafreed.ParseResources("textures", this);
1014
+
1015
+ // 935. System.out.println("Total = " + totalcount);
10021016 }
10031017
10041018 void SetupUI2(ObjEditor oe)
....@@ -1067,25 +1081,25 @@
10671081 // }
10681082 // });
10691083
1070
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10711085 collapseButton.setToolTipText("Collapse toolbar");
10721086 collapseButton.addActionListener(this);
10731087
1074
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10751089 maximize3DButton.setToolTipText("Maximize 3D view");
10761090 maximize3DButton.addActionListener(this);
10771091
1078
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10791093 twoButton.setToolTipText("Show 3D view only");
10801094 twoButton.addActionListener(this);
10811095 this.fullscreenLayout = twoButton;
10821096
1083
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841098 threeButton.setToolTipText("Show controls and 3D view");
10851099 threeButton.addActionListener(this);
10861100 if (Globals.ADVANCED)
10871101 {
1088
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10891103 sixButton.setToolTipText("Show 3D view and controls");
10901104 sixButton.addActionListener(this);
10911105 }
....@@ -1094,51 +1108,51 @@
10941108 // sevenButton.addActionListener(this);
10951109 //
10961110
1097
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10981112 fullButton.setToolTipText("Full-screen window");
10991113 fullButton.addActionListener(this);
11001114
1101
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021116 screenfitButton.setToolTipText("Screen fit");
11031117 screenfitButton.addActionListener(this);
11041118
1105
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1119
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061120 restoreCameraButton.setToolTipText("Restore viewpoint");
11071121 restoreCameraButton.addActionListener(this);
11081122
1109
- versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11101124 saveVersionButton.setToolTipText("Duplicate current version");
11111125 saveVersionButton.addActionListener(this);
11121126
1113
- versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1127
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11141128 deleteVersionButton.setToolTipText("Delete current version");
11151129 deleteVersionButton.addActionListener(this);
11161130 deleteVersionButton.setEnabled(false);
11171131
1118
- versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11191133 previousVersionButton.setToolTipText("Previous version");
11201134 previousVersionButton.addActionListener(this);
11211135 previousVersionButton.setEnabled(false);
11221136
11231137 cGridBag updown = new cGridBag().setVertical(true);
1124
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11251139 restoreButton.setToolTipText("Undo (restore current version)");
11261140 restoreButton.addActionListener(this);
11271141 restoreButton.setEnabled(false);
11281142
1129
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11301144 replaceButton.setToolTipText("Save (replace current version)");
11311145 replaceButton.addActionListener(this);
11321146 replaceButton.setEnabled(false);
11331147
11341148 versionManagerPanel.add(updown);
11351149
1136
- versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1150
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11371151 nextVersionButton.setToolTipText("Next version");
11381152 nextVersionButton.addActionListener(this);
11391153 nextVersionButton.setEnabled(false);
11401154
1141
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11421156 oneStepButton.setToolTipText("Animate one step forward");
11431157 oneStepButton.addActionListener(this);
11441158
....@@ -1161,11 +1175,11 @@
11611175
11621176 if (Globals.ADVANCED)
11631177 {
1164
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1178
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11651179 snapobjectButton.addActionListener(this);
11661180 snapobjectButton.setToolTipText("Snap Object");
11671181
1168
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1182
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691183 fourButton.addActionListener(this);
11701184 fourButton.setToolTipText("Show control panel only");
11711185 }
....@@ -1173,11 +1187,11 @@
11731187 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11741188
11751189
1176
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1190
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771191 rootButton.setToolTipText("Open selection in new tab");
11781192 rootButton.addActionListener(this);
11791193
1180
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811195 closeButton.setToolTipText("Close tab");
11821196 closeButton.addActionListener(this);
11831197 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1186,38 +1200,38 @@
11861200 cGridBag row1 = new cGridBag();
11871201
11881202 // INSERT
1189
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1203
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11901204 gridButton.setToolTipText("Create ground");
11911205 gridButton.addActionListener(this);
11921206
1193
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1207
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11941208 boxButton.setToolTipText("Create box");
11951209 boxButton.addActionListener(this);
11961210
1197
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1211
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11981212 superButton.setToolTipText("Create superellipsoid");
11991213 superButton.addActionListener(this);
12001214
1201
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12021216 sphereButton.setToolTipText("Create sphere");
12031217 sphereButton.addActionListener(this);
12041218
1205
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12061220 coneButton.setToolTipText("Create cone");
12071221 coneButton.addActionListener(this);
12081222
1209
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1223
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12101224 torusButton.setToolTipText("Create torus");
12111225 torusButton.addActionListener(this);
12121226
1213
- if (Globals.ADVANCED)
1227
+ if (false) //Globals.ADVANCED)
12141228 {
1215
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1229
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161230 kleinButton.setToolTipText("Create Klein bottle");
12171231 kleinButton.addActionListener(this);
12181232 }
12191233
1220
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1234
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12211235 particlesButton.setToolTipText("Create particle system");
12221236 particlesButton.addActionListener(this);
12231237
....@@ -1225,31 +1239,31 @@
12251239
12261240 cGridBag row2 = new cGridBag();
12271241
1228
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1242
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12291243 groupButton.setToolTipText("Create group");
12301244 groupButton.addActionListener(this);
12311245
1232
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12331247 compositeButton.setToolTipText("Create composite");
12341248 compositeButton.addActionListener(this);
12351249
1236
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12371251 switchButton.setToolTipText("Create item switcher");
12381252 switchButton.addActionListener(this);
12391253
1240
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12411255 loopButton.setToolTipText("Create loop");
12421256 loopButton.addActionListener(this);
12431257
1244
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451259 textureButton.setToolTipText("Create texture");
12461260 textureButton.addActionListener(this);
12471261
1248
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491263 overlayButton.setToolTipText("Create overlay");
12501264 overlayButton.addActionListener(this);
12511265
1252
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12531267 lightButton.setToolTipText("Create light");
12541268 lightButton.addActionListener(this);
12551269
....@@ -1259,7 +1273,10 @@
12591273
12601274 CreateTexturePanel(textures);
12611275
1262
- resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
1276
+ int tabCount = resourcecontainer.getTabCount();
1277
+
1278
+ if (tabCount > 0)
1279
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
12631280
12641281 oe.toolboxPanel.add(textures);
12651282
....@@ -1268,11 +1285,11 @@
12681285 CreateSkyboxPanel(oe.skyboxPanel);
12691286
12701287 // EDIT panel
1271
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1288
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12721289 editButton.setToolTipText("Pin selection controls");
12731290 editButton.addActionListener(this);
12741291
1275
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12761293 uneditButton.setToolTipText("Unpin and remove selection controls");
12771294 uneditButton.addActionListener(this);
12781295
....@@ -1280,7 +1297,7 @@
12801297 allParamsButton.setToolTipText("Show all controls");
12811298 allParamsButton.addActionListener(this);
12821299
1283
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1300
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12841301 clearPanelButton.setToolTipText("Clear all controls");
12851302 clearPanelButton.addActionListener(this);
12861303
....@@ -1288,7 +1305,7 @@
12881305 //unselectButton.setToolTipText("Unselect");
12891306 //unselectButton.addActionListener(this);
12901307
1291
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1308
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12921309 flashSelectionButton.setToolTipText("Highlight selection");
12931310 flashSelectionButton.addActionListener(this);
12941311
....@@ -1483,7 +1500,7 @@
14831500
14841501 void EditObject(Object3D obj)
14851502 {
1486
- assert(obj instanceof Composite);
1503
+ //assert(obj instanceof Composite);
14871504
14881505 // if (obj.versionlist == null)
14891506 // {
....@@ -2119,24 +2136,24 @@
21192136 switch(axis)
21202137 {
21212138 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;
2139
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2140
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2141
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2142
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21262143 norm = cVector.X;
21272144 break;
21282145 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;
2146
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2147
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2148
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2149
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21332150 norm = cVector.Y;
21342151 break;
21352152 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;
2153
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2154
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2155
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2156
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21402157 norm = cVector.Z;
21412158 break;
21422159 }
....@@ -3458,6 +3475,10 @@
34583475 {
34593476 ClearMaterials();
34603477 } else
3478
+ if (source == clearVersionsItem)
3479
+ {
3480
+ ClearVersions();
3481
+ } else
34613482 if (source == liveleavesItem)
34623483 {
34633484 LiveLeaves(true);
....@@ -3597,6 +3618,18 @@
35973618 if (source == transformChildrenItem)
35983619 {
35993620 TransformChildren();
3621
+ } else
3622
+ if (source == textureRatioRItem)
3623
+ {
3624
+ TextureRatio(0);
3625
+ } else
3626
+ if (source == textureRatioGItem)
3627
+ {
3628
+ TextureRatio(1);
3629
+ } else
3630
+ if (source == textureRatioBItem)
3631
+ {
3632
+ TextureRatio(2);
36003633 } else
36013634 if (source == resetTransformItem)
36023635 {
....@@ -3970,7 +4003,8 @@
39704003 if (source == closeButton)
39714004 {
39724005 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
- Replace();
4006
+ if (copy.versionlist != null)
4007
+ Replace();
39744008
39754009 cRadio ab;
39764010 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
....@@ -4070,7 +4104,8 @@
40704104 } else
40714105 if(source instanceof cRadio)
40724106 {
4073
- Replace();
4107
+ if (copy.versionlist != null)
4108
+ Replace();
40744109
40754110 group.parent = keepparent;
40764111 group.attributes = 0;
....@@ -4123,7 +4158,7 @@
41234158 */
41244159 radio.layout.doClick();
41254160
4126
- assert(copy instanceof Composite);
4161
+ //assert(copy instanceof Composite);
41274162
41284163 if (copy.versionlist == null)
41294164 {
....@@ -4134,12 +4169,14 @@
41344169 // and check if any of these nodes are reachable below the root.
41354170 Grafreed.grafreed.universe.TagObjects(copy, true);
41364171
4137
- if (!copy.HasTags())
4172
+ if (copy instanceof Composite && copy.versionlist == null && !copy.HasTags())
41384173 {
41394174 copy.versionlist = new Object3D[100];
41404175
4141
- Save(true);
4176
+ //Save(true);
41424177 }
4178
+ else
4179
+ copy.versionindex = -2;
41434180
41444181 Grafreed.grafreed.universe.TagObjects(copy, false);
41454182 }
....@@ -4259,6 +4296,18 @@
42594296 refreshContents();
42604297 }
42614298
4299
+ void TextureRatio(int axis)
4300
+ {
4301
+ Object3D obj;
4302
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4303
+ {
4304
+ obj = (Object3D)e.nextElement();
4305
+ obj.TextureRatio(axis);
4306
+ }
4307
+
4308
+ refreshContents();
4309
+ }
4310
+
42624311 void ResetTransform()
42634312 {
42644313 ResetTransform(-1);
....@@ -4274,38 +4323,8 @@
42744323 if (obj.toParent == null)
42754324 continue;
42764325
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
- }
4326
+ obj.ResetTransform(mask);
4327
+
43094328 if (obj.parent == null)
43104329 {
43114330 System.out.println("NULL PARENT!");
....@@ -4814,6 +4833,12 @@
48144833 {
48154834 Object3D obj = group.selection.get(i);
48164835
4836
+ if (obj.toParent == null)
4837
+ {
4838
+ obj.toParent = LA.newMatrix();
4839
+ obj.fromParent = LA.newMatrix();
4840
+ }
4841
+
48174842 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48184843 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48194844 }
....@@ -5105,6 +5130,12 @@
51055130 refreshContents();
51065131 }
51075132
5133
+ void ClearVersions()
5134
+ {
5135
+ group.selection.ClearVersions();
5136
+ refreshContents();
5137
+ }
5138
+
51085139 void FlipV(boolean flip)
51095140 {
51105141 group.selection.FlipV(flip);
....@@ -5390,12 +5421,12 @@
53905421 }
53915422 }
53925423
5393
- rootButton.setEnabled(allComposites);
5424
+ rootButton.setEnabled(true); // allComposites);
53945425 }
53955426
53965427 void refreshContents(boolean cp)
53975428 {
5398
- if (false)
5429
+ if (Globals.ADVANCED)
53995430 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
54005431 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
54015432 {
....@@ -6346,6 +6377,7 @@
63466377 private MenuItem clipMeshItem;
63476378 private MenuItem smoothMeshItem;
63486379 private MenuItem clearMaterialsItem;
6380
+ private MenuItem clearVersionsItem;
63496381
63506382 private MenuItem liveleavesItem;
63516383 private MenuItem unliveleavesItem;
....@@ -6369,6 +6401,9 @@
63696401 private MenuItem maxTexturesItem;
63706402 private MenuItem panoTexturesItem;
63716403
6404
+ private MenuItem textureRatioRItem;
6405
+ private MenuItem textureRatioGItem;
6406
+ private MenuItem textureRatioBItem;
63726407 private MenuItem resetCentroidItem;
63736408 private MenuItem resetCentroidXZItem;
63746409 private MenuItem resetTransformItem;