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,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
....@@ -1311,6 +1318,8 @@
13111318
13121319 cGridBag jSPPanel = new cGridBag();
13131320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
13141323 JScrollPane jSP;
13151324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13161325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1319,11 +1328,11 @@
13191328 oe.treePanel.add(jSPPanel);
13201329 oe.treePanel.Return();
13211330
1322
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
13231332 oe.treePanel.Return();
1324
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1325
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1326
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
13271336
13281337 // mainPanel.setDividerLocation(0.1); //1.0);
13291338 mainPanel.setResizeWeight(0.4);
....@@ -1481,7 +1490,7 @@
14811490
14821491 void EditObject(Object3D obj)
14831492 {
1484
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14851494
14861495 // if (obj.versionlist == null)
14871496 // {
....@@ -2117,24 +2126,24 @@
21172126 switch(axis)
21182127 {
21192128 case 0 :
2120
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2121
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2122
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2123
- 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;
21242133 norm = cVector.X;
21252134 break;
21262135 case 1 :
2127
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2128
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2129
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2130
- 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;
21312140 norm = cVector.Y;
21322141 break;
21332142 case 2 :
2134
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2135
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2136
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2137
- 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;
21382147 norm = cVector.Z;
21392148 break;
21402149 }
....@@ -2703,11 +2712,11 @@
27032712 if (!group.selection.isEmpty())
27042713 {
27052714 Composite csg = new GroupLeaf();
2715
+ group(csg);
27062716 csg.count = 5;
27072717 Composite child = new cGroup("Branch");
27082718 csg.addChild(child);
27092719 child.addChild(csg);
2710
- group(csg);
27112720 }
27122721 } else
27132722 if (source == doubleItem)
....@@ -2715,6 +2724,7 @@
27152724 if (!group.selection.isEmpty())
27162725 {
27172726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27182728 csg.count = 5;
27192729 Composite child = new cGroup("Branch A");
27202730 csg.addChild(child);
....@@ -2722,7 +2732,6 @@
27222732 child = new cGroup("Branch B");
27232733 csg.addChild(child);
27242734 child.addChild(csg);
2725
- group(csg);
27262735 }
27272736 } else
27282737 if (source == tripleItem)
....@@ -2788,7 +2797,7 @@
27882797 {
27892798 Maximize();
27902799 } else
2791
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27922801 {
27932802 ToggleFullScreen();
27942803 } else
....@@ -2797,13 +2806,13 @@
27972806 this.expandedLayout = radio.layout;
27982807 CollapseToolbar();
27992808 } else
2800
- if (source == maximize3DButton)
2801
- {
2802
- this.expandedLayout = radio.layout;
2803
- radio.layout = twoButton;
2804
- Show3DView();
2805
- CollapseToolbar();
2806
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
28072816 if (source == previousVersionButton)
28082817 {
28092818 // Go to previous version
....@@ -3456,6 +3465,10 @@
34563465 {
34573466 ClearMaterials();
34583467 } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
3471
+ } else
34593472 if (source == liveleavesItem)
34603473 {
34613474 LiveLeaves(true);
....@@ -3595,6 +3608,18 @@
35953608 if (source == transformChildrenItem)
35963609 {
35973610 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);
35983623 } else
35993624 if (source == resetTransformItem)
36003625 {
....@@ -3968,6 +3993,9 @@
39683993 if (source == closeButton)
39693994 {
39703995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
39713999 cRadio ab;
39724000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39734001 {
....@@ -4066,6 +4094,9 @@
40664094 } else
40674095 if(source instanceof cRadio)
40684096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
40694100 group.parent = keepparent;
40704101 group.attributes = 0;
40714102 //group.editWindow = null;
....@@ -4117,17 +4148,28 @@
41174148 */
41184149 radio.layout.doClick();
41194150
4120
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41214152
41224153 if (copy.versionlist == null)
41234154 {
4124
- copy.versionlist = new Object3D[100];
41254155 copy.versionindex = -1;
41264156
41274157 // Cannot work with loops
4128
- // To fix this issue, first mark all nodes above the root,
4158
+ // To fix this issue, we first mark all nodes above the root,
41294159 // and check if any of these nodes are reachable below the root.
4130
- //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);
41314173 }
41324174
41334175 SetVersionStates();
....@@ -4245,6 +4287,18 @@
42454287 refreshContents();
42464288 }
42474289
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
+
42484302 void ResetTransform()
42494303 {
42504304 ResetTransform(-1);
....@@ -4260,42 +4314,8 @@
42604314 if (obj.toParent == null)
42614315 continue;
42624316
4263
- if (mask == -1)
4264
- {
4265
- if (obj instanceof Camera) // jan 2014
4266
- {
4267
- LA.matIdentity(obj.toParent);
4268
- LA.matIdentity(obj.fromParent);
4269
- }
4270
- else
4271
- {
4272
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4273
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4274
- }
4275
- TouchTransform(obj);
4276
- continue;
4277
- }
4278
- if ((mask&2) != 0) // Scale
4279
- {
4280
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4281
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4282
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4283
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4284
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4285
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4286
- }
4287
- if ((mask&4) != 0) // Rotation
4288
- {
4289
- // ?
4290
- }
4291
- if ((mask&1) != 0) // Translation
4292
- {
4293
- if (obj.toParent != null)
4294
- {
4295
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4296
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4297
- }
4298
- }
4317
+ obj.ResetTransform(mask);
4318
+
42994319 if (obj.parent == null)
43004320 {
43014321 System.out.println("NULL PARENT!");
....@@ -4804,6 +4824,12 @@
48044824 {
48054825 Object3D obj = group.selection.get(i);
48064826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
48074833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48084834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48094835 }
....@@ -5095,6 +5121,12 @@
50955121 refreshContents();
50965122 }
50975123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50985130 void FlipV(boolean flip)
50995131 {
51005132 group.selection.FlipV(flip);
....@@ -5333,7 +5365,7 @@
53335365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53345366 // a camera
53355367 {
5336
- 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
53375369 {
53385370 CameraPane.camerachangeframe = 0; // don't refuse it
53395371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5380,11 +5412,12 @@
53805412 }
53815413 }
53825414
5383
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
53845416 }
53855417
53865418 void refreshContents(boolean cp)
53875419 {
5420
+ if (Globals.SHOWINFO)
53885421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53895422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53905423 {
....@@ -6335,6 +6368,7 @@
63356368 private MenuItem clipMeshItem;
63366369 private MenuItem smoothMeshItem;
63376370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63386372
63396373 private MenuItem liveleavesItem;
63406374 private MenuItem unliveleavesItem;
....@@ -6358,6 +6392,9 @@
63586392 private MenuItem maxTexturesItem;
63596393 private MenuItem panoTexturesItem;
63606394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63616398 private MenuItem resetCentroidItem;
63626399 private MenuItem resetCentroidXZItem;
63636400 private MenuItem resetTransformItem;