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;
....@@ -415,13 +405,15 @@
415405 this.copy = this.group = group;
416406 //selectees = this.group.selectees;
417407
418
- if (copy.versionlist == null)
419
- {
420
- copy.versionlist = new Object3D[100];
421
- copy.versionindex = -1;
422
-
423
- Save(true);
424
- }
408
+ assert(false);
409
+
410
+// if (copy.versionlist == null)
411
+// {
412
+// copy.versionlist = new Object3D[100];
413
+// copy.versionindex = -1;
414
+//
415
+// //Save(true);
416
+// }
425417
426418 if(ui)
427419 SetupUI(objEditor);
....@@ -444,13 +436,13 @@
444436
445437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
446438
447
- if (copy.versionlist == null)
448
- {
449
- copy.versionlist = new Object3D[100];
450
- copy.versionindex = -1;
451
-
452
- Save(true);
453
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
454446 }
455447
456448 void CloneSelection(boolean supports)
....@@ -763,9 +755,9 @@
763755 shadowYItem.addActionListener(this);
764756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
765757 shadowZItem.addActionListener(this);
758
+
766759 attributeItem = menu.add(new MenuItem("Attribute"));
767760 attributeItem.addActionListener(this);
768
-
769761 if (Globals.ADVANCED)
770762 {
771763 menu.add("-");
....@@ -777,11 +769,18 @@
777769 pointflowItem.addActionListener(this);
778770 }
779771 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("-");
780779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
781780 resetTransformItem.addActionListener(this);
782781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
783782 resetCentroidItem.addActionListener(this);
784
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
785784 resetCentroidXZItem.addActionListener(this);
786785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
787786 transformGeometryItem.addActionListener(this);
....@@ -833,6 +832,8 @@
833832 }
834833
835834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
836837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
837838 clearMaterialsItem.addActionListener(this);
838839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -855,9 +856,9 @@
855856 hideleavesItem.addActionListener(this);
856857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
857858 showleavesItem.addActionListener(this);
858
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
859860 markleavesItem.addActionListener(this);
860
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
861862 unmarkleavesItem.addActionListener(this);
862863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
863864 rewindleavesItem.addActionListener(this);
....@@ -934,6 +935,8 @@
934935 cGridBag currenttab;
935936 //boolean added; // patch for jar
936937
938
+ int totalcount = 0;
939
+
937940 int tabcount = 0;
938941 int colcount = 0;
939942 int rowcount = 0;
....@@ -962,7 +965,7 @@
962965 texturecount = 0;
963966 }
964967
965
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
966969 {
967970 //if (!added)
968971 {
....@@ -971,7 +974,8 @@
971974 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
972975 }
973976
974
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
975979
976980 if (++colcount >= columns)
977981 {
....@@ -997,6 +1001,8 @@
9971001 container.add(resourcecontainer);
9981002
9991003 Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
10001006 }
10011007
10021008 void SetupUI2(ObjEditor oe)
....@@ -1036,9 +1042,9 @@
10361042 oe.radioPanel.add(dummyButton);
10371043 oe.buttonGroup.add(dummyButton);
10381044 */
1039
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
10401046
1041
- copyOptionsPanel.preferredHeight = 2;
1047
+ versionManagerPanel.preferredHeight = 4;
10421048
10431049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10441050
....@@ -1065,25 +1071,29 @@
10651071 // }
10661072 // });
10671073
1068
- 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);
10691079 collapseButton.setToolTipText("Collapse toolbar");
10701080 collapseButton.addActionListener(this);
10711081
1072
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
- maximize3DButton.setToolTipText("Maximize 3D view");
1074
- 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);
10751085
1076
- 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);
10771087 twoButton.setToolTipText("Show 3D view only");
10781088 twoButton.addActionListener(this);
10791089 this.fullscreenLayout = twoButton;
10801090
1081
- 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);
10821092 threeButton.setToolTipText("Show controls and 3D view");
10831093 threeButton.addActionListener(this);
10841094 if (Globals.ADVANCED)
10851095 {
1086
- 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);
10871097 sixButton.setToolTipText("Show 3D view and controls");
10881098 sixButton.addActionListener(this);
10891099 }
....@@ -1092,50 +1102,47 @@
10921102 // sevenButton.addActionListener(this);
10931103 //
10941104
1095
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
- fullButton.setToolTipText("Full-screen window");
1097
- fullButton.addActionListener(this);
1098
-
1099
- 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);
11001106 screenfitButton.setToolTipText("Screen fit");
11011107 screenfitButton.addActionListener(this);
11021108
1103
- 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);
11041110 restoreCameraButton.setToolTipText("Restore viewpoint");
11051111 restoreCameraButton.addActionListener(this);
11061112
1107
- 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);
11081114 saveVersionButton.setToolTipText("Duplicate current version");
11091115 saveVersionButton.addActionListener(this);
11101116
1111
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121118 deleteVersionButton.setToolTipText("Delete current version");
11131119 deleteVersionButton.addActionListener(this);
1120
+ deleteVersionButton.setEnabled(false);
11141121
1115
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11161123 previousVersionButton.setToolTipText("Previous version");
11171124 previousVersionButton.addActionListener(this);
11181125 previousVersionButton.setEnabled(false);
11191126
11201127 cGridBag updown = new cGridBag().setVertical(true);
1121
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11221129 restoreButton.setToolTipText("Undo (restore current version)");
11231130 restoreButton.addActionListener(this);
1124
- //restoreButton.setEnabled(false);
1131
+ restoreButton.setEnabled(false);
11251132
1126
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11271134 replaceButton.setToolTipText("Save (replace current version)");
11281135 replaceButton.addActionListener(this);
1129
- //replaceButton.setEnabled(false);
1136
+ replaceButton.setEnabled(false);
11301137
1131
- copyOptionsPanel.add(updown);
1138
+ versionManagerPanel.add(updown);
11321139
1133
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11341141 nextVersionButton.setToolTipText("Next version");
11351142 nextVersionButton.addActionListener(this);
11361143 nextVersionButton.setEnabled(false);
11371144
1138
- 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);
11391146 oneStepButton.setToolTipText("Animate one step forward");
11401147 oneStepButton.addActionListener(this);
11411148
....@@ -1158,11 +1165,11 @@
11581165
11591166 if (Globals.ADVANCED)
11601167 {
1161
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11621169 snapobjectButton.addActionListener(this);
11631170 snapobjectButton.setToolTipText("Snap Object");
11641171
1165
- 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);
11661173 fourButton.addActionListener(this);
11671174 fourButton.setToolTipText("Show control panel only");
11681175 }
....@@ -1170,11 +1177,11 @@
11701177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11711178
11721179
1173
- 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);
11741181 rootButton.setToolTipText("Open selection in new tab");
11751182 rootButton.addActionListener(this);
11761183
1177
- 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);
11781185 closeButton.setToolTipText("Close tab");
11791186 closeButton.addActionListener(this);
11801187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1183,38 +1190,38 @@
11831190 cGridBag row1 = new cGridBag();
11841191
11851192 // INSERT
1186
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11871194 gridButton.setToolTipText("Create ground");
11881195 gridButton.addActionListener(this);
11891196
1190
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911198 boxButton.setToolTipText("Create box");
11921199 boxButton.addActionListener(this);
11931200
1194
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11951202 superButton.setToolTipText("Create superellipsoid");
11961203 superButton.addActionListener(this);
11971204
1198
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1205
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991206 sphereButton.setToolTipText("Create sphere");
12001207 sphereButton.addActionListener(this);
12011208
1202
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1209
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031210 coneButton.setToolTipText("Create cone");
12041211 coneButton.addActionListener(this);
12051212
1206
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1213
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12071214 torusButton.setToolTipText("Create torus");
12081215 torusButton.addActionListener(this);
12091216
1210
- if (Globals.ADVANCED)
1217
+ if (false) //Globals.ADVANCED)
12111218 {
1212
- 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);
12131220 kleinButton.setToolTipText("Create Klein bottle");
12141221 kleinButton.addActionListener(this);
12151222 }
12161223
1217
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12181225 particlesButton.setToolTipText("Create particle system");
12191226 particlesButton.addActionListener(this);
12201227
....@@ -1222,31 +1229,31 @@
12221229
12231230 cGridBag row2 = new cGridBag();
12241231
1225
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12261233 groupButton.setToolTipText("Create group");
12271234 groupButton.addActionListener(this);
12281235
1229
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12301237 compositeButton.setToolTipText("Create composite");
12311238 compositeButton.addActionListener(this);
12321239
1233
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12341241 switchButton.setToolTipText("Create item switcher");
12351242 switchButton.addActionListener(this);
12361243
1237
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12381245 loopButton.setToolTipText("Create loop");
12391246 loopButton.addActionListener(this);
12401247
1241
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12421249 textureButton.setToolTipText("Create texture");
12431250 textureButton.addActionListener(this);
12441251
1245
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12461253 overlayButton.setToolTipText("Create overlay");
12471254 overlayButton.addActionListener(this);
12481255
1249
- 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);
12501257 lightButton.setToolTipText("Create light");
12511258 lightButton.addActionListener(this);
12521259
....@@ -1256,6 +1263,11 @@
12561263
12571264 CreateTexturePanel(textures);
12581265
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
12591271 oe.toolboxPanel.add(textures);
12601272
12611273 textures.preferredHeight = 100;
....@@ -1263,11 +1275,11 @@
12631275 CreateSkyboxPanel(oe.skyboxPanel);
12641276
12651277 // EDIT panel
1266
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12671279 editButton.setToolTipText("Pin selection controls");
12681280 editButton.addActionListener(this);
12691281
1270
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12711283 uneditButton.setToolTipText("Unpin and remove selection controls");
12721284 uneditButton.addActionListener(this);
12731285
....@@ -1275,7 +1287,7 @@
12751287 allParamsButton.setToolTipText("Show all controls");
12761288 allParamsButton.addActionListener(this);
12771289
1278
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12791291 clearPanelButton.setToolTipText("Clear all controls");
12801292 clearPanelButton.addActionListener(this);
12811293
....@@ -1283,7 +1295,7 @@
12831295 //unselectButton.setToolTipText("Unselect");
12841296 //unselectButton.addActionListener(this);
12851297
1286
- 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);
12871299 flashSelectionButton.setToolTipText("Highlight selection");
12881300 flashSelectionButton.addActionListener(this);
12891301
....@@ -1306,6 +1318,8 @@
13061318
13071319 cGridBag jSPPanel = new cGridBag();
13081320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
13091323 JScrollPane jSP;
13101324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13111325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1314,11 +1328,11 @@
13141328 oe.treePanel.add(jSPPanel);
13151329 oe.treePanel.Return();
13161330
1317
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
13181332 oe.treePanel.Return();
1319
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1320
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1321
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
13221336
13231337 // mainPanel.setDividerLocation(0.1); //1.0);
13241338 mainPanel.setResizeWeight(0.4);
....@@ -1476,7 +1490,7 @@
14761490
14771491 void EditObject(Object3D obj)
14781492 {
1479
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14801494
14811495 // if (obj.versionlist == null)
14821496 // {
....@@ -2112,24 +2126,24 @@
21122126 switch(axis)
21132127 {
21142128 case 0 :
2115
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2116
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2117
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2118
- 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;
21192133 norm = cVector.X;
21202134 break;
21212135 case 1 :
2122
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2123
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2124
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2125
- 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;
21262140 norm = cVector.Y;
21272141 break;
21282142 case 2 :
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 = maxima.y; vert3.z = minima.z;
2132
- 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;
21332147 norm = cVector.Z;
21342148 break;
21352149 }
....@@ -2698,11 +2712,11 @@
26982712 if (!group.selection.isEmpty())
26992713 {
27002714 Composite csg = new GroupLeaf();
2715
+ group(csg);
27012716 csg.count = 5;
27022717 Composite child = new cGroup("Branch");
27032718 csg.addChild(child);
27042719 child.addChild(csg);
2705
- group(csg);
27062720 }
27072721 } else
27082722 if (source == doubleItem)
....@@ -2710,6 +2724,7 @@
27102724 if (!group.selection.isEmpty())
27112725 {
27122726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27132728 csg.count = 5;
27142729 Composite child = new cGroup("Branch A");
27152730 csg.addChild(child);
....@@ -2717,7 +2732,6 @@
27172732 child = new cGroup("Branch B");
27182733 csg.addChild(child);
27192734 child.addChild(csg);
2720
- group(csg);
27212735 }
27222736 } else
27232737 if (source == tripleItem)
....@@ -2783,7 +2797,7 @@
27832797 {
27842798 Maximize();
27852799 } else
2786
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27872801 {
27882802 ToggleFullScreen();
27892803 } else
....@@ -2792,13 +2806,13 @@
27922806 this.expandedLayout = radio.layout;
27932807 CollapseToolbar();
27942808 } else
2795
- if (source == maximize3DButton)
2796
- {
2797
- this.expandedLayout = radio.layout;
2798
- radio.layout = twoButton;
2799
- Show3DView();
2800
- CollapseToolbar();
2801
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
28022816 if (source == previousVersionButton)
28032817 {
28042818 // Go to previous version
....@@ -3451,6 +3465,10 @@
34513465 {
34523466 ClearMaterials();
34533467 } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
3471
+ } else
34543472 if (source == liveleavesItem)
34553473 {
34563474 LiveLeaves(true);
....@@ -3590,6 +3608,18 @@
35903608 if (source == transformChildrenItem)
35913609 {
35923610 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);
35933623 } else
35943624 if (source == resetTransformItem)
35953625 {
....@@ -3963,6 +3993,9 @@
39633993 if (source == closeButton)
39643994 {
39653995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
39663999 cRadio ab;
39674000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39684001 {
....@@ -4061,6 +4094,9 @@
40614094 } else
40624095 if(source instanceof cRadio)
40634096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
40644100 group.parent = keepparent;
40654101 group.attributes = 0;
40664102 //group.editWindow = null;
....@@ -4112,17 +4148,28 @@
41124148 */
41134149 radio.layout.doClick();
41144150
4115
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41164152
41174153 if (copy.versionlist == null)
41184154 {
4119
- copy.versionlist = new Object3D[100];
41204155 copy.versionindex = -1;
41214156
41224157 // Cannot work with loops
4123
- // To fix this issue, first mark all nodes above the root,
4158
+ // To fix this issue, we first mark all nodes above the root,
41244159 // and check if any of these nodes are reachable below the root.
4125
- //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);
41264173 }
41274174
41284175 SetVersionStates();
....@@ -4240,6 +4287,18 @@
42404287 refreshContents();
42414288 }
42424289
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
+
42434302 void ResetTransform()
42444303 {
42454304 ResetTransform(-1);
....@@ -4255,42 +4314,8 @@
42554314 if (obj.toParent == null)
42564315 continue;
42574316
4258
- if (mask == -1)
4259
- {
4260
- if (obj instanceof Camera) // jan 2014
4261
- {
4262
- LA.matIdentity(obj.toParent);
4263
- LA.matIdentity(obj.fromParent);
4264
- }
4265
- else
4266
- {
4267
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4268
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4269
- }
4270
- TouchTransform(obj);
4271
- continue;
4272
- }
4273
- if ((mask&2) != 0) // Scale
4274
- {
4275
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4276
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4277
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4278
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4279
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4280
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4281
- }
4282
- if ((mask&4) != 0) // Rotation
4283
- {
4284
- // ?
4285
- }
4286
- if ((mask&1) != 0) // Translation
4287
- {
4288
- if (obj.toParent != null)
4289
- {
4290
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4291
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4292
- }
4293
- }
4317
+ obj.ResetTransform(mask);
4318
+
42944319 if (obj.parent == null)
42954320 {
42964321 System.out.println("NULL PARENT!");
....@@ -4799,6 +4824,12 @@
47994824 {
48004825 Object3D obj = group.selection.get(i);
48014826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
48024833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48034834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48044835 }
....@@ -5090,6 +5121,12 @@
50905121 refreshContents();
50915122 }
50925123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50935130 void FlipV(boolean flip)
50945131 {
50955132 group.selection.FlipV(flip);
....@@ -5328,7 +5365,7 @@
53285365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53295366 // a camera
53305367 {
5331
- 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
53325369 {
53335370 CameraPane.camerachangeframe = 0; // don't refuse it
53345371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5375,11 +5412,12 @@
53755412 }
53765413 }
53775414
5378
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
53795416 }
53805417
53815418 void refreshContents(boolean cp)
53825419 {
5420
+ if (Globals.SHOWINFO)
53835421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53845422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53855423 {
....@@ -6330,6 +6368,7 @@
63306368 private MenuItem clipMeshItem;
63316369 private MenuItem smoothMeshItem;
63326370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63336372
63346373 private MenuItem liveleavesItem;
63356374 private MenuItem unliveleavesItem;
....@@ -6353,6 +6392,9 @@
63536392 private MenuItem maxTexturesItem;
63546393 private MenuItem panoTexturesItem;
63556394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63566398 private MenuItem resetCentroidItem;
63576399 private MenuItem resetCentroidXZItem;
63586400 private MenuItem resetTransformItem;