Normand Briere
2019-08-12 8f1afe25ea8fc8801aab66331c32a50859a758c2
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -41,6 +42,22 @@
4142 });
4243 }
4344
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
4461 public void AddSkyboxTab0(JTabbedPane skyboxpanel)
4562 {
4663 cGridBag tab0 = new cGridBag().setVertical(true);
....@@ -60,7 +77,7 @@
6077 //AddSkyboxButton("default", "cornell", row0);
6178 AddSkyboxButton("penguins", "dust", row0);
6279 AddSkyboxButton("penguins", "tropic", row0);
63
- AddSkyboxButton("default", "skycube", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
6481
6582 AddSkyboxButton("default", "uffizi", row1);
6683 AddSkyboxButton("bridge", "Bridge", row1);
....@@ -90,7 +107,7 @@
90107 AddSkyboxButton("park", "Skansen3", row6);
91108 AddSkyboxButton("park", "Skansen4", row6);
92109 AddSkyboxButton("park", "Skansen5", row6);
93
- AddSkyboxButton("park", "Stairs", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94111
95112 tab0.add(row0);
96113 tab0.add(row1);
....@@ -144,21 +161,18 @@
144161
145162 AddSkyboxButton("mountain", "Maskonaive2", row4);
146163 AddSkyboxButton("mountain", "Maskonaive3", row4);
147
- AddSkyboxButton("mountain", "Ryfjallet", row4);
148164 AddSkyboxButton("mountain", "Teide", row4);
149165 AddSkyboxButton("park", "Tantolunden4", row4);
150166
151
- AddSkyboxButton("penguins", "wrath", row5);
152
- AddSkyboxButton("penguins", "yonder", row5);
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
153169 AddSkyboxButton("rocky", "Langholmen", row5);
154170 AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
- AddSkyboxButton("rocky", "Tantolunden6", row5);
156171
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
157173 AddSkyboxButton("default", "CloudyHills", row6);
158174 AddSkyboxButton("daz", "Autumn", row6);
159
- AddSkyboxButton("daz", "Greenlands", row6);
160175 AddSkyboxButton("daz", "MountainTrail", row6);
161
- AddSkyboxButton("daz", "Oasis", row6);
162176 /*
163177 Autumn
164178 Greenlands
....@@ -210,8 +224,8 @@
210224 AddSkyboxButton("penguins", "sleepyhollow", row1);
211225
212226 AddSkyboxButton("penguins", "kenon_star", row2);
213
- AddSkyboxButton("indoors", "DallasW", row2);
214
- AddSkyboxButton("indoors", "MarriottMadisonWest", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
215229 AddSkyboxButton("indoors", "Vasa", row2);
216230
217231 AddSkyboxButton("winter", "Backyard", row3);
....@@ -232,7 +246,7 @@
232246 AddSkyboxButton("daz", "TheRock", row6);
233247 AddSkyboxButton("daz", "TopOfTheWorld", row6);
234248 AddSkyboxButton("daz", "Winter", row6);
235
- AddSkyboxButton("penguins", "desertdawn", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
236250
237251 tab0.add(row0);
238252 tab0.add(row1);
....@@ -248,15 +262,113 @@
248262 //tab0.add(new cGridBag());
249263 }
250264 }
251
-
252
- public void ChangeSkybox(String name)
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
253267 {
254
- cameraView.envyoff = false;
255
- cameraView.skyboxname = name;
256
- cameraView.skyboxext = "jpg";
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
257336 cameraView.repaint();
258337 }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
259350
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ for (int i=0; i<group.selection.size(); i++)
354
+ {
355
+ Object3D obj = group.selection.get(i);
356
+ obj.SetPigmentTexture("@" + texture);
357
+ }
358
+
359
+ refreshContents();
360
+ }
361
+
362
+ public void Show3DView()
363
+ {
364
+ // bug
365
+ //gridPanel.setDividerLocation(1.0);
366
+ //bigPanel.setDividerLocation(0.0);
367
+ bigThree.ClearUI();
368
+ bigThree.add(centralPanel);
369
+ bigThree.FlushUI();
370
+ }
371
+
260372 //ObjEditor objEditor;
261373 public void closeUI2()
262374 {
....@@ -294,10 +406,12 @@
294406 this.copy = this.group = group;
295407 //selectees = this.group.selectees;
296408
297
- if (copy.versions == null)
409
+ if (copy.versionlist == null)
298410 {
299
- copy.versions = new byte[100][];
411
+ copy.versionlist = new Object3D[100];
300412 copy.versionindex = -1;
413
+
414
+ Save(true);
301415 }
302416
303417 if(ui)
....@@ -321,9 +435,9 @@
321435
322436 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
323437
324
- if (copy.versions == null)
438
+ if (copy.versionlist == null)
325439 {
326
- copy.versions = new byte[100][];
440
+ copy.versionlist = new Object3D[100];
327441 copy.versionindex = -1;
328442
329443 Save(true);
....@@ -529,11 +643,9 @@
529643 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
530644 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
531645 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
532
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
533646 oe.cameraMenu.add("-");
534647 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
535648 openWindowItem.addActionListener(this);
536
- editLeafItem.addActionListener(this);
537649 lookAtItem.addActionListener(this);
538650 //lookFromItem.addActinoListener(this);
539651 //switchViewItem.addActionListener(this);
....@@ -781,6 +893,9 @@
781893 shareGeometriesItem.addActionListener(this);
782894 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
783895 mergeGeometriesItem.addActionListener(this);
896
+ menu.add("-");
897
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
898
+ editLeafItem.addActionListener(this);
784899 if (Globals.ADVANCED)
785900 {
786901 // Pretty much the same as duplicate and clone.
....@@ -797,6 +912,73 @@
797912 buildToolsMenu(menu);
798913 }
799914
915
+ JTabbedPane resourcecontainer;
916
+ cGridBag currenttab;
917
+ boolean added; // patch for jar
918
+
919
+ int tabcount = 0;
920
+ int colcount = 0;
921
+ int rowcount = 0;
922
+ int texturecount = 0;
923
+
924
+ int columns = 5;
925
+ int rows = 7;
926
+
927
+ public void ResourceCallBack(String[] path)
928
+ {
929
+// for (int i = 0; i < path.length; i++)
930
+// System.out.print(path[i] + "/");
931
+// System.out.println();
932
+
933
+ if (//rowcount == 0 ||
934
+ path.length == 1)
935
+ {
936
+ currenttab = new cGridBag();
937
+ added = false;
938
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
+ currenttab.setName(tabname);
940
+ rowcount = 1;
941
+ colcount = 0;
942
+ texturecount = 0;
943
+ }
944
+
945
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
946
+ {
947
+ if (!added)
948
+ {
949
+ added = true;
950
+ resourcecontainer.add(currenttab);
951
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
953
+ }
954
+
955
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
956
+
957
+ if (++colcount >= columns)
958
+ {
959
+ colcount = 0;
960
+ currenttab.Return();
961
+
962
+ if (rowcount++ >= rows)
963
+ {
964
+ rowcount = 0;
965
+ }
966
+ }
967
+ }
968
+ else
969
+ {
970
+// if (!path[path.length-1].equals("icons"))
971
+// resourcecontainer.Return();
972
+ }
973
+ }
974
+
975
+ void CreateTexturePanel(cGridBag container)
976
+ {
977
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
978
+ container.add(resourcecontainer);
979
+
980
+ Grafreed.ParseResources("textures", this);
981
+ }
800982
801983 void SetupUI2(ObjEditor oe)
802984 {
....@@ -815,11 +997,6 @@
815997 //new Exception().printStackTrace();
816998
817999 oe.radioPanel = new JPanel(new GridBagLayout());
818
- oe.aConstraints.weightx = 1;
819
- oe.aConstraints.weighty = 0;
820
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
821
- oe.aConstraints.gridwidth = 100;
822
- oe.aConstraints.gridheight = 1;
8231000 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8241001
8251002 oe.buttonGroup = new ButtonGroup();
....@@ -852,10 +1029,49 @@
8521029
8531030 if (Globals.ADVANCED)
8541031 {
855
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
856
- maxButton.setToolTipText("Maximize window");
857
- maxButton.addActionListener(this);
1032
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+// maxButton.setToolTipText("Maximize window");
1034
+// maxButton.addActionListener(this);
8581035 }
1036
+
1037
+// cButton gcButton;
1038
+//
1039
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1040
+// gcButton.setToolTipText("Garbage collect");
1041
+// gcButton.addActionListener(new ActionListener()
1042
+// {
1043
+// public void actionPerformed(ActionEvent e)
1044
+// {
1045
+// System.gc();
1046
+// }
1047
+// });
1048
+
1049
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ collapseButton.setToolTipText("Collapse toolbar");
1051
+ collapseButton.addActionListener(this);
1052
+
1053
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ maximize3DButton.setToolTipText("Maximize 3D view");
1055
+ maximize3DButton.addActionListener(this);
1056
+
1057
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ twoButton.setToolTipText("Show 3D view only");
1059
+ twoButton.addActionListener(this);
1060
+ this.fullscreenLayout = twoButton;
1061
+
1062
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ threeButton.setToolTipText("Show controls and 3D view");
1064
+ threeButton.addActionListener(this);
1065
+ if (Globals.ADVANCED)
1066
+ {
1067
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ sixButton.setToolTipText("Show 3D view and controls");
1069
+ sixButton.addActionListener(this);
1070
+ }
1071
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+// sevenButton.setToolTipText("3-column layout");
1073
+// sevenButton.addActionListener(this);
1074
+ //
8591075
8601076 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
8611077 fullButton.setToolTipText("Full-screen window");
....@@ -869,41 +1085,45 @@
8691085 restoreCameraButton.setToolTipText("Restore viewpoint");
8701086 restoreCameraButton.addActionListener(this);
8711087
872
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
- saveButton.setToolTipText("New version");
874
- saveButton.addActionListener(this);
1088
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ saveVersionButton.setToolTipText("Duplicate current version");
1090
+ saveVersionButton.addActionListener(this);
8751091
876
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
877
- undoButton.setToolTipText("Previous version");
878
- undoButton.addActionListener(this);
879
- undoButton.setEnabled(false);
1092
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ deleteVersionButton.setToolTipText("Delete current version");
1094
+ deleteVersionButton.addActionListener(this);
1095
+
1096
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ previousVersionButton.setToolTipText("Previous version");
1098
+ previousVersionButton.addActionListener(this);
1099
+ previousVersionButton.setEnabled(false);
8801100
8811101 cGridBag updown = new cGridBag().setVertical(true);
8821102 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
883
- restoreButton.setToolTipText("Restore current");
1103
+ restoreButton.setToolTipText("Undo (restore current version)");
8841104 restoreButton.addActionListener(this);
885
- restoreButton.setEnabled(false);
1105
+ //restoreButton.setEnabled(false);
8861106
8871107 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
888
- replaceButton.setToolTipText("Replace current");
1108
+ replaceButton.setToolTipText("Save (replace current version)");
8891109 replaceButton.addActionListener(this);
890
- replaceButton.setEnabled(false);
1110
+ //replaceButton.setEnabled(false);
8911111
8921112 copyOptionsPanel.add(updown);
8931113
894
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
895
- redoButton.setToolTipText("Next version");
896
- redoButton.addActionListener(this);
897
- redoButton.setEnabled(false);
1114
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ nextVersionButton.setToolTipText("Next version");
1116
+ nextVersionButton.addActionListener(this);
1117
+ nextVersionButton.setEnabled(false);
1118
+
1119
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ oneStepButton.setToolTipText("Animate one step forward");
1121
+ oneStepButton.addActionListener(this);
8981122
8991123 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9001124 liveCB.setToolTipText("Enable animation");
9011125 liveCB.addItemListener(this);
9021126
903
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
904
- oneStepButton.setToolTipText("Animate one step forward");
905
- oneStepButton.addActionListener(this);
906
-
9071127 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9081128 fastCB.setToolTipText("Fast mode");
9091129 fastCB.addItemListener(this);
....@@ -930,21 +1150,6 @@
9301150
9311151 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9321152
933
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
934
- twoButton.setToolTipText("Show 3D view only");
935
- twoButton.addActionListener(this);
936
- this.fullscreenLayout = twoButton;
937
-
938
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
- threeButton.setToolTipText("Show controls and 3D view");
940
- threeButton.addActionListener(this);
941
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
- sixButton.setToolTipText("Show 3D view and controls");
943
- sixButton.addActionListener(this);
944
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
-// sevenButton.setToolTipText("3-column layout");
946
-// sevenButton.addActionListener(this);
947
- //
9481153
9491154 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9501155 rootButton.setToolTipText("Open selection in new tab");
....@@ -960,7 +1165,7 @@
9601165
9611166 // INSERT
9621167 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
- gridButton.setToolTipText("Create grid");
1168
+ gridButton.setToolTipText("Create ground");
9641169 gridButton.addActionListener(this);
9651170
9661171 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1028,18 +1233,15 @@
10281233
10291234 oe.toolboxPanel.add(row2);
10301235
1031
- // ENVYMAPS
1032
- cGridBag skyboxpane = new cGridBag();
1033
- skyboxpane.preferredHeight = 100;
1236
+ cGridBag textures = new cGridBag();
10341237
1035
- oe.toolboxPanel.add(skyboxpane);
1238
+ CreateTexturePanel(textures);
10361239
1037
- JTabbedPane skyboxpanel = new JTabbedPane();
1038
- skyboxpane.add(skyboxpanel);
1240
+ oe.toolboxPanel.add(textures);
10391241
1040
- AddSkyboxTab0(skyboxpanel);
1041
- AddSkyboxTab1(skyboxpanel);
1042
- AddSkyboxTab2(skyboxpanel);
1242
+ textures.preferredHeight = 100;
1243
+
1244
+ CreateSkyboxPanel(oe.skyboxPanel);
10431245
10441246 // EDIT panel
10451247 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1047,20 +1249,20 @@
10471249 editButton.addActionListener(this);
10481250
10491251 editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
- uneditButton.setToolTipText("Remove selection controls");
1252
+ uneditButton.setToolTipText("Unpin and remove selection controls");
10511253 uneditButton.addActionListener(this);
10521254
10531255 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
- allParamsButton.setToolTipText("Show all controle");
1256
+ allParamsButton.setToolTipText("Show all controls");
10551257 allParamsButton.addActionListener(this);
10561258
1057
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
- clearPanelButton.setToolTipText("Clear edit panel");
1259
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1260
+ clearPanelButton.setToolTipText("Clear all controls");
10591261 clearPanelButton.addActionListener(this);
10601262
1061
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
- unselectButton.setToolTipText("Unselect");
1063
- unselectButton.addActionListener(this);
1263
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1264
+ //unselectButton.setToolTipText("Unselect");
1265
+ //unselectButton.addActionListener(this);
10641266
10651267 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10661268 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -1120,7 +1322,7 @@
11201322 dgr.addDragGestureListener(this);
11211323 }catch(Exception e) {}
11221324 */
1123
- radio.layout = sixButton; // sevenButton;
1325
+ radio.layout = threeButton; // sixButton;
11241326 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11251327 }
11261328
....@@ -1171,9 +1373,12 @@
11711373 smoothCB.setToolTipText("Snapping delay");
11721374 smoothCB.addItemListener(this);
11731375
1174
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1175
- slowCB.setToolTipText("Smooth interpolation");
1176
- slowCB.addItemListener(this);
1376
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1377
+// slowCB.setToolTipText("Smooth interpolation");
1378
+// slowCB.addItemListener(this);
1379
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1380
+ minshaderCB.setToolTipText("Minimal fast shader");
1381
+ minshaderCB.addItemListener(this);
11771382
11781383 // constraints.gridy += 1;
11791384 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1252,6 +1457,14 @@
12521457
12531458 void EditObject(Object3D obj)
12541459 {
1460
+ assert(obj instanceof Composite);
1461
+
1462
+ if (obj.versionlist == null)
1463
+ {
1464
+ obj.versionlist = new Object3D[100];
1465
+ obj.versionindex = -1;
1466
+ }
1467
+
12551468 cRadio radioButton = new cRadio(obj.name);
12561469
12571470 // June 2019. Patch to avoid bug with transparency.
....@@ -1262,7 +1475,7 @@
12621475 }
12631476
12641477 radioButton.SetObject(obj);
1265
- radioButton.layout = sixButton; // sevenButton;
1478
+ radioButton.layout = threeButton; // sixButton;
12661479 radioButton.SetCamera(cameraView.renderCamera, false);
12671480 radioButton.addActionListener(this);
12681481 radioPanel.add(radioButton);
....@@ -1287,6 +1500,8 @@
12871500 cCheckBox localCB;
12881501 cCheckBox crowdCB;
12891502 cCheckBox smoothCB;
1503
+ cCheckBox minshaderCB;
1504
+
12901505 cToggleButton fastCB;
12911506 cCheckBox slowCB;
12921507 cCheckBox boxCB;
....@@ -1357,6 +1572,12 @@
13571572 {
13581573 cameraView.ToggleInertia();
13591574 cameraView.repaint();
1575
+ }
1576
+ else if(e.getSource() == minshaderCB)
1577
+ {
1578
+ Globals.MINSHADER ^= true;
1579
+ cameraView.programInitialized = false;
1580
+ cameraView.repaint();
13601581 }
13611582 else if(e.getSource() == localCB)
13621583 {
....@@ -1634,7 +1855,12 @@
16341855 TreePath path;
16351856
16361857 public TransferableTreePath(TreePath tp) {
1637
- path = tp;
1858
+ Object[] objs = new Object[tp.getPathCount()];
1859
+ for (int i=0; i<objs.length; i++)
1860
+ {
1861
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1862
+ }
1863
+ path = new TreePath(objs);
16381864 }
16391865
16401866 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2497,7 +2723,7 @@
24972723 if (source == invariantsItem)
24982724 {
24992725 System.out.println("Invariants:");
2500
- Grafreed.grafreeD.universe.invariants();
2726
+ Grafreed.grafreed.universe.invariants();
25012727 } else
25022728 if (source == memoryItem)
25032729 {
....@@ -2528,33 +2754,52 @@
25282754 {
25292755 ToggleFullScreen();
25302756 } else
2531
- if (source == undoButton)
2757
+ if (source == collapseButton)
2758
+ {
2759
+ this.expandedLayout = radio.layout;
2760
+ CollapseToolbar();
2761
+ } else
2762
+ if (source == maximize3DButton)
2763
+ {
2764
+ this.expandedLayout = radio.layout;
2765
+ radio.layout = twoButton;
2766
+ Show3DView();
2767
+ CollapseToolbar();
2768
+ } else
2769
+ if (source == previousVersionButton)
25322770 {
25332771 // Go to previous version
25342772 //if (!Undo())
25352773 //java.awt.Toolkit.getDefaultToolkit().beep();
2536
- Undo();
2774
+ PreviousVersion();
25372775 } else
25382776 if (source == restoreButton)
25392777 {
25402778 // Restore current version
25412779 Restore();
2780
+ //restoreButton.setEnabled(false);
25422781 } else
25432782 if (source == replaceButton)
25442783 {
25452784 // Overwrite current version
25462785 Replace();
2786
+ //replaceButton.setEnabled(false);
25472787 } else
2548
- if (source == redoButton)
2788
+ if (source == nextVersionButton)
25492789 {
25502790 // Go to next version
2551
- Redo();
2791
+ NextVersion();
25522792 } else
2553
- if (source == saveButton)
2793
+ if (source == saveVersionButton)
25542794 {
25552795 // Save a new version
25562796 if (!Save(true))
25572797 java.awt.Toolkit.getDefaultToolkit().beep();
2798
+ } else
2799
+ if (source == deleteVersionButton)
2800
+ {
2801
+ // Delete a new version
2802
+ DeleteVersion();
25582803 } else
25592804 if (source == oneStepButton)
25602805 {
....@@ -2609,11 +2854,11 @@
26092854 } else
26102855 if (source == undoItem)
26112856 {
2612
- Undo();
2857
+ PreviousVersion();
26132858 } else
26142859 if (source == redoItem)
26152860 {
2616
- Redo();
2861
+ NextVersion();
26172862 } else
26182863 if (source == duplicateItem)
26192864 {
....@@ -3472,38 +3717,7 @@
34723717 if (CameraPane.FULLSCREEN)
34733718 fullscreenLayout = radio.layout;
34743719
3475
- // bug
3476
- //gridPanel.setDividerLocation(1.0);
3477
- //bigPanel.setDividerLocation(0.0);
3478
-// bigThree.remove(scenePanel);
3479
-// bigThree.remove(centralPanel);
3480
-// bigThree.remove(XYZPanel);
3481
-// aWindowConstraints.gridx = 0;
3482
-// aWindowConstraints.gridy = 0;
3483
-// aWindowConstraints.gridwidth = 1;
3484
-// // aConstraints.gridheight = 3;
3485
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3486
-// aWindowConstraints.weightx = 0;
3487
-// aWindowConstraints.weighty = 1;
3488
-// //bigThree.add(jtp, aWindowConstraints);
3489
-// aWindowConstraints.weightx = 1;
3490
-// aWindowConstraints.gridwidth = 3;
3491
-// // aConstraints.gridheight = 3;
3492
-// aWindowConstraints.gridx = 1;
3493
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3494
-// bigThree.add(centralPanel, aWindowConstraints);
3495
-// aWindowConstraints.weightx = 0;
3496
-// aWindowConstraints.gridx = 4;
3497
-// aWindowConstraints.gridwidth = 1;
3498
-// // aConstraints.gridheight = 3;
3499
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3500
-// //bigThree.add(XYZPanel, aWindowConstraints);
3501
-// scenePanel.setVisible(false);
3502
-// centralPanel.setVisible(true);
3503
-// XYZPanel.setVisible(false);
3504
- bigThree.ClearUI();
3505
- bigThree.add(centralPanel);
3506
- bigThree.FlushUI();
3720
+ Show3DView();
35073721
35083722 cameraView.requestFocusInWindow();
35093723
....@@ -3689,6 +3903,7 @@
36893903 } else
36903904 if (source == rootButton)
36913905 {
3906
+ Replace();
36923907 Object3D obj;
36933908 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
36943909 {
....@@ -3746,10 +3961,10 @@
37463961 {
37473962 Object3D child = (Object3D)e.nextElement();
37483963 if(child.editWindow != null)
3749
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37503964 child.pinned = false;
37513965 child.CloseUI();
37523966 listUI.remove(child);
3967
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37533968
37543969 //child.editWindow = null; // ???????????
37553970 }
....@@ -3768,6 +3983,7 @@
37683983 obj.CloseUI();
37693984 }
37703985 listUI.clear();
3986
+ SetPinStates(group.selection.size() > 0);
37713987 refreshContents(true);
37723988 } else
37733989 if (source == allParamsButton)
....@@ -3824,8 +4040,6 @@
38244040
38254041 copy = group;
38264042
3827
- SetUndoStates();
3828
-
38294043 //Globals.theRenderer.object = group;
38304044 if(!useclient)
38314045 {
....@@ -3853,7 +4067,10 @@
38534067 */
38544068 radio.layout.doClick();
38554069
4070
+ SetUndoStates();
4071
+
38564072 ClearUnpinned();
4073
+
38574074 //Grafreed.Assert(group != null);
38584075 //Grafreed.Assert(group.selection != null);
38594076 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3870,11 +4087,13 @@
38704087 } else if (event.getSource() == editCameraItem)
38714088 {
38724089 cameraView.ProtectCamera();
4090
+ cameraView.requestFocusInWindow();
38734091 cameraView.repaint();
38744092 return;
38754093 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
38764094 {
38774095 cameraView.RevertCamera();
4096
+ cameraView.requestFocusInWindow();
38784097 cameraView.repaint();
38794098 return;
38804099 // } else if (event.getSource() == textureButton)
....@@ -5007,9 +5226,7 @@
50075226
50085227 freezemodel = false;
50095228 }
5010
-
5011
- boolean flashIt = true;
5012
-
5229
+
50135230 public void valueChanged(TreeSelectionEvent e)
50145231 //public boolean handleEvent(Event event)
50155232 {
....@@ -5082,13 +5299,28 @@
50825299 {
50835300 editButton.setEnabled(enabled);
50845301 uneditButton.setEnabled(enabled);
5085
- unselectButton.setEnabled(enabled);
5302
+ //unselectButton.setEnabled(enabled);
50865303 flashSelectionButton.setEnabled(enabled);
5304
+
5305
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5306
+
5307
+ boolean allComposites = true;
5308
+
5309
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5310
+ {
5311
+ if (!(e.nextElement() instanceof Composite))
5312
+ {
5313
+ allComposites = false;
5314
+ break;
5315
+ }
5316
+ }
5317
+
5318
+ rootButton.setEnabled(allComposites);
50875319 }
50885320
50895321 void refreshContents(boolean cp)
50905322 {
5091
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5323
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
50925324 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
50935325 {
50945326 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5098,7 +5330,7 @@
50985330 Object3D child = (Object3D) group.selection.get(i);
50995331
51005332 objEditor.AddInfo(child, this, true);
5101
- System.err.println("info : " + child.GetPath());
5333
+// System.err.println("info : " + child.GetPath());
51025334 }
51035335
51045336 objEditor.SetText(); // jan 2014
....@@ -5924,7 +6156,6 @@
59246156
59256157 cButton restoreCameraButton;
59266158
5927
- cButton saveButton;
59286159 cButton oneStepButton;
59296160
59306161 cButton groupButton;