Normand Briere
2019-08-26 6266c8a4b2485b29a7d5bcb217460d7aad3e1c4a
GroupEditor.java
....@@ -29,7 +29,7 @@
2929 {
3030 cButton skyboxButton;
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
3434 skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
....@@ -46,7 +46,7 @@
4646 {
4747 cButton textureButton;
4848 final String path = "textures/" + f + "/" + c + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
5050 textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
....@@ -347,7 +347,7 @@
347347
348348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
349349 {
350
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351351
352352 AddSkyboxTab0(skyboxpane);
353353 AddSkyboxTab1(skyboxpane);
....@@ -415,13 +415,15 @@
415415 this.copy = this.group = group;
416416 //selectees = this.group.selectees;
417417
418
- if (copy.versionlist == null)
419
- {
420
- copy.versionlist = new Object3D[100];
421
- copy.versionindex = -1;
422
-
423
- Save(true);
424
- }
418
+ assert(false);
419
+
420
+// if (copy.versionlist == null)
421
+// {
422
+// copy.versionlist = new Object3D[100];
423
+// copy.versionindex = -1;
424
+//
425
+// //Save(true);
426
+// }
425427
426428 if(ui)
427429 SetupUI(objEditor);
....@@ -444,13 +446,13 @@
444446
445447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
446448
447
- if (copy.versionlist == null)
448
- {
449
- copy.versionlist = new Object3D[100];
450
- copy.versionindex = -1;
451
-
452
- Save(true);
453
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
454456 }
455457
456458 void CloneSelection(boolean supports)
....@@ -569,9 +571,6 @@
569571 // pasteExpandItem.addActionListener(this);
570572 //menu.add("-");
571573 oe.jTree.popup.addSeparator();
572
-
573
- deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
- deleteItem.addActionListener(this);
575574
576575 if (Globals.ADVANCED)
577576 {
....@@ -706,15 +705,17 @@
706705 setMasterItem.addActionListener(this);
707706 }
708707
709
- oe.menuBar.add(menu = new Menu("Group"));
710
-// grabItem = menu.add(new MenuItem("Grab"));
711
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
712710 backItem = menu.add(new MenuItem("Back"));
713711 backItem.addActionListener(this);
714712 frontItem = menu.add(new MenuItem("Front"));
715713 frontItem.addActionListener(this);
716714 // compositeItem = menu.add(new MenuItem("Composite"));
717715 // compositeItem.addActionListener(this);
716
+
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
718719
719720 if (Globals.ADVANCED)
720721 {
....@@ -723,6 +724,11 @@
723724 }
724725 ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
726732
727733 // menu.add("-");
728734 //
....@@ -759,11 +765,11 @@
759765 shadowYItem.addActionListener(this);
760766 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
761767 shadowZItem.addActionListener(this);
762
- attributeItem = menu.add(new MenuItem("Attribute"));
763
- attributeItem.addActionListener(this);
764768
765769 if (Globals.ADVANCED)
766770 {
771
+ attributeItem = menu.add(new MenuItem("Attribute"));
772
+ attributeItem.addActionListener(this);
767773 menu.add("-");
768774 linkerItem = menu.add(new MenuItem("Linker"));
769775 linkerItem.addActionListener(this);
....@@ -773,11 +779,18 @@
773779 pointflowItem.addActionListener(this);
774780 }
775781 menu.add("-");
782
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
783
+ textureRatioRItem.addActionListener(this);
784
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
785
+ textureRatioGItem.addActionListener(this);
786
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
787
+ textureRatioBItem.addActionListener(this);
788
+ menu.add("-");
776789 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
777790 resetTransformItem.addActionListener(this);
778791 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
779792 resetCentroidItem.addActionListener(this);
780
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
793
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
781794 resetCentroidXZItem.addActionListener(this);
782795 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
783796 transformGeometryItem.addActionListener(this);
....@@ -829,6 +842,8 @@
829842 }
830843
831844 oe.menuBar.add(menu = new Menu("Attributes"));
845
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
846
+ clearVersionsItem.addActionListener(this);
832847 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
833848 clearMaterialsItem.addActionListener(this);
834849 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -851,9 +866,9 @@
851866 hideleavesItem.addActionListener(this);
852867 showleavesItem = menu.add(new MenuItem("Show Leaves"));
853868 showleavesItem.addActionListener(this);
854
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
869
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
855870 markleavesItem.addActionListener(this);
856
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
871
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
857872 unmarkleavesItem.addActionListener(this);
858873 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
859874 rewindleavesItem.addActionListener(this);
....@@ -928,8 +943,10 @@
928943
929944 JTabbedPane resourcecontainer;
930945 cGridBag currenttab;
931
- boolean added; // patch for jar
946
+ //boolean added; // patch for jar
932947
948
+ int totalcount = 0;
949
+
933950 int tabcount = 0;
934951 int colcount = 0;
935952 int rowcount = 0;
....@@ -940,33 +957,35 @@
940957
941958 public void ResourceCallBack(String[] path)
942959 {
943
- for (int i = 0; i < path.length; i++)
944
- System.out.print(path[i] + "/");
945
- System.out.println();
960
+// for (int i = 0; i < path.length; i++)
961
+// System.out.print(path[i] + "/");
962
+// System.out.println();
946963
947964 if (//rowcount == 0 ||
948
- path.length == 1)
965
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949966 {
950967 currenttab = new cGridBag();
951
- added = false;
952968 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
953969 currenttab.setName(tabname);
970
+ //added = false;
971
+ resourcecontainer.add(currenttab);
972
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
954973 rowcount = 1;
955974 colcount = 0;
956975 texturecount = 0;
957976 }
958977
959
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
978
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
960979 {
961
- if (!added)
980
+ //if (!added)
962981 {
963
- added = true;
964
- resourcecontainer.add(currenttab);
982
+ //added = true;
965983 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
984
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
967985 }
968986
969
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
987
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
988
+ totalcount++;
970989
971990 if (++colcount >= columns)
972991 {
....@@ -992,6 +1011,8 @@
9921011 container.add(resourcecontainer);
9931012
9941013 Grafreed.ParseResources("textures", this);
1014
+
1015
+ // 935. System.out.println("Total = " + totalcount);
9951016 }
9961017
9971018 void SetupUI2(ObjEditor oe)
....@@ -1031,9 +1052,9 @@
10311052 oe.radioPanel.add(dummyButton);
10321053 oe.buttonGroup.add(dummyButton);
10331054 */
1034
- cGridBag copyOptionsPanel = new cGridBag();
1055
+ cGridBag versionManagerPanel = new cGridBag();
10351056
1036
- copyOptionsPanel.preferredHeight = 2;
1057
+ versionManagerPanel.preferredHeight = 4;
10371058
10381059 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10391060
....@@ -1060,25 +1081,25 @@
10601081 // }
10611082 // });
10621083
1063
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10641085 collapseButton.setToolTipText("Collapse toolbar");
10651086 collapseButton.addActionListener(this);
10661087
1067
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681089 maximize3DButton.setToolTipText("Maximize 3D view");
10691090 maximize3DButton.addActionListener(this);
10701091
1071
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721093 twoButton.setToolTipText("Show 3D view only");
10731094 twoButton.addActionListener(this);
10741095 this.fullscreenLayout = twoButton;
10751096
1076
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771098 threeButton.setToolTipText("Show controls and 3D view");
10781099 threeButton.addActionListener(this);
10791100 if (Globals.ADVANCED)
10801101 {
1081
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10821103 sixButton.setToolTipText("Show 3D view and controls");
10831104 sixButton.addActionListener(this);
10841105 }
....@@ -1087,50 +1108,51 @@
10871108 // sevenButton.addActionListener(this);
10881109 //
10891110
1090
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10911112 fullButton.setToolTipText("Full-screen window");
10921113 fullButton.addActionListener(this);
10931114
1094
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10951116 screenfitButton.setToolTipText("Screen fit");
10961117 screenfitButton.addActionListener(this);
10971118
1098
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1119
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10991120 restoreCameraButton.setToolTipText("Restore viewpoint");
11001121 restoreCameraButton.addActionListener(this);
11011122
1102
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031124 saveVersionButton.setToolTipText("Duplicate current version");
11041125 saveVersionButton.addActionListener(this);
11051126
1106
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1127
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11071128 deleteVersionButton.setToolTipText("Delete current version");
11081129 deleteVersionButton.addActionListener(this);
1130
+ deleteVersionButton.setEnabled(false);
11091131
1110
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11111133 previousVersionButton.setToolTipText("Previous version");
11121134 previousVersionButton.addActionListener(this);
11131135 previousVersionButton.setEnabled(false);
11141136
11151137 cGridBag updown = new cGridBag().setVertical(true);
1116
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171139 restoreButton.setToolTipText("Undo (restore current version)");
11181140 restoreButton.addActionListener(this);
1119
- //restoreButton.setEnabled(false);
1141
+ restoreButton.setEnabled(false);
11201142
1121
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11221144 replaceButton.setToolTipText("Save (replace current version)");
11231145 replaceButton.addActionListener(this);
1124
- //replaceButton.setEnabled(false);
1146
+ replaceButton.setEnabled(false);
11251147
1126
- copyOptionsPanel.add(updown);
1148
+ versionManagerPanel.add(updown);
11271149
1128
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1150
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291151 nextVersionButton.setToolTipText("Next version");
11301152 nextVersionButton.addActionListener(this);
11311153 nextVersionButton.setEnabled(false);
11321154
1133
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11341156 oneStepButton.setToolTipText("Animate one step forward");
11351157 oneStepButton.addActionListener(this);
11361158
....@@ -1153,11 +1175,11 @@
11531175
11541176 if (Globals.ADVANCED)
11551177 {
1156
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1178
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11571179 snapobjectButton.addActionListener(this);
11581180 snapobjectButton.setToolTipText("Snap Object");
11591181
1160
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1182
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11611183 fourButton.addActionListener(this);
11621184 fourButton.setToolTipText("Show control panel only");
11631185 }
....@@ -1165,11 +1187,11 @@
11651187 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11661188
11671189
1168
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1190
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691191 rootButton.setToolTipText("Open selection in new tab");
11701192 rootButton.addActionListener(this);
11711193
1172
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11731195 closeButton.setToolTipText("Close tab");
11741196 closeButton.addActionListener(this);
11751197 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1178,38 +1200,38 @@
11781200 cGridBag row1 = new cGridBag();
11791201
11801202 // INSERT
1181
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1203
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11821204 gridButton.setToolTipText("Create ground");
11831205 gridButton.addActionListener(this);
11841206
1185
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1207
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11861208 boxButton.setToolTipText("Create box");
11871209 boxButton.addActionListener(this);
11881210
1189
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1190
- sphereButton.setToolTipText("Create sphere");
1191
- sphereButton.addActionListener(this);
1192
-
1193
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
- coneButton.setToolTipText("Create cone");
1195
- coneButton.addActionListener(this);
1196
-
1197
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
- torusButton.setToolTipText("Create torus");
1199
- torusButton.addActionListener(this);
1200
-
1201
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1211
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12021212 superButton.setToolTipText("Create superellipsoid");
12031213 superButton.addActionListener(this);
12041214
1205
- if (Globals.ADVANCED)
1215
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1216
+ sphereButton.setToolTipText("Create sphere");
1217
+ sphereButton.addActionListener(this);
1218
+
1219
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1220
+ coneButton.setToolTipText("Create cone");
1221
+ coneButton.addActionListener(this);
1222
+
1223
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1224
+ torusButton.setToolTipText("Create torus");
1225
+ torusButton.addActionListener(this);
1226
+
1227
+ if (false) //Globals.ADVANCED)
12061228 {
1207
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1229
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081230 kleinButton.setToolTipText("Create Klein bottle");
12091231 kleinButton.addActionListener(this);
12101232 }
12111233
1212
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1234
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12131235 particlesButton.setToolTipText("Create particle system");
12141236 particlesButton.addActionListener(this);
12151237
....@@ -1217,31 +1239,31 @@
12171239
12181240 cGridBag row2 = new cGridBag();
12191241
1220
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1242
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12211243 groupButton.setToolTipText("Create group");
12221244 groupButton.addActionListener(this);
12231245
1224
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12251247 compositeButton.setToolTipText("Create composite");
12261248 compositeButton.addActionListener(this);
12271249
1228
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12291251 switchButton.setToolTipText("Create item switcher");
12301252 switchButton.addActionListener(this);
12311253
1232
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12331255 loopButton.setToolTipText("Create loop");
12341256 loopButton.addActionListener(this);
12351257
1236
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12371259 textureButton.setToolTipText("Create texture");
12381260 textureButton.addActionListener(this);
12391261
1240
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12411263 overlayButton.setToolTipText("Create overlay");
12421264 overlayButton.addActionListener(this);
12431265
1244
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451267 lightButton.setToolTipText("Create light");
12461268 lightButton.addActionListener(this);
12471269
....@@ -1251,6 +1273,11 @@
12511273
12521274 CreateTexturePanel(textures);
12531275
1276
+ int tabCount = resourcecontainer.getTabCount();
1277
+
1278
+ if (tabCount > 0)
1279
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1280
+
12541281 oe.toolboxPanel.add(textures);
12551282
12561283 textures.preferredHeight = 100;
....@@ -1258,11 +1285,11 @@
12581285 CreateSkyboxPanel(oe.skyboxPanel);
12591286
12601287 // EDIT panel
1261
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1288
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12621289 editButton.setToolTipText("Pin selection controls");
12631290 editButton.addActionListener(this);
12641291
1265
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12661293 uneditButton.setToolTipText("Unpin and remove selection controls");
12671294 uneditButton.addActionListener(this);
12681295
....@@ -1270,7 +1297,7 @@
12701297 allParamsButton.setToolTipText("Show all controls");
12711298 allParamsButton.addActionListener(this);
12721299
1273
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1300
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12741301 clearPanelButton.setToolTipText("Clear all controls");
12751302 clearPanelButton.addActionListener(this);
12761303
....@@ -1278,7 +1305,7 @@
12781305 //unselectButton.setToolTipText("Unselect");
12791306 //unselectButton.addActionListener(this);
12801307
1281
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1308
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12821309 flashSelectionButton.setToolTipText("Highlight selection");
12831310 flashSelectionButton.addActionListener(this);
12841311
....@@ -1301,6 +1328,8 @@
13011328
13021329 cGridBag jSPPanel = new cGridBag();
13031330
1331
+ jSPPanel.preferredHeight = 20;
1332
+
13041333 JScrollPane jSP;
13051334 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13061335 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1309,11 +1338,11 @@
13091338 oe.treePanel.add(jSPPanel);
13101339 oe.treePanel.Return();
13111340
1312
- oe.treePanel.add(copyOptionsPanel);
1341
+ oe.treePanel.add(versionManagerPanel);
13131342 oe.treePanel.Return();
1314
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1315
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1316
- sliderPane.preferredHeight = 1;
1343
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1344
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1345
+ versionSliderPane.preferredHeight = 3;
13171346
13181347 // mainPanel.setDividerLocation(0.1); //1.0);
13191348 mainPanel.setResizeWeight(0.4);
....@@ -1471,7 +1500,7 @@
14711500
14721501 void EditObject(Object3D obj)
14731502 {
1474
- assert(obj instanceof Composite);
1503
+ //assert(obj instanceof Composite);
14751504
14761505 // if (obj.versionlist == null)
14771506 // {
....@@ -1503,6 +1532,7 @@
15031532
15041533 oe.SetupViews();
15051534
1535
+ if (Globals.DEBUG)
15061536 System.out.println("SetupViews");
15071537 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15081538 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2106,24 +2136,24 @@
21062136 switch(axis)
21072137 {
21082138 case 0 :
2109
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2110
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2111
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2112
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2139
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2140
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2141
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2142
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21132143 norm = cVector.X;
21142144 break;
21152145 case 1 :
2116
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2117
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2118
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2119
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2146
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2147
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2148
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2149
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21202150 norm = cVector.Y;
21212151 break;
21222152 case 2 :
2123
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2124
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2125
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2126
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2153
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2154
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2155
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2156
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21272157 norm = cVector.Z;
21282158 break;
21292159 }
....@@ -2164,7 +2194,11 @@
21642194 shadow.material = new cMaterial(obj.material);
21652195 shadow.material.diffuse = 0.0001f;
21662196 shadow.material.specular = 0.0001f;
2167
- //shadow.projectedVertices[1].x = 300;
2197
+ shadow.material.opacity = 0.75f;
2198
+
2199
+ AllocProjectedVertices(shadow);
2200
+
2201
+ shadow.projectedVertices[1].x = 300;
21682202
21692203 makeSomething(shadow);
21702204 }
....@@ -3441,6 +3475,10 @@
34413475 {
34423476 ClearMaterials();
34433477 } else
3478
+ if (source == clearVersionsItem)
3479
+ {
3480
+ ClearVersions();
3481
+ } else
34443482 if (source == liveleavesItem)
34453483 {
34463484 LiveLeaves(true);
....@@ -3580,6 +3618,18 @@
35803618 if (source == transformChildrenItem)
35813619 {
35823620 TransformChildren();
3621
+ } else
3622
+ if (source == textureRatioRItem)
3623
+ {
3624
+ TextureRatio(0);
3625
+ } else
3626
+ if (source == textureRatioGItem)
3627
+ {
3628
+ TextureRatio(1);
3629
+ } else
3630
+ if (source == textureRatioBItem)
3631
+ {
3632
+ TextureRatio(2);
35833633 } else
35843634 if (source == resetTransformItem)
35853635 {
....@@ -3953,6 +4003,9 @@
39534003 if (source == closeButton)
39544004 {
39554005 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4006
+ if (copy.versionlist != null)
4007
+ Replace();
4008
+
39564009 cRadio ab;
39574010 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39584011 {
....@@ -4051,6 +4104,9 @@
40514104 } else
40524105 if(source instanceof cRadio)
40534106 {
4107
+ if (copy.versionlist != null)
4108
+ Replace();
4109
+
40544110 group.parent = keepparent;
40554111 group.attributes = 0;
40564112 //group.editWindow = null;
....@@ -4102,14 +4158,27 @@
41024158 */
41034159 radio.layout.doClick();
41044160
4105
- assert(copy instanceof Composite);
4161
+ //assert(copy instanceof Composite);
41064162
41074163 if (copy.versionlist == null)
41084164 {
4109
- copy.versionlist = new Object3D[100];
41104165 copy.versionindex = -1;
41114166
4112
- Save(true);
4167
+ // Cannot work with loops
4168
+ // To fix this issue, we first mark all nodes above the root,
4169
+ // and check if any of these nodes are reachable below the root.
4170
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4171
+
4172
+ if (copy instanceof Composite && copy.versionlist == null && !copy.HasTags())
4173
+ {
4174
+ copy.versionlist = new Object3D[100];
4175
+
4176
+ //Save(true);
4177
+ }
4178
+ else
4179
+ copy.versionindex = -2;
4180
+
4181
+ Grafreed.grafreed.universe.TagObjects(copy, false);
41134182 }
41144183
41154184 SetVersionStates();
....@@ -4227,6 +4296,18 @@
42274296 refreshContents();
42284297 }
42294298
4299
+ void TextureRatio(int axis)
4300
+ {
4301
+ Object3D obj;
4302
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4303
+ {
4304
+ obj = (Object3D)e.nextElement();
4305
+ obj.TextureRatio(axis);
4306
+ }
4307
+
4308
+ refreshContents();
4309
+ }
4310
+
42304311 void ResetTransform()
42314312 {
42324313 ResetTransform(-1);
....@@ -4242,42 +4323,8 @@
42424323 if (obj.toParent == null)
42434324 continue;
42444325
4245
- if (mask == -1)
4246
- {
4247
- if (obj instanceof Camera) // jan 2014
4248
- {
4249
- LA.matIdentity(obj.toParent);
4250
- LA.matIdentity(obj.fromParent);
4251
- }
4252
- else
4253
- {
4254
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
4255
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
4256
- }
4257
- TouchTransform(obj);
4258
- continue;
4259
- }
4260
- if ((mask&2) != 0) // Scale
4261
- {
4262
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
4263
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
4264
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
4265
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
4266
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4267
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4268
- }
4269
- if ((mask&4) != 0) // Rotation
4270
- {
4271
- // ?
4272
- }
4273
- if ((mask&1) != 0) // Translation
4274
- {
4275
- if (obj.toParent != null)
4276
- {
4277
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4278
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4279
- }
4280
- }
4326
+ obj.ResetTransform(mask);
4327
+
42814328 if (obj.parent == null)
42824329 {
42834330 System.out.println("NULL PARENT!");
....@@ -4786,6 +4833,12 @@
47864833 {
47874834 Object3D obj = group.selection.get(i);
47884835
4836
+ if (obj.toParent == null)
4837
+ {
4838
+ obj.toParent = LA.newMatrix();
4839
+ obj.fromParent = LA.newMatrix();
4840
+ }
4841
+
47894842 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47904843 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47914844 }
....@@ -5077,6 +5130,12 @@
50775130 refreshContents();
50785131 }
50795132
5133
+ void ClearVersions()
5134
+ {
5135
+ group.selection.ClearVersions();
5136
+ refreshContents();
5137
+ }
5138
+
50805139 void FlipV(boolean flip)
50815140 {
50825141 group.selection.FlipV(flip);
....@@ -5354,18 +5413,20 @@
53545413 if (group.selection != null)
53555414 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53565415 {
5357
- if (!(e.nextElement() instanceof Composite))
5416
+ Object next = e.nextElement();
5417
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53585418 {
53595419 allComposites = false;
53605420 break;
53615421 }
53625422 }
53635423
5364
- rootButton.setEnabled(allComposites);
5424
+ rootButton.setEnabled(true); // allComposites);
53655425 }
53665426
53675427 void refreshContents(boolean cp)
53685428 {
5429
+ if (Globals.ADVANCED)
53695430 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53705431 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53715432 {
....@@ -6316,6 +6377,7 @@
63166377 private MenuItem clipMeshItem;
63176378 private MenuItem smoothMeshItem;
63186379 private MenuItem clearMaterialsItem;
6380
+ private MenuItem clearVersionsItem;
63196381
63206382 private MenuItem liveleavesItem;
63216383 private MenuItem unliveleavesItem;
....@@ -6339,13 +6401,16 @@
63396401 private MenuItem maxTexturesItem;
63406402 private MenuItem panoTexturesItem;
63416403
6404
+ private MenuItem textureRatioRItem;
6405
+ private MenuItem textureRatioGItem;
6406
+ private MenuItem textureRatioBItem;
63426407 private MenuItem resetCentroidItem;
63436408 private MenuItem resetCentroidXZItem;
63446409 private MenuItem resetTransformItem;
63456410 private MenuItem transformGeometryItem;
63466411 private MenuItem transformChildrenItem;
63476412 private MenuItem hideItem;
6348
- private MenuItem grabItem;
6413
+ private JMenuItem grabItem;
63496414 private MenuItem backItem;
63506415 private MenuItem frontItem;
63516416 private MenuItem cameraItem;