Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
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)
....@@ -540,33 +542,35 @@
540542 // menu.add("-");
541543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
542544 duplicateItem.addActionListener(this);
543
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
544547 cloneItem.addActionListener(this);
545
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
546549 {
547550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
548551 cloneSupportItem.addActionListener(this);
549552 }
553
+ oe.jTree.popup.addSeparator();
550554 menu.add("-");
551
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
552556 cutItem.addActionListener(this);
553
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
554558 copyItem.addActionListener(this);
555559 pasteItem = menu.add(new MenuItem("Paste"));
556560 pasteItem.addActionListener(this);
557561
558
- menu.add("-");
559
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
562
+ oe.jTree.popup.addSeparator();
563
+ //menu.add("-");
564
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
560565 pasteIntoItem.addActionListener(this);
561
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
562567 pasteLinkItem.addActionListener(this);
563
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
564569 pasteCloneItem.addActionListener(this);
565
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
566571 // pasteExpandItem.addActionListener(this);
567
- menu.add("-");
568
- deleteItem = menu.add(new MenuItem("Delete"));
569
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
570574
571575 if (Globals.ADVANCED)
572576 {
....@@ -701,9 +705,8 @@
701705 setMasterItem.addActionListener(this);
702706 }
703707
704
- oe.menuBar.add(menu = new Menu("Group"));
705
-// grabItem = menu.add(new MenuItem("Grab"));
706
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
707710 backItem = menu.add(new MenuItem("Back"));
708711 backItem.addActionListener(this);
709712 frontItem = menu.add(new MenuItem("Front"));
....@@ -711,13 +714,21 @@
711714 // compositeItem = menu.add(new MenuItem("Composite"));
712715 // compositeItem.addActionListener(this);
713716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
714720 if (Globals.ADVANCED)
715721 {
716722 hideItem = menu.add(new MenuItem("Hidden Group"));
717723 hideItem.addActionListener(this);
718724 }
719
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
720726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
721732
722733 // menu.add("-");
723734 //
....@@ -824,6 +835,8 @@
824835 }
825836
826837 oe.menuBar.add(menu = new Menu("Attributes"));
838
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
839
+ clearVersionsItem.addActionListener(this);
827840 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
828841 clearMaterialsItem.addActionListener(this);
829842 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -846,9 +859,9 @@
846859 hideleavesItem.addActionListener(this);
847860 showleavesItem = menu.add(new MenuItem("Show Leaves"));
848861 showleavesItem.addActionListener(this);
849
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
862
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
850863 markleavesItem.addActionListener(this);
851
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
864
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
852865 unmarkleavesItem.addActionListener(this);
853866 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
854867 rewindleavesItem.addActionListener(this);
....@@ -923,8 +936,10 @@
923936
924937 JTabbedPane resourcecontainer;
925938 cGridBag currenttab;
926
- boolean added; // patch for jar
939
+ //boolean added; // patch for jar
927940
941
+ int totalcount = 0;
942
+
928943 int tabcount = 0;
929944 int colcount = 0;
930945 int rowcount = 0;
....@@ -940,28 +955,30 @@
940955 // System.out.println();
941956
942957 if (//rowcount == 0 ||
943
- path.length == 1)
958
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
944959 {
945960 currenttab = new cGridBag();
946
- added = false;
947961 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948962 currenttab.setName(tabname);
963
+ //added = false;
964
+ resourcecontainer.add(currenttab);
965
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
949966 rowcount = 1;
950967 colcount = 0;
951968 texturecount = 0;
952969 }
953970
954
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
971
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
955972 {
956
- if (!added)
973
+ //if (!added)
957974 {
958
- added = true;
959
- resourcecontainer.add(currenttab);
975
+ //added = true;
960976 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
977
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
962978 }
963979
964
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
980
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981
+ totalcount++;
965982
966983 if (++colcount >= columns)
967984 {
....@@ -987,6 +1004,8 @@
9871004 container.add(resourcecontainer);
9881005
9891006 Grafreed.ParseResources("textures", this);
1007
+
1008
+ // 935. System.out.println("Total = " + totalcount);
9901009 }
9911010
9921011 void SetupUI2(ObjEditor oe)
....@@ -1026,9 +1045,9 @@
10261045 oe.radioPanel.add(dummyButton);
10271046 oe.buttonGroup.add(dummyButton);
10281047 */
1029
- cGridBag copyOptionsPanel = new cGridBag();
1048
+ cGridBag versionManagerPanel = new cGridBag();
10301049
1031
- copyOptionsPanel.preferredHeight = 2;
1050
+ versionManagerPanel.preferredHeight = 4;
10321051
10331052 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10341053
....@@ -1055,25 +1074,25 @@
10551074 // }
10561075 // });
10571076
1058
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10591078 collapseButton.setToolTipText("Collapse toolbar");
10601079 collapseButton.addActionListener(this);
10611080
1062
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10631082 maximize3DButton.setToolTipText("Maximize 3D view");
10641083 maximize3DButton.addActionListener(this);
10651084
1066
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1085
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10671086 twoButton.setToolTipText("Show 3D view only");
10681087 twoButton.addActionListener(this);
10691088 this.fullscreenLayout = twoButton;
10701089
1071
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1090
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10721091 threeButton.setToolTipText("Show controls and 3D view");
10731092 threeButton.addActionListener(this);
10741093 if (Globals.ADVANCED)
10751094 {
1076
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771096 sixButton.setToolTipText("Show 3D view and controls");
10781097 sixButton.addActionListener(this);
10791098 }
....@@ -1082,50 +1101,51 @@
10821101 // sevenButton.addActionListener(this);
10831102 //
10841103
1085
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1104
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861105 fullButton.setToolTipText("Full-screen window");
10871106 fullButton.addActionListener(this);
10881107
1089
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901109 screenfitButton.setToolTipText("Screen fit");
10911110 screenfitButton.addActionListener(this);
10921111
1093
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941113 restoreCameraButton.setToolTipText("Restore viewpoint");
10951114 restoreCameraButton.addActionListener(this);
10961115
1097
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1116
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10981117 saveVersionButton.setToolTipText("Duplicate current version");
10991118 saveVersionButton.addActionListener(this);
11001119
1101
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11021121 deleteVersionButton.setToolTipText("Delete current version");
11031122 deleteVersionButton.addActionListener(this);
1123
+ deleteVersionButton.setEnabled(false);
11041124
1105
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11061126 previousVersionButton.setToolTipText("Previous version");
11071127 previousVersionButton.addActionListener(this);
11081128 previousVersionButton.setEnabled(false);
11091129
11101130 cGridBag updown = new cGridBag().setVertical(true);
1111
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1131
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121132 restoreButton.setToolTipText("Undo (restore current version)");
11131133 restoreButton.addActionListener(this);
1114
- //restoreButton.setEnabled(false);
1134
+ restoreButton.setEnabled(false);
11151135
1116
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171137 replaceButton.setToolTipText("Save (replace current version)");
11181138 replaceButton.addActionListener(this);
1119
- //replaceButton.setEnabled(false);
1139
+ replaceButton.setEnabled(false);
11201140
1121
- copyOptionsPanel.add(updown);
1141
+ versionManagerPanel.add(updown);
11221142
1123
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11241144 nextVersionButton.setToolTipText("Next version");
11251145 nextVersionButton.addActionListener(this);
11261146 nextVersionButton.setEnabled(false);
11271147
1128
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11291149 oneStepButton.setToolTipText("Animate one step forward");
11301150 oneStepButton.addActionListener(this);
11311151
....@@ -1148,11 +1168,11 @@
11481168
11491169 if (Globals.ADVANCED)
11501170 {
1151
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11521172 snapobjectButton.addActionListener(this);
11531173 snapobjectButton.setToolTipText("Snap Object");
11541174
1155
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561176 fourButton.addActionListener(this);
11571177 fourButton.setToolTipText("Show control panel only");
11581178 }
....@@ -1160,11 +1180,11 @@
11601180 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11611181
11621182
1163
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11641184 rootButton.setToolTipText("Open selection in new tab");
11651185 rootButton.addActionListener(this);
11661186
1167
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681188 closeButton.setToolTipText("Close tab");
11691189 closeButton.addActionListener(this);
11701190 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1173,38 +1193,38 @@
11731193 cGridBag row1 = new cGridBag();
11741194
11751195 // INSERT
1176
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11771197 gridButton.setToolTipText("Create ground");
11781198 gridButton.addActionListener(this);
11791199
1180
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1200
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11811201 boxButton.setToolTipText("Create box");
11821202 boxButton.addActionListener(this);
11831203
1184
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
- sphereButton.setToolTipText("Create sphere");
1186
- sphereButton.addActionListener(this);
1187
-
1188
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1189
- coneButton.setToolTipText("Create cone");
1190
- coneButton.addActionListener(this);
1191
-
1192
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
- torusButton.setToolTipText("Create torus");
1194
- torusButton.addActionListener(this);
1195
-
1196
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11971205 superButton.setToolTipText("Create superellipsoid");
11981206 superButton.addActionListener(this);
11991207
1208
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1209
+ sphereButton.setToolTipText("Create sphere");
1210
+ sphereButton.addActionListener(this);
1211
+
1212
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1213
+ coneButton.setToolTipText("Create cone");
1214
+ coneButton.addActionListener(this);
1215
+
1216
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1217
+ torusButton.setToolTipText("Create torus");
1218
+ torusButton.addActionListener(this);
1219
+
12001220 if (Globals.ADVANCED)
12011221 {
1202
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12031223 kleinButton.setToolTipText("Create Klein bottle");
12041224 kleinButton.addActionListener(this);
12051225 }
12061226
1207
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081228 particlesButton.setToolTipText("Create particle system");
12091229 particlesButton.addActionListener(this);
12101230
....@@ -1212,31 +1232,31 @@
12121232
12131233 cGridBag row2 = new cGridBag();
12141234
1215
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1235
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161236 groupButton.setToolTipText("Create group");
12171237 groupButton.addActionListener(this);
12181238
1219
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1239
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201240 compositeButton.setToolTipText("Create composite");
12211241 compositeButton.addActionListener(this);
12221242
1223
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1243
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241244 switchButton.setToolTipText("Create item switcher");
12251245 switchButton.addActionListener(this);
12261246
1227
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1247
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281248 loopButton.setToolTipText("Create loop");
12291249 loopButton.addActionListener(this);
12301250
1231
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1251
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12321252 textureButton.setToolTipText("Create texture");
12331253 textureButton.addActionListener(this);
12341254
1235
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1255
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12361256 overlayButton.setToolTipText("Create overlay");
12371257 overlayButton.addActionListener(this);
12381258
1239
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1259
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12401260 lightButton.setToolTipText("Create light");
12411261 lightButton.addActionListener(this);
12421262
....@@ -1246,6 +1266,11 @@
12461266
12471267 CreateTexturePanel(textures);
12481268
1269
+ int tabCount = resourcecontainer.getTabCount();
1270
+
1271
+ if (tabCount > 0)
1272
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1273
+
12491274 oe.toolboxPanel.add(textures);
12501275
12511276 textures.preferredHeight = 100;
....@@ -1253,11 +1278,11 @@
12531278 CreateSkyboxPanel(oe.skyboxPanel);
12541279
12551280 // EDIT panel
1256
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1281
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571282 editButton.setToolTipText("Pin selection controls");
12581283 editButton.addActionListener(this);
12591284
1260
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1285
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12611286 uneditButton.setToolTipText("Unpin and remove selection controls");
12621287 uneditButton.addActionListener(this);
12631288
....@@ -1265,7 +1290,7 @@
12651290 allParamsButton.setToolTipText("Show all controls");
12661291 allParamsButton.addActionListener(this);
12671292
1268
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1293
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12691294 clearPanelButton.setToolTipText("Clear all controls");
12701295 clearPanelButton.addActionListener(this);
12711296
....@@ -1273,7 +1298,7 @@
12731298 //unselectButton.setToolTipText("Unselect");
12741299 //unselectButton.addActionListener(this);
12751300
1276
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1301
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12771302 flashSelectionButton.setToolTipText("Highlight selection");
12781303 flashSelectionButton.addActionListener(this);
12791304
....@@ -1296,6 +1321,8 @@
12961321
12971322 cGridBag jSPPanel = new cGridBag();
12981323
1324
+ jSPPanel.preferredHeight = 20;
1325
+
12991326 JScrollPane jSP;
13001327 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
13011328 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1304,11 +1331,11 @@
13041331 oe.treePanel.add(jSPPanel);
13051332 oe.treePanel.Return();
13061333
1307
- oe.treePanel.add(copyOptionsPanel);
1334
+ oe.treePanel.add(versionManagerPanel);
13081335 oe.treePanel.Return();
1309
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1310
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1311
- sliderPane.preferredHeight = 1;
1336
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1337
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1338
+ versionSliderPane.preferredHeight = 3;
13121339
13131340 // mainPanel.setDividerLocation(0.1); //1.0);
13141341 mainPanel.setResizeWeight(0.4);
....@@ -1498,6 +1525,7 @@
14981525
14991526 oe.SetupViews();
15001527
1528
+ if (Globals.DEBUG)
15011529 System.out.println("SetupViews");
15021530 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
15031531 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2101,24 +2129,24 @@
21012129 switch(axis)
21022130 {
21032131 case 0 :
2104
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2105
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2106
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2107
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2132
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2133
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2134
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2135
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
21082136 norm = cVector.X;
21092137 break;
21102138 case 1 :
2111
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2112
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2113
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2114
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2139
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2140
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2141
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2142
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
21152143 norm = cVector.Y;
21162144 break;
21172145 case 2 :
2118
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2119
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2120
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2121
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2146
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2147
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2148
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2149
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
21222150 norm = cVector.Z;
21232151 break;
21242152 }
....@@ -2159,7 +2187,11 @@
21592187 shadow.material = new cMaterial(obj.material);
21602188 shadow.material.diffuse = 0.0001f;
21612189 shadow.material.specular = 0.0001f;
2162
- //shadow.projectedVertices[1].x = 300;
2190
+ shadow.material.opacity = 0.75f;
2191
+
2192
+ AllocProjectedVertices(shadow);
2193
+
2194
+ shadow.projectedVertices[1].x = 300;
21632195
21642196 makeSomething(shadow);
21652197 }
....@@ -2680,27 +2712,35 @@
26802712 } else
26812713 if (source == loopItem || source == loopButton)
26822714 {
2715
+ if (!group.selection.isEmpty())
2716
+ {
26832717 Composite csg = new GroupLeaf();
26842718 csg.count = 5;
2685
- group(csg);
26862719 Composite child = new cGroup("Branch");
26872720 csg.addChild(child);
26882721 child.addChild(csg);
2722
+ group(csg);
2723
+ }
26892724 } else
26902725 if (source == doubleItem)
26912726 {
2727
+ if (!group.selection.isEmpty())
2728
+ {
26922729 Composite csg = new GroupLeaf("Fork");
26932730 csg.count = 5;
2694
- group(csg);
26952731 Composite child = new cGroup("Branch A");
26962732 csg.addChild(child);
26972733 child.addChild(csg);
26982734 child = new cGroup("Branch B");
26992735 csg.addChild(child);
27002736 child.addChild(csg);
2737
+ group(csg);
2738
+ }
27012739 } else
27022740 if (source == tripleItem)
27032741 {
2742
+ if (!group.selection.isEmpty())
2743
+ {
27042744 Composite csg = new GroupLeaf("Trident");
27052745 csg.count = 4;
27062746 group(csg);
....@@ -2713,6 +2753,7 @@
27132753 child = new cGroup();
27142754 csg.addChild(child);
27152755 child.addChild(csg);
2756
+ }
27162757 } else
27172758 if (source == computeAOItem)
27182759 {
....@@ -3348,22 +3389,34 @@
33483389 } else
33493390 if (source == ungroupItem || source == ungroupButton)
33503391 {
3351
- boolean hasRoot = false;
3392
+ boolean canUngroup = true;
33523393
33533394 for (int i=0; i<group.selection.size(); i++)
33543395 {
3355
- if (group.selection.get(i) == group)
3396
+ Object3D selectedItem = group.selection.get(i);
3397
+
3398
+ if (selectedItem.Size() == 0)
33563399 {
3357
- hasRoot = true;
3400
+ // Cannot ungroup leaves
3401
+ canUngroup = false;
3402
+ break;
3403
+ }
3404
+
3405
+ if (selectedItem == group)
3406
+ {
3407
+ // Cannot ungroup root
3408
+ canUngroup = false;
33583409 break;
33593410 }
33603411 }
33613412
3362
- if (!hasRoot)
3413
+ if (canUngroup)
33633414 {
33643415 for (int i=0; i<group.selection.size(); i++)
33653416 {
3366
- Ungroup(group.selection.get(i));
3417
+ Object3D selectedItem = group.selection.get(i);
3418
+
3419
+ Ungroup(selectedItem);
33673420 }
33683421
33693422 ClearSelection(false);
....@@ -3414,6 +3467,10 @@
34143467 if (source == clearMaterialsItem)
34153468 {
34163469 ClearMaterials();
3470
+ } else
3471
+ if (source == clearVersionsItem)
3472
+ {
3473
+ ClearVersions();
34173474 } else
34183475 if (source == liveleavesItem)
34193476 {
....@@ -3927,6 +3984,8 @@
39273984 if (source == closeButton)
39283985 {
39293986 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
+ Replace();
3988
+
39303989 cRadio ab;
39313990 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39323991 {
....@@ -4025,6 +4084,8 @@
40254084 } else
40264085 if(source instanceof cRadio)
40274086 {
4087
+ Replace();
4088
+
40284089 group.parent = keepparent;
40294090 group.attributes = 0;
40304091 //group.editWindow = null;
....@@ -4080,10 +4141,23 @@
40804141
40814142 if (copy.versionlist == null)
40824143 {
4083
- copy.versionlist = new Object3D[100];
40844144 copy.versionindex = -1;
40854145
4086
- Save(true);
4146
+ // Cannot work with loops
4147
+ // To fix this issue, we first mark all nodes above the root,
4148
+ // and check if any of these nodes are reachable below the root.
4149
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4150
+
4151
+ if (copy.versionlist == null && !copy.HasTags())
4152
+ {
4153
+ copy.versionlist = new Object3D[100];
4154
+
4155
+ //Save(true);
4156
+ }
4157
+ else
4158
+ copy.versionindex = -2;
4159
+
4160
+ Grafreed.grafreed.universe.TagObjects(copy, false);
40874161 }
40884162
40894163 SetVersionStates();
....@@ -4231,7 +4305,7 @@
42314305 TouchTransform(obj);
42324306 continue;
42334307 }
4234
- if ((mask&2) != 0) // Scale
4308
+ if ((mask&2) != 0) // Scale/rotation
42354309 {
42364310 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42374311 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4239,10 +4313,6 @@
42394313 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42404314 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42414315 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4242
- }
4243
- if ((mask&4) != 0) // Rotation
4244
- {
4245
- // ?
42464316 }
42474317 if ((mask&1) != 0) // Translation
42484318 {
....@@ -5051,6 +5121,12 @@
50515121 refreshContents();
50525122 }
50535123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50545130 void FlipV(boolean flip)
50555131 {
50565132 group.selection.FlipV(flip);
....@@ -5328,7 +5404,8 @@
53285404 if (group.selection != null)
53295405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53305406 {
5331
- if (!(e.nextElement() instanceof Composite))
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53325409 {
53335410 allComposites = false;
53345411 break;
....@@ -5340,6 +5417,7 @@
53405417
53415418 void refreshContents(boolean cp)
53425419 {
5420
+ if (Globals.ADVANCED)
53435421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53445422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53455423 {
....@@ -6233,11 +6311,11 @@
62336311 private MenuItem lookAtItem;
62346312 private MenuItem lookFromItem;
62356313 private MenuItem switchViewItem;
6236
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
62376315 private MenuItem undoItem;
62386316 private MenuItem redoItem;
62396317 private JMenuItem duplicateItem;
6240
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
62416319 private MenuItem cloneSupportItem;
62426320 private MenuItem overwriteGeoItem;
62436321 private MenuItem overwriteMatItem;
....@@ -6258,13 +6336,13 @@
62586336 private MenuItem cloneGeometriesItem;
62596337 private MenuItem shareGeometriesItem;
62606338 private MenuItem mergeGeometriesItem;
6261
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
62626340 private MenuItem pasteItem;
6263
- private MenuItem pasteIntoItem;
6264
- private MenuItem pasteLinkItem;
6265
- private MenuItem pasteCloneItem;
6266
- private MenuItem pasteExpandItem;
6267
- private MenuItem deleteItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
62686346 private MenuItem clearAllItem;
62696347 private MenuItem genUVItem;
62706348 private MenuItem genNormalsMESHItem;
....@@ -6290,6 +6368,7 @@
62906368 private MenuItem clipMeshItem;
62916369 private MenuItem smoothMeshItem;
62926370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
62936372
62946373 private MenuItem liveleavesItem;
62956374 private MenuItem unliveleavesItem;
....@@ -6319,7 +6398,7 @@
63196398 private MenuItem transformGeometryItem;
63206399 private MenuItem transformChildrenItem;
63216400 private MenuItem hideItem;
6322
- private MenuItem grabItem;
6401
+ private JMenuItem grabItem;
63236402 private MenuItem backItem;
63246403 private MenuItem frontItem;
63256404 private MenuItem cameraItem;
....@@ -6332,7 +6411,7 @@
63326411 private MenuItem switchTransfoItem;
63336412 private MenuItem morphItem;
63346413 private MenuItem linkerItem;
6335
- private MenuItem ungroupItem;
6414
+ private JMenuItem ungroupItem;
63366415 private MenuItem editItem;
63376416 private MenuItem openWindowItem;
63386417 private MenuItem editLeafItem;