Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
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,12 +415,14 @@
406415 this.copy = this.group = group;
407416 //selectees = this.group.selectees;
408417
418
+ assert(false);
419
+
409420 if (copy.versionlist == null)
410421 {
411422 copy.versionlist = new Object3D[100];
412423 copy.versionindex = -1;
413424
414
- Save(true);
425
+ //Save(true);
415426 }
416427
417428 if(ui)
....@@ -440,7 +451,7 @@
440451 copy.versionlist = new Object3D[100];
441452 copy.versionindex = -1;
442453
443
- Save(true);
454
+ //Save(true);
444455 }
445456 }
446457
....@@ -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 //
....@@ -837,9 +857,9 @@
837857 hideleavesItem.addActionListener(this);
838858 showleavesItem = menu.add(new MenuItem("Show Leaves"));
839859 showleavesItem.addActionListener(this);
840
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
860
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
841861 markleavesItem.addActionListener(this);
842
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
862
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
843863 unmarkleavesItem.addActionListener(this);
844864 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
845865 rewindleavesItem.addActionListener(this);
....@@ -914,8 +934,10 @@
914934
915935 JTabbedPane resourcecontainer;
916936 cGridBag currenttab;
917
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
918938
939
+ int totalcount = 0;
940
+
919941 int tabcount = 0;
920942 int colcount = 0;
921943 int rowcount = 0;
....@@ -931,28 +953,30 @@
931953 // System.out.println();
932954
933955 if (//rowcount == 0 ||
934
- path.length == 1)
956
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
935957 {
936958 currenttab = new cGridBag();
937
- added = false;
938959 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939960 currenttab.setName(tabname);
961
+ //added = false;
962
+ resourcecontainer.add(currenttab);
963
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
940964 rowcount = 1;
941965 colcount = 0;
942966 texturecount = 0;
943967 }
944968
945
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
969
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
946970 {
947
- if (!added)
971
+ //if (!added)
948972 {
949
- added = true;
950
- resourcecontainer.add(currenttab);
973
+ //added = true;
951974 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
975
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
953976 }
954977
955
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
978
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
979
+ totalcount++;
956980
957981 if (++colcount >= columns)
958982 {
....@@ -978,6 +1002,8 @@
9781002 container.add(resourcecontainer);
9791003
9801004 Grafreed.ParseResources("textures", this);
1005
+
1006
+ // 935. System.out.println("Total = " + totalcount);
9811007 }
9821008
9831009 void SetupUI2(ObjEditor oe)
....@@ -1017,9 +1043,9 @@
10171043 oe.radioPanel.add(dummyButton);
10181044 oe.buttonGroup.add(dummyButton);
10191045 */
1020
- cGridBag copyOptionsPanel = new cGridBag();
1046
+ cGridBag versionManagerPanel = new cGridBag();
10211047
1022
- copyOptionsPanel.preferredHeight = 2;
1048
+ versionManagerPanel.preferredHeight = 4;
10231049
10241050 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10251051
....@@ -1034,8 +1060,8 @@
10341060 // maxButton.addActionListener(this);
10351061 }
10361062
1037
-// cButton gcButton;
1038
-//
1063
+ cButton gcButton;
1064
+
10391065 // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10401066 // gcButton.setToolTipText("Garbage collect");
10411067 // gcButton.addActionListener(new ActionListener()
....@@ -1046,25 +1072,25 @@
10461072 // }
10471073 // });
10481074
1049
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10501076 collapseButton.setToolTipText("Collapse toolbar");
10511077 collapseButton.addActionListener(this);
10521078
1053
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1079
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10541080 maximize3DButton.setToolTipText("Maximize 3D view");
10551081 maximize3DButton.addActionListener(this);
10561082
1057
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10581084 twoButton.setToolTipText("Show 3D view only");
10591085 twoButton.addActionListener(this);
10601086 this.fullscreenLayout = twoButton;
10611087
1062
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10631089 threeButton.setToolTipText("Show controls and 3D view");
10641090 threeButton.addActionListener(this);
10651091 if (Globals.ADVANCED)
10661092 {
1067
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681094 sixButton.setToolTipText("Show 3D view and controls");
10691095 sixButton.addActionListener(this);
10701096 }
....@@ -1073,50 +1099,51 @@
10731099 // sevenButton.addActionListener(this);
10741100 //
10751101
1076
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771103 fullButton.setToolTipText("Full-screen window");
10781104 fullButton.addActionListener(this);
10791105
1080
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10811107 screenfitButton.setToolTipText("Screen fit");
10821108 screenfitButton.addActionListener(this);
10831109
1084
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1110
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10851111 restoreCameraButton.setToolTipText("Restore viewpoint");
10861112 restoreCameraButton.addActionListener(this);
10871113
1088
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1114
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10891115 saveVersionButton.setToolTipText("Duplicate current version");
10901116 saveVersionButton.addActionListener(this);
10911117
1092
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10931119 deleteVersionButton.setToolTipText("Delete current version");
10941120 deleteVersionButton.addActionListener(this);
1121
+ deleteVersionButton.setEnabled(false);
10951122
1096
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10971124 previousVersionButton.setToolTipText("Previous version");
10981125 previousVersionButton.addActionListener(this);
10991126 previousVersionButton.setEnabled(false);
11001127
11011128 cGridBag updown = new cGridBag().setVertical(true);
1102
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031130 restoreButton.setToolTipText("Undo (restore current version)");
11041131 restoreButton.addActionListener(this);
1105
- //restoreButton.setEnabled(false);
1132
+ restoreButton.setEnabled(false);
11061133
1107
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11081135 replaceButton.setToolTipText("Save (replace current version)");
11091136 replaceButton.addActionListener(this);
1110
- //replaceButton.setEnabled(false);
1137
+ replaceButton.setEnabled(false);
11111138
1112
- copyOptionsPanel.add(updown);
1139
+ versionManagerPanel.add(updown);
11131140
1114
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1141
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11151142 nextVersionButton.setToolTipText("Next version");
11161143 nextVersionButton.addActionListener(this);
11171144 nextVersionButton.setEnabled(false);
11181145
1119
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1146
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11201147 oneStepButton.setToolTipText("Animate one step forward");
11211148 oneStepButton.addActionListener(this);
11221149
....@@ -1139,11 +1166,11 @@
11391166
11401167 if (Globals.ADVANCED)
11411168 {
1142
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1169
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11431170 snapobjectButton.addActionListener(this);
11441171 snapobjectButton.setToolTipText("Snap Object");
11451172
1146
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1173
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11471174 fourButton.addActionListener(this);
11481175 fourButton.setToolTipText("Show control panel only");
11491176 }
....@@ -1151,11 +1178,11 @@
11511178 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11521179
11531180
1154
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1181
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11551182 rootButton.setToolTipText("Open selection in new tab");
11561183 rootButton.addActionListener(this);
11571184
1158
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11591186 closeButton.setToolTipText("Close tab");
11601187 closeButton.addActionListener(this);
11611188 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1164,38 +1191,38 @@
11641191 cGridBag row1 = new cGridBag();
11651192
11661193 // INSERT
1167
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681195 gridButton.setToolTipText("Create ground");
11691196 gridButton.addActionListener(this);
11701197
1171
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11721199 boxButton.setToolTipText("Create box");
11731200 boxButton.addActionListener(this);
11741201
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);
1202
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11881203 superButton.setToolTipText("Create superellipsoid");
11891204 superButton.addActionListener(this);
11901205
1206
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ sphereButton.setToolTipText("Create sphere");
1208
+ sphereButton.addActionListener(this);
1209
+
1210
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1211
+ coneButton.setToolTipText("Create cone");
1212
+ coneButton.addActionListener(this);
1213
+
1214
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1215
+ torusButton.setToolTipText("Create torus");
1216
+ torusButton.addActionListener(this);
1217
+
11911218 if (Globals.ADVANCED)
11921219 {
1193
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11941221 kleinButton.setToolTipText("Create Klein bottle");
11951222 kleinButton.addActionListener(this);
11961223 }
11971224
1198
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1225
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991226 particlesButton.setToolTipText("Create particle system");
12001227 particlesButton.addActionListener(this);
12011228
....@@ -1203,31 +1230,31 @@
12031230
12041231 cGridBag row2 = new cGridBag();
12051232
1206
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1233
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12071234 groupButton.setToolTipText("Create group");
12081235 groupButton.addActionListener(this);
12091236
1210
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12111238 compositeButton.setToolTipText("Create composite");
12121239 compositeButton.addActionListener(this);
12131240
1214
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1241
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12151242 switchButton.setToolTipText("Create item switcher");
12161243 switchButton.addActionListener(this);
12171244
1218
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1245
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12191246 loopButton.setToolTipText("Create loop");
12201247 loopButton.addActionListener(this);
12211248
1222
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1249
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231250 textureButton.setToolTipText("Create texture");
12241251 textureButton.addActionListener(this);
12251252
1226
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1253
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12271254 overlayButton.setToolTipText("Create overlay");
12281255 overlayButton.addActionListener(this);
12291256
1230
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1257
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12311258 lightButton.setToolTipText("Create light");
12321259 lightButton.addActionListener(this);
12331260
....@@ -1237,6 +1264,11 @@
12371264
12381265 CreateTexturePanel(textures);
12391266
1267
+ int tabCount = resourcecontainer.getTabCount();
1268
+
1269
+ if (tabCount > 0)
1270
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1271
+
12401272 oe.toolboxPanel.add(textures);
12411273
12421274 textures.preferredHeight = 100;
....@@ -1244,11 +1276,11 @@
12441276 CreateSkyboxPanel(oe.skyboxPanel);
12451277
12461278 // EDIT panel
1247
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1279
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12481280 editButton.setToolTipText("Pin selection controls");
12491281 editButton.addActionListener(this);
12501282
1251
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12521284 uneditButton.setToolTipText("Unpin and remove selection controls");
12531285 uneditButton.addActionListener(this);
12541286
....@@ -1256,7 +1288,7 @@
12561288 allParamsButton.setToolTipText("Show all controls");
12571289 allParamsButton.addActionListener(this);
12581290
1259
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12601292 clearPanelButton.setToolTipText("Clear all controls");
12611293 clearPanelButton.addActionListener(this);
12621294
....@@ -1264,7 +1296,7 @@
12641296 //unselectButton.setToolTipText("Unselect");
12651297 //unselectButton.addActionListener(this);
12661298
1267
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1299
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12681300 flashSelectionButton.setToolTipText("Highlight selection");
12691301 flashSelectionButton.addActionListener(this);
12701302
....@@ -1287,6 +1319,8 @@
12871319
12881320 cGridBag jSPPanel = new cGridBag();
12891321
1322
+ jSPPanel.preferredHeight = 20;
1323
+
12901324 JScrollPane jSP;
12911325 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12921326 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1295,11 +1329,11 @@
12951329 oe.treePanel.add(jSPPanel);
12961330 oe.treePanel.Return();
12971331
1298
- oe.treePanel.add(copyOptionsPanel);
1332
+ oe.treePanel.add(versionManagerPanel);
12991333 oe.treePanel.Return();
1300
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1301
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1302
- sliderPane.preferredHeight = 1;
1334
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1335
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1336
+ versionSliderPane.preferredHeight = 3;
13031337
13041338 // mainPanel.setDividerLocation(0.1); //1.0);
13051339 mainPanel.setResizeWeight(0.4);
....@@ -1459,11 +1493,11 @@
14591493 {
14601494 assert(obj instanceof Composite);
14611495
1462
- if (obj.versionlist == null)
1463
- {
1464
- obj.versionlist = new Object3D[100];
1465
- obj.versionindex = -1;
1466
- }
1496
+// if (obj.versionlist == null)
1497
+// {
1498
+// obj.versionlist = new Object3D[100];
1499
+// obj.versionindex = -1;
1500
+// }
14671501
14681502 cRadio radioButton = new cRadio(obj.name);
14691503
....@@ -1489,6 +1523,7 @@
14891523
14901524 oe.SetupViews();
14911525
1526
+ if (Globals.DEBUG)
14921527 System.out.println("SetupViews");
14931528 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14941529 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2150,7 +2185,11 @@
21502185 shadow.material = new cMaterial(obj.material);
21512186 shadow.material.diffuse = 0.0001f;
21522187 shadow.material.specular = 0.0001f;
2153
- //shadow.projectedVertices[1].x = 300;
2188
+ shadow.material.opacity = 0.75f;
2189
+
2190
+ AllocProjectedVertices(shadow);
2191
+
2192
+ shadow.projectedVertices[1].x = 300;
21542193
21552194 makeSomething(shadow);
21562195 }
....@@ -2671,27 +2710,35 @@
26712710 } else
26722711 if (source == loopItem || source == loopButton)
26732712 {
2713
+ if (!group.selection.isEmpty())
2714
+ {
26742715 Composite csg = new GroupLeaf();
26752716 csg.count = 5;
2676
- group(csg);
26772717 Composite child = new cGroup("Branch");
26782718 csg.addChild(child);
26792719 child.addChild(csg);
2720
+ group(csg);
2721
+ }
26802722 } else
26812723 if (source == doubleItem)
26822724 {
2725
+ if (!group.selection.isEmpty())
2726
+ {
26832727 Composite csg = new GroupLeaf("Fork");
26842728 csg.count = 5;
2685
- group(csg);
26862729 Composite child = new cGroup("Branch A");
26872730 csg.addChild(child);
26882731 child.addChild(csg);
26892732 child = new cGroup("Branch B");
26902733 csg.addChild(child);
26912734 child.addChild(csg);
2735
+ group(csg);
2736
+ }
26922737 } else
26932738 if (source == tripleItem)
26942739 {
2740
+ if (!group.selection.isEmpty())
2741
+ {
26952742 Composite csg = new GroupLeaf("Trident");
26962743 csg.count = 4;
26972744 group(csg);
....@@ -2704,6 +2751,7 @@
27042751 child = new cGroup();
27052752 csg.addChild(child);
27062753 child.addChild(csg);
2754
+ }
27072755 } else
27082756 if (source == computeAOItem)
27092757 {
....@@ -3339,22 +3387,34 @@
33393387 } else
33403388 if (source == ungroupItem || source == ungroupButton)
33413389 {
3342
- boolean hasRoot = false;
3390
+ boolean canUngroup = true;
33433391
33443392 for (int i=0; i<group.selection.size(); i++)
33453393 {
3346
- if (group.selection.get(i) == group)
3394
+ Object3D selectedItem = group.selection.get(i);
3395
+
3396
+ if (selectedItem.Size() == 0)
33473397 {
3348
- hasRoot = true;
3398
+ // Cannot ungroup leaves
3399
+ canUngroup = false;
3400
+ break;
3401
+ }
3402
+
3403
+ if (selectedItem == group)
3404
+ {
3405
+ // Cannot ungroup root
3406
+ canUngroup = false;
33493407 break;
33503408 }
33513409 }
33523410
3353
- if (!hasRoot)
3411
+ if (canUngroup)
33543412 {
33553413 for (int i=0; i<group.selection.size(); i++)
33563414 {
3357
- Ungroup(group.selection.get(i));
3415
+ Object3D selectedItem = group.selection.get(i);
3416
+
3417
+ Ungroup(selectedItem);
33583418 }
33593419
33603420 ClearSelection(false);
....@@ -3918,6 +3978,8 @@
39183978 if (source == closeButton)
39193979 {
39203980 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3981
+ Replace();
3982
+
39213983 cRadio ab;
39223984 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39233985 {
....@@ -4016,6 +4078,8 @@
40164078 } else
40174079 if(source instanceof cRadio)
40184080 {
4081
+ Replace();
4082
+
40194083 group.parent = keepparent;
40204084 group.attributes = 0;
40214085 //group.editWindow = null;
....@@ -4067,7 +4131,28 @@
40674131 */
40684132 radio.layout.doClick();
40694133
4070
- SetUndoStates();
4134
+ assert(copy instanceof Composite);
4135
+
4136
+ if (copy.versionlist == null)
4137
+ {
4138
+ copy.versionindex = -1;
4139
+
4140
+ // Cannot work with loops
4141
+ // To fix this issue, we first mark all nodes above the root,
4142
+ // and check if any of these nodes are reachable below the root.
4143
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4144
+
4145
+ if (!copy.HasTags())
4146
+ {
4147
+ copy.versionlist = new Object3D[100];
4148
+
4149
+ Save(true);
4150
+ }
4151
+
4152
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4153
+ }
4154
+
4155
+ SetVersionStates();
40714156
40724157 ClearUnpinned();
40734158
....@@ -4212,7 +4297,7 @@
42124297 TouchTransform(obj);
42134298 continue;
42144299 }
4215
- if ((mask&2) != 0) // Scale
4300
+ if ((mask&2) != 0) // Scale/rotation
42164301 {
42174302 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42184303 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4220,10 +4305,6 @@
42204305 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42214306 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42224307 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4223
- }
4224
- if ((mask&4) != 0) // Rotation
4225
- {
4226
- // ?
42274308 }
42284309 if ((mask&1) != 0) // Translation
42294310 {
....@@ -5306,9 +5387,11 @@
53065387
53075388 boolean allComposites = true;
53085389
5390
+ if (group.selection != null)
53095391 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53105392 {
5311
- if (!(e.nextElement() instanceof Composite))
5393
+ Object next = e.nextElement();
5394
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53125395 {
53135396 allComposites = false;
53145397 break;
....@@ -5320,6 +5403,7 @@
53205403
53215404 void refreshContents(boolean cp)
53225405 {
5406
+ if (Globals.ADVANCED)
53235407 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53245408 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53255409 {
....@@ -6213,11 +6297,11 @@
62136297 private MenuItem lookAtItem;
62146298 private MenuItem lookFromItem;
62156299 private MenuItem switchViewItem;
6216
- private MenuItem cutItem;
6300
+ private JMenuItem cutItem;
62176301 private MenuItem undoItem;
62186302 private MenuItem redoItem;
62196303 private JMenuItem duplicateItem;
6220
- private MenuItem cloneItem;
6304
+ private JMenuItem cloneItem;
62216305 private MenuItem cloneSupportItem;
62226306 private MenuItem overwriteGeoItem;
62236307 private MenuItem overwriteMatItem;
....@@ -6238,13 +6322,13 @@
62386322 private MenuItem cloneGeometriesItem;
62396323 private MenuItem shareGeometriesItem;
62406324 private MenuItem mergeGeometriesItem;
6241
- private MenuItem copyItem;
6325
+ private JMenuItem copyItem;
62426326 private MenuItem pasteItem;
6243
- private MenuItem pasteIntoItem;
6244
- private MenuItem pasteLinkItem;
6245
- private MenuItem pasteCloneItem;
6246
- private MenuItem pasteExpandItem;
6247
- private MenuItem deleteItem;
6327
+ private JMenuItem pasteIntoItem;
6328
+ private JMenuItem pasteLinkItem;
6329
+ private JMenuItem pasteCloneItem;
6330
+ private JMenuItem pasteExpandItem;
6331
+ private JMenuItem deleteItem;
62486332 private MenuItem clearAllItem;
62496333 private MenuItem genUVItem;
62506334 private MenuItem genNormalsMESHItem;
....@@ -6299,7 +6383,7 @@
62996383 private MenuItem transformGeometryItem;
63006384 private MenuItem transformChildrenItem;
63016385 private MenuItem hideItem;
6302
- private MenuItem grabItem;
6386
+ private JMenuItem grabItem;
63036387 private MenuItem backItem;
63046388 private MenuItem frontItem;
63056389 private MenuItem cameraItem;
....@@ -6312,7 +6396,7 @@
63126396 private MenuItem switchTransfoItem;
63136397 private MenuItem morphItem;
63146398 private MenuItem linkerItem;
6315
- private MenuItem ungroupItem;
6399
+ private JMenuItem ungroupItem;
63166400 private MenuItem editItem;
63176401 private MenuItem openWindowItem;
63186402 private MenuItem editLeafItem;