Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
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,10 +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;
424
+
425
+ //Save(true);
413426 }
414427
415428 if(ui)
....@@ -438,7 +451,7 @@
438451 copy.versionlist = new Object3D[100];
439452 copy.versionindex = -1;
440453
441
- Save(true);
454
+ //Save(true);
442455 }
443456 }
444457
....@@ -529,33 +542,35 @@
529542 // menu.add("-");
530543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
531544 duplicateItem.addActionListener(this);
532
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
533547 cloneItem.addActionListener(this);
534
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
535549 {
536550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
537551 cloneSupportItem.addActionListener(this);
538552 }
553
+ oe.jTree.popup.addSeparator();
539554 menu.add("-");
540
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
541556 cutItem.addActionListener(this);
542
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
543558 copyItem.addActionListener(this);
544559 pasteItem = menu.add(new MenuItem("Paste"));
545560 pasteItem.addActionListener(this);
546561
547
- menu.add("-");
548
- 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"));
549565 pasteIntoItem.addActionListener(this);
550
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
551567 pasteLinkItem.addActionListener(this);
552
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
553569 pasteCloneItem.addActionListener(this);
554
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
555571 // pasteExpandItem.addActionListener(this);
556
- menu.add("-");
557
- deleteItem = menu.add(new MenuItem("Delete"));
558
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
559574
560575 if (Globals.ADVANCED)
561576 {
....@@ -641,11 +656,9 @@
641656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
642657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
643658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
644
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
645659 oe.cameraMenu.add("-");
646660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
647661 openWindowItem.addActionListener(this);
648
- editLeafItem.addActionListener(this);
649662 lookAtItem.addActionListener(this);
650663 //lookFromItem.addActinoListener(this);
651664 //switchViewItem.addActionListener(this);
....@@ -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);
....@@ -893,6 +913,9 @@
893913 shareGeometriesItem.addActionListener(this);
894914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
895915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
896919 if (Globals.ADVANCED)
897920 {
898921 // Pretty much the same as duplicate and clone.
....@@ -911,7 +934,7 @@
911934
912935 JTabbedPane resourcecontainer;
913936 cGridBag currenttab;
914
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
915938
916939 int tabcount = 0;
917940 int colcount = 0;
....@@ -928,12 +951,14 @@
928951 // System.out.println();
929952
930953 if (//rowcount == 0 ||
931
- path.length == 1)
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
932955 {
933956 currenttab = new cGridBag();
934
- added = false;
935957 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
936958 currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
937962 rowcount = 1;
938963 colcount = 0;
939964 texturecount = 0;
....@@ -941,12 +966,11 @@
941966
942967 if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
943968 {
944
- if (!added)
969
+ //if (!added)
945970 {
946
- added = true;
947
- resourcecontainer.add(currenttab);
971
+ //added = true;
948972 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
949
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
950974 }
951975
952976 AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
....@@ -1014,9 +1038,9 @@
10141038 oe.radioPanel.add(dummyButton);
10151039 oe.buttonGroup.add(dummyButton);
10161040 */
1017
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
10181042
1019
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
10201044
10211045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10221046
....@@ -1026,42 +1050,42 @@
10261050
10271051 if (Globals.ADVANCED)
10281052 {
1029
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
- maxButton.setToolTipText("Maximize window");
1031
- maxButton.addActionListener(this);
1053
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+// maxButton.setToolTipText("Maximize window");
1055
+// maxButton.addActionListener(this);
10321056 }
10331057
10341058 cButton gcButton;
10351059
1036
- oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
- gcButton.setToolTipText("Garbage collect");
1038
- gcButton.addActionListener(new ActionListener()
1039
- {
1040
- public void actionPerformed(ActionEvent e)
1041
- {
1042
- System.gc();
1043
- }
1044
- });
1060
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// gcButton.setToolTipText("Garbage collect");
1062
+// gcButton.addActionListener(new ActionListener()
1063
+// {
1064
+// public void actionPerformed(ActionEvent e)
1065
+// {
1066
+// System.gc();
1067
+// }
1068
+// });
10451069
1046
- 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);
10471071 collapseButton.setToolTipText("Collapse toolbar");
10481072 collapseButton.addActionListener(this);
10491073
1050
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10511075 maximize3DButton.setToolTipText("Maximize 3D view");
10521076 maximize3DButton.addActionListener(this);
10531077
1054
- 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);
10551079 twoButton.setToolTipText("Show 3D view only");
10561080 twoButton.addActionListener(this);
10571081 this.fullscreenLayout = twoButton;
10581082
1059
- 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);
10601084 threeButton.setToolTipText("Show controls and 3D view");
10611085 threeButton.addActionListener(this);
10621086 if (Globals.ADVANCED)
10631087 {
1064
- 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);
10651089 sixButton.setToolTipText("Show 3D view and controls");
10661090 sixButton.addActionListener(this);
10671091 }
....@@ -1070,50 +1094,51 @@
10701094 // sevenButton.addActionListener(this);
10711095 //
10721096
1073
- 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);
10741098 fullButton.setToolTipText("Full-screen window");
10751099 fullButton.addActionListener(this);
10761100
1077
- 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);
10781102 screenfitButton.setToolTipText("Screen fit");
10791103 screenfitButton.addActionListener(this);
10801104
1081
- 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);
10821106 restoreCameraButton.setToolTipText("Restore viewpoint");
10831107 restoreCameraButton.addActionListener(this);
10841108
1085
- 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);
10861110 saveVersionButton.setToolTipText("Duplicate current version");
10871111 saveVersionButton.addActionListener(this);
10881112
1089
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901114 deleteVersionButton.setToolTipText("Delete current version");
10911115 deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
10921117
1093
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941119 previousVersionButton.setToolTipText("Previous version");
10951120 previousVersionButton.addActionListener(this);
10961121 previousVersionButton.setEnabled(false);
10971122
10981123 cGridBag updown = new cGridBag().setVertical(true);
1099
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001125 restoreButton.setToolTipText("Undo (restore current version)");
11011126 restoreButton.addActionListener(this);
1102
- //restoreButton.setEnabled(false);
1127
+ restoreButton.setEnabled(false);
11031128
1104
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11051130 replaceButton.setToolTipText("Save (replace current version)");
11061131 replaceButton.addActionListener(this);
1107
- //replaceButton.setEnabled(false);
1132
+ replaceButton.setEnabled(false);
11081133
1109
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
11101135
1111
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121137 nextVersionButton.setToolTipText("Next version");
11131138 nextVersionButton.addActionListener(this);
11141139 nextVersionButton.setEnabled(false);
11151140
1116
- 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);
11171142 oneStepButton.setToolTipText("Animate one step forward");
11181143 oneStepButton.addActionListener(this);
11191144
....@@ -1136,11 +1161,11 @@
11361161
11371162 if (Globals.ADVANCED)
11381163 {
1139
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11401165 snapobjectButton.addActionListener(this);
11411166 snapobjectButton.setToolTipText("Snap Object");
11421167
1143
- 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);
11441169 fourButton.addActionListener(this);
11451170 fourButton.setToolTipText("Show control panel only");
11461171 }
....@@ -1148,11 +1173,11 @@
11481173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11491174
11501175
1151
- 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);
11521177 rootButton.setToolTipText("Open selection in new tab");
11531178 rootButton.addActionListener(this);
11541179
1155
- 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);
11561181 closeButton.setToolTipText("Close tab");
11571182 closeButton.addActionListener(this);
11581183 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1161,38 +1186,38 @@
11611186 cGridBag row1 = new cGridBag();
11621187
11631188 // INSERT
1164
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1165
- gridButton.setToolTipText("Create grid");
1189
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1190
+ gridButton.setToolTipText("Create ground");
11661191 gridButton.addActionListener(this);
11671192
1168
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691194 boxButton.setToolTipText("Create box");
11701195 boxButton.addActionListener(this);
11711196
1172
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1173
- sphereButton.setToolTipText("Create sphere");
1174
- sphereButton.addActionListener(this);
1175
-
1176
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1177
- coneButton.setToolTipText("Create cone");
1178
- coneButton.addActionListener(this);
1179
-
1180
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1181
- torusButton.setToolTipText("Create torus");
1182
- torusButton.addActionListener(this);
1183
-
1184
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11851198 superButton.setToolTipText("Create superellipsoid");
11861199 superButton.addActionListener(this);
11871200
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
+
11881213 if (Globals.ADVANCED)
11891214 {
1190
- 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);
11911216 kleinButton.setToolTipText("Create Klein bottle");
11921217 kleinButton.addActionListener(this);
11931218 }
11941219
1195
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11961221 particlesButton.setToolTipText("Create particle system");
11971222 particlesButton.addActionListener(this);
11981223
....@@ -1200,31 +1225,31 @@
12001225
12011226 cGridBag row2 = new cGridBag();
12021227
1203
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12041229 groupButton.setToolTipText("Create group");
12051230 groupButton.addActionListener(this);
12061231
1207
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081233 compositeButton.setToolTipText("Create composite");
12091234 compositeButton.addActionListener(this);
12101235
1211
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12121237 switchButton.setToolTipText("Create item switcher");
12131238 switchButton.addActionListener(this);
12141239
1215
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161241 loopButton.setToolTipText("Create loop");
12171242 loopButton.addActionListener(this);
12181243
1219
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201245 textureButton.setToolTipText("Create texture");
12211246 textureButton.addActionListener(this);
12221247
1223
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241249 overlayButton.setToolTipText("Create overlay");
12251250 overlayButton.addActionListener(this);
12261251
1227
- 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);
12281253 lightButton.setToolTipText("Create light");
12291254 lightButton.addActionListener(this);
12301255
....@@ -1234,6 +1259,8 @@
12341259
12351260 CreateTexturePanel(textures);
12361261
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
1263
+
12371264 oe.toolboxPanel.add(textures);
12381265
12391266 textures.preferredHeight = 100;
....@@ -1241,11 +1268,11 @@
12411268 CreateSkyboxPanel(oe.skyboxPanel);
12421269
12431270 // EDIT panel
1244
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1271
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451272 editButton.setToolTipText("Pin selection controls");
12461273 editButton.addActionListener(this);
12471274
1248
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1275
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491276 uneditButton.setToolTipText("Unpin and remove selection controls");
12501277 uneditButton.addActionListener(this);
12511278
....@@ -1253,7 +1280,7 @@
12531280 allParamsButton.setToolTipText("Show all controls");
12541281 allParamsButton.addActionListener(this);
12551282
1256
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571284 clearPanelButton.setToolTipText("Clear all controls");
12581285 clearPanelButton.addActionListener(this);
12591286
....@@ -1261,7 +1288,7 @@
12611288 //unselectButton.setToolTipText("Unselect");
12621289 //unselectButton.addActionListener(this);
12631290
1264
- 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);
12651292 flashSelectionButton.setToolTipText("Highlight selection");
12661293 flashSelectionButton.addActionListener(this);
12671294
....@@ -1284,6 +1311,8 @@
12841311
12851312 cGridBag jSPPanel = new cGridBag();
12861313
1314
+ jSPPanel.preferredHeight = 20;
1315
+
12871316 JScrollPane jSP;
12881317 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12891318 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1292,11 +1321,11 @@
12921321 oe.treePanel.add(jSPPanel);
12931322 oe.treePanel.Return();
12941323
1295
- oe.treePanel.add(copyOptionsPanel);
1324
+ oe.treePanel.add(versionManagerPanel);
12961325 oe.treePanel.Return();
1297
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1298
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1299
- sliderPane.preferredHeight = 1;
1326
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1327
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1328
+ versionSliderPane.preferredHeight = 3;
13001329
13011330 // mainPanel.setDividerLocation(0.1); //1.0);
13021331 mainPanel.setResizeWeight(0.4);
....@@ -1454,6 +1483,14 @@
14541483
14551484 void EditObject(Object3D obj)
14561485 {
1486
+ assert(obj instanceof Composite);
1487
+
1488
+// if (obj.versionlist == null)
1489
+// {
1490
+// obj.versionlist = new Object3D[100];
1491
+// obj.versionindex = -1;
1492
+// }
1493
+
14571494 cRadio radioButton = new cRadio(obj.name);
14581495
14591496 // June 2019. Patch to avoid bug with transparency.
....@@ -1478,6 +1515,7 @@
14781515
14791516 oe.SetupViews();
14801517
1518
+ if (Globals.DEBUG)
14811519 System.out.println("SetupViews");
14821520 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14831521 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2139,7 +2177,11 @@
21392177 shadow.material = new cMaterial(obj.material);
21402178 shadow.material.diffuse = 0.0001f;
21412179 shadow.material.specular = 0.0001f;
2142
- //shadow.projectedVertices[1].x = 300;
2180
+ shadow.material.opacity = 0.75f;
2181
+
2182
+ AllocProjectedVertices(shadow);
2183
+
2184
+ shadow.projectedVertices[1].x = 300;
21432185
21442186 makeSomething(shadow);
21452187 }
....@@ -2660,27 +2702,35 @@
26602702 } else
26612703 if (source == loopItem || source == loopButton)
26622704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
26632707 Composite csg = new GroupLeaf();
26642708 csg.count = 5;
2665
- group(csg);
26662709 Composite child = new cGroup("Branch");
26672710 csg.addChild(child);
26682711 child.addChild(csg);
2712
+ group(csg);
2713
+ }
26692714 } else
26702715 if (source == doubleItem)
26712716 {
2717
+ if (!group.selection.isEmpty())
2718
+ {
26722719 Composite csg = new GroupLeaf("Fork");
26732720 csg.count = 5;
2674
- group(csg);
26752721 Composite child = new cGroup("Branch A");
26762722 csg.addChild(child);
26772723 child.addChild(csg);
26782724 child = new cGroup("Branch B");
26792725 csg.addChild(child);
26802726 child.addChild(csg);
2727
+ group(csg);
2728
+ }
26812729 } else
26822730 if (source == tripleItem)
26832731 {
2732
+ if (!group.selection.isEmpty())
2733
+ {
26842734 Composite csg = new GroupLeaf("Trident");
26852735 csg.count = 4;
26862736 group(csg);
....@@ -2693,6 +2743,7 @@
26932743 child = new cGroup();
26942744 csg.addChild(child);
26952745 child.addChild(csg);
2746
+ }
26962747 } else
26972748 if (source == computeAOItem)
26982749 {
....@@ -3328,22 +3379,34 @@
33283379 } else
33293380 if (source == ungroupItem || source == ungroupButton)
33303381 {
3331
- boolean hasRoot = false;
3382
+ boolean canUngroup = true;
33323383
33333384 for (int i=0; i<group.selection.size(); i++)
33343385 {
3335
- if (group.selection.get(i) == group)
3386
+ Object3D selectedItem = group.selection.get(i);
3387
+
3388
+ if (selectedItem.Size() == 0)
33363389 {
3337
- 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;
33383399 break;
33393400 }
33403401 }
33413402
3342
- if (!hasRoot)
3403
+ if (canUngroup)
33433404 {
33443405 for (int i=0; i<group.selection.size(); i++)
33453406 {
3346
- Ungroup(group.selection.get(i));
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ Ungroup(selectedItem);
33473410 }
33483411
33493412 ClearSelection(false);
....@@ -3892,6 +3955,7 @@
38923955 } else
38933956 if (source == rootButton)
38943957 {
3958
+ Replace();
38953959 Object3D obj;
38963960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38973961 {
....@@ -3906,6 +3970,8 @@
39063970 if (source == closeButton)
39073971 {
39083972 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
+ Replace();
3974
+
39093975 cRadio ab;
39103976 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39113977 {
....@@ -4004,6 +4070,8 @@
40044070 } else
40054071 if(source instanceof cRadio)
40064072 {
4073
+ Replace();
4074
+
40074075 group.parent = keepparent;
40084076 group.attributes = 0;
40094077 //group.editWindow = null;
....@@ -4028,8 +4096,6 @@
40284096
40294097 copy = group;
40304098
4031
- SetUndoStates();
4032
-
40334099 //Globals.theRenderer.object = group;
40344100 if(!useclient)
40354101 {
....@@ -4057,6 +4123,29 @@
40574123 */
40584124 radio.layout.doClick();
40594125
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();
4148
+
40604149 ClearUnpinned();
40614150
40624151 //Grafreed.Assert(group != null);
....@@ -4200,7 +4289,7 @@
42004289 TouchTransform(obj);
42014290 continue;
42024291 }
4203
- if ((mask&2) != 0) // Scale
4292
+ if ((mask&2) != 0) // Scale/rotation
42044293 {
42054294 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42064295 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4208,10 +4297,6 @@
42084297 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42094298 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42104299 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4211
- }
4212
- if ((mask&4) != 0) // Rotation
4213
- {
4214
- // ?
42154300 }
42164301 if ((mask&1) != 0) // Translation
42174302 {
....@@ -5291,10 +5376,26 @@
52915376 flashSelectionButton.setEnabled(enabled);
52925377
52935378 clearPanelButton.setEnabled(!listUI.isEmpty());
5379
+
5380
+ boolean allComposites = true;
5381
+
5382
+ if (group.selection != null)
5383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5384
+ {
5385
+ Object next = e.nextElement();
5386
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5387
+ {
5388
+ allComposites = false;
5389
+ break;
5390
+ }
5391
+ }
5392
+
5393
+ rootButton.setEnabled(allComposites);
52945394 }
52955395
52965396 void refreshContents(boolean cp)
52975397 {
5398
+ if (Globals.ADVANCED)
52985399 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52995400 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53005401 {
....@@ -6188,11 +6289,11 @@
61886289 private MenuItem lookAtItem;
61896290 private MenuItem lookFromItem;
61906291 private MenuItem switchViewItem;
6191
- private MenuItem cutItem;
6292
+ private JMenuItem cutItem;
61926293 private MenuItem undoItem;
61936294 private MenuItem redoItem;
61946295 private JMenuItem duplicateItem;
6195
- private MenuItem cloneItem;
6296
+ private JMenuItem cloneItem;
61966297 private MenuItem cloneSupportItem;
61976298 private MenuItem overwriteGeoItem;
61986299 private MenuItem overwriteMatItem;
....@@ -6213,13 +6314,13 @@
62136314 private MenuItem cloneGeometriesItem;
62146315 private MenuItem shareGeometriesItem;
62156316 private MenuItem mergeGeometriesItem;
6216
- private MenuItem copyItem;
6317
+ private JMenuItem copyItem;
62176318 private MenuItem pasteItem;
6218
- private MenuItem pasteIntoItem;
6219
- private MenuItem pasteLinkItem;
6220
- private MenuItem pasteCloneItem;
6221
- private MenuItem pasteExpandItem;
6222
- private MenuItem deleteItem;
6319
+ private JMenuItem pasteIntoItem;
6320
+ private JMenuItem pasteLinkItem;
6321
+ private JMenuItem pasteCloneItem;
6322
+ private JMenuItem pasteExpandItem;
6323
+ private JMenuItem deleteItem;
62236324 private MenuItem clearAllItem;
62246325 private MenuItem genUVItem;
62256326 private MenuItem genNormalsMESHItem;
....@@ -6274,7 +6375,7 @@
62746375 private MenuItem transformGeometryItem;
62756376 private MenuItem transformChildrenItem;
62766377 private MenuItem hideItem;
6277
- private MenuItem grabItem;
6378
+ private JMenuItem grabItem;
62786379 private MenuItem backItem;
62796380 private MenuItem frontItem;
62806381 private MenuItem cameraItem;
....@@ -6287,7 +6388,7 @@
62876388 private MenuItem switchTransfoItem;
62886389 private MenuItem morphItem;
62896390 private MenuItem linkerItem;
6290
- private MenuItem ungroupItem;
6391
+ private JMenuItem ungroupItem;
62916392 private MenuItem editItem;
62926393 private MenuItem openWindowItem;
62936394 private MenuItem editLeafItem;