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,
....@@ -28,8 +29,8 @@
2829 {
2930 cButton skyboxButton;
3031 final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
- //row.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
- row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
3334 skyboxButton.setToolTipText(s);
3435 skyboxButton.addActionListener(new ActionListener()
3536 {
....@@ -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);
....@@ -57,11 +74,12 @@
5774 cGridBag row6 = new cGridBag();
5875
5976 AddSkyboxButton("default", "rgb", row0);
60
- AddSkyboxButton("default", "cornell", row0);
61
- AddSkyboxButton("default", "uffizi", row0);
62
- AddSkyboxButton("default", "CloudyHills", row0);
63
-
64
- AddSkyboxButton("default", "skycube", row1);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
6583 AddSkyboxButton("bridge", "Bridge", row1);
6684 AddSkyboxButton("bridge", "Bridge2", row1);
6785 AddSkyboxButton("urban", "GamlaStan2", row1);
....@@ -73,23 +91,23 @@
7391
7492 AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
7593 AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
7695 AddSkyboxButton("park", "BerzeliiPark", row3);
77
- AddSkyboxButton("park", "Buddha", row3);
7896
97
+ AddSkyboxButton("park", "Buddha", row4);
7998 AddSkyboxButton("park", "CNTower2", row4);
8099 AddSkyboxButton("park", "NiagaraFalls1", row4);
81100 AddSkyboxButton("park", "NiagaraFalls3", row4);
82
- AddSkyboxButton("park", "Park", row4);
83101
102
+ AddSkyboxButton("park", "Park", row5);
84103 AddSkyboxButton("park", "Pond", row5);
85104 AddSkyboxButton("park", "Skansen", row5);
86105 AddSkyboxButton("park", "Skansen2", row5);
87
- AddSkyboxButton("park", "Skansen3", row5);
88106
107
+ AddSkyboxButton("park", "Skansen3", row6);
89108 AddSkyboxButton("park", "Skansen4", row6);
90109 AddSkyboxButton("park", "Skansen5", row6);
91
- AddSkyboxButton("park", "Stairs", row6);
92
- AddSkyboxButton("park", "Tantolunden4", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
93111
94112 tab0.add(row0);
95113 tab0.add(row1);
....@@ -140,24 +158,29 @@
140158 AddSkyboxButton("forest", "Langholmen2", row3);
141159 AddSkyboxButton("forest", "Plants", row3);
142160 AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
143162 AddSkyboxButton("mountain", "Maskonaive2", row4);
144
-
145163 AddSkyboxButton("mountain", "Maskonaive3", row4);
146
- AddSkyboxButton("mountain", "Ryfjallet", row4);
147
- AddSkyboxButton("mountain", "Teide", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
148166
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
149169 AddSkyboxButton("rocky", "Langholmen", row5);
150
- AddSkyboxButton("rocky", "Riddarfjarden", row5);
151170 AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
152172 AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
153176 /*
154
-Kastellholmen
155
-Langholmen
156
-Riddarfjarden
157
-Skinnarviksberget
158
-Tanto
159
-Tantolunden2
160
-Tantolunden6
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
161184 */
162185
163186 tab0.add(row0);
....@@ -197,39 +220,33 @@
197220
198221 AddSkyboxButton("urban", "CNTower", row1);
199222 AddSkyboxButton("bridge", "ArstaBridge", row1);
200
- AddSkyboxButton("indoors", "DallasW", row1);
201
- AddSkyboxButton("indoors", "MarriottMadisonWest", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
202225
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
203229 AddSkyboxButton("indoors", "Vasa", row2);
204
- AddSkyboxButton("winter", "Backyard", row2);
205
- AddSkyboxButton("winter", "Creek", row2);
206
- AddSkyboxButton("winter", "FootballField3", row2);
207230
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
208234 AddSkyboxButton("winter", "Forest", row3);
209
- AddSkyboxButton("winter", "HornstullsStrand2", row3);
210
- AddSkyboxButton("winter", "House", row3);
211
- AddSkyboxButton("winter", "IceLake", row3);
212235
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
213239 AddSkyboxButton("winter", "IceRiver", row4);
214
- AddSkyboxButton("winter", "Park3", row4);
215
- AddSkyboxButton("winter", "PondWinter", row4);
216240
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
217243 AddSkyboxButton("winter", "Tantolunden5", row5);
218244 AddSkyboxButton("winter", "Vindelalven", row5);
219
- /*
220
-Backyard
221
-Creek
222
-FootballField3
223
-Forest
224
-HornstullsStrand2
225
-House
226
-IceLake
227
-IceRiver
228
-Park3
229
-PondWinter
230
-Tantolunden5
231
-Vindelalven *
232
- */
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233250
234251 tab0.add(row0);
235252 tab0.add(row1);
....@@ -245,15 +262,113 @@
245262 //tab0.add(new cGridBag());
246263 }
247264 }
248
-
249
- public void ChangeSkybox(String name)
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250267 {
251
- cameraView.envyoff = false;
252
- cameraView.skyboxname = name;
253
- 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";
254336 cameraView.repaint();
255337 }
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
+ }
256350
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
+
257372 //ObjEditor objEditor;
258373 public void closeUI2()
259374 {
....@@ -291,10 +406,12 @@
291406 this.copy = this.group = group;
292407 //selectees = this.group.selectees;
293408
294
- if (copy.versions == null)
409
+ if (copy.versionlist == null)
295410 {
296
- copy.versions = new byte[100][];
411
+ copy.versionlist = new Object3D[100];
297412 copy.versionindex = -1;
413
+
414
+ Save(true);
298415 }
299416
300417 if(ui)
....@@ -318,9 +435,9 @@
318435
319436 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
320437
321
- if (copy.versions == null)
438
+ if (copy.versionlist == null)
322439 {
323
- copy.versions = new byte[100][];
440
+ copy.versionlist = new Object3D[100];
324441 copy.versionindex = -1;
325442
326443 Save(true);
....@@ -526,11 +643,9 @@
526643 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
527644 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
528645 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
529
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
530646 oe.cameraMenu.add("-");
531647 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
532648 openWindowItem.addActionListener(this);
533
- editLeafItem.addActionListener(this);
534649 lookAtItem.addActionListener(this);
535650 //lookFromItem.addActinoListener(this);
536651 //switchViewItem.addActionListener(this);
....@@ -778,6 +893,9 @@
778893 shareGeometriesItem.addActionListener(this);
779894 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
780895 mergeGeometriesItem.addActionListener(this);
896
+ menu.add("-");
897
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
898
+ editLeafItem.addActionListener(this);
781899 if (Globals.ADVANCED)
782900 {
783901 // Pretty much the same as duplicate and clone.
....@@ -794,6 +912,73 @@
794912 buildToolsMenu(menu);
795913 }
796914
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
+ }
797982
798983 void SetupUI2(ObjEditor oe)
799984 {
....@@ -812,11 +997,6 @@
812997 //new Exception().printStackTrace();
813998
814999 oe.radioPanel = new JPanel(new GridBagLayout());
815
- oe.aConstraints.weightx = 1;
816
- oe.aConstraints.weighty = 0;
817
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
818
- oe.aConstraints.gridwidth = 100;
819
- oe.aConstraints.gridheight = 1;
8201000 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8211001
8221002 oe.buttonGroup = new ButtonGroup();
....@@ -849,10 +1029,49 @@
8491029
8501030 if (Globals.ADVANCED)
8511031 {
852
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
853
- maxButton.setToolTipText("Maximize window");
854
- 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);
8551035 }
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
+ //
8561075
8571076 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
8581077 fullButton.setToolTipText("Full-screen window");
....@@ -866,41 +1085,45 @@
8661085 restoreCameraButton.setToolTipText("Restore viewpoint");
8671086 restoreCameraButton.addActionListener(this);
8681087
869
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
- saveButton.setToolTipText("New version");
871
- 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);
8721091
873
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
874
- undoButton.setToolTipText("Previous version");
875
- undoButton.addActionListener(this);
876
- 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);
8771100
8781101 cGridBag updown = new cGridBag().setVertical(true);
8791102 updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
- restoreButton.setToolTipText("Restore current");
1103
+ restoreButton.setToolTipText("Undo (restore current version)");
8811104 restoreButton.addActionListener(this);
882
- restoreButton.setEnabled(false);
1105
+ //restoreButton.setEnabled(false);
8831106
8841107 updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
- replaceButton.setToolTipText("Replace current");
1108
+ replaceButton.setToolTipText("Save (replace current version)");
8861109 replaceButton.addActionListener(this);
887
- replaceButton.setEnabled(false);
1110
+ //replaceButton.setEnabled(false);
8881111
8891112 copyOptionsPanel.add(updown);
8901113
891
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
892
- redoButton.setToolTipText("Next version");
893
- redoButton.addActionListener(this);
894
- 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);
8951122
8961123 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
8971124 liveCB.setToolTipText("Enable animation");
8981125 liveCB.addItemListener(this);
8991126
900
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
901
- oneStepButton.setToolTipText("Animate one step forward");
902
- oneStepButton.addActionListener(this);
903
-
9041127 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9051128 fastCB.setToolTipText("Fast mode");
9061129 fastCB.addItemListener(this);
....@@ -927,21 +1150,6 @@
9271150
9281151 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9291152
930
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
- twoButton.setToolTipText("Show 3D view only");
932
- twoButton.addActionListener(this);
933
- this.fullscreenLayout = twoButton;
934
-
935
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
- threeButton.setToolTipText("Show controls and 3D view");
937
- threeButton.addActionListener(this);
938
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
- sixButton.setToolTipText("Show 3D view and controls");
940
- sixButton.addActionListener(this);
941
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
-// sevenButton.setToolTipText("3-column layout");
943
-// sevenButton.addActionListener(this);
944
- //
9451153
9461154 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
9471155 rootButton.setToolTipText("Open selection in new tab");
....@@ -957,7 +1165,7 @@
9571165
9581166 // INSERT
9591167 row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
960
- gridButton.setToolTipText("Create grid");
1168
+ gridButton.setToolTipText("Create ground");
9611169 gridButton.addActionListener(this);
9621170
9631171 row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1025,18 +1233,15 @@
10251233
10261234 oe.toolboxPanel.add(row2);
10271235
1028
- // ENVYMAPS
1029
- cGridBag skyboxpane = new cGridBag();
1030
- skyboxpane.preferredHeight = 100;
1236
+ cGridBag textures = new cGridBag();
10311237
1032
- oe.toolboxPanel.add(skyboxpane);
1238
+ CreateTexturePanel(textures);
10331239
1034
- JTabbedPane skyboxpanel = new JTabbedPane();
1035
- skyboxpane.add(skyboxpanel);
1240
+ oe.toolboxPanel.add(textures);
10361241
1037
- AddSkyboxTab0(skyboxpanel);
1038
- AddSkyboxTab1(skyboxpanel);
1039
- AddSkyboxTab2(skyboxpanel);
1242
+ textures.preferredHeight = 100;
1243
+
1244
+ CreateSkyboxPanel(oe.skyboxPanel);
10401245
10411246 // EDIT panel
10421247 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -1044,20 +1249,20 @@
10441249 editButton.addActionListener(this);
10451250
10461251 editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
- uneditButton.setToolTipText("Remove selection controls");
1252
+ uneditButton.setToolTipText("Unpin and remove selection controls");
10481253 uneditButton.addActionListener(this);
10491254
10501255 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1051
- allParamsButton.setToolTipText("Show all controle");
1256
+ allParamsButton.setToolTipText("Show all controls");
10521257 allParamsButton.addActionListener(this);
10531258
1054
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
- clearPanelButton.setToolTipText("Clear edit panel");
1259
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1260
+ clearPanelButton.setToolTipText("Clear all controls");
10561261 clearPanelButton.addActionListener(this);
10571262
1058
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
- unselectButton.setToolTipText("Unselect");
1060
- unselectButton.addActionListener(this);
1263
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1264
+ //unselectButton.setToolTipText("Unselect");
1265
+ //unselectButton.addActionListener(this);
10611266
10621267 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10631268 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -1117,7 +1322,7 @@
11171322 dgr.addDragGestureListener(this);
11181323 }catch(Exception e) {}
11191324 */
1120
- radio.layout = sixButton; // sevenButton;
1325
+ radio.layout = threeButton; // sixButton;
11211326 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11221327 }
11231328
....@@ -1168,9 +1373,12 @@
11681373 smoothCB.setToolTipText("Snapping delay");
11691374 smoothCB.addItemListener(this);
11701375
1171
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1172
- slowCB.setToolTipText("Smooth interpolation");
1173
- 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);
11741382
11751383 // constraints.gridy += 1;
11761384 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1249,6 +1457,14 @@
12491457
12501458 void EditObject(Object3D obj)
12511459 {
1460
+ assert(obj instanceof Composite);
1461
+
1462
+ if (obj.versionlist == null)
1463
+ {
1464
+ obj.versionlist = new Object3D[100];
1465
+ obj.versionindex = -1;
1466
+ }
1467
+
12521468 cRadio radioButton = new cRadio(obj.name);
12531469
12541470 // June 2019. Patch to avoid bug with transparency.
....@@ -1259,7 +1475,7 @@
12591475 }
12601476
12611477 radioButton.SetObject(obj);
1262
- radioButton.layout = sixButton; // sevenButton;
1478
+ radioButton.layout = threeButton; // sixButton;
12631479 radioButton.SetCamera(cameraView.renderCamera, false);
12641480 radioButton.addActionListener(this);
12651481 radioPanel.add(radioButton);
....@@ -1284,6 +1500,8 @@
12841500 cCheckBox localCB;
12851501 cCheckBox crowdCB;
12861502 cCheckBox smoothCB;
1503
+ cCheckBox minshaderCB;
1504
+
12871505 cToggleButton fastCB;
12881506 cCheckBox slowCB;
12891507 cCheckBox boxCB;
....@@ -1354,6 +1572,12 @@
13541572 {
13551573 cameraView.ToggleInertia();
13561574 cameraView.repaint();
1575
+ }
1576
+ else if(e.getSource() == minshaderCB)
1577
+ {
1578
+ Globals.MINSHADER ^= true;
1579
+ cameraView.programInitialized = false;
1580
+ cameraView.repaint();
13571581 }
13581582 else if(e.getSource() == localCB)
13591583 {
....@@ -1631,7 +1855,12 @@
16311855 TreePath path;
16321856
16331857 public TransferableTreePath(TreePath tp) {
1634
- 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);
16351864 }
16361865
16371866 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2494,7 +2723,7 @@
24942723 if (source == invariantsItem)
24952724 {
24962725 System.out.println("Invariants:");
2497
- Grafreed.grafreeD.universe.invariants();
2726
+ Grafreed.grafreed.universe.invariants();
24982727 } else
24992728 if (source == memoryItem)
25002729 {
....@@ -2525,33 +2754,52 @@
25252754 {
25262755 ToggleFullScreen();
25272756 } else
2528
- 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)
25292770 {
25302771 // Go to previous version
25312772 //if (!Undo())
25322773 //java.awt.Toolkit.getDefaultToolkit().beep();
2533
- Undo();
2774
+ PreviousVersion();
25342775 } else
25352776 if (source == restoreButton)
25362777 {
25372778 // Restore current version
25382779 Restore();
2780
+ //restoreButton.setEnabled(false);
25392781 } else
25402782 if (source == replaceButton)
25412783 {
25422784 // Overwrite current version
25432785 Replace();
2786
+ //replaceButton.setEnabled(false);
25442787 } else
2545
- if (source == redoButton)
2788
+ if (source == nextVersionButton)
25462789 {
25472790 // Go to next version
2548
- Redo();
2791
+ NextVersion();
25492792 } else
2550
- if (source == saveButton)
2793
+ if (source == saveVersionButton)
25512794 {
25522795 // Save a new version
25532796 if (!Save(true))
25542797 java.awt.Toolkit.getDefaultToolkit().beep();
2798
+ } else
2799
+ if (source == deleteVersionButton)
2800
+ {
2801
+ // Delete a new version
2802
+ DeleteVersion();
25552803 } else
25562804 if (source == oneStepButton)
25572805 {
....@@ -2606,11 +2854,11 @@
26062854 } else
26072855 if (source == undoItem)
26082856 {
2609
- Undo();
2857
+ PreviousVersion();
26102858 } else
26112859 if (source == redoItem)
26122860 {
2613
- Redo();
2861
+ NextVersion();
26142862 } else
26152863 if (source == duplicateItem)
26162864 {
....@@ -3469,38 +3717,7 @@
34693717 if (CameraPane.FULLSCREEN)
34703718 fullscreenLayout = radio.layout;
34713719
3472
- // bug
3473
- //gridPanel.setDividerLocation(1.0);
3474
- //bigPanel.setDividerLocation(0.0);
3475
-// bigThree.remove(scenePanel);
3476
-// bigThree.remove(centralPanel);
3477
-// bigThree.remove(XYZPanel);
3478
-// aWindowConstraints.gridx = 0;
3479
-// aWindowConstraints.gridy = 0;
3480
-// aWindowConstraints.gridwidth = 1;
3481
-// // aConstraints.gridheight = 3;
3482
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3483
-// aWindowConstraints.weightx = 0;
3484
-// aWindowConstraints.weighty = 1;
3485
-// //bigThree.add(jtp, aWindowConstraints);
3486
-// aWindowConstraints.weightx = 1;
3487
-// aWindowConstraints.gridwidth = 3;
3488
-// // aConstraints.gridheight = 3;
3489
-// aWindowConstraints.gridx = 1;
3490
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3491
-// bigThree.add(centralPanel, aWindowConstraints);
3492
-// aWindowConstraints.weightx = 0;
3493
-// aWindowConstraints.gridx = 4;
3494
-// aWindowConstraints.gridwidth = 1;
3495
-// // aConstraints.gridheight = 3;
3496
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3497
-// //bigThree.add(XYZPanel, aWindowConstraints);
3498
-// scenePanel.setVisible(false);
3499
-// centralPanel.setVisible(true);
3500
-// XYZPanel.setVisible(false);
3501
- bigThree.ClearUI();
3502
- bigThree.add(centralPanel);
3503
- bigThree.FlushUI();
3720
+ Show3DView();
35043721
35053722 cameraView.requestFocusInWindow();
35063723
....@@ -3686,6 +3903,7 @@
36863903 } else
36873904 if (source == rootButton)
36883905 {
3906
+ Replace();
36893907 Object3D obj;
36903908 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
36913909 {
....@@ -3743,10 +3961,10 @@
37433961 {
37443962 Object3D child = (Object3D)e.nextElement();
37453963 if(child.editWindow != null)
3746
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37473964 child.pinned = false;
37483965 child.CloseUI();
37493966 listUI.remove(child);
3967
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37503968
37513969 //child.editWindow = null; // ???????????
37523970 }
....@@ -3765,6 +3983,7 @@
37653983 obj.CloseUI();
37663984 }
37673985 listUI.clear();
3986
+ SetPinStates(group.selection.size() > 0);
37683987 refreshContents(true);
37693988 } else
37703989 if (source == allParamsButton)
....@@ -3821,8 +4040,6 @@
38214040
38224041 copy = group;
38234042
3824
- SetUndoStates();
3825
-
38264043 //Globals.theRenderer.object = group;
38274044 if(!useclient)
38284045 {
....@@ -3850,7 +4067,10 @@
38504067 */
38514068 radio.layout.doClick();
38524069
4070
+ SetUndoStates();
4071
+
38534072 ClearUnpinned();
4073
+
38544074 //Grafreed.Assert(group != null);
38554075 //Grafreed.Assert(group.selection != null);
38564076 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3867,11 +4087,13 @@
38674087 } else if (event.getSource() == editCameraItem)
38684088 {
38694089 cameraView.ProtectCamera();
4090
+ cameraView.requestFocusInWindow();
38704091 cameraView.repaint();
38714092 return;
38724093 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
38734094 {
38744095 cameraView.RevertCamera();
4096
+ cameraView.requestFocusInWindow();
38754097 cameraView.repaint();
38764098 return;
38774099 // } else if (event.getSource() == textureButton)
....@@ -5004,9 +5226,7 @@
50045226
50055227 freezemodel = false;
50065228 }
5007
-
5008
- boolean flashIt = true;
5009
-
5229
+
50105230 public void valueChanged(TreeSelectionEvent e)
50115231 //public boolean handleEvent(Event event)
50125232 {
....@@ -5079,13 +5299,28 @@
50795299 {
50805300 editButton.setEnabled(enabled);
50815301 uneditButton.setEnabled(enabled);
5082
- unselectButton.setEnabled(enabled);
5302
+ //unselectButton.setEnabled(enabled);
50835303 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);
50845319 }
50855320
50865321 void refreshContents(boolean cp)
50875322 {
5088
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5323
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
50895324 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
50905325 {
50915326 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5095,7 +5330,7 @@
50955330 Object3D child = (Object3D) group.selection.get(i);
50965331
50975332 objEditor.AddInfo(child, this, true);
5098
- System.err.println("info : " + child.GetPath());
5333
+// System.err.println("info : " + child.GetPath());
50995334 }
51005335
51015336 objEditor.SetText(); // jan 2014
....@@ -5921,7 +6156,6 @@
59216156
59226157 cButton restoreCameraButton;
59236158
5924
- cButton saveButton;
59256159 cButton oneStepButton;
59266160
59276161 cButton groupButton;