Normand Briere
2019-09-02 21ac57b36a9e3b909853c7d64ac29b7ad72490a3
GroupEditor.java
....@@ -29,7 +29,7 @@
2929 {
3030 cButton skyboxButton;
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
3434 skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
....@@ -46,7 +46,7 @@
4646 {
4747 cButton textureButton;
4848 final String path = "textures/" + f + "/" + c + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
5050 textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
....@@ -347,7 +347,7 @@
347347
348348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
349349 {
350
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351351
352352 AddSkyboxTab0(skyboxpane);
353353 AddSkyboxTab1(skyboxpane);
....@@ -366,16 +366,6 @@
366366 }
367367
368368 refreshContents();
369
- }
370
-
371
- public void Show3DView()
372
- {
373
- // bug
374
- //gridPanel.setDividerLocation(1.0);
375
- //bigPanel.setDividerLocation(0.0);
376
- bigThree.ClearUI();
377
- bigThree.add(centralPanel);
378
- bigThree.FlushUI();
379369 }
380370
381371 //ObjEditor objEditor;
....@@ -415,13 +405,15 @@
415405 this.copy = this.group = group;
416406 //selectees = this.group.selectees;
417407
418
- if (copy.versionlist == null)
419
- {
420
- copy.versionlist = new Object3D[100];
421
- copy.versionindex = -1;
422
-
423
- Save(true);
424
- }
408
+ assert(false);
409
+
410
+// if (copy.versionlist == null)
411
+// {
412
+// copy.versionlist = new Object3D[100];
413
+// copy.versionindex = -1;
414
+//
415
+// //Save(true);
416
+// }
425417
426418 if(ui)
427419 SetupUI(objEditor);
....@@ -444,13 +436,13 @@
444436
445437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
446438
447
- if (copy.versionlist == null)
448
- {
449
- copy.versionlist = new Object3D[100];
450
- copy.versionindex = -1;
451
-
452
- Save(true);
453
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
454446 }
455447
456448 void CloneSelection(boolean supports)
....@@ -569,9 +561,6 @@
569561 // pasteExpandItem.addActionListener(this);
570562 //menu.add("-");
571563 oe.jTree.popup.addSeparator();
572
-
573
- deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
- deleteItem.addActionListener(this);
575564
576565 if (Globals.ADVANCED)
577566 {
....@@ -706,15 +695,17 @@
706695 setMasterItem.addActionListener(this);
707696 }
708697
709
- oe.menuBar.add(menu = new Menu("Group"));
710
-// grabItem = menu.add(new MenuItem("Grab"));
711
-// grabItem.addActionListener(this);
698
+ oe.menuBar.add(menu = new Menu("Order"));
699
+
712700 backItem = menu.add(new MenuItem("Back"));
713701 backItem.addActionListener(this);
714702 frontItem = menu.add(new MenuItem("Front"));
715703 frontItem.addActionListener(this);
716704 // compositeItem = menu.add(new MenuItem("Composite"));
717705 // compositeItem.addActionListener(this);
706
+
707
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
708
+ grabItem.addActionListener(this);
718709
719710 if (Globals.ADVANCED)
720711 {
....@@ -723,6 +714,11 @@
723714 }
724715 ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725716 ungroupItem.addActionListener(this);
717
+
718
+ oe.jTree.popup.addSeparator();
719
+
720
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
721
+ deleteItem.addActionListener(this);
726722
727723 // menu.add("-");
728724 //
....@@ -759,9 +755,9 @@
759755 shadowYItem.addActionListener(this);
760756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
761757 shadowZItem.addActionListener(this);
758
+
762759 attributeItem = menu.add(new MenuItem("Attribute"));
763760 attributeItem.addActionListener(this);
764
-
765761 if (Globals.ADVANCED)
766762 {
767763 menu.add("-");
....@@ -773,11 +769,18 @@
773769 pointflowItem.addActionListener(this);
774770 }
775771 menu.add("-");
772
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
773
+ textureRatioRItem.addActionListener(this);
774
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
775
+ textureRatioGItem.addActionListener(this);
776
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
777
+ textureRatioBItem.addActionListener(this);
778
+ menu.add("-");
776779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
777780 resetTransformItem.addActionListener(this);
778781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
779782 resetCentroidItem.addActionListener(this);
780
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
781784 resetCentroidXZItem.addActionListener(this);
782785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
783786 transformGeometryItem.addActionListener(this);
....@@ -829,6 +832,8 @@
829832 }
830833
831834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
832837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
833838 clearMaterialsItem.addActionListener(this);
834839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -851,9 +856,9 @@
851856 hideleavesItem.addActionListener(this);
852857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
853858 showleavesItem.addActionListener(this);
854
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
855860 markleavesItem.addActionListener(this);
856
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
857862 unmarkleavesItem.addActionListener(this);
858863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
859864 rewindleavesItem.addActionListener(this);
....@@ -928,8 +933,10 @@
928933
929934 JTabbedPane resourcecontainer;
930935 cGridBag currenttab;
931
- boolean added; // patch for jar
936
+ //boolean added; // patch for jar
932937
938
+ int totalcount = 0;
939
+
933940 int tabcount = 0;
934941 int colcount = 0;
935942 int rowcount = 0;
....@@ -940,33 +947,35 @@
940947
941948 public void ResourceCallBack(String[] path)
942949 {
943
- for (int i = 0; i < path.length; i++)
944
- System.out.print(path[i] + "/");
945
- System.out.println();
950
+// for (int i = 0; i < path.length; i++)
951
+// System.out.print(path[i] + "/");
952
+// System.out.println();
946953
947954 if (//rowcount == 0 ||
948
- path.length == 1)
955
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949956 {
950957 currenttab = new cGridBag();
951
- added = false;
952958 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
953959 currenttab.setName(tabname);
960
+ //added = false;
961
+ resourcecontainer.add(currenttab);
962
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
954963 rowcount = 1;
955964 colcount = 0;
956965 texturecount = 0;
957966 }
958967
959
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
960969 {
961
- if (!added)
970
+ //if (!added)
962971 {
963
- added = true;
964
- resourcecontainer.add(currenttab);
972
+ //added = true;
965973 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
974
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
967975 }
968976
969
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
970979
971980 if (++colcount >= columns)
972981 {
....@@ -992,6 +1001,8 @@
9921001 container.add(resourcecontainer);
9931002
9941003 Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
9951006 }
9961007
9971008 void SetupUI2(ObjEditor oe)
....@@ -1031,9 +1042,9 @@
10311042 oe.radioPanel.add(dummyButton);
10321043 oe.buttonGroup.add(dummyButton);
10331044 */
1034
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
10351046
1036
- copyOptionsPanel.preferredHeight = 2;
1047
+ versionManagerPanel.preferredHeight = 4;
10371048
10381049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10391050
....@@ -1060,25 +1071,29 @@
10601071 // }
10611072 // });
10621073
1063
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ fullScreenButton.setToolTipText("Full-screen window");
1076
+ fullScreenButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10641079 collapseButton.setToolTipText("Collapse toolbar");
10651080 collapseButton.addActionListener(this);
10661081
1067
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
- maximize3DButton.setToolTipText("Maximize 3D view");
1069
- maximize3DButton.addActionListener(this);
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
10701085
1071
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721087 twoButton.setToolTipText("Show 3D view only");
10731088 twoButton.addActionListener(this);
10741089 this.fullscreenLayout = twoButton;
10751090
1076
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771092 threeButton.setToolTipText("Show controls and 3D view");
10781093 threeButton.addActionListener(this);
10791094 if (Globals.ADVANCED)
10801095 {
1081
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10821097 sixButton.setToolTipText("Show 3D view and controls");
10831098 sixButton.addActionListener(this);
10841099 }
....@@ -1087,50 +1102,47 @@
10871102 // sevenButton.addActionListener(this);
10881103 //
10891104
1090
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
- fullButton.setToolTipText("Full-screen window");
1092
- fullButton.addActionListener(this);
1093
-
1094
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10951106 screenfitButton.setToolTipText("Screen fit");
10961107 screenfitButton.addActionListener(this);
10971108
1098
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10991110 restoreCameraButton.setToolTipText("Restore viewpoint");
11001111 restoreCameraButton.addActionListener(this);
11011112
1102
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031114 saveVersionButton.setToolTipText("Duplicate current version");
11041115 saveVersionButton.addActionListener(this);
11051116
1106
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11071118 deleteVersionButton.setToolTipText("Delete current version");
11081119 deleteVersionButton.addActionListener(this);
1120
+ deleteVersionButton.setEnabled(false);
11091121
1110
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11111123 previousVersionButton.setToolTipText("Previous version");
11121124 previousVersionButton.addActionListener(this);
11131125 previousVersionButton.setEnabled(false);
11141126
11151127 cGridBag updown = new cGridBag().setVertical(true);
1116
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171129 restoreButton.setToolTipText("Undo (restore current version)");
11181130 restoreButton.addActionListener(this);
1119
- //restoreButton.setEnabled(false);
1131
+ restoreButton.setEnabled(false);
11201132
1121
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11221134 replaceButton.setToolTipText("Save (replace current version)");
11231135 replaceButton.addActionListener(this);
1124
- //replaceButton.setEnabled(false);
1136
+ replaceButton.setEnabled(false);
11251137
1126
- copyOptionsPanel.add(updown);
1138
+ versionManagerPanel.add(updown);
11271139
1128
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291141 nextVersionButton.setToolTipText("Next version");
11301142 nextVersionButton.addActionListener(this);
11311143 nextVersionButton.setEnabled(false);
11321144
1133
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1145
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11341146 oneStepButton.setToolTipText("Animate one step forward");
11351147 oneStepButton.addActionListener(this);
11361148
....@@ -1153,11 +1165,11 @@
11531165
11541166 if (Globals.ADVANCED)
11551167 {
1156
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11571169 snapobjectButton.addActionListener(this);
11581170 snapobjectButton.setToolTipText("Snap Object");
11591171
1160
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1172
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11611173 fourButton.addActionListener(this);
11621174 fourButton.setToolTipText("Show control panel only");
11631175 }
....@@ -1165,11 +1177,11 @@
11651177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11661178
11671179
1168
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691181 rootButton.setToolTipText("Open selection in new tab");
11701182 rootButton.addActionListener(this);
11711183
1172
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11731185 closeButton.setToolTipText("Close tab");
11741186 closeButton.addActionListener(this);
11751187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1178,38 +1190,38 @@
11781190 cGridBag row1 = new cGridBag();
11791191
11801192 // INSERT
1181
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11821194 gridButton.setToolTipText("Create ground");
11831195 gridButton.addActionListener(this);
11841196
1185
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11861198 boxButton.setToolTipText("Create box");
11871199 boxButton.addActionListener(this);
11881200
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);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12021202 superButton.setToolTipText("Create superellipsoid");
12031203 superButton.addActionListener(this);
12041204
1205
- if (Globals.ADVANCED)
1205
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ sphereButton.setToolTipText("Create sphere");
1207
+ sphereButton.addActionListener(this);
1208
+
1209
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ coneButton.setToolTipText("Create cone");
1211
+ coneButton.addActionListener(this);
1212
+
1213
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1214
+ torusButton.setToolTipText("Create torus");
1215
+ torusButton.addActionListener(this);
1216
+
1217
+ if (false) //Globals.ADVANCED)
12061218 {
1207
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081220 kleinButton.setToolTipText("Create Klein bottle");
12091221 kleinButton.addActionListener(this);
12101222 }
12111223
1212
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12131225 particlesButton.setToolTipText("Create particle system");
12141226 particlesButton.addActionListener(this);
12151227
....@@ -1217,31 +1229,31 @@
12171229
12181230 cGridBag row2 = new cGridBag();
12191231
1220
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12211233 groupButton.setToolTipText("Create group");
12221234 groupButton.addActionListener(this);
12231235
1224
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12251237 compositeButton.setToolTipText("Create composite");
12261238 compositeButton.addActionListener(this);
12271239
1228
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12291241 switchButton.setToolTipText("Create item switcher");
12301242 switchButton.addActionListener(this);
12311243
1232
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12331245 loopButton.setToolTipText("Create loop");
12341246 loopButton.addActionListener(this);
12351247
1236
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12371249 textureButton.setToolTipText("Create texture");
12381250 textureButton.addActionListener(this);
12391251
1240
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12411253 overlayButton.setToolTipText("Create overlay");
12421254 overlayButton.addActionListener(this);
12431255
1244
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1256
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451257 lightButton.setToolTipText("Create light");
12461258 lightButton.addActionListener(this);
12471259
....@@ -1251,6 +1263,11 @@
12511263
12521264 CreateTexturePanel(textures);
12531265
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
12541271 oe.toolboxPanel.add(textures);
12551272
12561273 textures.preferredHeight = 100;
....@@ -1258,11 +1275,11 @@
12581275 CreateSkyboxPanel(oe.skyboxPanel);
12591276
12601277 // EDIT panel
1261
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12621279 editButton.setToolTipText("Pin selection controls");
12631280 editButton.addActionListener(this);
12641281
1265
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12661283 uneditButton.setToolTipText("Unpin and remove selection controls");
12671284 uneditButton.addActionListener(this);
12681285
....@@ -1270,7 +1287,7 @@
12701287 allParamsButton.setToolTipText("Show all controls");
12711288 allParamsButton.addActionListener(this);
12721289
1273
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12741291 clearPanelButton.setToolTipText("Clear all controls");
12751292 clearPanelButton.addActionListener(this);
12761293
....@@ -1278,7 +1295,7 @@
12781295 //unselectButton.setToolTipText("Unselect");
12791296 //unselectButton.addActionListener(this);
12801297
1281
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12821299 flashSelectionButton.setToolTipText("Highlight selection");
12831300 flashSelectionButton.addActionListener(this);
12841301
....@@ -1301,6 +1318,8 @@
13011318
13021319 cGridBag jSPPanel = new cGridBag();
13031320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
13041323 JScrollPane jSP;
13051324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13061325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1309,11 +1328,11 @@
13091328 oe.treePanel.add(jSPPanel);
13101329 oe.treePanel.Return();
13111330
1312
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
13131332 oe.treePanel.Return();
1314
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1315
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1316
- sliderPane.preferredHeight = 1;
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
13171336
13181337 // mainPanel.setDividerLocation(0.1); //1.0);
13191338 mainPanel.setResizeWeight(0.4);
....@@ -1471,7 +1490,7 @@
14711490
14721491 void EditObject(Object3D obj)
14731492 {
1474
- assert(obj instanceof Composite);
1493
+ //assert(obj instanceof Composite);
14751494
14761495 // if (obj.versionlist == null)
14771496 // {
....@@ -1503,6 +1522,7 @@
15031522
15041523 oe.SetupViews();
15051524
1525
+ if (Globals.DEBUG)
15061526 System.out.println("SetupViews");
15071527 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15081528 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2106,24 +2126,24 @@
21062126 switch(axis)
21072127 {
21082128 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;
2129
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2130
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2131
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2132
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21132133 norm = cVector.X;
21142134 break;
21152135 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;
2136
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2137
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2138
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2139
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21202140 norm = cVector.Y;
21212141 break;
21222142 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;
2143
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2144
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2145
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2146
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21272147 norm = cVector.Z;
21282148 break;
21292149 }
....@@ -2164,7 +2184,11 @@
21642184 shadow.material = new cMaterial(obj.material);
21652185 shadow.material.diffuse = 0.0001f;
21662186 shadow.material.specular = 0.0001f;
2167
- //shadow.projectedVertices[1].x = 300;
2187
+ shadow.material.opacity = 0.75f;
2188
+
2189
+ AllocProjectedVertices(shadow);
2190
+
2191
+ shadow.projectedVertices[1].x = 300;
21682192
21692193 makeSomething(shadow);
21702194 }
....@@ -2688,11 +2712,11 @@
26882712 if (!group.selection.isEmpty())
26892713 {
26902714 Composite csg = new GroupLeaf();
2715
+ group(csg);
26912716 csg.count = 5;
26922717 Composite child = new cGroup("Branch");
26932718 csg.addChild(child);
26942719 child.addChild(csg);
2695
- group(csg);
26962720 }
26972721 } else
26982722 if (source == doubleItem)
....@@ -2700,6 +2724,7 @@
27002724 if (!group.selection.isEmpty())
27012725 {
27022726 Composite csg = new GroupLeaf("Fork");
2727
+ group(csg);
27032728 csg.count = 5;
27042729 Composite child = new cGroup("Branch A");
27052730 csg.addChild(child);
....@@ -2707,7 +2732,6 @@
27072732 child = new cGroup("Branch B");
27082733 csg.addChild(child);
27092734 child.addChild(csg);
2710
- group(csg);
27112735 }
27122736 } else
27132737 if (source == tripleItem)
....@@ -2773,7 +2797,7 @@
27732797 {
27742798 Maximize();
27752799 } else
2776
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
27772801 {
27782802 ToggleFullScreen();
27792803 } else
....@@ -2782,13 +2806,13 @@
27822806 this.expandedLayout = radio.layout;
27832807 CollapseToolbar();
27842808 } else
2785
- if (source == maximize3DButton)
2786
- {
2787
- this.expandedLayout = radio.layout;
2788
- radio.layout = twoButton;
2789
- Show3DView();
2790
- CollapseToolbar();
2791
- } else
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
27922816 if (source == previousVersionButton)
27932817 {
27942818 // Go to previous version
....@@ -3441,6 +3465,10 @@
34413465 {
34423466 ClearMaterials();
34433467 } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
3471
+ } else
34443472 if (source == liveleavesItem)
34453473 {
34463474 LiveLeaves(true);
....@@ -3580,6 +3608,18 @@
35803608 if (source == transformChildrenItem)
35813609 {
35823610 TransformChildren();
3611
+ } else
3612
+ if (source == textureRatioRItem)
3613
+ {
3614
+ TextureRatio(0);
3615
+ } else
3616
+ if (source == textureRatioGItem)
3617
+ {
3618
+ TextureRatio(1);
3619
+ } else
3620
+ if (source == textureRatioBItem)
3621
+ {
3622
+ TextureRatio(2);
35833623 } else
35843624 if (source == resetTransformItem)
35853625 {
....@@ -3953,6 +3993,9 @@
39533993 if (source == closeButton)
39543994 {
39553995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
39563999 cRadio ab;
39574000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39584001 {
....@@ -4051,6 +4094,9 @@
40514094 } else
40524095 if(source instanceof cRadio)
40534096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
40544100 group.parent = keepparent;
40554101 group.attributes = 0;
40564102 //group.editWindow = null;
....@@ -4102,14 +4148,28 @@
41024148 */
41034149 radio.layout.doClick();
41044150
4105
- assert(copy instanceof Composite);
4151
+ //assert(copy instanceof Composite);
41064152
41074153 if (copy.versionlist == null)
41084154 {
4109
- copy.versionlist = new Object3D[100];
41104155 copy.versionindex = -1;
41114156
4112
- Save(true);
4157
+ // Cannot work with loops
4158
+ // To fix this issue, we first mark all nodes above the root,
4159
+ // and check if any of these nodes are reachable below the root.
4160
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4161
+
4162
+ if (copy instanceof Composite && !copy.HasTags())
4163
+ {
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
4166
+
4167
+ //Save(true);
4168
+ }
4169
+ else
4170
+ copy.versionindex = -2;
4171
+
4172
+ Grafreed.grafreed.universe.TagObjects(copy, false);
41134173 }
41144174
41154175 SetVersionStates();
....@@ -4227,6 +4287,18 @@
42274287 refreshContents();
42284288 }
42294289
4290
+ void TextureRatio(int axis)
4291
+ {
4292
+ Object3D obj;
4293
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4294
+ {
4295
+ obj = (Object3D)e.nextElement();
4296
+ obj.TextureRatio(axis);
4297
+ }
4298
+
4299
+ refreshContents();
4300
+ }
4301
+
42304302 void ResetTransform()
42314303 {
42324304 ResetTransform(-1);
....@@ -4242,42 +4314,8 @@
42424314 if (obj.toParent == null)
42434315 continue;
42444316
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
- }
4317
+ obj.ResetTransform(mask);
4318
+
42814319 if (obj.parent == null)
42824320 {
42834321 System.out.println("NULL PARENT!");
....@@ -4786,6 +4824,12 @@
47864824 {
47874825 Object3D obj = group.selection.get(i);
47884826
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
4832
+
47894833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
47904834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
47914835 }
....@@ -5077,6 +5121,12 @@
50775121 refreshContents();
50785122 }
50795123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50805130 void FlipV(boolean flip)
50815131 {
50825132 group.selection.FlipV(flip);
....@@ -5315,7 +5365,7 @@
53155365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
53165366 // a camera
53175367 {
5318
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5368
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
53195369 {
53205370 CameraPane.camerachangeframe = 0; // don't refuse it
53215371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -5354,18 +5404,20 @@
53545404 if (group.selection != null)
53555405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53565406 {
5357
- if (!(e.nextElement() instanceof Composite))
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53585409 {
53595410 allComposites = false;
53605411 break;
53615412 }
53625413 }
53635414
5364
- rootButton.setEnabled(allComposites);
5415
+ rootButton.setEnabled(true); // allComposites);
53655416 }
53665417
53675418 void refreshContents(boolean cp)
53685419 {
5420
+ if (Globals.SHOWINFO)
53695421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53705422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53715423 {
....@@ -6316,6 +6368,7 @@
63166368 private MenuItem clipMeshItem;
63176369 private MenuItem smoothMeshItem;
63186370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
63196372
63206373 private MenuItem liveleavesItem;
63216374 private MenuItem unliveleavesItem;
....@@ -6339,13 +6392,16 @@
63396392 private MenuItem maxTexturesItem;
63406393 private MenuItem panoTexturesItem;
63416394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
63426398 private MenuItem resetCentroidItem;
63436399 private MenuItem resetCentroidXZItem;
63446400 private MenuItem resetTransformItem;
63456401 private MenuItem transformGeometryItem;
63466402 private MenuItem transformChildrenItem;
63476403 private MenuItem hideItem;
6348
- private MenuItem grabItem;
6404
+ private JMenuItem grabItem;
63496405 private MenuItem backItem;
63506406 private MenuItem frontItem;
63516407 private MenuItem cameraItem;