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;
....@@ -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)
....@@ -491,11 +483,16 @@
491483
492484 Object3D parent = obj.parent;
493485 obj.parent = null;
486
+
494487 // Object3D support = obj.support;
495488 // obj.support = null;
496489 if (!supports)
497490 obj.SaveSupports();
491
+
498492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
499496 obj.parent = parent;
500497 // obj.support = support;
501498 // clone.support = support; // aout 2013
....@@ -565,8 +562,10 @@
565562 pasteLinkItem.addActionListener(this);
566563 pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
567564 pasteCloneItem.addActionListener(this);
568
-// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
569
-// pasteExpandItem.addActionListener(this);
565
+// CRASH
566
+ pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
567
+//
568
+ pasteExpandItem.addActionListener(this);
570569 //menu.add("-");
571570 oe.jTree.popup.addSeparator();
572571
....@@ -763,9 +762,9 @@
763762 shadowYItem.addActionListener(this);
764763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
765764 shadowZItem.addActionListener(this);
765
+
766766 attributeItem = menu.add(new MenuItem("Attribute"));
767767 attributeItem.addActionListener(this);
768
-
769768 if (Globals.ADVANCED)
770769 {
771770 menu.add("-");
....@@ -777,11 +776,18 @@
777776 pointflowItem.addActionListener(this);
778777 }
779778 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("-");
780786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
781787 resetTransformItem.addActionListener(this);
782788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
783789 resetCentroidItem.addActionListener(this);
784
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
785791 resetCentroidXZItem.addActionListener(this);
786792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
787793 transformGeometryItem.addActionListener(this);
....@@ -797,7 +803,7 @@
797803 genNormalsCADItem.addActionListener(this);
798804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
799805 genNormalsMESHItem.addActionListener(this);
800
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
801807 {
802808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
803809 genNormalsMINEItem.addActionListener(this);
....@@ -833,6 +839,8 @@
833839 }
834840
835841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
836844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
837845 clearMaterialsItem.addActionListener(this);
838846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -855,9 +863,9 @@
855863 hideleavesItem.addActionListener(this);
856864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
857865 showleavesItem.addActionListener(this);
858
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
859867 markleavesItem.addActionListener(this);
860
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
861869 unmarkleavesItem.addActionListener(this);
862870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
863871 rewindleavesItem.addActionListener(this);
....@@ -934,6 +942,8 @@
934942 cGridBag currenttab;
935943 //boolean added; // patch for jar
936944
945
+ int totalcount = 0;
946
+
937947 int tabcount = 0;
938948 int colcount = 0;
939949 int rowcount = 0;
....@@ -956,13 +966,13 @@
956966 currenttab.setName(tabname);
957967 //added = false;
958968 resourcecontainer.add(currenttab);
959
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
960970 rowcount = 1;
961971 colcount = 0;
962972 texturecount = 0;
963973 }
964974
965
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
966976 {
967977 //if (!added)
968978 {
....@@ -971,7 +981,13 @@
971981 currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
972982 }
973983
974
- 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++;
975991
976992 if (++colcount >= columns)
977993 {
....@@ -997,6 +1013,8 @@
9971013 container.add(resourcecontainer);
9981014
9991015 Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
10001018 }
10011019
10021020 void SetupUI2(ObjEditor oe)
....@@ -1036,9 +1054,9 @@
10361054 oe.radioPanel.add(dummyButton);
10371055 oe.buttonGroup.add(dummyButton);
10381056 */
1039
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
10401058
1041
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
10421060
10431061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10441062
....@@ -1065,25 +1083,29 @@
10651083 // }
10661084 // });
10671085
1068
- 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);
10691091 collapseButton.setToolTipText("Collapse toolbar");
10701092 collapseButton.addActionListener(this);
10711093
1072
- oe.toolbarPanel.add(maximize3DButton = GetButton("icons/empty.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
- maximize3DButton.setToolTipText("Maximize 3D view");
1074
- 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);
10751097
1076
- 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);
10771099 twoButton.setToolTipText("Show 3D view only");
10781100 twoButton.addActionListener(this);
10791101 this.fullscreenLayout = twoButton;
10801102
1081
- 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);
10821104 threeButton.setToolTipText("Show controls and 3D view");
10831105 threeButton.addActionListener(this);
10841106 if (Globals.ADVANCED)
10851107 {
1086
- 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);
10871109 sixButton.setToolTipText("Show 3D view and controls");
10881110 sixButton.addActionListener(this);
10891111 }
....@@ -1092,50 +1114,47 @@
10921114 // sevenButton.addActionListener(this);
10931115 //
10941116
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);
1117
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001118 screenfitButton.setToolTipText("Screen fit");
11011119 screenfitButton.addActionListener(this);
11021120
1103
- 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);
11041122 restoreCameraButton.setToolTipText("Restore viewpoint");
11051123 restoreCameraButton.addActionListener(this);
11061124
1107
- 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);
11081126 saveVersionButton.setToolTipText("Duplicate current version");
11091127 saveVersionButton.addActionListener(this);
11101128
1111
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121130 deleteVersionButton.setToolTipText("Delete current version");
11131131 deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
11141133
1115
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11161135 previousVersionButton.setToolTipText("Previous version");
11171136 previousVersionButton.addActionListener(this);
11181137 previousVersionButton.setEnabled(false);
11191138
11201139 cGridBag updown = new cGridBag().setVertical(true);
1121
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11221141 restoreButton.setToolTipText("Undo (restore current version)");
11231142 restoreButton.addActionListener(this);
1124
- //restoreButton.setEnabled(false);
1143
+ restoreButton.setEnabled(false);
11251144
1126
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11271146 replaceButton.setToolTipText("Save (replace current version)");
11281147 replaceButton.addActionListener(this);
1129
- //replaceButton.setEnabled(false);
1148
+ replaceButton.setEnabled(false);
11301149
1131
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
11321151
1133
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11341153 nextVersionButton.setToolTipText("Next version");
11351154 nextVersionButton.addActionListener(this);
11361155 nextVersionButton.setEnabled(false);
11371156
1138
- 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);
11391158 oneStepButton.setToolTipText("Animate one step forward");
11401159 oneStepButton.addActionListener(this);
11411160
....@@ -1158,11 +1177,11 @@
11581177
11591178 if (Globals.ADVANCED)
11601179 {
1161
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11621181 snapobjectButton.addActionListener(this);
11631182 snapobjectButton.setToolTipText("Snap Object");
11641183
1165
- 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);
11661185 fourButton.addActionListener(this);
11671186 fourButton.setToolTipText("Show control panel only");
11681187 }
....@@ -1170,83 +1189,85 @@
11701189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11711190
11721191
1173
- 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);
11741193 rootButton.setToolTipText("Open selection in new tab");
11751194 rootButton.addActionListener(this);
11761195
1177
- 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);
11781197 closeButton.setToolTipText("Close tab");
11791198 closeButton.addActionListener(this);
11801199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
11811200 //clearButton.addActionListener(this);
11821201
11831202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
11841204
11851205 // INSERT
1186
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11871207 gridButton.setToolTipText("Create ground");
11881208 gridButton.addActionListener(this);
11891209
1190
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911211 boxButton.setToolTipText("Create box");
11921212 boxButton.addActionListener(this);
11931213
1194
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11951215 superButton.setToolTipText("Create superellipsoid");
11961216 superButton.addActionListener(this);
11971217
1198
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1218
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991219 sphereButton.setToolTipText("Create sphere");
12001220 sphereButton.addActionListener(this);
12011221
1202
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031223 coneButton.setToolTipText("Create cone");
12041224 coneButton.addActionListener(this);
12051225
1206
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1226
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12071227 torusButton.setToolTipText("Create torus");
12081228 torusButton.addActionListener(this);
12091229
1210
- if (Globals.ADVANCED)
1230
+ if (false) //Globals.ADVANCED)
12111231 {
1212
- 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);
12131233 kleinButton.setToolTipText("Create Klein bottle");
12141234 kleinButton.addActionListener(this);
12151235 }
12161236
1217
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12181238 particlesButton.setToolTipText("Create particle system");
12191239 particlesButton.addActionListener(this);
12201240
12211241 oe.toolboxPanel.add(row1);
12221242
12231243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
12241245
1225
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12261247 groupButton.setToolTipText("Create group");
12271248 groupButton.addActionListener(this);
12281249
1229
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12301251 compositeButton.setToolTipText("Create composite");
12311252 compositeButton.addActionListener(this);
12321253
1233
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12341255 switchButton.setToolTipText("Create item switcher");
12351256 switchButton.addActionListener(this);
12361257
1237
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12381259 loopButton.setToolTipText("Create loop");
12391260 loopButton.addActionListener(this);
12401261
1241
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12421263 textureButton.setToolTipText("Create texture");
12431264 textureButton.addActionListener(this);
12441265
1245
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12461267 overlayButton.setToolTipText("Create overlay");
12471268 overlayButton.addActionListener(this);
12481269
1249
- 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);
12501271 lightButton.setToolTipText("Create light");
12511272 lightButton.addActionListener(this);
12521273
....@@ -1256,6 +1277,11 @@
12561277
12571278 CreateTexturePanel(textures);
12581279
1280
+ int tabCount = resourcecontainer.getTabCount();
1281
+
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
12591285 oe.toolboxPanel.add(textures);
12601286
12611287 textures.preferredHeight = 100;
....@@ -1263,11 +1289,11 @@
12631289 CreateSkyboxPanel(oe.skyboxPanel);
12641290
12651291 // EDIT panel
1266
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12671293 editButton.setToolTipText("Pin selection controls");
12681294 editButton.addActionListener(this);
12691295
1270
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12711297 uneditButton.setToolTipText("Unpin and remove selection controls");
12721298 uneditButton.addActionListener(this);
12731299
....@@ -1275,7 +1301,7 @@
12751301 allParamsButton.setToolTipText("Show all controls");
12761302 allParamsButton.addActionListener(this);
12771303
1278
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12791305 clearPanelButton.setToolTipText("Clear all controls");
12801306 clearPanelButton.addActionListener(this);
12811307
....@@ -1283,7 +1309,7 @@
12831309 //unselectButton.setToolTipText("Unselect");
12841310 //unselectButton.addActionListener(this);
12851311
1286
- 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);
12871313 flashSelectionButton.setToolTipText("Highlight selection");
12881314 flashSelectionButton.addActionListener(this);
12891315
....@@ -1306,6 +1332,8 @@
13061332
13071333 cGridBag jSPPanel = new cGridBag();
13081334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
13091337 JScrollPane jSP;
13101338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13111339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1314,11 +1342,12 @@
13141342 oe.treePanel.add(jSPPanel);
13151343 oe.treePanel.Return();
13161344
1317
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
13181346 oe.treePanel.Return();
1319
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1320
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1321
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
13221351
13231352 // mainPanel.setDividerLocation(0.1); //1.0);
13241353 mainPanel.setResizeWeight(0.4);
....@@ -1375,7 +1404,7 @@
13751404 // supportCB.setToolTipText("Enable rigging");
13761405 // supportCB.addItemListener(this);
13771406
1378
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
13791408 freezeCB.setToolTipText("Fast moving camera");
13801409 freezeCB.addItemListener(this);
13811410
....@@ -1384,9 +1413,12 @@
13841413
13851414 panel.Return();
13861415
1416
+ if (Globals.ADVANCED)
1417
+ {
13871418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
13881419 crowdCB.setToolTipText("Used for crowds");
13891420 crowdCB.addItemListener(this);
1421
+ }
13901422
13911423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
13921424 smoothCB.setToolTipText("Snapping delay");
....@@ -1399,30 +1431,26 @@
13991431 minshaderCB.setToolTipText("Minimal fast shader");
14001432 minshaderCB.addItemListener(this);
14011433
1402
-// constraints.gridy += 1;
14031434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
14041435 // speakerMocapCB.addItemListener(this);
14051436
1406
- panel.Return();
1407
-
14081437 if (false)
14091438 {
14101439 // handled in scripts
1411
- //constraints.gridy += 1;
14121440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
14131441 speakerCameraCB.addItemListener(this);
14141442
1415
- //constraints.gridy += 1;
14161443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
14171444 speakerFocusCB.addItemListener(this);
14181445
1419
- //constraints.gridy += 1;
1420
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1421
- smoothfocusCB.addItemListener(this);
14221446 panel.Return();
14231447 }
14241448
1425
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
14261454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
14271455 // debugCB.addItemListener(this);
14281456
....@@ -1476,7 +1504,7 @@
14761504
14771505 void EditObject(Object3D obj)
14781506 {
1479
- assert(obj instanceof Composite);
1507
+ //assert(obj instanceof Composite);
14801508
14811509 // if (obj.versionlist == null)
14821510 // {
....@@ -2061,7 +2089,7 @@
20612089 Object3D obj = (Object3D)group.selection.elementAt(0);
20622090 objEditor.ScreenFit(obj, false);
20632091
2064
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
20652093 refreshContents();
20662094 }
20672095
....@@ -2098,7 +2126,7 @@
20982126 obj.parent.TransformToWorld(maxima); //, maxima);
20992127 }
21002128
2101
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
21022130
21032131 shadow.toParent = LA.newMatrix();
21042132 shadow.fromParent = LA.newMatrix();
....@@ -2112,24 +2140,24 @@
21122140 switch(axis)
21132141 {
21142142 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;
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;
21192147 norm = cVector.X;
21202148 break;
21212149 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;
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;
21262154 norm = cVector.Y;
21272155 break;
21282156 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;
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;
21332161 norm = cVector.Z;
21342162 break;
21352163 }
....@@ -2698,11 +2726,11 @@
26982726 if (!group.selection.isEmpty())
26992727 {
27002728 Composite csg = new GroupLeaf();
2729
+ group(csg);
27012730 csg.count = 5;
27022731 Composite child = new cGroup("Branch");
27032732 csg.addChild(child);
27042733 child.addChild(csg);
2705
- group(csg);
27062734 }
27072735 } else
27082736 if (source == doubleItem)
....@@ -2710,6 +2738,7 @@
27102738 if (!group.selection.isEmpty())
27112739 {
27122740 Composite csg = new GroupLeaf("Fork");
2741
+ group(csg);
27132742 csg.count = 5;
27142743 Composite child = new cGroup("Branch A");
27152744 csg.addChild(child);
....@@ -2717,7 +2746,6 @@
27172746 child = new cGroup("Branch B");
27182747 csg.addChild(child);
27192748 child.addChild(csg);
2720
- group(csg);
27212749 }
27222750 } else
27232751 if (source == tripleItem)
....@@ -2783,7 +2811,7 @@
27832811 {
27842812 Maximize();
27852813 } else
2786
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
27872815 {
27882816 ToggleFullScreen();
27892817 } else
....@@ -2792,13 +2820,13 @@
27922820 this.expandedLayout = radio.layout;
27932821 CollapseToolbar();
27942822 } else
2795
- if (source == maximize3DButton)
2796
- {
2797
- this.expandedLayout = radio.layout;
2798
- radio.layout = twoButton;
2799
- Show3DView();
2800
- CollapseToolbar();
2801
- } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
28022830 if (source == previousVersionButton)
28032831 {
28042832 // Go to previous version
....@@ -2826,7 +2854,7 @@
28262854 if (source == saveVersionButton)
28272855 {
28282856 // Save a new version
2829
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
28302858 java.awt.Toolkit.getDefaultToolkit().beep();
28312859 } else
28322860 if (source == deleteVersionButton)
....@@ -3451,6 +3479,10 @@
34513479 {
34523480 ClearMaterials();
34533481 } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
3485
+ } else
34543486 if (source == liveleavesItem)
34553487 {
34563488 LiveLeaves(true);
....@@ -3590,6 +3622,18 @@
35903622 if (source == transformChildrenItem)
35913623 {
35923624 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);
35933637 } else
35943638 if (source == resetTransformItem)
35953639 {
....@@ -3963,6 +4007,9 @@
39634007 if (source == closeButton)
39644008 {
39654009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
39664013 cRadio ab;
39674014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39684015 {
....@@ -4061,6 +4108,9 @@
40614108 } else
40624109 if(source instanceof cRadio)
40634110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
40644114 group.parent = keepparent;
40654115 group.attributes = 0;
40664116 //group.editWindow = null;
....@@ -4112,17 +4162,28 @@
41124162 */
41134163 radio.layout.doClick();
41144164
4115
- assert(copy instanceof Composite);
4165
+ //assert(copy instanceof Composite);
41164166
41174167 if (copy.versionlist == null)
41184168 {
4119
- copy.versionlist = new Object3D[100];
41204169 copy.versionindex = -1;
41214170
41224171 // Cannot work with loops
4123
- // To fix this issue, first mark all nodes above the root,
4172
+ // To fix this issue, we first mark all nodes above the root,
41244173 // and check if any of these nodes are reachable below the root.
4125
- //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);
41264187 }
41274188
41284189 SetVersionStates();
....@@ -4240,9 +4301,46 @@
42404301 refreshContents();
42414302 }
42424303
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
+
42434316 void ResetTransform()
42444317 {
42454318 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();
42464344 }
42474345
42484346 void ResetTransform(int mask)
....@@ -4255,42 +4353,8 @@
42554353 if (obj.toParent == null)
42564354 continue;
42574355
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
- }
4356
+ obj.ResetTransform(mask);
4357
+
42944358 if (obj.parent == null)
42954359 {
42964360 System.out.println("NULL PARENT!");
....@@ -4799,10 +4863,17 @@
47994863 {
48004864 Object3D obj = group.selection.get(i);
48014865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
48024872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
48034873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
48044874 }
48054875
4876
+ Globals.lighttouched = true;
48064877 refreshContents();
48074878 }
48084879
....@@ -5090,6 +5161,12 @@
50905161 refreshContents();
50915162 }
50925163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
50935170 void FlipV(boolean flip)
50945171 {
50955172 group.selection.FlipV(flip);
....@@ -5328,10 +5405,10 @@
53285405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53295406 // a camera
53305407 {
5331
- 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
53325409 {
53335410 CameraPane.camerachangeframe = 0; // don't refuse it
5334
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
53355412 }
53365413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
53375414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5375,11 +5452,12 @@
53755452 }
53765453 }
53775454
5378
- rootButton.setEnabled(allComposites);
5455
+ rootButton.setEnabled(true); // allComposites);
53795456 }
53805457
53815458 void refreshContents(boolean cp)
53825459 {
5460
+ if (Globals.SHOWINFO)
53835461 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53845462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53855463 {
....@@ -6330,6 +6408,7 @@
63306408 private MenuItem clipMeshItem;
63316409 private MenuItem smoothMeshItem;
63326410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
63336412
63346413 private MenuItem liveleavesItem;
63356414 private MenuItem unliveleavesItem;
....@@ -6353,6 +6432,9 @@
63536432 private MenuItem maxTexturesItem;
63546433 private MenuItem panoTexturesItem;
63556434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
63566438 private MenuItem resetCentroidItem;
63576439 private MenuItem resetCentroidXZItem;
63586440 private MenuItem resetTransformItem;