Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
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,9 +29,9 @@
2829 {
2930 cButton skyboxButton;
3031 final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
- row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
3233 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3435 skyboxButton.addActionListener(new ActionListener()
3536 {
3637 @Override
....@@ -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, !Globals.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);
....@@ -56,11 +73,11 @@
5673 cGridBag row5 = new cGridBag();
5774 cGridBag row6 = new cGridBag();
5875
59
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
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,122 @@
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
- group.skyboxname = name;
256
- group.skyboxext = "jpg";
257
- cameraView.repaint();
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
+ 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
+ }
346
+ }
347
+
348
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
349
+ {
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351
+
352
+ AddSkyboxTab0(skyboxpane);
353
+ AddSkyboxTab1(skyboxpane);
354
+ AddSkyboxTab2(skyboxpane);
355
+ AddSkyboxTab3(skyboxpane);
356
+
357
+ skyboxPanel.add(skyboxpane);
258358 }
259359
360
+ public void ChangeTexture(String texture)
361
+ {
362
+ for (int i=0; i<group.selection.size(); i++)
363
+ {
364
+ Object3D obj = group.selection.get(i);
365
+ obj.SetPigmentTexture("@" + texture);
366
+ }
367
+
368
+ refreshContents();
369
+ }
370
+
371
+ public void Show3DView()
372
+ {
373
+ // bug
374
+ //gridPanel.setDividerLocation(1.0);
375
+ //bigPanel.setDividerLocation(0.0);
376
+ bigThree.ClearUI();
377
+ bigThree.add(centralPanel);
378
+ bigThree.FlushUI();
379
+ }
380
+
260381 //ObjEditor objEditor;
261382 public void closeUI2()
262383 {
....@@ -294,11 +415,15 @@
294415 this.copy = this.group = group;
295416 //selectees = this.group.selectees;
296417
297
- if (copy.versions == null)
298
- {
299
- copy.versions = new byte[100][];
300
- copy.versionindex = -1;
301
- }
418
+ assert(false);
419
+
420
+// if (copy.versionlist == null)
421
+// {
422
+// copy.versionlist = new Object3D[100];
423
+// copy.versionindex = -1;
424
+//
425
+// //Save(true);
426
+// }
302427
303428 if(ui)
304429 SetupUI(objEditor);
....@@ -321,13 +446,13 @@
321446
322447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
323448
324
- if (copy.versions == null)
325
- {
326
- copy.versions = new byte[100][];
327
- copy.versionindex = -1;
328
-
329
- Save(true);
330
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
331456 }
332457
333458 void CloneSelection(boolean supports)
....@@ -417,33 +542,35 @@
417542 // menu.add("-");
418543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
419544 duplicateItem.addActionListener(this);
420
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
421547 cloneItem.addActionListener(this);
422
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
423549 {
424550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
425551 cloneSupportItem.addActionListener(this);
426552 }
553
+ oe.jTree.popup.addSeparator();
427554 menu.add("-");
428
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
429556 cutItem.addActionListener(this);
430
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
431558 copyItem.addActionListener(this);
432559 pasteItem = menu.add(new MenuItem("Paste"));
433560 pasteItem.addActionListener(this);
434561
435
- menu.add("-");
436
- 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"));
437565 pasteIntoItem.addActionListener(this);
438
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
439567 pasteLinkItem.addActionListener(this);
440
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
441569 pasteCloneItem.addActionListener(this);
442
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
443571 // pasteExpandItem.addActionListener(this);
444
- menu.add("-");
445
- deleteItem = menu.add(new MenuItem("Delete"));
446
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
447574
448575 if (Globals.ADVANCED)
449576 {
....@@ -529,11 +656,9 @@
529656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
530657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
531658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
532
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
533659 oe.cameraMenu.add("-");
534660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
535661 openWindowItem.addActionListener(this);
536
- editLeafItem.addActionListener(this);
537662 lookAtItem.addActionListener(this);
538663 //lookFromItem.addActinoListener(this);
539664 //switchViewItem.addActionListener(this);
....@@ -580,9 +705,8 @@
580705 setMasterItem.addActionListener(this);
581706 }
582707
583
- oe.menuBar.add(menu = new Menu("Group"));
584
-// grabItem = menu.add(new MenuItem("Grab"));
585
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
586710 backItem = menu.add(new MenuItem("Back"));
587711 backItem.addActionListener(this);
588712 frontItem = menu.add(new MenuItem("Front"));
....@@ -590,13 +714,21 @@
590714 // compositeItem = menu.add(new MenuItem("Composite"));
591715 // compositeItem.addActionListener(this);
592716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
593720 if (Globals.ADVANCED)
594721 {
595722 hideItem = menu.add(new MenuItem("Hidden Group"));
596723 hideItem.addActionListener(this);
597724 }
598
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
599726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
600732
601733 // menu.add("-");
602734 //
....@@ -703,6 +835,8 @@
703835 }
704836
705837 oe.menuBar.add(menu = new Menu("Attributes"));
838
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
839
+ clearVersionsItem.addActionListener(this);
706840 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
707841 clearMaterialsItem.addActionListener(this);
708842 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -725,9 +859,9 @@
725859 hideleavesItem.addActionListener(this);
726860 showleavesItem = menu.add(new MenuItem("Show Leaves"));
727861 showleavesItem.addActionListener(this);
728
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
862
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
729863 markleavesItem.addActionListener(this);
730
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
864
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
731865 unmarkleavesItem.addActionListener(this);
732866 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
733867 rewindleavesItem.addActionListener(this);
....@@ -781,6 +915,9 @@
781915 shareGeometriesItem.addActionListener(this);
782916 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
783917 mergeGeometriesItem.addActionListener(this);
918
+ menu.add("-");
919
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
920
+ editLeafItem.addActionListener(this);
784921 if (Globals.ADVANCED)
785922 {
786923 // Pretty much the same as duplicate and clone.
....@@ -797,6 +934,79 @@
797934 buildToolsMenu(menu);
798935 }
799936
937
+ JTabbedPane resourcecontainer;
938
+ cGridBag currenttab;
939
+ //boolean added; // patch for jar
940
+
941
+ int totalcount = 0;
942
+
943
+ int tabcount = 0;
944
+ int colcount = 0;
945
+ int rowcount = 0;
946
+ int texturecount = 0;
947
+
948
+ int columns = 5;
949
+ int rows = 7;
950
+
951
+ public void ResourceCallBack(String[] path)
952
+ {
953
+// for (int i = 0; i < path.length; i++)
954
+// System.out.print(path[i] + "/");
955
+// System.out.println();
956
+
957
+ if (//rowcount == 0 ||
958
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
959
+ {
960
+ currenttab = new cGridBag();
961
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
962
+ currenttab.setName(tabname);
963
+ //added = false;
964
+ resourcecontainer.add(currenttab);
965
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
966
+ rowcount = 1;
967
+ colcount = 0;
968
+ texturecount = 0;
969
+ }
970
+
971
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
972
+ {
973
+ //if (!added)
974
+ {
975
+ //added = true;
976
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
977
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
978
+ }
979
+
980
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
981
+ totalcount++;
982
+
983
+ if (++colcount >= columns)
984
+ {
985
+ colcount = 0;
986
+ currenttab.Return();
987
+
988
+ if (rowcount++ >= rows)
989
+ {
990
+ rowcount = 0;
991
+ }
992
+ }
993
+ }
994
+ else
995
+ {
996
+// if (!path[path.length-1].equals("icons"))
997
+// resourcecontainer.Return();
998
+ }
999
+ }
1000
+
1001
+ void CreateTexturePanel(cGridBag container)
1002
+ {
1003
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
1004
+ container.add(resourcecontainer);
1005
+
1006
+ Grafreed.ParseResources("textures", this);
1007
+
1008
+ // 935. System.out.println("Total = " + totalcount);
1009
+ }
8001010
8011011 void SetupUI2(ObjEditor oe)
8021012 {
....@@ -815,11 +1025,6 @@
8151025 //new Exception().printStackTrace();
8161026
8171027 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;
8231028 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8241029
8251030 oe.buttonGroup = new ButtonGroup();
....@@ -840,9 +1045,9 @@
8401045 oe.radioPanel.add(dummyButton);
8411046 oe.buttonGroup.add(dummyButton);
8421047 */
843
- cGridBag copyOptionsPanel = new cGridBag();
1048
+ cGridBag versionManagerPanel = new cGridBag();
8441049
845
- copyOptionsPanel.preferredHeight = 2;
1050
+ versionManagerPanel.preferredHeight = 4;
8461051
8471052 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
8481053
....@@ -852,58 +1057,102 @@
8521057
8531058 if (Globals.ADVANCED)
8541059 {
855
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
856
- maxButton.setToolTipText("Maximize window");
857
- maxButton.addActionListener(this);
1060
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// maxButton.setToolTipText("Maximize window");
1062
+// maxButton.addActionListener(this);
8581063 }
8591064
860
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ cButton gcButton;
1066
+
1067
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+// gcButton.setToolTipText("Garbage collect");
1069
+// gcButton.addActionListener(new ActionListener()
1070
+// {
1071
+// public void actionPerformed(ActionEvent e)
1072
+// {
1073
+// System.gc();
1074
+// }
1075
+// });
1076
+
1077
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1078
+ collapseButton.setToolTipText("Collapse toolbar");
1079
+ collapseButton.addActionListener(this);
1080
+
1081
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1082
+ maximize3DButton.setToolTipText("Maximize 3D view");
1083
+ maximize3DButton.addActionListener(this);
1084
+
1085
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1086
+ twoButton.setToolTipText("Show 3D view only");
1087
+ twoButton.addActionListener(this);
1088
+ this.fullscreenLayout = twoButton;
1089
+
1090
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1091
+ threeButton.setToolTipText("Show controls and 3D view");
1092
+ threeButton.addActionListener(this);
1093
+ if (Globals.ADVANCED)
1094
+ {
1095
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1096
+ sixButton.setToolTipText("Show 3D view and controls");
1097
+ sixButton.addActionListener(this);
1098
+ }
1099
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+// sevenButton.setToolTipText("3-column layout");
1101
+// sevenButton.addActionListener(this);
1102
+ //
1103
+
1104
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8611105 fullButton.setToolTipText("Full-screen window");
8621106 fullButton.addActionListener(this);
8631107
864
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8651109 screenfitButton.setToolTipText("Screen fit");
8661110 screenfitButton.addActionListener(this);
8671111
868
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8691113 restoreCameraButton.setToolTipText("Restore viewpoint");
8701114 restoreCameraButton.addActionListener(this);
8711115
872
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
- saveButton.setToolTipText("New version");
874
- saveButton.addActionListener(this);
1116
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1117
+ saveVersionButton.setToolTipText("Duplicate current version");
1118
+ saveVersionButton.addActionListener(this);
8751119
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);
1120
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1121
+ deleteVersionButton.setToolTipText("Delete current version");
1122
+ deleteVersionButton.addActionListener(this);
1123
+ deleteVersionButton.setEnabled(false);
1124
+
1125
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1126
+ previousVersionButton.setToolTipText("Previous version");
1127
+ previousVersionButton.addActionListener(this);
1128
+ previousVersionButton.setEnabled(false);
8801129
8811130 cGridBag updown = new cGridBag().setVertical(true);
882
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
883
- restoreButton.setToolTipText("Restore current");
1131
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1132
+ restoreButton.setToolTipText("Undo (restore current version)");
8841133 restoreButton.addActionListener(this);
8851134 restoreButton.setEnabled(false);
8861135
887
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
888
- replaceButton.setToolTipText("Replace current");
1136
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1137
+ replaceButton.setToolTipText("Save (replace current version)");
8891138 replaceButton.addActionListener(this);
8901139 replaceButton.setEnabled(false);
8911140
892
- copyOptionsPanel.add(updown);
1141
+ versionManagerPanel.add(updown);
8931142
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);
1143
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1144
+ nextVersionButton.setToolTipText("Next version");
1145
+ nextVersionButton.addActionListener(this);
1146
+ nextVersionButton.setEnabled(false);
1147
+
1148
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1149
+ oneStepButton.setToolTipText("Animate one step forward");
1150
+ oneStepButton.addActionListener(this);
8981151
8991152 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9001153 liveCB.setToolTipText("Enable animation");
9011154 liveCB.addItemListener(this);
9021155
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
-
9071156 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9081157 fastCB.setToolTipText("Fast mode");
9091158 fastCB.addItemListener(this);
....@@ -919,38 +1168,23 @@
9191168
9201169 if (Globals.ADVANCED)
9211170 {
922
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9231172 snapobjectButton.addActionListener(this);
9241173 snapobjectButton.setToolTipText("Snap Object");
9251174
926
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9271176 fourButton.addActionListener(this);
9281177 fourButton.setToolTipText("Show control panel only");
9291178 }
9301179
9311180 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9321181
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
- //
9481182
949
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9501184 rootButton.setToolTipText("Open selection in new tab");
9511185 rootButton.addActionListener(this);
9521186
953
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9541188 closeButton.setToolTipText("Close tab");
9551189 closeButton.addActionListener(this);
9561190 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -959,38 +1193,38 @@
9591193 cGridBag row1 = new cGridBag();
9601194
9611195 // INSERT
962
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
- gridButton.setToolTipText("Create grid");
1196
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1197
+ gridButton.setToolTipText("Create ground");
9641198 gridButton.addActionListener(this);
9651199
966
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1200
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9671201 boxButton.setToolTipText("Create box");
9681202 boxButton.addActionListener(this);
9691203
970
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
971
- sphereButton.setToolTipText("Create sphere");
972
- sphereButton.addActionListener(this);
973
-
974
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
975
- coneButton.setToolTipText("Create cone");
976
- coneButton.addActionListener(this);
977
-
978
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
979
- torusButton.setToolTipText("Create torus");
980
- torusButton.addActionListener(this);
981
-
982
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9831205 superButton.setToolTipText("Create superellipsoid");
9841206 superButton.addActionListener(this);
9851207
1208
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1209
+ sphereButton.setToolTipText("Create sphere");
1210
+ sphereButton.addActionListener(this);
1211
+
1212
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1213
+ coneButton.setToolTipText("Create cone");
1214
+ coneButton.addActionListener(this);
1215
+
1216
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1217
+ torusButton.setToolTipText("Create torus");
1218
+ torusButton.addActionListener(this);
1219
+
9861220 if (Globals.ADVANCED)
9871221 {
988
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9891223 kleinButton.setToolTipText("Create Klein bottle");
9901224 kleinButton.addActionListener(this);
9911225 }
9921226
993
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9941228 particlesButton.setToolTipText("Create particle system");
9951229 particlesButton.addActionListener(this);
9961230
....@@ -998,71 +1232,73 @@
9981232
9991233 cGridBag row2 = new cGridBag();
10001234
1001
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1235
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10021236 groupButton.setToolTipText("Create group");
10031237 groupButton.addActionListener(this);
10041238
1005
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1239
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10061240 compositeButton.setToolTipText("Create composite");
10071241 compositeButton.addActionListener(this);
10081242
1009
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1243
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10101244 switchButton.setToolTipText("Create item switcher");
10111245 switchButton.addActionListener(this);
10121246
1013
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1247
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10141248 loopButton.setToolTipText("Create loop");
10151249 loopButton.addActionListener(this);
10161250
1017
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1251
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10181252 textureButton.setToolTipText("Create texture");
10191253 textureButton.addActionListener(this);
10201254
1021
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1255
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10221256 overlayButton.setToolTipText("Create overlay");
10231257 overlayButton.addActionListener(this);
10241258
1025
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1259
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10261260 lightButton.setToolTipText("Create light");
10271261 lightButton.addActionListener(this);
10281262
10291263 oe.toolboxPanel.add(row2);
10301264
1031
- // ENVYMAPS
1032
- cGridBag skyboxpane = new cGridBag();
1033
- skyboxpane.preferredHeight = 100;
1265
+ cGridBag textures = new cGridBag();
10341266
1035
- oe.toolboxPanel.add(skyboxpane);
1267
+ CreateTexturePanel(textures);
10361268
1037
- JTabbedPane skyboxpanel = new JTabbedPane();
1038
- skyboxpane.add(skyboxpanel);
1269
+ int tabCount = resourcecontainer.getTabCount();
10391270
1040
- AddSkyboxTab0(skyboxpanel);
1041
- AddSkyboxTab1(skyboxpanel);
1042
- AddSkyboxTab2(skyboxpanel);
1271
+ if (tabCount > 0)
1272
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1273
+
1274
+ oe.toolboxPanel.add(textures);
1275
+
1276
+ textures.preferredHeight = 100;
1277
+
1278
+ CreateSkyboxPanel(oe.skyboxPanel);
10431279
10441280 // EDIT panel
1045
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1281
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10461282 editButton.setToolTipText("Pin selection controls");
10471283 editButton.addActionListener(this);
10481284
1049
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
- uneditButton.setToolTipText("Remove selection controls");
1285
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1286
+ uneditButton.setToolTipText("Unpin and remove selection controls");
10511287 uneditButton.addActionListener(this);
10521288
10531289 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
- allParamsButton.setToolTipText("Show all controle");
1290
+ allParamsButton.setToolTipText("Show all controls");
10551291 allParamsButton.addActionListener(this);
10561292
1057
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
- clearPanelButton.setToolTipText("Clear edit panel");
1293
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1294
+ clearPanelButton.setToolTipText("Clear all controls");
10591295 clearPanelButton.addActionListener(this);
10601296
1061
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
- unselectButton.setToolTipText("Unselect");
1063
- unselectButton.addActionListener(this);
1297
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ //unselectButton.setToolTipText("Unselect");
1299
+ //unselectButton.addActionListener(this);
10641300
1065
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1301
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10661302 flashSelectionButton.setToolTipText("Highlight selection");
10671303 flashSelectionButton.addActionListener(this);
10681304
....@@ -1085,6 +1321,8 @@
10851321
10861322 cGridBag jSPPanel = new cGridBag();
10871323
1324
+ jSPPanel.preferredHeight = 20;
1325
+
10881326 JScrollPane jSP;
10891327 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
10901328 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1093,11 +1331,11 @@
10931331 oe.treePanel.add(jSPPanel);
10941332 oe.treePanel.Return();
10951333
1096
- oe.treePanel.add(copyOptionsPanel);
1334
+ oe.treePanel.add(versionManagerPanel);
10971335 oe.treePanel.Return();
1098
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
- sliderPane.preferredHeight = 1;
1336
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1337
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1338
+ versionSliderPane.preferredHeight = 3;
11011339
11021340 // mainPanel.setDividerLocation(0.1); //1.0);
11031341 mainPanel.setResizeWeight(0.4);
....@@ -1120,7 +1358,7 @@
11201358 dgr.addDragGestureListener(this);
11211359 }catch(Exception e) {}
11221360 */
1123
- radio.layout = sixButton; // sevenButton;
1361
+ radio.layout = threeButton; // sixButton;
11241362 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11251363 }
11261364
....@@ -1171,9 +1409,12 @@
11711409 smoothCB.setToolTipText("Snapping delay");
11721410 smoothCB.addItemListener(this);
11731411
1174
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1175
- slowCB.setToolTipText("Smooth interpolation");
1176
- slowCB.addItemListener(this);
1412
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1413
+// slowCB.setToolTipText("Smooth interpolation");
1414
+// slowCB.addItemListener(this);
1415
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1416
+ minshaderCB.setToolTipText("Minimal fast shader");
1417
+ minshaderCB.addItemListener(this);
11771418
11781419 // constraints.gridy += 1;
11791420 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1252,6 +1493,14 @@
12521493
12531494 void EditObject(Object3D obj)
12541495 {
1496
+ assert(obj instanceof Composite);
1497
+
1498
+// if (obj.versionlist == null)
1499
+// {
1500
+// obj.versionlist = new Object3D[100];
1501
+// obj.versionindex = -1;
1502
+// }
1503
+
12551504 cRadio radioButton = new cRadio(obj.name);
12561505
12571506 // June 2019. Patch to avoid bug with transparency.
....@@ -1262,7 +1511,7 @@
12621511 }
12631512
12641513 radioButton.SetObject(obj);
1265
- radioButton.layout = sixButton; // sevenButton;
1514
+ radioButton.layout = threeButton; // sixButton;
12661515 radioButton.SetCamera(cameraView.renderCamera, false);
12671516 radioButton.addActionListener(this);
12681517 radioPanel.add(radioButton);
....@@ -1276,6 +1525,7 @@
12761525
12771526 oe.SetupViews();
12781527
1528
+ if (Globals.DEBUG)
12791529 System.out.println("SetupViews");
12801530 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
12811531 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1287,6 +1537,8 @@
12871537 cCheckBox localCB;
12881538 cCheckBox crowdCB;
12891539 cCheckBox smoothCB;
1540
+ cCheckBox minshaderCB;
1541
+
12901542 cToggleButton fastCB;
12911543 cCheckBox slowCB;
12921544 cCheckBox boxCB;
....@@ -1357,6 +1609,12 @@
13571609 {
13581610 cameraView.ToggleInertia();
13591611 cameraView.repaint();
1612
+ }
1613
+ else if(e.getSource() == minshaderCB)
1614
+ {
1615
+ Globals.MINSHADER ^= true;
1616
+ cameraView.programInitialized = false;
1617
+ cameraView.repaint();
13601618 }
13611619 else if(e.getSource() == localCB)
13621620 {
....@@ -1634,7 +1892,12 @@
16341892 TreePath path;
16351893
16361894 public TransferableTreePath(TreePath tp) {
1637
- path = tp;
1895
+ Object[] objs = new Object[tp.getPathCount()];
1896
+ for (int i=0; i<objs.length; i++)
1897
+ {
1898
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1899
+ }
1900
+ path = new TreePath(objs);
16381901 }
16391902
16401903 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1866,24 +2129,24 @@
18662129 switch(axis)
18672130 {
18682131 case 0 :
1869
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1870
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1871
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1872
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2132
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2133
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2134
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2135
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
18732136 norm = cVector.X;
18742137 break;
18752138 case 1 :
1876
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1877
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1878
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1879
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2139
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2140
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2141
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2142
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
18802143 norm = cVector.Y;
18812144 break;
18822145 case 2 :
1883
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1884
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1885
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1886
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2146
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2147
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2148
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2149
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
18872150 norm = cVector.Z;
18882151 break;
18892152 }
....@@ -1924,7 +2187,11 @@
19242187 shadow.material = new cMaterial(obj.material);
19252188 shadow.material.diffuse = 0.0001f;
19262189 shadow.material.specular = 0.0001f;
1927
- //shadow.projectedVertices[1].x = 300;
2190
+ shadow.material.opacity = 0.75f;
2191
+
2192
+ AllocProjectedVertices(shadow);
2193
+
2194
+ shadow.projectedVertices[1].x = 300;
19282195
19292196 makeSomething(shadow);
19302197 }
....@@ -2445,27 +2712,35 @@
24452712 } else
24462713 if (source == loopItem || source == loopButton)
24472714 {
2715
+ if (!group.selection.isEmpty())
2716
+ {
24482717 Composite csg = new GroupLeaf();
24492718 csg.count = 5;
2450
- group(csg);
24512719 Composite child = new cGroup("Branch");
24522720 csg.addChild(child);
24532721 child.addChild(csg);
2722
+ group(csg);
2723
+ }
24542724 } else
24552725 if (source == doubleItem)
24562726 {
2727
+ if (!group.selection.isEmpty())
2728
+ {
24572729 Composite csg = new GroupLeaf("Fork");
24582730 csg.count = 5;
2459
- group(csg);
24602731 Composite child = new cGroup("Branch A");
24612732 csg.addChild(child);
24622733 child.addChild(csg);
24632734 child = new cGroup("Branch B");
24642735 csg.addChild(child);
24652736 child.addChild(csg);
2737
+ group(csg);
2738
+ }
24662739 } else
24672740 if (source == tripleItem)
24682741 {
2742
+ if (!group.selection.isEmpty())
2743
+ {
24692744 Composite csg = new GroupLeaf("Trident");
24702745 csg.count = 4;
24712746 group(csg);
....@@ -2478,6 +2753,7 @@
24782753 child = new cGroup();
24792754 csg.addChild(child);
24802755 child.addChild(csg);
2756
+ }
24812757 } else
24822758 if (source == computeAOItem)
24832759 {
....@@ -2497,7 +2773,7 @@
24972773 if (source == invariantsItem)
24982774 {
24992775 System.out.println("Invariants:");
2500
- Grafreed.grafreeD.universe.invariants();
2776
+ Grafreed.grafreed.universe.invariants();
25012777 } else
25022778 if (source == memoryItem)
25032779 {
....@@ -2528,33 +2804,52 @@
25282804 {
25292805 ToggleFullScreen();
25302806 } else
2531
- if (source == undoButton)
2807
+ if (source == collapseButton)
2808
+ {
2809
+ this.expandedLayout = radio.layout;
2810
+ CollapseToolbar();
2811
+ } else
2812
+ if (source == maximize3DButton)
2813
+ {
2814
+ this.expandedLayout = radio.layout;
2815
+ radio.layout = twoButton;
2816
+ Show3DView();
2817
+ CollapseToolbar();
2818
+ } else
2819
+ if (source == previousVersionButton)
25322820 {
25332821 // Go to previous version
25342822 //if (!Undo())
25352823 //java.awt.Toolkit.getDefaultToolkit().beep();
2536
- Undo();
2824
+ PreviousVersion();
25372825 } else
25382826 if (source == restoreButton)
25392827 {
25402828 // Restore current version
25412829 Restore();
2830
+ //restoreButton.setEnabled(false);
25422831 } else
25432832 if (source == replaceButton)
25442833 {
25452834 // Overwrite current version
25462835 Replace();
2836
+ //replaceButton.setEnabled(false);
25472837 } else
2548
- if (source == redoButton)
2838
+ if (source == nextVersionButton)
25492839 {
25502840 // Go to next version
2551
- Redo();
2841
+ NextVersion();
25522842 } else
2553
- if (source == saveButton)
2843
+ if (source == saveVersionButton)
25542844 {
25552845 // Save a new version
25562846 if (!Save(true))
25572847 java.awt.Toolkit.getDefaultToolkit().beep();
2848
+ } else
2849
+ if (source == deleteVersionButton)
2850
+ {
2851
+ // Delete a new version
2852
+ DeleteVersion();
25582853 } else
25592854 if (source == oneStepButton)
25602855 {
....@@ -2609,11 +2904,11 @@
26092904 } else
26102905 if (source == undoItem)
26112906 {
2612
- Undo();
2907
+ PreviousVersion();
26132908 } else
26142909 if (source == redoItem)
26152910 {
2616
- Redo();
2911
+ NextVersion();
26172912 } else
26182913 if (source == duplicateItem)
26192914 {
....@@ -3094,22 +3389,34 @@
30943389 } else
30953390 if (source == ungroupItem || source == ungroupButton)
30963391 {
3097
- boolean hasRoot = false;
3392
+ boolean canUngroup = true;
30983393
30993394 for (int i=0; i<group.selection.size(); i++)
31003395 {
3101
- if (group.selection.get(i) == group)
3396
+ Object3D selectedItem = group.selection.get(i);
3397
+
3398
+ if (selectedItem.Size() == 0)
31023399 {
3103
- hasRoot = true;
3400
+ // Cannot ungroup leaves
3401
+ canUngroup = false;
3402
+ break;
3403
+ }
3404
+
3405
+ if (selectedItem == group)
3406
+ {
3407
+ // Cannot ungroup root
3408
+ canUngroup = false;
31043409 break;
31053410 }
31063411 }
31073412
3108
- if (!hasRoot)
3413
+ if (canUngroup)
31093414 {
31103415 for (int i=0; i<group.selection.size(); i++)
31113416 {
3112
- Ungroup(group.selection.get(i));
3417
+ Object3D selectedItem = group.selection.get(i);
3418
+
3419
+ Ungroup(selectedItem);
31133420 }
31143421
31153422 ClearSelection(false);
....@@ -3160,6 +3467,10 @@
31603467 if (source == clearMaterialsItem)
31613468 {
31623469 ClearMaterials();
3470
+ } else
3471
+ if (source == clearVersionsItem)
3472
+ {
3473
+ ClearVersions();
31633474 } else
31643475 if (source == liveleavesItem)
31653476 {
....@@ -3472,38 +3783,7 @@
34723783 if (CameraPane.FULLSCREEN)
34733784 fullscreenLayout = radio.layout;
34743785
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();
3786
+ Show3DView();
35073787
35083788 cameraView.requestFocusInWindow();
35093789
....@@ -3689,6 +3969,7 @@
36893969 } else
36903970 if (source == rootButton)
36913971 {
3972
+ Replace();
36923973 Object3D obj;
36933974 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
36943975 {
....@@ -3703,6 +3984,8 @@
37033984 if (source == closeButton)
37043985 {
37053986 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3987
+ Replace();
3988
+
37063989 cRadio ab;
37073990 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37083991 {
....@@ -3746,10 +4029,10 @@
37464029 {
37474030 Object3D child = (Object3D)e.nextElement();
37484031 if(child.editWindow != null)
3749
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37504032 child.pinned = false;
37514033 child.CloseUI();
37524034 listUI.remove(child);
4035
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37534036
37544037 //child.editWindow = null; // ???????????
37554038 }
....@@ -3768,6 +4051,7 @@
37684051 obj.CloseUI();
37694052 }
37704053 listUI.clear();
4054
+ SetPinStates(group.selection.size() > 0);
37714055 refreshContents(true);
37724056 } else
37734057 if (source == allParamsButton)
....@@ -3800,6 +4084,8 @@
38004084 } else
38014085 if(source instanceof cRadio)
38024086 {
4087
+ Replace();
4088
+
38034089 group.parent = keepparent;
38044090 group.attributes = 0;
38054091 //group.editWindow = null;
....@@ -3824,8 +4110,6 @@
38244110
38254111 copy = group;
38264112
3827
- SetUndoStates();
3828
-
38294113 //Globals.theRenderer.object = group;
38304114 if(!useclient)
38314115 {
....@@ -3853,7 +4137,33 @@
38534137 */
38544138 radio.layout.doClick();
38554139
4140
+ assert(copy instanceof Composite);
4141
+
4142
+ if (copy.versionlist == null)
4143
+ {
4144
+ copy.versionindex = -1;
4145
+
4146
+ // Cannot work with loops
4147
+ // To fix this issue, we first mark all nodes above the root,
4148
+ // and check if any of these nodes are reachable below the root.
4149
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4150
+
4151
+ if (copy.versionlist == null && !copy.HasTags())
4152
+ {
4153
+ copy.versionlist = new Object3D[100];
4154
+
4155
+ //Save(true);
4156
+ }
4157
+ else
4158
+ copy.versionindex = -2;
4159
+
4160
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4161
+ }
4162
+
4163
+ SetVersionStates();
4164
+
38564165 ClearUnpinned();
4166
+
38574167 //Grafreed.Assert(group != null);
38584168 //Grafreed.Assert(group.selection != null);
38594169 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3870,11 +4180,13 @@
38704180 } else if (event.getSource() == editCameraItem)
38714181 {
38724182 cameraView.ProtectCamera();
4183
+ cameraView.requestFocusInWindow();
38734184 cameraView.repaint();
38744185 return;
38754186 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
38764187 {
38774188 cameraView.RevertCamera();
4189
+ cameraView.requestFocusInWindow();
38784190 cameraView.repaint();
38794191 return;
38804192 // } else if (event.getSource() == textureButton)
....@@ -3993,7 +4305,7 @@
39934305 TouchTransform(obj);
39944306 continue;
39954307 }
3996
- if ((mask&2) != 0) // Scale
4308
+ if ((mask&2) != 0) // Scale/rotation
39974309 {
39984310 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
39994311 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4001,10 +4313,6 @@
40014313 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
40024314 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
40034315 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4004
- }
4005
- if ((mask&4) != 0) // Rotation
4006
- {
4007
- // ?
40084316 }
40094317 if ((mask&1) != 0) // Translation
40104318 {
....@@ -4813,6 +5121,12 @@
48135121 refreshContents();
48145122 }
48155123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
48165130 void FlipV(boolean flip)
48175131 {
48185132 group.selection.FlipV(flip);
....@@ -5007,9 +5321,7 @@
50075321
50085322 freezemodel = false;
50095323 }
5010
-
5011
- boolean flashIt = true;
5012
-
5324
+
50135325 public void valueChanged(TreeSelectionEvent e)
50145326 //public boolean handleEvent(Event event)
50155327 {
....@@ -5082,13 +5394,31 @@
50825394 {
50835395 editButton.setEnabled(enabled);
50845396 uneditButton.setEnabled(enabled);
5085
- unselectButton.setEnabled(enabled);
5397
+ //unselectButton.setEnabled(enabled);
50865398 flashSelectionButton.setEnabled(enabled);
5399
+
5400
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5401
+
5402
+ boolean allComposites = true;
5403
+
5404
+ if (group.selection != null)
5405
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5406
+ {
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5409
+ {
5410
+ allComposites = false;
5411
+ break;
5412
+ }
5413
+ }
5414
+
5415
+ rootButton.setEnabled(allComposites);
50875416 }
50885417
50895418 void refreshContents(boolean cp)
50905419 {
5091
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5420
+ if (Globals.ADVANCED)
5421
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
50925422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
50935423 {
50945424 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5098,7 +5428,7 @@
50985428 Object3D child = (Object3D) group.selection.get(i);
50995429
51005430 objEditor.AddInfo(child, this, true);
5101
- System.err.println("info : " + child.GetPath());
5431
+// System.err.println("info : " + child.GetPath());
51025432 }
51035433
51045434 objEditor.SetText(); // jan 2014
....@@ -5924,7 +6254,6 @@
59246254
59256255 cButton restoreCameraButton;
59266256
5927
- cButton saveButton;
59286257 cButton oneStepButton;
59296258
59306259 cButton groupButton;
....@@ -5982,11 +6311,11 @@
59826311 private MenuItem lookAtItem;
59836312 private MenuItem lookFromItem;
59846313 private MenuItem switchViewItem;
5985
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
59866315 private MenuItem undoItem;
59876316 private MenuItem redoItem;
59886317 private JMenuItem duplicateItem;
5989
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
59906319 private MenuItem cloneSupportItem;
59916320 private MenuItem overwriteGeoItem;
59926321 private MenuItem overwriteMatItem;
....@@ -6007,13 +6336,13 @@
60076336 private MenuItem cloneGeometriesItem;
60086337 private MenuItem shareGeometriesItem;
60096338 private MenuItem mergeGeometriesItem;
6010
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
60116340 private MenuItem pasteItem;
6012
- private MenuItem pasteIntoItem;
6013
- private MenuItem pasteLinkItem;
6014
- private MenuItem pasteCloneItem;
6015
- private MenuItem pasteExpandItem;
6016
- private MenuItem deleteItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
60176346 private MenuItem clearAllItem;
60186347 private MenuItem genUVItem;
60196348 private MenuItem genNormalsMESHItem;
....@@ -6039,6 +6368,7 @@
60396368 private MenuItem clipMeshItem;
60406369 private MenuItem smoothMeshItem;
60416370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
60426372
60436373 private MenuItem liveleavesItem;
60446374 private MenuItem unliveleavesItem;
....@@ -6068,7 +6398,7 @@
60686398 private MenuItem transformGeometryItem;
60696399 private MenuItem transformChildrenItem;
60706400 private MenuItem hideItem;
6071
- private MenuItem grabItem;
6401
+ private JMenuItem grabItem;
60726402 private MenuItem backItem;
60736403 private MenuItem frontItem;
60746404 private MenuItem cameraItem;
....@@ -6081,7 +6411,7 @@
60816411 private MenuItem switchTransfoItem;
60826412 private MenuItem morphItem;
60836413 private MenuItem linkerItem;
6084
- private MenuItem ungroupItem;
6414
+ private JMenuItem ungroupItem;
60856415 private MenuItem editItem;
60866416 private MenuItem openWindowItem;
60876417 private MenuItem editLeafItem;