Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
GroupEditor.java
....@@ -29,9 +29,9 @@
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));
34
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
3636 {
3737 @Override
....@@ -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 {
....@@ -73,7 +73,7 @@
7373 cGridBag row5 = new cGridBag();
7474 cGridBag row6 = new cGridBag();
7575
76
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
7777 //AddSkyboxButton("default", "cornell", row0);
7878 AddSkyboxButton("penguins", "dust", row0);
7979 AddSkyboxButton("penguins", "tropic", row0);
....@@ -330,15 +330,24 @@
330330
331331 public void ChangeSkybox(String skybox)
332332 {
333
- //cameraView.envyoff = false;
334
- group.skyboxname = skybox;
335
- group.skyboxext = "jpg";
336
- cameraView.repaint();
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
337346 }
338347
339348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
340349 {
341
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
342351
343352 AddSkyboxTab0(skyboxpane);
344353 AddSkyboxTab1(skyboxpane);
....@@ -406,13 +415,15 @@
406415 this.copy = this.group = group;
407416 //selectees = this.group.selectees;
408417
409
- if (copy.versionlist == null)
410
- {
411
- copy.versionlist = new Object3D[100];
412
- copy.versionindex = -1;
413
-
414
- Save(true);
415
- }
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
+// }
416427
417428 if(ui)
418429 SetupUI(objEditor);
....@@ -435,13 +446,13 @@
435446
436447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
437448
438
- if (copy.versionlist == null)
439
- {
440
- copy.versionlist = new Object3D[100];
441
- copy.versionindex = -1;
442
-
443
- Save(true);
444
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
445456 }
446457
447458 void CloneSelection(boolean supports)
....@@ -531,33 +542,35 @@
531542 // menu.add("-");
532543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
533544 duplicateItem.addActionListener(this);
534
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
535547 cloneItem.addActionListener(this);
536
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
537549 {
538550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
539551 cloneSupportItem.addActionListener(this);
540552 }
553
+ oe.jTree.popup.addSeparator();
541554 menu.add("-");
542
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
543556 cutItem.addActionListener(this);
544
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
545558 copyItem.addActionListener(this);
546559 pasteItem = menu.add(new MenuItem("Paste"));
547560 pasteItem.addActionListener(this);
548561
549
- menu.add("-");
550
- 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"));
551565 pasteIntoItem.addActionListener(this);
552
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
553567 pasteLinkItem.addActionListener(this);
554
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
555569 pasteCloneItem.addActionListener(this);
556
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
557571 // pasteExpandItem.addActionListener(this);
558
- menu.add("-");
559
- deleteItem = menu.add(new MenuItem("Delete"));
560
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
561574
562575 if (Globals.ADVANCED)
563576 {
....@@ -692,9 +705,8 @@
692705 setMasterItem.addActionListener(this);
693706 }
694707
695
- oe.menuBar.add(menu = new Menu("Group"));
696
-// grabItem = menu.add(new MenuItem("Grab"));
697
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
698710 backItem = menu.add(new MenuItem("Back"));
699711 backItem.addActionListener(this);
700712 frontItem = menu.add(new MenuItem("Front"));
....@@ -702,13 +714,21 @@
702714 // compositeItem = menu.add(new MenuItem("Composite"));
703715 // compositeItem.addActionListener(this);
704716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
705720 if (Globals.ADVANCED)
706721 {
707722 hideItem = menu.add(new MenuItem("Hidden Group"));
708723 hideItem.addActionListener(this);
709724 }
710
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
711726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
712732
713733 // menu.add("-");
714734 //
....@@ -815,6 +835,8 @@
815835 }
816836
817837 oe.menuBar.add(menu = new Menu("Attributes"));
838
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
839
+ clearVersionsItem.addActionListener(this);
818840 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
819841 clearMaterialsItem.addActionListener(this);
820842 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -837,9 +859,9 @@
837859 hideleavesItem.addActionListener(this);
838860 showleavesItem = menu.add(new MenuItem("Show Leaves"));
839861 showleavesItem.addActionListener(this);
840
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
862
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
841863 markleavesItem.addActionListener(this);
842
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
864
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
843865 unmarkleavesItem.addActionListener(this);
844866 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
845867 rewindleavesItem.addActionListener(this);
....@@ -914,8 +936,10 @@
914936
915937 JTabbedPane resourcecontainer;
916938 cGridBag currenttab;
917
- boolean added; // patch for jar
939
+ //boolean added; // patch for jar
918940
941
+ int totalcount = 0;
942
+
919943 int tabcount = 0;
920944 int colcount = 0;
921945 int rowcount = 0;
....@@ -931,28 +955,30 @@
931955 // System.out.println();
932956
933957 if (//rowcount == 0 ||
934
- path.length == 1)
958
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
935959 {
936960 currenttab = new cGridBag();
937
- added = false;
938961 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939962 currenttab.setName(tabname);
963
+ //added = false;
964
+ resourcecontainer.add(currenttab);
965
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
940966 rowcount = 1;
941967 colcount = 0;
942968 texturecount = 0;
943969 }
944970
945
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
971
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
946972 {
947
- if (!added)
973
+ //if (!added)
948974 {
949
- added = true;
950
- resourcecontainer.add(currenttab);
975
+ //added = true;
951976 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
977
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
953978 }
954979
955
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
980
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981
+ totalcount++;
956982
957983 if (++colcount >= columns)
958984 {
....@@ -978,6 +1004,8 @@
9781004 container.add(resourcecontainer);
9791005
9801006 Grafreed.ParseResources("textures", this);
1007
+
1008
+ // 935. System.out.println("Total = " + totalcount);
9811009 }
9821010
9831011 void SetupUI2(ObjEditor oe)
....@@ -1017,9 +1045,9 @@
10171045 oe.radioPanel.add(dummyButton);
10181046 oe.buttonGroup.add(dummyButton);
10191047 */
1020
- cGridBag copyOptionsPanel = new cGridBag();
1048
+ cGridBag versionManagerPanel = new cGridBag();
10211049
1022
- copyOptionsPanel.preferredHeight = 2;
1050
+ versionManagerPanel.preferredHeight = 4;
10231051
10241052 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10251053
....@@ -1034,8 +1062,8 @@
10341062 // maxButton.addActionListener(this);
10351063 }
10361064
1037
-// cButton gcButton;
1038
-//
1065
+ cButton gcButton;
1066
+
10391067 // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10401068 // gcButton.setToolTipText("Garbage collect");
10411069 // gcButton.addActionListener(new ActionListener()
....@@ -1046,25 +1074,25 @@
10461074 // }
10471075 // });
10481076
1049
- 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);
10501078 collapseButton.setToolTipText("Collapse toolbar");
10511079 collapseButton.addActionListener(this);
10521080
1053
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10541082 maximize3DButton.setToolTipText("Maximize 3D view");
10551083 maximize3DButton.addActionListener(this);
10561084
1057
- 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);
10581086 twoButton.setToolTipText("Show 3D view only");
10591087 twoButton.addActionListener(this);
10601088 this.fullscreenLayout = twoButton;
10611089
1062
- 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);
10631091 threeButton.setToolTipText("Show controls and 3D view");
10641092 threeButton.addActionListener(this);
10651093 if (Globals.ADVANCED)
10661094 {
1067
- 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);
10681096 sixButton.setToolTipText("Show 3D view and controls");
10691097 sixButton.addActionListener(this);
10701098 }
....@@ -1073,50 +1101,51 @@
10731101 // sevenButton.addActionListener(this);
10741102 //
10751103
1076
- 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);
10771105 fullButton.setToolTipText("Full-screen window");
10781106 fullButton.addActionListener(this);
10791107
1080
- 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);
10811109 screenfitButton.setToolTipText("Screen fit");
10821110 screenfitButton.addActionListener(this);
10831111
1084
- 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);
10851113 restoreCameraButton.setToolTipText("Restore viewpoint");
10861114 restoreCameraButton.addActionListener(this);
10871115
1088
- 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);
10891117 saveVersionButton.setToolTipText("Duplicate current version");
10901118 saveVersionButton.addActionListener(this);
10911119
1092
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10931121 deleteVersionButton.setToolTipText("Delete current version");
10941122 deleteVersionButton.addActionListener(this);
1123
+ deleteVersionButton.setEnabled(false);
10951124
1096
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10971126 previousVersionButton.setToolTipText("Previous version");
10981127 previousVersionButton.addActionListener(this);
10991128 previousVersionButton.setEnabled(false);
11001129
11011130 cGridBag updown = new cGridBag().setVertical(true);
1102
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1131
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031132 restoreButton.setToolTipText("Undo (restore current version)");
11041133 restoreButton.addActionListener(this);
1105
- //restoreButton.setEnabled(false);
1134
+ restoreButton.setEnabled(false);
11061135
1107
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11081137 replaceButton.setToolTipText("Save (replace current version)");
11091138 replaceButton.addActionListener(this);
1110
- //replaceButton.setEnabled(false);
1139
+ replaceButton.setEnabled(false);
11111140
1112
- copyOptionsPanel.add(updown);
1141
+ versionManagerPanel.add(updown);
11131142
1114
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11151144 nextVersionButton.setToolTipText("Next version");
11161145 nextVersionButton.addActionListener(this);
11171146 nextVersionButton.setEnabled(false);
11181147
1119
- 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);
11201149 oneStepButton.setToolTipText("Animate one step forward");
11211150 oneStepButton.addActionListener(this);
11221151
....@@ -1139,11 +1168,11 @@
11391168
11401169 if (Globals.ADVANCED)
11411170 {
1142
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11431172 snapobjectButton.addActionListener(this);
11441173 snapobjectButton.setToolTipText("Snap Object");
11451174
1146
- 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);
11471176 fourButton.addActionListener(this);
11481177 fourButton.setToolTipText("Show control panel only");
11491178 }
....@@ -1151,11 +1180,11 @@
11511180 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11521181
11531182
1154
- 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);
11551184 rootButton.setToolTipText("Open selection in new tab");
11561185 rootButton.addActionListener(this);
11571186
1158
- 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);
11591188 closeButton.setToolTipText("Close tab");
11601189 closeButton.addActionListener(this);
11611190 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1164,38 +1193,38 @@
11641193 cGridBag row1 = new cGridBag();
11651194
11661195 // INSERT
1167
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681197 gridButton.setToolTipText("Create ground");
11691198 gridButton.addActionListener(this);
11701199
1171
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1200
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11721201 boxButton.setToolTipText("Create box");
11731202 boxButton.addActionListener(this);
11741203
1175
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
- sphereButton.setToolTipText("Create sphere");
1177
- sphereButton.addActionListener(this);
1178
-
1179
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
- coneButton.setToolTipText("Create cone");
1181
- coneButton.addActionListener(this);
1182
-
1183
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
- torusButton.setToolTipText("Create torus");
1185
- torusButton.addActionListener(this);
1186
-
1187
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11881205 superButton.setToolTipText("Create superellipsoid");
11891206 superButton.addActionListener(this);
11901207
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
+
11911220 if (Globals.ADVANCED)
11921221 {
1193
- 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);
11941223 kleinButton.setToolTipText("Create Klein bottle");
11951224 kleinButton.addActionListener(this);
11961225 }
11971226
1198
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991228 particlesButton.setToolTipText("Create particle system");
12001229 particlesButton.addActionListener(this);
12011230
....@@ -1203,31 +1232,31 @@
12031232
12041233 cGridBag row2 = new cGridBag();
12051234
1206
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1235
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12071236 groupButton.setToolTipText("Create group");
12081237 groupButton.addActionListener(this);
12091238
1210
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1239
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12111240 compositeButton.setToolTipText("Create composite");
12121241 compositeButton.addActionListener(this);
12131242
1214
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1243
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12151244 switchButton.setToolTipText("Create item switcher");
12161245 switchButton.addActionListener(this);
12171246
1218
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1247
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12191248 loopButton.setToolTipText("Create loop");
12201249 loopButton.addActionListener(this);
12211250
1222
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1251
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231252 textureButton.setToolTipText("Create texture");
12241253 textureButton.addActionListener(this);
12251254
1226
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1255
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12271256 overlayButton.setToolTipText("Create overlay");
12281257 overlayButton.addActionListener(this);
12291258
1230
- 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);
12311260 lightButton.setToolTipText("Create light");
12321261 lightButton.addActionListener(this);
12331262
....@@ -1237,6 +1266,11 @@
12371266
12381267 CreateTexturePanel(textures);
12391268
1269
+ int tabCount = resourcecontainer.getTabCount();
1270
+
1271
+ if (tabCount > 0)
1272
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1273
+
12401274 oe.toolboxPanel.add(textures);
12411275
12421276 textures.preferredHeight = 100;
....@@ -1244,11 +1278,11 @@
12441278 CreateSkyboxPanel(oe.skyboxPanel);
12451279
12461280 // EDIT panel
1247
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1281
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12481282 editButton.setToolTipText("Pin selection controls");
12491283 editButton.addActionListener(this);
12501284
1251
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1285
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12521286 uneditButton.setToolTipText("Unpin and remove selection controls");
12531287 uneditButton.addActionListener(this);
12541288
....@@ -1256,7 +1290,7 @@
12561290 allParamsButton.setToolTipText("Show all controls");
12571291 allParamsButton.addActionListener(this);
12581292
1259
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1293
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12601294 clearPanelButton.setToolTipText("Clear all controls");
12611295 clearPanelButton.addActionListener(this);
12621296
....@@ -1264,7 +1298,7 @@
12641298 //unselectButton.setToolTipText("Unselect");
12651299 //unselectButton.addActionListener(this);
12661300
1267
- 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);
12681302 flashSelectionButton.setToolTipText("Highlight selection");
12691303 flashSelectionButton.addActionListener(this);
12701304
....@@ -1287,6 +1321,8 @@
12871321
12881322 cGridBag jSPPanel = new cGridBag();
12891323
1324
+ jSPPanel.preferredHeight = 20;
1325
+
12901326 JScrollPane jSP;
12911327 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12921328 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1295,11 +1331,11 @@
12951331 oe.treePanel.add(jSPPanel);
12961332 oe.treePanel.Return();
12971333
1298
- oe.treePanel.add(copyOptionsPanel);
1334
+ oe.treePanel.add(versionManagerPanel);
12991335 oe.treePanel.Return();
1300
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1301
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1302
- sliderPane.preferredHeight = 1;
1336
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1337
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1338
+ versionSliderPane.preferredHeight = 3;
13031339
13041340 // mainPanel.setDividerLocation(0.1); //1.0);
13051341 mainPanel.setResizeWeight(0.4);
....@@ -1459,11 +1495,11 @@
14591495 {
14601496 assert(obj instanceof Composite);
14611497
1462
- if (obj.versionlist == null)
1463
- {
1464
- obj.versionlist = new Object3D[100];
1465
- obj.versionindex = -1;
1466
- }
1498
+// if (obj.versionlist == null)
1499
+// {
1500
+// obj.versionlist = new Object3D[100];
1501
+// obj.versionindex = -1;
1502
+// }
14671503
14681504 cRadio radioButton = new cRadio(obj.name);
14691505
....@@ -1489,6 +1525,7 @@
14891525
14901526 oe.SetupViews();
14911527
1528
+ if (Globals.DEBUG)
14921529 System.out.println("SetupViews");
14931530 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14941531 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2092,24 +2129,24 @@
20922129 switch(axis)
20932130 {
20942131 case 0 :
2095
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2096
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
2097
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2098
- 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;
20992136 norm = cVector.X;
21002137 break;
21012138 case 1 :
2102
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2103
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2104
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
2105
- 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;
21062143 norm = cVector.Y;
21072144 break;
21082145 case 2 :
2109
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
2110
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
2111
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
2112
- 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;
21132150 norm = cVector.Z;
21142151 break;
21152152 }
....@@ -2150,7 +2187,11 @@
21502187 shadow.material = new cMaterial(obj.material);
21512188 shadow.material.diffuse = 0.0001f;
21522189 shadow.material.specular = 0.0001f;
2153
- //shadow.projectedVertices[1].x = 300;
2190
+ shadow.material.opacity = 0.75f;
2191
+
2192
+ AllocProjectedVertices(shadow);
2193
+
2194
+ shadow.projectedVertices[1].x = 300;
21542195
21552196 makeSomething(shadow);
21562197 }
....@@ -2671,27 +2712,35 @@
26712712 } else
26722713 if (source == loopItem || source == loopButton)
26732714 {
2715
+ if (!group.selection.isEmpty())
2716
+ {
26742717 Composite csg = new GroupLeaf();
26752718 csg.count = 5;
2676
- group(csg);
26772719 Composite child = new cGroup("Branch");
26782720 csg.addChild(child);
26792721 child.addChild(csg);
2722
+ group(csg);
2723
+ }
26802724 } else
26812725 if (source == doubleItem)
26822726 {
2727
+ if (!group.selection.isEmpty())
2728
+ {
26832729 Composite csg = new GroupLeaf("Fork");
26842730 csg.count = 5;
2685
- group(csg);
26862731 Composite child = new cGroup("Branch A");
26872732 csg.addChild(child);
26882733 child.addChild(csg);
26892734 child = new cGroup("Branch B");
26902735 csg.addChild(child);
26912736 child.addChild(csg);
2737
+ group(csg);
2738
+ }
26922739 } else
26932740 if (source == tripleItem)
26942741 {
2742
+ if (!group.selection.isEmpty())
2743
+ {
26952744 Composite csg = new GroupLeaf("Trident");
26962745 csg.count = 4;
26972746 group(csg);
....@@ -2704,6 +2753,7 @@
27042753 child = new cGroup();
27052754 csg.addChild(child);
27062755 child.addChild(csg);
2756
+ }
27072757 } else
27082758 if (source == computeAOItem)
27092759 {
....@@ -3339,22 +3389,34 @@
33393389 } else
33403390 if (source == ungroupItem || source == ungroupButton)
33413391 {
3342
- boolean hasRoot = false;
3392
+ boolean canUngroup = true;
33433393
33443394 for (int i=0; i<group.selection.size(); i++)
33453395 {
3346
- if (group.selection.get(i) == group)
3396
+ Object3D selectedItem = group.selection.get(i);
3397
+
3398
+ if (selectedItem.Size() == 0)
33473399 {
3348
- 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;
33493409 break;
33503410 }
33513411 }
33523412
3353
- if (!hasRoot)
3413
+ if (canUngroup)
33543414 {
33553415 for (int i=0; i<group.selection.size(); i++)
33563416 {
3357
- Ungroup(group.selection.get(i));
3417
+ Object3D selectedItem = group.selection.get(i);
3418
+
3419
+ Ungroup(selectedItem);
33583420 }
33593421
33603422 ClearSelection(false);
....@@ -3405,6 +3467,10 @@
34053467 if (source == clearMaterialsItem)
34063468 {
34073469 ClearMaterials();
3470
+ } else
3471
+ if (source == clearVersionsItem)
3472
+ {
3473
+ ClearVersions();
34083474 } else
34093475 if (source == liveleavesItem)
34103476 {
....@@ -3918,6 +3984,8 @@
39183984 if (source == closeButton)
39193985 {
39203986 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
+ Replace();
3988
+
39213989 cRadio ab;
39223990 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39233991 {
....@@ -4016,6 +4084,8 @@
40164084 } else
40174085 if(source instanceof cRadio)
40184086 {
4087
+ Replace();
4088
+
40194089 group.parent = keepparent;
40204090 group.attributes = 0;
40214091 //group.editWindow = null;
....@@ -4067,7 +4137,30 @@
40674137 */
40684138 radio.layout.doClick();
40694139
4070
- SetUndoStates();
4140
+ assert(copy instanceof Composite);
4141
+
4142
+ if (copy.versionlist == null)
4143
+ {
4144
+ copy.versionindex = -1;
4145
+
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);
4161
+ }
4162
+
4163
+ SetVersionStates();
40714164
40724165 ClearUnpinned();
40734166
....@@ -4212,7 +4305,7 @@
42124305 TouchTransform(obj);
42134306 continue;
42144307 }
4215
- if ((mask&2) != 0) // Scale
4308
+ if ((mask&2) != 0) // Scale/rotation
42164309 {
42174310 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42184311 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4220,10 +4313,6 @@
42204313 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42214314 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42224315 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4223
- }
4224
- if ((mask&4) != 0) // Rotation
4225
- {
4226
- // ?
42274316 }
42284317 if ((mask&1) != 0) // Translation
42294318 {
....@@ -5032,6 +5121,12 @@
50325121 refreshContents();
50335122 }
50345123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
50355130 void FlipV(boolean flip)
50365131 {
50375132 group.selection.FlipV(flip);
....@@ -5306,9 +5401,11 @@
53065401
53075402 boolean allComposites = true;
53085403
5404
+ if (group.selection != null)
53095405 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53105406 {
5311
- if (!(e.nextElement() instanceof Composite))
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53125409 {
53135410 allComposites = false;
53145411 break;
....@@ -5320,6 +5417,7 @@
53205417
53215418 void refreshContents(boolean cp)
53225419 {
5420
+ if (Globals.ADVANCED)
53235421 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53245422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53255423 {
....@@ -6213,11 +6311,11 @@
62136311 private MenuItem lookAtItem;
62146312 private MenuItem lookFromItem;
62156313 private MenuItem switchViewItem;
6216
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
62176315 private MenuItem undoItem;
62186316 private MenuItem redoItem;
62196317 private JMenuItem duplicateItem;
6220
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
62216319 private MenuItem cloneSupportItem;
62226320 private MenuItem overwriteGeoItem;
62236321 private MenuItem overwriteMatItem;
....@@ -6238,13 +6336,13 @@
62386336 private MenuItem cloneGeometriesItem;
62396337 private MenuItem shareGeometriesItem;
62406338 private MenuItem mergeGeometriesItem;
6241
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
62426340 private MenuItem pasteItem;
6243
- private MenuItem pasteIntoItem;
6244
- private MenuItem pasteLinkItem;
6245
- private MenuItem pasteCloneItem;
6246
- private MenuItem pasteExpandItem;
6247
- private MenuItem deleteItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
62486346 private MenuItem clearAllItem;
62496347 private MenuItem genUVItem;
62506348 private MenuItem genNormalsMESHItem;
....@@ -6270,6 +6368,7 @@
62706368 private MenuItem clipMeshItem;
62716369 private MenuItem smoothMeshItem;
62726370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
62736372
62746373 private MenuItem liveleavesItem;
62756374 private MenuItem unliveleavesItem;
....@@ -6299,7 +6398,7 @@
62996398 private MenuItem transformGeometryItem;
63006399 private MenuItem transformChildrenItem;
63016400 private MenuItem hideItem;
6302
- private MenuItem grabItem;
6401
+ private JMenuItem grabItem;
63036402 private MenuItem backItem;
63046403 private MenuItem frontItem;
63056404 private MenuItem cameraItem;
....@@ -6312,7 +6411,7 @@
63126411 private MenuItem switchTransfoItem;
63136412 private MenuItem morphItem;
63146413 private MenuItem linkerItem;
6315
- private MenuItem ungroupItem;
6414
+ private JMenuItem ungroupItem;
63166415 private MenuItem editItem;
63176416 private MenuItem openWindowItem;
63186417 private MenuItem editLeafItem;