Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
GroupEditor.java
....@@ -29,9 +29,9 @@
2929 {
3030 cButton skyboxButton;
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
3636 {
3737 @Override
....@@ -46,7 +46,7 @@
4646 {
4747 cButton textureButton;
4848 final String path = "textures/" + f + "/" + c + "/"; // + t;
49
- row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF));
5050 textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
....@@ -73,7 +73,7 @@
7373 cGridBag row5 = new cGridBag();
7474 cGridBag row6 = new cGridBag();
7575
76
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
7777 //AddSkyboxButton("default", "cornell", row0);
7878 AddSkyboxButton("penguins", "dust", row0);
7979 AddSkyboxButton("penguins", "tropic", row0);
....@@ -330,15 +330,24 @@
330330
331331 public void ChangeSkybox(String skybox)
332332 {
333
- //cameraView.envyoff = false;
334
- group.skyboxname = skybox;
335
- group.skyboxext = "jpg";
336
- cameraView.repaint();
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
337346 }
338347
339348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
340349 {
341
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
342351
343352 AddSkyboxTab0(skyboxpane);
344353 AddSkyboxTab1(skyboxpane);
....@@ -406,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,8 +934,10 @@
911934
912935 JTabbedPane resourcecontainer;
913936 cGridBag currenttab;
914
- boolean added; // patch for jar
937
+ //boolean added; // patch for jar
915938
939
+ int totalcount = 0;
940
+
916941 int tabcount = 0;
917942 int colcount = 0;
918943 int rowcount = 0;
....@@ -928,28 +953,30 @@
928953 // System.out.println();
929954
930955 if (//rowcount == 0 ||
931
- path.length == 1)
956
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
932957 {
933958 currenttab = new cGridBag();
934
- added = false;
935959 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
936960 currenttab.setName(tabname);
961
+ //added = false;
962
+ resourcecontainer.add(currenttab);
963
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
937964 rowcount = 1;
938965 colcount = 0;
939966 texturecount = 0;
940967 }
941968
942
- if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
969
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
943970 {
944
- if (!added)
971
+ //if (!added)
945972 {
946
- added = true;
947
- resourcecontainer.add(currenttab);
973
+ //added = true;
948974 String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
949
- resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
975
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
950976 }
951977
952
- AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
978
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
979
+ totalcount++;
953980
954981 if (++colcount >= columns)
955982 {
....@@ -975,6 +1002,8 @@
9751002 container.add(resourcecontainer);
9761003
9771004 Grafreed.ParseResources("textures", this);
1005
+
1006
+ // 935. System.out.println("Total = " + totalcount);
9781007 }
9791008
9801009 void SetupUI2(ObjEditor oe)
....@@ -1014,9 +1043,9 @@
10141043 oe.radioPanel.add(dummyButton);
10151044 oe.buttonGroup.add(dummyButton);
10161045 */
1017
- cGridBag copyOptionsPanel = new cGridBag();
1046
+ cGridBag versionManagerPanel = new cGridBag();
10181047
1019
- copyOptionsPanel.preferredHeight = 2;
1048
+ versionManagerPanel.preferredHeight = 4;
10201049
10211050 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
10221051
....@@ -1026,42 +1055,42 @@
10261055
10271056 if (Globals.ADVANCED)
10281057 {
1029
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
- maxButton.setToolTipText("Maximize window");
1031
- maxButton.addActionListener(this);
1058
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
+// maxButton.setToolTipText("Maximize window");
1060
+// maxButton.addActionListener(this);
10321061 }
10331062
10341063 cButton gcButton;
10351064
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
- });
1065
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1066
+// gcButton.setToolTipText("Garbage collect");
1067
+// gcButton.addActionListener(new ActionListener()
1068
+// {
1069
+// public void actionPerformed(ActionEvent e)
1070
+// {
1071
+// System.gc();
1072
+// }
1073
+// });
10451074
1046
- oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10471076 collapseButton.setToolTipText("Collapse toolbar");
10481077 collapseButton.addActionListener(this);
10491078
1050
- oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1079
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10511080 maximize3DButton.setToolTipText("Maximize 3D view");
10521081 maximize3DButton.addActionListener(this);
10531082
1054
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10551084 twoButton.setToolTipText("Show 3D view only");
10561085 twoButton.addActionListener(this);
10571086 this.fullscreenLayout = twoButton;
10581087
1059
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10601089 threeButton.setToolTipText("Show controls and 3D view");
10611090 threeButton.addActionListener(this);
10621091 if (Globals.ADVANCED)
10631092 {
1064
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10651094 sixButton.setToolTipText("Show 3D view and controls");
10661095 sixButton.addActionListener(this);
10671096 }
....@@ -1070,50 +1099,51 @@
10701099 // sevenButton.addActionListener(this);
10711100 //
10721101
1073
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10741103 fullButton.setToolTipText("Full-screen window");
10751104 fullButton.addActionListener(this);
10761105
1077
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10781107 screenfitButton.setToolTipText("Screen fit");
10791108 screenfitButton.addActionListener(this);
10801109
1081
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1110
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10821111 restoreCameraButton.setToolTipText("Restore viewpoint");
10831112 restoreCameraButton.addActionListener(this);
10841113
1085
- copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1114
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10861115 saveVersionButton.setToolTipText("Duplicate current version");
10871116 saveVersionButton.addActionListener(this);
10881117
1089
- copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10901119 deleteVersionButton.setToolTipText("Delete current version");
10911120 deleteVersionButton.addActionListener(this);
1121
+ deleteVersionButton.setEnabled(false);
10921122
1093
- copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10941124 previousVersionButton.setToolTipText("Previous version");
10951125 previousVersionButton.addActionListener(this);
10961126 previousVersionButton.setEnabled(false);
10971127
10981128 cGridBag updown = new cGridBag().setVertical(true);
1099
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11001130 restoreButton.setToolTipText("Undo (restore current version)");
11011131 restoreButton.addActionListener(this);
1102
- //restoreButton.setEnabled(false);
1132
+ restoreButton.setEnabled(false);
11031133
1104
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11051135 replaceButton.setToolTipText("Save (replace current version)");
11061136 replaceButton.addActionListener(this);
1107
- //replaceButton.setEnabled(false);
1137
+ replaceButton.setEnabled(false);
11081138
1109
- copyOptionsPanel.add(updown);
1139
+ versionManagerPanel.add(updown);
11101140
1111
- copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1141
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11121142 nextVersionButton.setToolTipText("Next version");
11131143 nextVersionButton.addActionListener(this);
11141144 nextVersionButton.setEnabled(false);
11151145
1116
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1146
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11171147 oneStepButton.setToolTipText("Animate one step forward");
11181148 oneStepButton.addActionListener(this);
11191149
....@@ -1136,11 +1166,11 @@
11361166
11371167 if (Globals.ADVANCED)
11381168 {
1139
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1169
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11401170 snapobjectButton.addActionListener(this);
11411171 snapobjectButton.setToolTipText("Snap Object");
11421172
1143
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1173
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11441174 fourButton.addActionListener(this);
11451175 fourButton.setToolTipText("Show control panel only");
11461176 }
....@@ -1148,11 +1178,11 @@
11481178 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
11491179
11501180
1151
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1181
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11521182 rootButton.setToolTipText("Open selection in new tab");
11531183 rootButton.addActionListener(this);
11541184
1155
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11561186 closeButton.setToolTipText("Close tab");
11571187 closeButton.addActionListener(this);
11581188 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -1161,38 +1191,38 @@
11611191 cGridBag row1 = new cGridBag();
11621192
11631193 // INSERT
1164
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1165
- gridButton.setToolTipText("Create grid");
1194
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1195
+ gridButton.setToolTipText("Create ground");
11661196 gridButton.addActionListener(this);
11671197
1168
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11691199 boxButton.setToolTipText("Create box");
11701200 boxButton.addActionListener(this);
11711201
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);
1202
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11851203 superButton.setToolTipText("Create superellipsoid");
11861204 superButton.addActionListener(this);
11871205
1206
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ sphereButton.setToolTipText("Create sphere");
1208
+ sphereButton.addActionListener(this);
1209
+
1210
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1211
+ coneButton.setToolTipText("Create cone");
1212
+ coneButton.addActionListener(this);
1213
+
1214
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1215
+ torusButton.setToolTipText("Create torus");
1216
+ torusButton.addActionListener(this);
1217
+
11881218 if (Globals.ADVANCED)
11891219 {
1190
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11911221 kleinButton.setToolTipText("Create Klein bottle");
11921222 kleinButton.addActionListener(this);
11931223 }
11941224
1195
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1225
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11961226 particlesButton.setToolTipText("Create particle system");
11971227 particlesButton.addActionListener(this);
11981228
....@@ -1200,31 +1230,31 @@
12001230
12011231 cGridBag row2 = new cGridBag();
12021232
1203
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1233
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12041234 groupButton.setToolTipText("Create group");
12051235 groupButton.addActionListener(this);
12061236
1207
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12081238 compositeButton.setToolTipText("Create composite");
12091239 compositeButton.addActionListener(this);
12101240
1211
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1241
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12121242 switchButton.setToolTipText("Create item switcher");
12131243 switchButton.addActionListener(this);
12141244
1215
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1245
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12161246 loopButton.setToolTipText("Create loop");
12171247 loopButton.addActionListener(this);
12181248
1219
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1249
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12201250 textureButton.setToolTipText("Create texture");
12211251 textureButton.addActionListener(this);
12221252
1223
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1253
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12241254 overlayButton.setToolTipText("Create overlay");
12251255 overlayButton.addActionListener(this);
12261256
1227
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1257
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12281258 lightButton.setToolTipText("Create light");
12291259 lightButton.addActionListener(this);
12301260
....@@ -1234,6 +1264,11 @@
12341264
12351265 CreateTexturePanel(textures);
12361266
1267
+ int tabCount = resourcecontainer.getTabCount();
1268
+
1269
+ if (tabCount > 0)
1270
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1271
+
12371272 oe.toolboxPanel.add(textures);
12381273
12391274 textures.preferredHeight = 100;
....@@ -1241,11 +1276,11 @@
12411276 CreateSkyboxPanel(oe.skyboxPanel);
12421277
12431278 // EDIT panel
1244
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1279
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12451280 editButton.setToolTipText("Pin selection controls");
12461281 editButton.addActionListener(this);
12471282
1248
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12491284 uneditButton.setToolTipText("Unpin and remove selection controls");
12501285 uneditButton.addActionListener(this);
12511286
....@@ -1253,7 +1288,7 @@
12531288 allParamsButton.setToolTipText("Show all controls");
12541289 allParamsButton.addActionListener(this);
12551290
1256
- editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12571292 clearPanelButton.setToolTipText("Clear all controls");
12581293 clearPanelButton.addActionListener(this);
12591294
....@@ -1261,7 +1296,7 @@
12611296 //unselectButton.setToolTipText("Unselect");
12621297 //unselectButton.addActionListener(this);
12631298
1264
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1299
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
12651300 flashSelectionButton.setToolTipText("Highlight selection");
12661301 flashSelectionButton.addActionListener(this);
12671302
....@@ -1284,6 +1319,8 @@
12841319
12851320 cGridBag jSPPanel = new cGridBag();
12861321
1322
+ jSPPanel.preferredHeight = 20;
1323
+
12871324 JScrollPane jSP;
12881325 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
12891326 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1292,11 +1329,11 @@
12921329 oe.treePanel.add(jSPPanel);
12931330 oe.treePanel.Return();
12941331
1295
- oe.treePanel.add(copyOptionsPanel);
1332
+ oe.treePanel.add(versionManagerPanel);
12961333 oe.treePanel.Return();
1297
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1298
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1299
- sliderPane.preferredHeight = 1;
1334
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1335
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1336
+ versionSliderPane.preferredHeight = 3;
13001337
13011338 // mainPanel.setDividerLocation(0.1); //1.0);
13021339 mainPanel.setResizeWeight(0.4);
....@@ -1454,6 +1491,14 @@
14541491
14551492 void EditObject(Object3D obj)
14561493 {
1494
+ assert(obj instanceof Composite);
1495
+
1496
+// if (obj.versionlist == null)
1497
+// {
1498
+// obj.versionlist = new Object3D[100];
1499
+// obj.versionindex = -1;
1500
+// }
1501
+
14571502 cRadio radioButton = new cRadio(obj.name);
14581503
14591504 // June 2019. Patch to avoid bug with transparency.
....@@ -1478,6 +1523,7 @@
14781523
14791524 oe.SetupViews();
14801525
1526
+ if (Globals.DEBUG)
14811527 System.out.println("SetupViews");
14821528 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
14831529 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -2139,7 +2185,11 @@
21392185 shadow.material = new cMaterial(obj.material);
21402186 shadow.material.diffuse = 0.0001f;
21412187 shadow.material.specular = 0.0001f;
2142
- //shadow.projectedVertices[1].x = 300;
2188
+ shadow.material.opacity = 0.75f;
2189
+
2190
+ AllocProjectedVertices(shadow);
2191
+
2192
+ shadow.projectedVertices[1].x = 300;
21432193
21442194 makeSomething(shadow);
21452195 }
....@@ -2660,27 +2710,35 @@
26602710 } else
26612711 if (source == loopItem || source == loopButton)
26622712 {
2713
+ if (!group.selection.isEmpty())
2714
+ {
26632715 Composite csg = new GroupLeaf();
26642716 csg.count = 5;
2665
- group(csg);
26662717 Composite child = new cGroup("Branch");
26672718 csg.addChild(child);
26682719 child.addChild(csg);
2720
+ group(csg);
2721
+ }
26692722 } else
26702723 if (source == doubleItem)
26712724 {
2725
+ if (!group.selection.isEmpty())
2726
+ {
26722727 Composite csg = new GroupLeaf("Fork");
26732728 csg.count = 5;
2674
- group(csg);
26752729 Composite child = new cGroup("Branch A");
26762730 csg.addChild(child);
26772731 child.addChild(csg);
26782732 child = new cGroup("Branch B");
26792733 csg.addChild(child);
26802734 child.addChild(csg);
2735
+ group(csg);
2736
+ }
26812737 } else
26822738 if (source == tripleItem)
26832739 {
2740
+ if (!group.selection.isEmpty())
2741
+ {
26842742 Composite csg = new GroupLeaf("Trident");
26852743 csg.count = 4;
26862744 group(csg);
....@@ -2693,6 +2751,7 @@
26932751 child = new cGroup();
26942752 csg.addChild(child);
26952753 child.addChild(csg);
2754
+ }
26962755 } else
26972756 if (source == computeAOItem)
26982757 {
....@@ -3328,22 +3387,34 @@
33283387 } else
33293388 if (source == ungroupItem || source == ungroupButton)
33303389 {
3331
- boolean hasRoot = false;
3390
+ boolean canUngroup = true;
33323391
33333392 for (int i=0; i<group.selection.size(); i++)
33343393 {
3335
- if (group.selection.get(i) == group)
3394
+ Object3D selectedItem = group.selection.get(i);
3395
+
3396
+ if (selectedItem.Size() == 0)
33363397 {
3337
- hasRoot = true;
3398
+ // Cannot ungroup leaves
3399
+ canUngroup = false;
3400
+ break;
3401
+ }
3402
+
3403
+ if (selectedItem == group)
3404
+ {
3405
+ // Cannot ungroup root
3406
+ canUngroup = false;
33383407 break;
33393408 }
33403409 }
33413410
3342
- if (!hasRoot)
3411
+ if (canUngroup)
33433412 {
33443413 for (int i=0; i<group.selection.size(); i++)
33453414 {
3346
- Ungroup(group.selection.get(i));
3415
+ Object3D selectedItem = group.selection.get(i);
3416
+
3417
+ Ungroup(selectedItem);
33473418 }
33483419
33493420 ClearSelection(false);
....@@ -3892,6 +3963,7 @@
38923963 } else
38933964 if (source == rootButton)
38943965 {
3966
+ Replace();
38953967 Object3D obj;
38963968 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
38973969 {
....@@ -3906,6 +3978,8 @@
39063978 if (source == closeButton)
39073979 {
39083980 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3981
+ Replace();
3982
+
39093983 cRadio ab;
39103984 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
39113985 {
....@@ -4004,6 +4078,8 @@
40044078 } else
40054079 if(source instanceof cRadio)
40064080 {
4081
+ Replace();
4082
+
40074083 group.parent = keepparent;
40084084 group.attributes = 0;
40094085 //group.editWindow = null;
....@@ -4028,8 +4104,6 @@
40284104
40294105 copy = group;
40304106
4031
- SetUndoStates();
4032
-
40334107 //Globals.theRenderer.object = group;
40344108 if(!useclient)
40354109 {
....@@ -4057,6 +4131,29 @@
40574131 */
40584132 radio.layout.doClick();
40594133
4134
+ assert(copy instanceof Composite);
4135
+
4136
+ if (copy.versionlist == null)
4137
+ {
4138
+ copy.versionindex = -1;
4139
+
4140
+ // Cannot work with loops
4141
+ // To fix this issue, we first mark all nodes above the root,
4142
+ // and check if any of these nodes are reachable below the root.
4143
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4144
+
4145
+ if (!copy.HasTags())
4146
+ {
4147
+ copy.versionlist = new Object3D[100];
4148
+
4149
+ Save(true);
4150
+ }
4151
+
4152
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4153
+ }
4154
+
4155
+ SetVersionStates();
4156
+
40604157 ClearUnpinned();
40614158
40624159 //Grafreed.Assert(group != null);
....@@ -4200,7 +4297,7 @@
42004297 TouchTransform(obj);
42014298 continue;
42024299 }
4203
- if ((mask&2) != 0) // Scale
4300
+ if ((mask&2) != 0) // Scale/rotation
42044301 {
42054302 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
42064303 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4208,10 +4305,6 @@
42084305 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
42094306 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
42104307 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4211
- }
4212
- if ((mask&4) != 0) // Rotation
4213
- {
4214
- // ?
42154308 }
42164309 if ((mask&1) != 0) // Translation
42174310 {
....@@ -5291,10 +5384,26 @@
52915384 flashSelectionButton.setEnabled(enabled);
52925385
52935386 clearPanelButton.setEnabled(!listUI.isEmpty());
5387
+
5388
+ boolean allComposites = true;
5389
+
5390
+ if (group.selection != null)
5391
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5392
+ {
5393
+ Object next = e.nextElement();
5394
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5395
+ {
5396
+ allComposites = false;
5397
+ break;
5398
+ }
5399
+ }
5400
+
5401
+ rootButton.setEnabled(allComposites);
52945402 }
52955403
52965404 void refreshContents(boolean cp)
52975405 {
5406
+ if (Globals.ADVANCED)
52985407 //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
52995408 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
53005409 {
....@@ -6188,11 +6297,11 @@
61886297 private MenuItem lookAtItem;
61896298 private MenuItem lookFromItem;
61906299 private MenuItem switchViewItem;
6191
- private MenuItem cutItem;
6300
+ private JMenuItem cutItem;
61926301 private MenuItem undoItem;
61936302 private MenuItem redoItem;
61946303 private JMenuItem duplicateItem;
6195
- private MenuItem cloneItem;
6304
+ private JMenuItem cloneItem;
61966305 private MenuItem cloneSupportItem;
61976306 private MenuItem overwriteGeoItem;
61986307 private MenuItem overwriteMatItem;
....@@ -6213,13 +6322,13 @@
62136322 private MenuItem cloneGeometriesItem;
62146323 private MenuItem shareGeometriesItem;
62156324 private MenuItem mergeGeometriesItem;
6216
- private MenuItem copyItem;
6325
+ private JMenuItem copyItem;
62176326 private MenuItem pasteItem;
6218
- private MenuItem pasteIntoItem;
6219
- private MenuItem pasteLinkItem;
6220
- private MenuItem pasteCloneItem;
6221
- private MenuItem pasteExpandItem;
6222
- private MenuItem deleteItem;
6327
+ private JMenuItem pasteIntoItem;
6328
+ private JMenuItem pasteLinkItem;
6329
+ private JMenuItem pasteCloneItem;
6330
+ private JMenuItem pasteExpandItem;
6331
+ private JMenuItem deleteItem;
62236332 private MenuItem clearAllItem;
62246333 private MenuItem genUVItem;
62256334 private MenuItem genNormalsMESHItem;
....@@ -6274,7 +6383,7 @@
62746383 private MenuItem transformGeometryItem;
62756384 private MenuItem transformChildrenItem;
62766385 private MenuItem hideItem;
6277
- private MenuItem grabItem;
6386
+ private JMenuItem grabItem;
62786387 private MenuItem backItem;
62796388 private MenuItem frontItem;
62806389 private MenuItem cameraItem;
....@@ -6287,7 +6396,7 @@
62876396 private MenuItem switchTransfoItem;
62886397 private MenuItem morphItem;
62896398 private MenuItem linkerItem;
6290
- private MenuItem ungroupItem;
6399
+ private JMenuItem ungroupItem;
62916400 private MenuItem editItem;
62926401 private MenuItem openWindowItem;
62936402 private MenuItem editLeafItem;