Normand Briere
2019-08-20 537f4ac57ae2b34f0a04fa63874c8ca6534c9a6d
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,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,28 +951,29 @@
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;
943965 }
944966
945
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
967
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
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
955
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
976
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
956977
957978 if (++colcount >= columns)
958979 {
....@@ -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,11 @@
12371259
12381260 CreateTexturePanel(textures);
12391261
1262
+ int tabCount = resourcecontainer.getTabCount();
1263
+
1264
+ if (tabCount > 0)
1265
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1266
+
12401267 oe.toolboxPanel.add(textures);
12411268
12421269 textures.preferredHeight = 100;
....@@ -1244,11 +1271,11 @@
12441271 CreateSkyboxPanel(oe.skyboxPanel);
12451272
12461273 // EDIT panel
1247
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1274
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12481275 editButton.setToolTipText("Pin selection controls");
12491276 editButton.addActionListener(this);
12501277
1251
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12521279 uneditButton.setToolTipText("Unpin and remove selection controls");
12531280 uneditButton.addActionListener(this);
12541281
....@@ -1256,7 +1283,7 @@
12561283 allParamsButton.setToolTipText("Show all controls");
12571284 allParamsButton.addActionListener(this);
12581285
1259
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1286
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12601287 clearPanelButton.setToolTipText("Clear all controls");
12611288 clearPanelButton.addActionListener(this);
12621289
....@@ -1264,7 +1291,7 @@
12641291 //unselectButton.setToolTipText("Unselect");
12651292 //unselectButton.addActionListener(this);
12661293
1267
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1294
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12681295 flashSelectionButton.setToolTipText("Highlight selection");
12691296 flashSelectionButton.addActionListener(this);
12701297
....@@ -1287,6 +1314,8 @@
12871314
12881315 cGridBag jSPPanel = new cGridBag();
12891316
1317
+ jSPPanel.preferredHeight = 20;
1318
+
12901319 JScrollPane jSP;
12911320 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12921321 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1295,11 +1324,11 @@
12951324 oe.treePanel.add(jSPPanel);
12961325 oe.treePanel.Return();
12971326
1298
- oe.treePanel.add(copyOptionsPanel);
1327
+ oe.treePanel.add(versionManagerPanel);
12991328 oe.treePanel.Return();
1300
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1301
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1302
- sliderPane.preferredHeight = 1;
1329
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1330
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1331
+ versionSliderPane.preferredHeight = 3;
13031332
13041333 // mainPanel.setDividerLocation(0.1); //1.0);
13051334 mainPanel.setResizeWeight(0.4);
....@@ -1459,11 +1488,11 @@
14591488 {
14601489 assert(obj instanceof Composite);
14611490
1462
- if (obj.versionlist == null)
1463
- {
1464
- obj.versionlist = new Object3D[100];
1465
- obj.versionindex = -1;
1466
- }
1491
+// if (obj.versionlist == null)
1492
+// {
1493
+// obj.versionlist = new Object3D[100];
1494
+// obj.versionindex = -1;
1495
+// }
14671496
14681497 cRadio radioButton = new cRadio(obj.name);
14691498
....@@ -1489,6 +1518,7 @@
14891518
14901519 oe.SetupViews();
14911520
1521
+ if (Globals.DEBUG)
14921522 System.out.println("SetupViews");
14931523 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14941524 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2150,7 +2180,11 @@
21502180 shadow.material = new cMaterial(obj.material);
21512181 shadow.material.diffuse = 0.0001f;
21522182 shadow.material.specular = 0.0001f;
2153
- //shadow.projectedVertices[1].x = 300;
2183
+ shadow.material.opacity = 0.75f;
2184
+
2185
+ AllocProjectedVertices(shadow);
2186
+
2187
+ shadow.projectedVertices[1].x = 300;
21542188
21552189 makeSomething(shadow);
21562190 }
....@@ -2671,27 +2705,35 @@
26712705 } else
26722706 if (source == loopItem || source == loopButton)
26732707 {
2708
+ if (!group.selection.isEmpty())
2709
+ {
26742710 Composite csg = new GroupLeaf();
26752711 csg.count = 5;
2676
- group(csg);
26772712 Composite child = new cGroup("Branch");
26782713 csg.addChild(child);
26792714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
26802717 } else
26812718 if (source == doubleItem)
26822719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
26832722 Composite csg = new GroupLeaf("Fork");
26842723 csg.count = 5;
2685
- group(csg);
26862724 Composite child = new cGroup("Branch A");
26872725 csg.addChild(child);
26882726 child.addChild(csg);
26892727 child = new cGroup("Branch B");
26902728 csg.addChild(child);
26912729 child.addChild(csg);
2730
+ group(csg);
2731
+ }
26922732 } else
26932733 if (source == tripleItem)
26942734 {
2735
+ if (!group.selection.isEmpty())
2736
+ {
26952737 Composite csg = new GroupLeaf("Trident");
26962738 csg.count = 4;
26972739 group(csg);
....@@ -2704,6 +2746,7 @@
27042746 child = new cGroup();
27052747 csg.addChild(child);
27062748 child.addChild(csg);
2749
+ }
27072750 } else
27082751 if (source == computeAOItem)
27092752 {
....@@ -3339,22 +3382,34 @@
33393382 } else
33403383 if (source == ungroupItem || source == ungroupButton)
33413384 {
3342
- boolean hasRoot = false;
3385
+ boolean canUngroup = true;
33433386
33443387 for (int i=0; i<group.selection.size(); i++)
33453388 {
3346
- if (group.selection.get(i) == group)
3389
+ Object3D selectedItem = group.selection.get(i);
3390
+
3391
+ if (selectedItem.Size() == 0)
33473392 {
3348
- hasRoot = true;
3393
+ // Cannot ungroup leaves
3394
+ canUngroup = false;
3395
+ break;
3396
+ }
3397
+
3398
+ if (selectedItem == group)
3399
+ {
3400
+ // Cannot ungroup root
3401
+ canUngroup = false;
33493402 break;
33503403 }
33513404 }
33523405
3353
- if (!hasRoot)
3406
+ if (canUngroup)
33543407 {
33553408 for (int i=0; i<group.selection.size(); i++)
33563409 {
3357
- Ungroup(group.selection.get(i));
3410
+ Object3D selectedItem = group.selection.get(i);
3411
+
3412
+ Ungroup(selectedItem);
33583413 }
33593414
33603415 ClearSelection(false);
....@@ -3918,6 +3973,8 @@
39183973 if (source == closeButton)
39193974 {
39203975 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3976
+ Replace();
3977
+
39213978 cRadio ab;
39223979 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39233980 {
....@@ -4016,6 +4073,8 @@
40164073 } else
40174074 if(source instanceof cRadio)
40184075 {
4076
+ Replace();
4077
+
40194078 group.parent = keepparent;
40204079 group.attributes = 0;
40214080 //group.editWindow = null;
....@@ -4067,7 +4126,28 @@
40674126 */
40684127 radio.layout.doClick();
40694128
4070
- SetUndoStates();
4129
+ assert(copy instanceof Composite);
4130
+
4131
+ if (copy.versionlist == null)
4132
+ {
4133
+ copy.versionindex = -1;
4134
+
4135
+ // Cannot work with loops
4136
+ // To fix this issue, we first mark all nodes above the root,
4137
+ // and check if any of these nodes are reachable below the root.
4138
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4139
+
4140
+ if (!copy.HasTags())
4141
+ {
4142
+ copy.versionlist = new Object3D[100];
4143
+
4144
+ Save(true);
4145
+ }
4146
+
4147
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4148
+ }
4149
+
4150
+ SetVersionStates();
40714151
40724152 ClearUnpinned();
40734153
....@@ -4212,7 +4292,7 @@
42124292 TouchTransform(obj);
42134293 continue;
42144294 }
4215
- if ((mask&2) != 0) // Scale
4295
+ if ((mask&2) != 0) // Scale/rotation
42164296 {
42174297 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42184298 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4220,10 +4300,6 @@
42204300 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42214301 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42224302 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4223
- }
4224
- if ((mask&4) != 0) // Rotation
4225
- {
4226
- // ?
42274303 }
42284304 if ((mask&1) != 0) // Translation
42294305 {
....@@ -5306,9 +5382,11 @@
53065382
53075383 boolean allComposites = true;
53085384
5385
+ if (group.selection != null)
53095386 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
53105387 {
5311
- if (!(e.nextElement() instanceof Composite))
5388
+ Object next = e.nextElement();
5389
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
53125390 {
53135391 allComposites = false;
53145392 break;
....@@ -5320,6 +5398,7 @@
53205398
53215399 void refreshContents(boolean cp)
53225400 {
5401
+ if (Globals.ADVANCED)
53235402 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
53245403 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53255404 {
....@@ -6213,11 +6292,11 @@
62136292 private MenuItem lookAtItem;
62146293 private MenuItem lookFromItem;
62156294 private MenuItem switchViewItem;
6216
- private MenuItem cutItem;
6295
+ private JMenuItem cutItem;
62176296 private MenuItem undoItem;
62186297 private MenuItem redoItem;
62196298 private JMenuItem duplicateItem;
6220
- private MenuItem cloneItem;
6299
+ private JMenuItem cloneItem;
62216300 private MenuItem cloneSupportItem;
62226301 private MenuItem overwriteGeoItem;
62236302 private MenuItem overwriteMatItem;
....@@ -6238,13 +6317,13 @@
62386317 private MenuItem cloneGeometriesItem;
62396318 private MenuItem shareGeometriesItem;
62406319 private MenuItem mergeGeometriesItem;
6241
- private MenuItem copyItem;
6320
+ private JMenuItem copyItem;
62426321 private MenuItem pasteItem;
6243
- private MenuItem pasteIntoItem;
6244
- private MenuItem pasteLinkItem;
6245
- private MenuItem pasteCloneItem;
6246
- private MenuItem pasteExpandItem;
6247
- private MenuItem deleteItem;
6322
+ private JMenuItem pasteIntoItem;
6323
+ private JMenuItem pasteLinkItem;
6324
+ private JMenuItem pasteCloneItem;
6325
+ private JMenuItem pasteExpandItem;
6326
+ private JMenuItem deleteItem;
62486327 private MenuItem clearAllItem;
62496328 private MenuItem genUVItem;
62506329 private MenuItem genNormalsMESHItem;
....@@ -6299,7 +6378,7 @@
62996378 private MenuItem transformGeometryItem;
63006379 private MenuItem transformChildrenItem;
63016380 private MenuItem hideItem;
6302
- private MenuItem grabItem;
6381
+ private JMenuItem grabItem;
63036382 private MenuItem backItem;
63046383 private MenuItem frontItem;
63056384 private MenuItem cameraItem;
....@@ -6312,7 +6391,7 @@
63126391 private MenuItem switchTransfoItem;
63136392 private MenuItem morphItem;
63146393 private MenuItem linkerItem;
6315
- private MenuItem ungroupItem;
6394
+ private JMenuItem ungroupItem;
63166395 private MenuItem editItem;
63176396 private MenuItem openWindowItem;
63186397 private MenuItem editLeafItem;