Normand Briere
2019-08-18 66aca73cce89e4b4d7521862760edf4b0888bc38
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,10 +330,19 @@
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)
....@@ -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,7 +934,7 @@
914934
915935 JTabbedPane resourcecontainer;
916936 cGridBag currenttab;
917
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
918938
919939 int tabcount = 0;
920940 int colcount = 0;
....@@ -931,12 +951,14 @@
931951 // System.out.println();
932952
933953 if (//rowcount == 0 ||
934
- path.length == 1)
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
935955 {
936956 currenttab = new cGridBag();
937
- added = false;
938957 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
940962 rowcount = 1;
941963 colcount = 0;
942964 texturecount = 0;
....@@ -944,12 +966,11 @@
944966
945967 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
946968 {
947
- if (!added)
969
+ //if (!added)
948970 {
949
- added = true;
950
- resourcecontainer.add(currenttab);
971
+ //added = true;
951972 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
953974 }
954975
955976 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -1017,9 +1038,9 @@
10171038 oe.radioPanel.add(dummyButton);
10181039 oe.buttonGroup.add(dummyButton);
10191040 */
1020
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
10211042
1022
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
10231044
10241045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10251046
....@@ -1034,8 +1055,8 @@
10341055 // maxButton.addActionListener(this);
10351056 }
10361057
1037
-// cButton gcButton;
1038
-//
1058
+ cButton gcButton;
1059
+
10391060 // oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10401061 // gcButton.setToolTipText("Garbage collect");
10411062 // gcButton.addActionListener(new ActionListener()
....@@ -1046,25 +1067,25 @@
10461067 // }
10471068 // });
10481069
1049
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1070
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10501071 collapseButton.setToolTipText("Collapse toolbar");
10511072 collapseButton.addActionListener(this);
10521073
1053
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10541075 maximize3DButton.setToolTipText("Maximize 3D view");
10551076 maximize3DButton.addActionListener(this);
10561077
1057
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10581079 twoButton.setToolTipText("Show 3D view only");
10591080 twoButton.addActionListener(this);
10601081 this.fullscreenLayout = twoButton;
10611082
1062
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10631084 threeButton.setToolTipText("Show controls and 3D view");
10641085 threeButton.addActionListener(this);
10651086 if (Globals.ADVANCED)
10661087 {
1067
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10681089 sixButton.setToolTipText("Show 3D view and controls");
10691090 sixButton.addActionListener(this);
10701091 }
....@@ -1073,50 +1094,51 @@
10731094 // sevenButton.addActionListener(this);
10741095 //
10751096
1076
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10771098 fullButton.setToolTipText("Full-screen window");
10781099 fullButton.addActionListener(this);
10791100
1080
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10811102 screenfitButton.setToolTipText("Screen fit");
10821103 screenfitButton.addActionListener(this);
10831104
1084
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10851106 restoreCameraButton.setToolTipText("Restore viewpoint");
10861107 restoreCameraButton.addActionListener(this);
10871108
1088
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10891110 saveVersionButton.setToolTipText("Duplicate current version");
10901111 saveVersionButton.addActionListener(this);
10911112
1092
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10931114 deleteVersionButton.setToolTipText("Delete current version");
10941115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
10951117
1096
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10971119 previousVersionButton.setToolTipText("Previous version");
10981120 previousVersionButton.addActionListener(this);
10991121 previousVersionButton.setEnabled(false);
11001122
11011123 cGridBag updown = new cGridBag().setVertical(true);
1102
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11031125 restoreButton.setToolTipText("Undo (restore current version)");
11041126 restoreButton.addActionListener(this);
1105
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
11061128
1107
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11081130 replaceButton.setToolTipText("Save (replace current version)");
11091131 replaceButton.addActionListener(this);
1110
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
11111133
1112
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
11131135
1114
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11151137 nextVersionButton.setToolTipText("Next version");
11161138 nextVersionButton.addActionListener(this);
11171139 nextVersionButton.setEnabled(false);
11181140
1119
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1141
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11201142 oneStepButton.setToolTipText("Animate one step forward");
11211143 oneStepButton.addActionListener(this);
11221144
....@@ -1139,11 +1161,11 @@
11391161
11401162 if (Globals.ADVANCED)
11411163 {
1142
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11431165 snapobjectButton.addActionListener(this);
11441166 snapobjectButton.setToolTipText("Snap Object");
11451167
1146
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11471169 fourButton.addActionListener(this);
11481170 fourButton.setToolTipText("Show control panel only");
11491171 }
....@@ -1151,11 +1173,11 @@
11511173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11521174
11531175
1154
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11551177 rootButton.setToolTipText("Open selection in new tab");
11561178 rootButton.addActionListener(this);
11571179
1158
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11591181 closeButton.setToolTipText("Close tab");
11601182 closeButton.addActionListener(this);
11611183 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1164,38 +1186,38 @@
11641186 cGridBag row1 = new cGridBag();
11651187
11661188 // INSERT
1167
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1189
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11681190 gridButton.setToolTipText("Create ground");
11691191 gridButton.addActionListener(this);
11701192
1171
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11721194 boxButton.setToolTipText("Create box");
11731195 boxButton.addActionListener(this);
11741196
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);
1197
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11881198 superButton.setToolTipText("Create superellipsoid");
11891199 superButton.addActionListener(this);
11901200
1201
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1202
+ sphereButton.setToolTipText("Create sphere");
1203
+ sphereButton.addActionListener(this);
1204
+
1205
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ coneButton.setToolTipText("Create cone");
1207
+ coneButton.addActionListener(this);
1208
+
1209
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ torusButton.setToolTipText("Create torus");
1211
+ torusButton.addActionListener(this);
1212
+
11911213 if (Globals.ADVANCED)
11921214 {
1193
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11941216 kleinButton.setToolTipText("Create Klein bottle");
11951217 kleinButton.addActionListener(this);
11961218 }
11971219
1198
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11991221 particlesButton.setToolTipText("Create particle system");
12001222 particlesButton.addActionListener(this);
12011223
....@@ -1203,31 +1225,31 @@
12031225
12041226 cGridBag row2 = new cGridBag();
12051227
1206
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12071229 groupButton.setToolTipText("Create group");
12081230 groupButton.addActionListener(this);
12091231
1210
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12111233 compositeButton.setToolTipText("Create composite");
12121234 compositeButton.addActionListener(this);
12131235
1214
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12151237 switchButton.setToolTipText("Create item switcher");
12161238 switchButton.addActionListener(this);
12171239
1218
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12191241 loopButton.setToolTipText("Create loop");
12201242 loopButton.addActionListener(this);
12211243
1222
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12231245 textureButton.setToolTipText("Create texture");
12241246 textureButton.addActionListener(this);
12251247
1226
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12271249 overlayButton.setToolTipText("Create overlay");
12281250 overlayButton.addActionListener(this);
12291251
1230
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12311253 lightButton.setToolTipText("Create light");
12321254 lightButton.addActionListener(this);
12331255
....@@ -1237,6 +1259,8 @@
12371259
12381260 CreateTexturePanel(textures);
12391261
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
1263
+
12401264 oe.toolboxPanel.add(textures);
12411265
12421266 textures.preferredHeight = 100;
....@@ -1244,11 +1268,11 @@
12441268 CreateSkyboxPanel(oe.skyboxPanel);
12451269
12461270 // EDIT panel
1247
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1271
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12481272 editButton.setToolTipText("Pin selection controls");
12491273 editButton.addActionListener(this);
12501274
1251
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1275
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12521276 uneditButton.setToolTipText("Unpin and remove selection controls");
12531277 uneditButton.addActionListener(this);
12541278
....@@ -1256,7 +1280,7 @@
12561280 allParamsButton.setToolTipText("Show all controls");
12571281 allParamsButton.addActionListener(this);
12581282
1259
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12601284 clearPanelButton.setToolTipText("Clear all controls");
12611285 clearPanelButton.addActionListener(this);
12621286
....@@ -1264,7 +1288,7 @@
12641288 //unselectButton.setToolTipText("Unselect");
12651289 //unselectButton.addActionListener(this);
12661290
1267
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12681292 flashSelectionButton.setToolTipText("Highlight selection");
12691293 flashSelectionButton.addActionListener(this);
12701294
....@@ -1287,6 +1311,8 @@
12871311
12881312 cGridBag jSPPanel = new cGridBag();
12891313
1314
+ jSPPanel.preferredHeight = 20;
1315
+
12901316 JScrollPane jSP;
12911317 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12921318 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1295,11 +1321,11 @@
12951321 oe.treePanel.add(jSPPanel);
12961322 oe.treePanel.Return();
12971323
1298
- oe.treePanel.add(copyOptionsPanel);
1324
+ oe.treePanel.add(versionManagerPanel);
12991325 oe.treePanel.Return();
1300
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1301
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1302
- sliderPane.preferredHeight = 1;
1326
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1327
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1328
+ versionSliderPane.preferredHeight = 3;
13031329
13041330 // mainPanel.setDividerLocation(0.1); //1.0);
13051331 mainPanel.setResizeWeight(0.4);
....@@ -1459,11 +1485,11 @@
14591485 {
14601486 assert(obj instanceof Composite);
14611487
1462
- if (obj.versionlist == null)
1463
- {
1464
- obj.versionlist = new Object3D[100];
1465
- obj.versionindex = -1;
1466
- }
1488
+// if (obj.versionlist == null)
1489
+// {
1490
+// obj.versionlist = new Object3D[100];
1491
+// obj.versionindex = -1;
1492
+// }
14671493
14681494 cRadio radioButton = new cRadio(obj.name);
14691495
....@@ -1489,6 +1515,7 @@
14891515
14901516 oe.SetupViews();
14911517
1518
+ if (Globals.DEBUG)
14921519 System.out.println("SetupViews");
14931520 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14941521 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2150,7 +2177,11 @@
21502177 shadow.material = new cMaterial(obj.material);
21512178 shadow.material.diffuse = 0.0001f;
21522179 shadow.material.specular = 0.0001f;
2153
- //shadow.projectedVertices[1].x = 300;
2180
+ shadow.material.opacity = 0.75f;
2181
+
2182
+ AllocProjectedVertices(shadow);
2183
+
2184
+ shadow.projectedVertices[1].x = 300;
21542185
21552186 makeSomething(shadow);
21562187 }
....@@ -2671,27 +2702,35 @@
26712702 } else
26722703 if (source == loopItem || source == loopButton)
26732704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
26742707 Composite csg = new GroupLeaf();
26752708 csg.count = 5;
2676
- group(csg);
26772709 Composite child = new cGroup("Branch");
26782710 csg.addChild(child);
26792711 child.addChild(csg);
2712
+ group(csg);
2713
+ }
26802714 } else
26812715 if (source == doubleItem)
26822716 {
2717
+ if (!group.selection.isEmpty())
2718
+ {
26832719 Composite csg = new GroupLeaf("Fork");
26842720 csg.count = 5;
2685
- group(csg);
26862721 Composite child = new cGroup("Branch A");
26872722 csg.addChild(child);
26882723 child.addChild(csg);
26892724 child = new cGroup("Branch B");
26902725 csg.addChild(child);
26912726 child.addChild(csg);
2727
+ group(csg);
2728
+ }
26922729 } else
26932730 if (source == tripleItem)
26942731 {
2732
+ if (!group.selection.isEmpty())
2733
+ {
26952734 Composite csg = new GroupLeaf("Trident");
26962735 csg.count = 4;
26972736 group(csg);
....@@ -2704,6 +2743,7 @@
27042743 child = new cGroup();
27052744 csg.addChild(child);
27062745 child.addChild(csg);
2746
+ }
27072747 } else
27082748 if (source == computeAOItem)
27092749 {
....@@ -3339,22 +3379,34 @@
33393379 } else
33403380 if (source == ungroupItem || source == ungroupButton)
33413381 {
3342
- boolean hasRoot = false;
3382
+ boolean canUngroup = true;
33433383
33443384 for (int i=0; i<group.selection.size(); i++)
33453385 {
3346
- if (group.selection.get(i) == group)
3386
+ Object3D selectedItem = group.selection.get(i);
3387
+
3388
+ if (selectedItem.Size() == 0)
33473389 {
3348
- hasRoot = true;
3390
+ // Cannot ungroup leaves
3391
+ canUngroup = false;
3392
+ break;
3393
+ }
3394
+
3395
+ if (selectedItem == group)
3396
+ {
3397
+ // Cannot ungroup root
3398
+ canUngroup = false;
33493399 break;
33503400 }
33513401 }
33523402
3353
- if (!hasRoot)
3403
+ if (canUngroup)
33543404 {
33553405 for (int i=0; i<group.selection.size(); i++)
33563406 {
3357
- Ungroup(group.selection.get(i));
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ Ungroup(selectedItem);
33583410 }
33593411
33603412 ClearSelection(false);
....@@ -3918,6 +3970,8 @@
39183970 if (source == closeButton)
39193971 {
39203972 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
+ Replace();
3974
+
39213975 cRadio ab;
39223976 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39233977 {
....@@ -4016,6 +4070,8 @@
40164070 } else
40174071 if(source instanceof cRadio)
40184072 {
4073
+ Replace();
4074
+
40194075 group.parent = keepparent;
40204076 group.attributes = 0;
40214077 //group.editWindow = null;
....@@ -4067,7 +4123,28 @@
40674123 */
40684124 radio.layout.doClick();
40694125
4070
- SetUndoStates();
4126
+ assert(copy instanceof Composite);
4127
+
4128
+ if (copy.versionlist == null)
4129
+ {
4130
+ copy.versionindex = -1;
4131
+
4132
+ // Cannot work with loops
4133
+ // To fix this issue, we first mark all nodes above the root,
4134
+ // and check if any of these nodes are reachable below the root.
4135
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4136
+
4137
+ if (!copy.HasTags())
4138
+ {
4139
+ copy.versionlist = new Object3D[100];
4140
+
4141
+ Save(true);
4142
+ }
4143
+
4144
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4145
+ }
4146
+
4147
+ SetVersionStates();
40714148
40724149 ClearUnpinned();
40734150
....@@ -4212,7 +4289,7 @@
42124289 TouchTransform(obj);
42134290 continue;
42144291 }
4215
- if ((mask&2) != 0) // Scale
4292
+ if ((mask&2) != 0) // Scale/rotation
42164293 {
42174294 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42184295 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4220,10 +4297,6 @@
42204297 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42214298 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42224299 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4223
- }
4224
- if ((mask&4) != 0) // Rotation
4225
- {
4226
- // ?
42274300 }
42284301 if ((mask&1) != 0) // Translation
42294302 {
....@@ -5306,9 +5379,11 @@
53065379
53075380 boolean allComposites = true;
53085381
5382
+ if (group.selection != null)
53095383 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53105384 {
5311
- if (!(e.nextElement() instanceof Composite))
5385
+ Object next = e.nextElement();
5386
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53125387 {
53135388 allComposites = false;
53145389 break;
....@@ -5320,6 +5395,7 @@
53205395
53215396 void refreshContents(boolean cp)
53225397 {
5398
+ if (Globals.ADVANCED)
53235399 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53245400 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53255401 {
....@@ -6213,11 +6289,11 @@
62136289 private MenuItem lookAtItem;
62146290 private MenuItem lookFromItem;
62156291 private MenuItem switchViewItem;
6216
- private MenuItem cutItem;
6292
+ private JMenuItem cutItem;
62176293 private MenuItem undoItem;
62186294 private MenuItem redoItem;
62196295 private JMenuItem duplicateItem;
6220
- private MenuItem cloneItem;
6296
+ private JMenuItem cloneItem;
62216297 private MenuItem cloneSupportItem;
62226298 private MenuItem overwriteGeoItem;
62236299 private MenuItem overwriteMatItem;
....@@ -6238,13 +6314,13 @@
62386314 private MenuItem cloneGeometriesItem;
62396315 private MenuItem shareGeometriesItem;
62406316 private MenuItem mergeGeometriesItem;
6241
- private MenuItem copyItem;
6317
+ private JMenuItem copyItem;
62426318 private MenuItem pasteItem;
6243
- private MenuItem pasteIntoItem;
6244
- private MenuItem pasteLinkItem;
6245
- private MenuItem pasteCloneItem;
6246
- private MenuItem pasteExpandItem;
6247
- private MenuItem deleteItem;
6319
+ private JMenuItem pasteIntoItem;
6320
+ private JMenuItem pasteLinkItem;
6321
+ private JMenuItem pasteCloneItem;
6322
+ private JMenuItem pasteExpandItem;
6323
+ private JMenuItem deleteItem;
62486324 private MenuItem clearAllItem;
62496325 private MenuItem genUVItem;
62506326 private MenuItem genNormalsMESHItem;
....@@ -6299,7 +6375,7 @@
62996375 private MenuItem transformGeometryItem;
63006376 private MenuItem transformChildrenItem;
63016377 private MenuItem hideItem;
6302
- private MenuItem grabItem;
6378
+ private JMenuItem grabItem;
63036379 private MenuItem backItem;
63046380 private MenuItem frontItem;
63056381 private MenuItem cameraItem;
....@@ -6312,7 +6388,7 @@
63126388 private MenuItem switchTransfoItem;
63136389 private MenuItem morphItem;
63146390 private MenuItem linkerItem;
6315
- private MenuItem ungroupItem;
6391
+ private JMenuItem ungroupItem;
63166392 private MenuItem editItem;
63176393 private MenuItem openWindowItem;
63186394 private MenuItem editLeafItem;