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,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,28 +951,29 @@
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;
940965 }
941966
942
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
967
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
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
952
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
976
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
953977
954978 if (++colcount >= columns)
955979 {
....@@ -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,11 @@
12341259
12351260 CreateTexturePanel(textures);
12361261
1262
+ int tabCount = resourcecontainer.getTabCount();
1263
+
1264
+ if (tabCount > 0)
1265
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1266
+
12371267 oe.toolboxPanel.add(textures);
12381268
12391269 textures.preferredHeight = 100;
....@@ -1241,11 +1271,11 @@
12411271 CreateSkyboxPanel(oe.skyboxPanel);
12421272
12431273 // EDIT panel
1244
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1274
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451275 editButton.setToolTipText("Pin selection controls");
12461276 editButton.addActionListener(this);
12471277
1248
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491279 uneditButton.setToolTipText("Unpin and remove selection controls");
12501280 uneditButton.addActionListener(this);
12511281
....@@ -1253,7 +1283,7 @@
12531283 allParamsButton.setToolTipText("Show all controls");
12541284 allParamsButton.addActionListener(this);
12551285
1256
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1286
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571287 clearPanelButton.setToolTipText("Clear all controls");
12581288 clearPanelButton.addActionListener(this);
12591289
....@@ -1261,7 +1291,7 @@
12611291 //unselectButton.setToolTipText("Unselect");
12621292 //unselectButton.addActionListener(this);
12631293
1264
- 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);
12651295 flashSelectionButton.setToolTipText("Highlight selection");
12661296 flashSelectionButton.addActionListener(this);
12671297
....@@ -1284,6 +1314,8 @@
12841314
12851315 cGridBag jSPPanel = new cGridBag();
12861316
1317
+ jSPPanel.preferredHeight = 20;
1318
+
12871319 JScrollPane jSP;
12881320 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12891321 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1292,11 +1324,11 @@
12921324 oe.treePanel.add(jSPPanel);
12931325 oe.treePanel.Return();
12941326
1295
- oe.treePanel.add(copyOptionsPanel);
1327
+ oe.treePanel.add(versionManagerPanel);
12961328 oe.treePanel.Return();
1297
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1298
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1299
- sliderPane.preferredHeight = 1;
1329
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1330
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1331
+ versionSliderPane.preferredHeight = 3;
13001332
13011333 // mainPanel.setDividerLocation(0.1); //1.0);
13021334 mainPanel.setResizeWeight(0.4);
....@@ -1454,6 +1486,14 @@
14541486
14551487 void EditObject(Object3D obj)
14561488 {
1489
+ assert(obj instanceof Composite);
1490
+
1491
+// if (obj.versionlist == null)
1492
+// {
1493
+// obj.versionlist = new Object3D[100];
1494
+// obj.versionindex = -1;
1495
+// }
1496
+
14571497 cRadio radioButton = new cRadio(obj.name);
14581498
14591499 // June 2019. Patch to avoid bug with transparency.
....@@ -1478,6 +1518,7 @@
14781518
14791519 oe.SetupViews();
14801520
1521
+ if (Globals.DEBUG)
14811522 System.out.println("SetupViews");
14821523 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14831524 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2139,7 +2180,11 @@
21392180 shadow.material = new cMaterial(obj.material);
21402181 shadow.material.diffuse = 0.0001f;
21412182 shadow.material.specular = 0.0001f;
2142
- //shadow.projectedVertices[1].x = 300;
2183
+ shadow.material.opacity = 0.75f;
2184
+
2185
+ AllocProjectedVertices(shadow);
2186
+
2187
+ shadow.projectedVertices[1].x = 300;
21432188
21442189 makeSomething(shadow);
21452190 }
....@@ -2660,27 +2705,35 @@
26602705 } else
26612706 if (source == loopItem || source == loopButton)
26622707 {
2708
+ if (!group.selection.isEmpty())
2709
+ {
26632710 Composite csg = new GroupLeaf();
26642711 csg.count = 5;
2665
- group(csg);
26662712 Composite child = new cGroup("Branch");
26672713 csg.addChild(child);
26682714 child.addChild(csg);
2715
+ group(csg);
2716
+ }
26692717 } else
26702718 if (source == doubleItem)
26712719 {
2720
+ if (!group.selection.isEmpty())
2721
+ {
26722722 Composite csg = new GroupLeaf("Fork");
26732723 csg.count = 5;
2674
- group(csg);
26752724 Composite child = new cGroup("Branch A");
26762725 csg.addChild(child);
26772726 child.addChild(csg);
26782727 child = new cGroup("Branch B");
26792728 csg.addChild(child);
26802729 child.addChild(csg);
2730
+ group(csg);
2731
+ }
26812732 } else
26822733 if (source == tripleItem)
26832734 {
2735
+ if (!group.selection.isEmpty())
2736
+ {
26842737 Composite csg = new GroupLeaf("Trident");
26852738 csg.count = 4;
26862739 group(csg);
....@@ -2693,6 +2746,7 @@
26932746 child = new cGroup();
26942747 csg.addChild(child);
26952748 child.addChild(csg);
2749
+ }
26962750 } else
26972751 if (source == computeAOItem)
26982752 {
....@@ -3328,22 +3382,34 @@
33283382 } else
33293383 if (source == ungroupItem || source == ungroupButton)
33303384 {
3331
- boolean hasRoot = false;
3385
+ boolean canUngroup = true;
33323386
33333387 for (int i=0; i<group.selection.size(); i++)
33343388 {
3335
- if (group.selection.get(i) == group)
3389
+ Object3D selectedItem = group.selection.get(i);
3390
+
3391
+ if (selectedItem.Size() == 0)
33363392 {
3337
- 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;
33383402 break;
33393403 }
33403404 }
33413405
3342
- if (!hasRoot)
3406
+ if (canUngroup)
33433407 {
33443408 for (int i=0; i<group.selection.size(); i++)
33453409 {
3346
- Ungroup(group.selection.get(i));
3410
+ Object3D selectedItem = group.selection.get(i);
3411
+
3412
+ Ungroup(selectedItem);
33473413 }
33483414
33493415 ClearSelection(false);
....@@ -3892,6 +3958,7 @@
38923958 } else
38933959 if (source == rootButton)
38943960 {
3961
+ Replace();
38953962 Object3D obj;
38963963 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38973964 {
....@@ -3906,6 +3973,8 @@
39063973 if (source == closeButton)
39073974 {
39083975 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3976
+ Replace();
3977
+
39093978 cRadio ab;
39103979 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39113980 {
....@@ -4004,6 +4073,8 @@
40044073 } else
40054074 if(source instanceof cRadio)
40064075 {
4076
+ Replace();
4077
+
40074078 group.parent = keepparent;
40084079 group.attributes = 0;
40094080 //group.editWindow = null;
....@@ -4028,8 +4099,6 @@
40284099
40294100 copy = group;
40304101
4031
- SetUndoStates();
4032
-
40334102 //Globals.theRenderer.object = group;
40344103 if(!useclient)
40354104 {
....@@ -4057,6 +4126,29 @@
40574126 */
40584127 radio.layout.doClick();
40594128
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();
4151
+
40604152 ClearUnpinned();
40614153
40624154 //Grafreed.Assert(group != null);
....@@ -4200,7 +4292,7 @@
42004292 TouchTransform(obj);
42014293 continue;
42024294 }
4203
- if ((mask&2) != 0) // Scale
4295
+ if ((mask&2) != 0) // Scale/rotation
42044296 {
42054297 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42064298 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4208,10 +4300,6 @@
42084300 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42094301 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42104302 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4211
- }
4212
- if ((mask&4) != 0) // Rotation
4213
- {
4214
- // ?
42154303 }
42164304 if ((mask&1) != 0) // Translation
42174305 {
....@@ -5291,10 +5379,26 @@
52915379 flashSelectionButton.setEnabled(enabled);
52925380
52935381 clearPanelButton.setEnabled(!listUI.isEmpty());
5382
+
5383
+ boolean allComposites = true;
5384
+
5385
+ if (group.selection != null)
5386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5387
+ {
5388
+ Object next = e.nextElement();
5389
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5390
+ {
5391
+ allComposites = false;
5392
+ break;
5393
+ }
5394
+ }
5395
+
5396
+ rootButton.setEnabled(allComposites);
52945397 }
52955398
52965399 void refreshContents(boolean cp)
52975400 {
5401
+ if (Globals.ADVANCED)
52985402 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52995403 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53005404 {
....@@ -6188,11 +6292,11 @@
61886292 private MenuItem lookAtItem;
61896293 private MenuItem lookFromItem;
61906294 private MenuItem switchViewItem;
6191
- private MenuItem cutItem;
6295
+ private JMenuItem cutItem;
61926296 private MenuItem undoItem;
61936297 private MenuItem redoItem;
61946298 private JMenuItem duplicateItem;
6195
- private MenuItem cloneItem;
6299
+ private JMenuItem cloneItem;
61966300 private MenuItem cloneSupportItem;
61976301 private MenuItem overwriteGeoItem;
61986302 private MenuItem overwriteMatItem;
....@@ -6213,13 +6317,13 @@
62136317 private MenuItem cloneGeometriesItem;
62146318 private MenuItem shareGeometriesItem;
62156319 private MenuItem mergeGeometriesItem;
6216
- private MenuItem copyItem;
6320
+ private JMenuItem copyItem;
62176321 private MenuItem pasteItem;
6218
- private MenuItem pasteIntoItem;
6219
- private MenuItem pasteLinkItem;
6220
- private MenuItem pasteCloneItem;
6221
- private MenuItem pasteExpandItem;
6222
- private MenuItem deleteItem;
6322
+ private JMenuItem pasteIntoItem;
6323
+ private JMenuItem pasteLinkItem;
6324
+ private JMenuItem pasteCloneItem;
6325
+ private JMenuItem pasteExpandItem;
6326
+ private JMenuItem deleteItem;
62236327 private MenuItem clearAllItem;
62246328 private MenuItem genUVItem;
62256329 private MenuItem genNormalsMESHItem;
....@@ -6274,7 +6378,7 @@
62746378 private MenuItem transformGeometryItem;
62756379 private MenuItem transformChildrenItem;
62766380 private MenuItem hideItem;
6277
- private MenuItem grabItem;
6381
+ private JMenuItem grabItem;
62786382 private MenuItem backItem;
62796383 private MenuItem frontItem;
62806384 private MenuItem cameraItem;
....@@ -6287,7 +6391,7 @@
62876391 private MenuItem switchTransfoItem;
62886392 private MenuItem morphItem;
62896393 private MenuItem linkerItem;
6290
- private MenuItem ungroupItem;
6394
+ private JMenuItem ungroupItem;
62916395 private MenuItem editItem;
62926396 private MenuItem openWindowItem;
62936397 private MenuItem editLeafItem;