Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
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)
....@@ -493,11 +483,16 @@
493483
494484 Object3D parent = obj.parent;
495485 obj.parent = null;
486
+
496487 // Object3D support = obj.support;
497488 // obj.support = null;
498489 if (!supports)
499490 obj.SaveSupports();
491
+
500492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
501496 obj.parent = parent;
502497 // obj.support = support;
503498 // clone.support = support; // aout 2013
....@@ -567,8 +562,10 @@
567562 pasteLinkItem.addActionListener(this);
568563 pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
569564 pasteCloneItem.addActionListener(this);
570
-// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
571
-// pasteExpandItem.addActionListener(this);
565
+// CRASH
566
+ pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
567
+//
568
+ pasteExpandItem.addActionListener(this);
572569 //menu.add("-");
573570 oe.jTree.popup.addSeparator();
574571
....@@ -765,9 +762,9 @@
765762 shadowYItem.addActionListener(this);
766763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
767764 shadowZItem.addActionListener(this);
765
+
768766 attributeItem = menu.add(new MenuItem("Attribute"));
769767 attributeItem.addActionListener(this);
770
-
771768 if (Globals.ADVANCED)
772769 {
773770 menu.add("-");
....@@ -779,11 +776,18 @@
779776 pointflowItem.addActionListener(this);
780777 }
781778 menu.add("-");
779
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
780
+ textureRatioRItem.addActionListener(this);
781
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
782
+ textureRatioGItem.addActionListener(this);
783
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
784
+ textureRatioBItem.addActionListener(this);
785
+ menu.add("-");
782786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
783787 resetTransformItem.addActionListener(this);
784788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
785789 resetCentroidItem.addActionListener(this);
786
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
787791 resetCentroidXZItem.addActionListener(this);
788792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
789793 transformGeometryItem.addActionListener(this);
....@@ -799,7 +803,7 @@
799803 genNormalsCADItem.addActionListener(this);
800804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
801805 genNormalsMESHItem.addActionListener(this);
802
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
803807 {
804808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
805809 genNormalsMINEItem.addActionListener(this);
....@@ -835,6 +839,8 @@
835839 }
836840
837841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
838844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
839845 clearMaterialsItem.addActionListener(this);
840846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -857,9 +863,9 @@
857863 hideleavesItem.addActionListener(this);
858864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
859865 showleavesItem.addActionListener(this);
860
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
861867 markleavesItem.addActionListener(this);
862
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
863869 unmarkleavesItem.addActionListener(this);
864870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
865871 rewindleavesItem.addActionListener(this);
....@@ -936,6 +942,8 @@
936942 cGridBag currenttab;
937943 //boolean added; // patch for jar
938944
945
+ int totalcount = 0;
946
+
939947 int tabcount = 0;
940948 int colcount = 0;
941949 int rowcount = 0;
....@@ -958,13 +966,13 @@
958966 currenttab.setName(tabname);
959967 //added = false;
960968 resourcecontainer.add(currenttab);
961
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
962970 rowcount = 1;
963971 colcount = 0;
964972 texturecount = 0;
965973 }
966974
967
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
968976 {
969977 //if (!added)
970978 {
....@@ -973,7 +981,13 @@
973981 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
974982 }
975983
976
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
984
+ columns = 5;
985
+
986
+ if (path[0].contains("D&R") || path[0].contains("Paint"))
987
+ columns = 4;
988
+
989
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
990
+ totalcount++;
977991
978992 if (++colcount >= columns)
979993 {
....@@ -999,6 +1013,8 @@
9991013 container.add(resourcecontainer);
10001014
10011015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
10021018 }
10031019
10041020 void SetupUI2(ObjEditor oe)
....@@ -1038,9 +1054,9 @@
10381054 oe.radioPanel.add(dummyButton);
10391055 oe.buttonGroup.add(dummyButton);
10401056 */
1041
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10421058
1043
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10441060
10451061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10461062
....@@ -1067,25 +1083,29 @@
10671083 // }
10681084 // });
10691085
1070
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ fullScreenButton.setToolTipText("Full-screen window");
1088
+ fullScreenButton.addActionListener(this);
1089
+
1090
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10711091 collapseButton.setToolTipText("Collapse toolbar");
10721092 collapseButton.addActionListener(this);
10731093
1074
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
- maximize3DButton.setToolTipText("Maximize 3D view");
1076
- maximize3DButton.addActionListener(this);
1094
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1095
+// maximize3DButton.setToolTipText("Maximize 3D view");
1096
+// maximize3DButton.addActionListener(this);
10771097
1078
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1098
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10791099 twoButton.setToolTipText("Show 3D view only");
10801100 twoButton.addActionListener(this);
10811101 this.fullscreenLayout = twoButton;
10821102
1083
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10841104 threeButton.setToolTipText("Show controls and 3D view");
10851105 threeButton.addActionListener(this);
10861106 if (Globals.ADVANCED)
10871107 {
1088
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10891109 sixButton.setToolTipText("Show 3D view and controls");
10901110 sixButton.addActionListener(this);
10911111 }
....@@ -1094,51 +1114,47 @@
10941114 // sevenButton.addActionListener(this);
10951115 //
10961116
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);
1117
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021118 screenfitButton.setToolTipText("Screen fit");
11031119 screenfitButton.addActionListener(this);
11041120
1105
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061122 restoreCameraButton.setToolTipText("Restore viewpoint");
11071123 restoreCameraButton.addActionListener(this);
11081124
1109
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11101126 saveVersionButton.setToolTipText("Duplicate current version");
11111127 saveVersionButton.addActionListener(this);
11121128
1113
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11141130 deleteVersionButton.setToolTipText("Delete current version");
11151131 deleteVersionButton.addActionListener(this);
11161132 deleteVersionButton.setEnabled(false);
11171133
1118
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11191135 previousVersionButton.setToolTipText("Previous version");
11201136 previousVersionButton.addActionListener(this);
11211137 previousVersionButton.setEnabled(false);
11221138
11231139 cGridBag updown = new cGridBag().setVertical(true);
1124
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11251141 restoreButton.setToolTipText("Undo (restore current version)");
11261142 restoreButton.addActionListener(this);
11271143 restoreButton.setEnabled(false);
11281144
1129
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11301146 replaceButton.setToolTipText("Save (replace current version)");
11311147 replaceButton.addActionListener(this);
11321148 replaceButton.setEnabled(false);
11331149
1134
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
11351151
1136
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11371153 nextVersionButton.setToolTipText("Next version");
11381154 nextVersionButton.addActionListener(this);
11391155 nextVersionButton.setEnabled(false);
11401156
1141
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1157
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11421158 oneStepButton.setToolTipText("Animate one step forward");
11431159 oneStepButton.addActionListener(this);
11441160
....@@ -1161,11 +1177,11 @@
11611177
11621178 if (Globals.ADVANCED)
11631179 {
1164
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11651181 snapobjectButton.addActionListener(this);
11661182 snapobjectButton.setToolTipText("Snap Object");
11671183
1168
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691185 fourButton.addActionListener(this);
11701186 fourButton.setToolTipText("Show control panel only");
11711187 }
....@@ -1173,83 +1189,85 @@
11731189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11741190
11751191
1176
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1192
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771193 rootButton.setToolTipText("Open selection in new tab");
11781194 rootButton.addActionListener(this);
11791195
1180
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811197 closeButton.setToolTipText("Close tab");
11821198 closeButton.addActionListener(this);
11831199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11841200 //clearButton.addActionListener(this);
11851201
11861202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11871204
11881205 // INSERT
1189
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11901207 gridButton.setToolTipText("Create ground");
11911208 gridButton.addActionListener(this);
11921209
1193
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11941211 boxButton.setToolTipText("Create box");
11951212 boxButton.addActionListener(this);
11961213
1197
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11981215 superButton.setToolTipText("Create superellipsoid");
11991216 superButton.addActionListener(this);
12001217
1201
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1218
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12021219 sphereButton.setToolTipText("Create sphere");
12031220 sphereButton.addActionListener(this);
12041221
1205
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12061223 coneButton.setToolTipText("Create cone");
12071224 coneButton.addActionListener(this);
12081225
1209
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1226
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12101227 torusButton.setToolTipText("Create torus");
12111228 torusButton.addActionListener(this);
12121229
1213
- if (Globals.ADVANCED)
1230
+ if (false) //Globals.ADVANCED)
12141231 {
1215
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161233 kleinButton.setToolTipText("Create Klein bottle");
12171234 kleinButton.addActionListener(this);
12181235 }
12191236
1220
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12211238 particlesButton.setToolTipText("Create particle system");
12221239 particlesButton.addActionListener(this);
12231240
12241241 oe.toolboxPanel.add(row1);
12251242
12261243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
12271245
1228
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12291247 groupButton.setToolTipText("Create group");
12301248 groupButton.addActionListener(this);
12311249
1232
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12331251 compositeButton.setToolTipText("Create composite");
12341252 compositeButton.addActionListener(this);
12351253
1236
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12371255 switchButton.setToolTipText("Create item switcher");
12381256 switchButton.addActionListener(this);
12391257
1240
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12411259 loopButton.setToolTipText("Create loop");
12421260 loopButton.addActionListener(this);
12431261
1244
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451263 textureButton.setToolTipText("Create texture");
12461264 textureButton.addActionListener(this);
12471265
1248
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491267 overlayButton.setToolTipText("Create overlay");
12501268 overlayButton.addActionListener(this);
12511269
1252
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1270
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12531271 lightButton.setToolTipText("Create light");
12541272 lightButton.addActionListener(this);
12551273
....@@ -1259,6 +1277,11 @@
12591277
12601278 CreateTexturePanel(textures);
12611279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
12621285 oe.toolboxPanel.add(textures);
12631286
12641287 textures.preferredHeight = 100;
....@@ -1266,11 +1289,11 @@
12661289 CreateSkyboxPanel(oe.skyboxPanel);
12671290
12681291 // EDIT panel
1269
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12701293 editButton.setToolTipText("Pin selection controls");
12711294 editButton.addActionListener(this);
12721295
1273
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12741297 uneditButton.setToolTipText("Unpin and remove selection controls");
12751298 uneditButton.addActionListener(this);
12761299
....@@ -1278,7 +1301,7 @@
12781301 allParamsButton.setToolTipText("Show all controls");
12791302 allParamsButton.addActionListener(this);
12801303
1281
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12821305 clearPanelButton.setToolTipText("Clear all controls");
12831306 clearPanelButton.addActionListener(this);
12841307
....@@ -1286,7 +1309,7 @@
12861309 //unselectButton.setToolTipText("Unselect");
12871310 //unselectButton.addActionListener(this);
12881311
1289
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1312
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12901313 flashSelectionButton.setToolTipText("Highlight selection");
12911314 flashSelectionButton.addActionListener(this);
12921315
....@@ -1309,6 +1332,8 @@
13091332
13101333 cGridBag jSPPanel = new cGridBag();
13111334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
13121337 JScrollPane jSP;
13131338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13141339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1317,11 +1342,12 @@
13171342 oe.treePanel.add(jSPPanel);
13181343 oe.treePanel.Return();
13191344
1320
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
13211346 oe.treePanel.Return();
1322
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1323
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1324
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
13251351
13261352 // mainPanel.setDividerLocation(0.1); //1.0);
13271353 mainPanel.setResizeWeight(0.4);
....@@ -1378,7 +1404,7 @@
13781404 // supportCB.setToolTipText("Enable rigging");
13791405 // supportCB.addItemListener(this);
13801406
1381
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13821408 freezeCB.setToolTipText("Fast moving camera");
13831409 freezeCB.addItemListener(this);
13841410
....@@ -1387,9 +1413,12 @@
13871413
13881414 panel.Return();
13891415
1416
+ if (Globals.ADVANCED)
1417
+ {
13901418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13911419 crowdCB.setToolTipText("Used for crowds");
13921420 crowdCB.addItemListener(this);
1421
+ }
13931422
13941423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13951424 smoothCB.setToolTipText("Snapping delay");
....@@ -1402,30 +1431,26 @@
14021431 minshaderCB.setToolTipText("Minimal fast shader");
14031432 minshaderCB.addItemListener(this);
14041433
1405
-// constraints.gridy += 1;
14061434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
14071435 // speakerMocapCB.addItemListener(this);
14081436
1409
- panel.Return();
1410
-
14111437 if (false)
14121438 {
14131439 // handled in scripts
1414
- //constraints.gridy += 1;
14151440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
14161441 speakerCameraCB.addItemListener(this);
14171442
1418
- //constraints.gridy += 1;
14191443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
14201444 speakerFocusCB.addItemListener(this);
14211445
1422
- //constraints.gridy += 1;
1423
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1424
- smoothfocusCB.addItemListener(this);
14251446 panel.Return();
14261447 }
14271448
1428
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
14291454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
14301455 // debugCB.addItemListener(this);
14311456
....@@ -1479,7 +1504,7 @@
14791504
14801505 void EditObject(Object3D obj)
14811506 {
1482
- assert(obj instanceof Composite);
1507
+ //assert(obj instanceof Composite);
14831508
14841509 // if (obj.versionlist == null)
14851510 // {
....@@ -2064,7 +2089,7 @@
20642089 Object3D obj = (Object3D)group.selection.elementAt(0);
20652090 objEditor.ScreenFit(obj, false);
20662091
2067
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20682093 refreshContents();
20692094 }
20702095
....@@ -2101,7 +2126,7 @@
21012126 obj.parent.TransformToWorld(maxima); //, maxima);
21022127 }
21032128
2104
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
21052130
21062131 shadow.toParent = LA.newMatrix();
21072132 shadow.fromParent = LA.newMatrix();
....@@ -2115,24 +2140,24 @@
21152140 switch(axis)
21162141 {
21172142 case 0 :
2118
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2119
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2120
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2121
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2143
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2144
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2145
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2146
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21222147 norm = cVector.X;
21232148 break;
21242149 case 1 :
2125
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2126
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2127
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2128
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2150
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2151
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2152
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2153
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21292154 norm = cVector.Y;
21302155 break;
21312156 case 2 :
2132
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2133
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2134
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2135
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2157
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2158
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2159
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2160
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21362161 norm = cVector.Z;
21372162 break;
21382163 }
....@@ -2701,11 +2726,11 @@
27012726 if (!group.selection.isEmpty())
27022727 {
27032728 Composite csg = new GroupLeaf();
2729
+ group(csg);
27042730 csg.count = 5;
27052731 Composite child = new cGroup("Branch");
27062732 csg.addChild(child);
27072733 child.addChild(csg);
2708
- group(csg);
27092734 }
27102735 } else
27112736 if (source == doubleItem)
....@@ -2713,6 +2738,7 @@
27132738 if (!group.selection.isEmpty())
27142739 {
27152740 Composite csg = new GroupLeaf("Fork");
2741
+ group(csg);
27162742 csg.count = 5;
27172743 Composite child = new cGroup("Branch A");
27182744 csg.addChild(child);
....@@ -2720,7 +2746,6 @@
27202746 child = new cGroup("Branch B");
27212747 csg.addChild(child);
27222748 child.addChild(csg);
2723
- group(csg);
27242749 }
27252750 } else
27262751 if (source == tripleItem)
....@@ -2786,7 +2811,7 @@
27862811 {
27872812 Maximize();
27882813 } else
2789
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
27902815 {
27912816 ToggleFullScreen();
27922817 } else
....@@ -2795,13 +2820,13 @@
27952820 this.expandedLayout = radio.layout;
27962821 CollapseToolbar();
27972822 } else
2798
- if (source == maximize3DButton)
2799
- {
2800
- this.expandedLayout = radio.layout;
2801
- radio.layout = twoButton;
2802
- Show3DView();
2803
- CollapseToolbar();
2804
- } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
28052830 if (source == previousVersionButton)
28062831 {
28072832 // Go to previous version
....@@ -2829,7 +2854,7 @@
28292854 if (source == saveVersionButton)
28302855 {
28312856 // Save a new version
2832
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
28332858 java.awt.Toolkit.getDefaultToolkit().beep();
28342859 } else
28352860 if (source == deleteVersionButton)
....@@ -3454,6 +3479,10 @@
34543479 {
34553480 ClearMaterials();
34563481 } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
3485
+ } else
34573486 if (source == liveleavesItem)
34583487 {
34593488 LiveLeaves(true);
....@@ -3593,6 +3622,18 @@
35933622 if (source == transformChildrenItem)
35943623 {
35953624 TransformChildren();
3625
+ } else
3626
+ if (source == textureRatioRItem)
3627
+ {
3628
+ TextureRatio(0);
3629
+ } else
3630
+ if (source == textureRatioGItem)
3631
+ {
3632
+ TextureRatio(1);
3633
+ } else
3634
+ if (source == textureRatioBItem)
3635
+ {
3636
+ TextureRatio(2);
35963637 } else
35973638 if (source == resetTransformItem)
35983639 {
....@@ -3966,6 +4007,9 @@
39664007 if (source == closeButton)
39674008 {
39684009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
39694013 cRadio ab;
39704014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39714015 {
....@@ -4064,6 +4108,9 @@
40644108 } else
40654109 if(source instanceof cRadio)
40664110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
40674114 group.parent = keepparent;
40684115 group.attributes = 0;
40694116 //group.editWindow = null;
....@@ -4115,17 +4162,28 @@
41154162 */
41164163 radio.layout.doClick();
41174164
4118
- assert(copy instanceof Composite);
4165
+ //assert(copy instanceof Composite);
41194166
41204167 if (copy.versionlist == null)
41214168 {
4122
- copy.versionlist = new Object3D[100];
41234169 copy.versionindex = -1;
41244170
41254171 // Cannot work with loops
4126
- // To fix this issue, first mark all nodes above the root,
4172
+ // To fix this issue, we first mark all nodes above the root,
41274173 // and check if any of these nodes are reachable below the root.
4128
- //Save(true);
4174
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4175
+
4176
+ if (copy instanceof Composite && !copy.HasTags())
4177
+ {
4178
+ if (copy.versionlist == null)
4179
+ copy.versionlist = new Object3D[100];
4180
+
4181
+ //Save(true);
4182
+ }
4183
+ else
4184
+ copy.versionindex = -2;
4185
+
4186
+ Grafreed.grafreed.universe.TagObjects(copy, false);
41294187 }
41304188
41314189 SetVersionStates();
....@@ -4243,9 +4301,46 @@
42434301 refreshContents();
42444302 }
42454303
4304
+ void TextureRatio(int axis)
4305
+ {
4306
+ Object3D obj;
4307
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4308
+ {
4309
+ obj = (Object3D)e.nextElement();
4310
+ obj.TextureRatio(axis);
4311
+ }
4312
+
4313
+ refreshContents();
4314
+ }
4315
+
42464316 void ResetTransform()
42474317 {
42484318 ResetTransform(-1);
4319
+ }
4320
+
4321
+ void ScaleSelection(int scale)
4322
+ {
4323
+ Object3D obj;
4324
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4325
+ {
4326
+ obj = (Object3D)e.nextElement();
4327
+
4328
+ if (obj.toParent == null)
4329
+ continue;
4330
+
4331
+ obj.Scale(scale);
4332
+
4333
+ if (obj.parent == null)
4334
+ {
4335
+ System.out.println("NULL PARENT!");
4336
+ // new Exception().printStackTrace();
4337
+ }
4338
+ else
4339
+ TouchTransform(obj);
4340
+ //obj.parent.Touch();
4341
+ }
4342
+
4343
+ refreshContents();
42494344 }
42504345
42514346 void ResetTransform(int mask)
....@@ -4258,42 +4353,8 @@
42584353 if (obj.toParent == null)
42594354 continue;
42604355
4261
- if (mask == -1)
4262
- {
4263
- if (obj instanceof Camera) // jan 2014
4264
- {
4265
- LA.matIdentity(obj.toParent);
4266
- LA.matIdentity(obj.fromParent);
4267
- }
4268
- else
4269
- {
4270
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4271
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4272
- }
4273
- TouchTransform(obj);
4274
- continue;
4275
- }
4276
- if ((mask&2) != 0) // Scale
4277
- {
4278
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4279
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4280
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4281
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4282
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4283
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4284
- }
4285
- if ((mask&4) != 0) // Rotation
4286
- {
4287
- // ?
4288
- }
4289
- if ((mask&1) != 0) // Translation
4290
- {
4291
- if (obj.toParent != null)
4292
- {
4293
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4294
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4295
- }
4296
- }
4356
+ obj.ResetTransform(mask);
4357
+
42974358 if (obj.parent == null)
42984359 {
42994360 System.out.println("NULL PARENT!");
....@@ -4802,10 +4863,17 @@
48024863 {
48034864 Object3D obj = group.selection.get(i);
48044865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
48054872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48064873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48074874 }
48084875
4876
+ Globals.lighttouched = true;
48094877 refreshContents();
48104878 }
48114879
....@@ -5093,6 +5161,12 @@
50935161 refreshContents();
50945162 }
50955163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
50965170 void FlipV(boolean flip)
50975171 {
50985172 group.selection.FlipV(flip);
....@@ -5331,10 +5405,10 @@
53315405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53325406 // a camera
53335407 {
5334
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5408
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
53355409 {
53365410 CameraPane.camerachangeframe = 0; // don't refuse it
5337
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
53385412 }
53395413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
53405414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5378,11 +5452,12 @@
53785452 }
53795453 }
53805454
5381
- rootButton.setEnabled(allComposites);
5455
+ rootButton.setEnabled(true); // allComposites);
53825456 }
53835457
53845458 void refreshContents(boolean cp)
53855459 {
5460
+ if (Globals.SHOWINFO)
53865461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53875462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53885463 {
....@@ -6333,6 +6408,7 @@
63336408 private MenuItem clipMeshItem;
63346409 private MenuItem smoothMeshItem;
63356410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
63366412
63376413 private MenuItem liveleavesItem;
63386414 private MenuItem unliveleavesItem;
....@@ -6356,6 +6432,9 @@
63566432 private MenuItem maxTexturesItem;
63576433 private MenuItem panoTexturesItem;
63586434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
63596438 private MenuItem resetCentroidItem;
63606439 private MenuItem resetCentroidXZItem;
63616440 private MenuItem resetTransformItem;