Normand Briere
2019-08-18 66aca73cce89e4b4d7521862760edf4b0888bc38
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
- cameraView.skyboxname = name;
256
- cameraView.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();
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,10 +415,14 @@
294415 this.copy = this.group = group;
295416 //selectees = this.group.selectees;
296417
297
- if (copy.versions == null)
418
+ assert(false);
419
+
420
+ if (copy.versionlist == null)
298421 {
299
- copy.versions = new byte[100][];
422
+ copy.versionlist = new Object3D[100];
300423 copy.versionindex = -1;
424
+
425
+ //Save(true);
301426 }
302427
303428 if(ui)
....@@ -321,12 +446,12 @@
321446
322447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
323448
324
- if (copy.versions == null)
449
+ if (copy.versionlist == null)
325450 {
326
- copy.versions = new byte[100][];
451
+ copy.versionlist = new Object3D[100];
327452 copy.versionindex = -1;
328453
329
- Save(true);
454
+ //Save(true);
330455 }
331456 }
332457
....@@ -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 //
....@@ -725,9 +857,9 @@
725857 hideleavesItem.addActionListener(this);
726858 showleavesItem = menu.add(new MenuItem("Show Leaves"));
727859 showleavesItem.addActionListener(this);
728
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
860
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
729861 markleavesItem.addActionListener(this);
730
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
862
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
731863 unmarkleavesItem.addActionListener(this);
732864 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
733865 rewindleavesItem.addActionListener(this);
....@@ -781,6 +913,9 @@
781913 shareGeometriesItem.addActionListener(this);
782914 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
783915 mergeGeometriesItem.addActionListener(this);
916
+ menu.add("-");
917
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
918
+ editLeafItem.addActionListener(this);
784919 if (Globals.ADVANCED)
785920 {
786921 // Pretty much the same as duplicate and clone.
....@@ -797,6 +932,74 @@
797932 buildToolsMenu(menu);
798933 }
799934
935
+ JTabbedPane resourcecontainer;
936
+ cGridBag currenttab;
937
+ //boolean added; // patch for jar
938
+
939
+ int tabcount = 0;
940
+ int colcount = 0;
941
+ int rowcount = 0;
942
+ int texturecount = 0;
943
+
944
+ int columns = 5;
945
+ int rows = 7;
946
+
947
+ public void ResourceCallBack(String[] path)
948
+ {
949
+// for (int i = 0; i < path.length; i++)
950
+// System.out.print(path[i] + "/");
951
+// System.out.println();
952
+
953
+ if (//rowcount == 0 ||
954
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
955
+ {
956
+ currenttab = new cGridBag();
957
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
958
+ currenttab.setName(tabname);
959
+ //added = false;
960
+ resourcecontainer.add(currenttab);
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
962
+ rowcount = 1;
963
+ colcount = 0;
964
+ texturecount = 0;
965
+ }
966
+
967
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
968
+ {
969
+ //if (!added)
970
+ {
971
+ //added = true;
972
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
973
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
974
+ }
975
+
976
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
977
+
978
+ if (++colcount >= columns)
979
+ {
980
+ colcount = 0;
981
+ currenttab.Return();
982
+
983
+ if (rowcount++ >= rows)
984
+ {
985
+ rowcount = 0;
986
+ }
987
+ }
988
+ }
989
+ else
990
+ {
991
+// if (!path[path.length-1].equals("icons"))
992
+// resourcecontainer.Return();
993
+ }
994
+ }
995
+
996
+ void CreateTexturePanel(cGridBag container)
997
+ {
998
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
999
+ container.add(resourcecontainer);
1000
+
1001
+ Grafreed.ParseResources("textures", this);
1002
+ }
8001003
8011004 void SetupUI2(ObjEditor oe)
8021005 {
....@@ -815,11 +1018,6 @@
8151018 //new Exception().printStackTrace();
8161019
8171020 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;
8231021 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8241022
8251023 oe.buttonGroup = new ButtonGroup();
....@@ -840,9 +1038,9 @@
8401038 oe.radioPanel.add(dummyButton);
8411039 oe.buttonGroup.add(dummyButton);
8421040 */
843
- cGridBag copyOptionsPanel = new cGridBag();
1041
+ cGridBag versionManagerPanel = new cGridBag();
8441042
845
- copyOptionsPanel.preferredHeight = 2;
1043
+ versionManagerPanel.preferredHeight = 4;
8461044
8471045 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
8481046
....@@ -852,58 +1050,102 @@
8521050
8531051 if (Globals.ADVANCED)
8541052 {
855
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
856
- maxButton.setToolTipText("Maximize window");
857
- maxButton.addActionListener(this);
1053
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+// maxButton.setToolTipText("Maximize window");
1055
+// maxButton.addActionListener(this);
8581056 }
8591057
860
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ cButton gcButton;
1059
+
1060
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+// gcButton.setToolTipText("Garbage collect");
1062
+// gcButton.addActionListener(new ActionListener()
1063
+// {
1064
+// public void actionPerformed(ActionEvent e)
1065
+// {
1066
+// System.gc();
1067
+// }
1068
+// });
1069
+
1070
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1071
+ collapseButton.setToolTipText("Collapse toolbar");
1072
+ collapseButton.addActionListener(this);
1073
+
1074
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ maximize3DButton.setToolTipText("Maximize 3D view");
1076
+ maximize3DButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1079
+ twoButton.setToolTipText("Show 3D view only");
1080
+ twoButton.addActionListener(this);
1081
+ this.fullscreenLayout = twoButton;
1082
+
1083
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1084
+ threeButton.setToolTipText("Show controls and 3D view");
1085
+ threeButton.addActionListener(this);
1086
+ if (Globals.ADVANCED)
1087
+ {
1088
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1089
+ sixButton.setToolTipText("Show 3D view and controls");
1090
+ sixButton.addActionListener(this);
1091
+ }
1092
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+// sevenButton.setToolTipText("3-column layout");
1094
+// sevenButton.addActionListener(this);
1095
+ //
1096
+
1097
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8611098 fullButton.setToolTipText("Full-screen window");
8621099 fullButton.addActionListener(this);
8631100
864
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8651102 screenfitButton.setToolTipText("Screen fit");
8661103 screenfitButton.addActionListener(this);
8671104
868
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8691106 restoreCameraButton.setToolTipText("Restore viewpoint");
8701107 restoreCameraButton.addActionListener(this);
8711108
872
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
- saveButton.setToolTipText("New version");
874
- saveButton.addActionListener(this);
1109
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1110
+ saveVersionButton.setToolTipText("Duplicate current version");
1111
+ saveVersionButton.addActionListener(this);
8751112
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);
1113
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1114
+ deleteVersionButton.setToolTipText("Delete current version");
1115
+ deleteVersionButton.addActionListener(this);
1116
+ deleteVersionButton.setEnabled(false);
1117
+
1118
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1119
+ previousVersionButton.setToolTipText("Previous version");
1120
+ previousVersionButton.addActionListener(this);
1121
+ previousVersionButton.setEnabled(false);
8801122
8811123 cGridBag updown = new cGridBag().setVertical(true);
882
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
883
- restoreButton.setToolTipText("Restore current");
1124
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1125
+ restoreButton.setToolTipText("Undo (restore current version)");
8841126 restoreButton.addActionListener(this);
8851127 restoreButton.setEnabled(false);
8861128
887
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
888
- replaceButton.setToolTipText("Replace current");
1129
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1130
+ replaceButton.setToolTipText("Save (replace current version)");
8891131 replaceButton.addActionListener(this);
8901132 replaceButton.setEnabled(false);
8911133
892
- copyOptionsPanel.add(updown);
1134
+ versionManagerPanel.add(updown);
8931135
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);
1136
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1137
+ nextVersionButton.setToolTipText("Next version");
1138
+ nextVersionButton.addActionListener(this);
1139
+ nextVersionButton.setEnabled(false);
1140
+
1141
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1142
+ oneStepButton.setToolTipText("Animate one step forward");
1143
+ oneStepButton.addActionListener(this);
8981144
8991145 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
9001146 liveCB.setToolTipText("Enable animation");
9011147 liveCB.addItemListener(this);
9021148
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
-
9071149 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9081150 fastCB.setToolTipText("Fast mode");
9091151 fastCB.addItemListener(this);
....@@ -919,38 +1161,23 @@
9191161
9201162 if (Globals.ADVANCED)
9211163 {
922
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9231165 snapobjectButton.addActionListener(this);
9241166 snapobjectButton.setToolTipText("Snap Object");
9251167
926
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9271169 fourButton.addActionListener(this);
9281170 fourButton.setToolTipText("Show control panel only");
9291171 }
9301172
9311173 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9321174
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
- //
9481175
949
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9501177 rootButton.setToolTipText("Open selection in new tab");
9511178 rootButton.addActionListener(this);
9521179
953
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9541181 closeButton.setToolTipText("Close tab");
9551182 closeButton.addActionListener(this);
9561183 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -959,38 +1186,38 @@
9591186 cGridBag row1 = new cGridBag();
9601187
9611188 // INSERT
962
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
- gridButton.setToolTipText("Create grid");
1189
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1190
+ gridButton.setToolTipText("Create ground");
9641191 gridButton.addActionListener(this);
9651192
966
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9671194 boxButton.setToolTipText("Create box");
9681195 boxButton.addActionListener(this);
9691196
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);
1197
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9831198 superButton.setToolTipText("Create superellipsoid");
9841199 superButton.addActionListener(this);
9851200
1201
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1202
+ sphereButton.setToolTipText("Create sphere");
1203
+ sphereButton.addActionListener(this);
1204
+
1205
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ coneButton.setToolTipText("Create cone");
1207
+ coneButton.addActionListener(this);
1208
+
1209
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ torusButton.setToolTipText("Create torus");
1211
+ torusButton.addActionListener(this);
1212
+
9861213 if (Globals.ADVANCED)
9871214 {
988
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9891216 kleinButton.setToolTipText("Create Klein bottle");
9901217 kleinButton.addActionListener(this);
9911218 }
9921219
993
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9941221 particlesButton.setToolTipText("Create particle system");
9951222 particlesButton.addActionListener(this);
9961223
....@@ -998,71 +1225,70 @@
9981225
9991226 cGridBag row2 = new cGridBag();
10001227
1001
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10021229 groupButton.setToolTipText("Create group");
10031230 groupButton.addActionListener(this);
10041231
1005
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10061233 compositeButton.setToolTipText("Create composite");
10071234 compositeButton.addActionListener(this);
10081235
1009
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10101237 switchButton.setToolTipText("Create item switcher");
10111238 switchButton.addActionListener(this);
10121239
1013
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10141241 loopButton.setToolTipText("Create loop");
10151242 loopButton.addActionListener(this);
10161243
1017
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10181245 textureButton.setToolTipText("Create texture");
10191246 textureButton.addActionListener(this);
10201247
1021
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10221249 overlayButton.setToolTipText("Create overlay");
10231250 overlayButton.addActionListener(this);
10241251
1025
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10261253 lightButton.setToolTipText("Create light");
10271254 lightButton.addActionListener(this);
10281255
10291256 oe.toolboxPanel.add(row2);
10301257
1031
- // ENVYMAPS
1032
- cGridBag skyboxpane = new cGridBag();
1033
- skyboxpane.preferredHeight = 100;
1258
+ cGridBag textures = new cGridBag();
10341259
1035
- oe.toolboxPanel.add(skyboxpane);
1260
+ CreateTexturePanel(textures);
10361261
1037
- JTabbedPane skyboxpanel = new JTabbedPane();
1038
- skyboxpane.add(skyboxpanel);
1262
+ resourcecontainer.setSelectedIndex((int)(Math.random() * resourcecontainer.getTabCount()));
10391263
1040
- AddSkyboxTab0(skyboxpanel);
1041
- AddSkyboxTab1(skyboxpanel);
1042
- AddSkyboxTab2(skyboxpanel);
1264
+ oe.toolboxPanel.add(textures);
1265
+
1266
+ textures.preferredHeight = 100;
1267
+
1268
+ CreateSkyboxPanel(oe.skyboxPanel);
10431269
10441270 // EDIT panel
1045
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1271
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10461272 editButton.setToolTipText("Pin selection controls");
10471273 editButton.addActionListener(this);
10481274
1049
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
- uneditButton.setToolTipText("Remove selection controls");
1275
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1276
+ uneditButton.setToolTipText("Unpin and remove selection controls");
10511277 uneditButton.addActionListener(this);
10521278
10531279 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
- allParamsButton.setToolTipText("Show all controle");
1280
+ allParamsButton.setToolTipText("Show all controls");
10551281 allParamsButton.addActionListener(this);
10561282
1057
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
- clearPanelButton.setToolTipText("Clear edit panel");
1283
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1284
+ clearPanelButton.setToolTipText("Clear all controls");
10591285 clearPanelButton.addActionListener(this);
10601286
1061
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
- unselectButton.setToolTipText("Unselect");
1063
- unselectButton.addActionListener(this);
1287
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1288
+ //unselectButton.setToolTipText("Unselect");
1289
+ //unselectButton.addActionListener(this);
10641290
1065
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1291
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10661292 flashSelectionButton.setToolTipText("Highlight selection");
10671293 flashSelectionButton.addActionListener(this);
10681294
....@@ -1085,6 +1311,8 @@
10851311
10861312 cGridBag jSPPanel = new cGridBag();
10871313
1314
+ jSPPanel.preferredHeight = 20;
1315
+
10881316 JScrollPane jSP;
10891317 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
10901318 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1093,11 +1321,11 @@
10931321 oe.treePanel.add(jSPPanel);
10941322 oe.treePanel.Return();
10951323
1096
- oe.treePanel.add(copyOptionsPanel);
1324
+ oe.treePanel.add(versionManagerPanel);
10971325 oe.treePanel.Return();
1098
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
- sliderPane.preferredHeight = 1;
1326
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1327
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1328
+ versionSliderPane.preferredHeight = 3;
11011329
11021330 // mainPanel.setDividerLocation(0.1); //1.0);
11031331 mainPanel.setResizeWeight(0.4);
....@@ -1120,7 +1348,7 @@
11201348 dgr.addDragGestureListener(this);
11211349 }catch(Exception e) {}
11221350 */
1123
- radio.layout = sixButton; // sevenButton;
1351
+ radio.layout = threeButton; // sixButton;
11241352 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11251353 }
11261354
....@@ -1171,9 +1399,12 @@
11711399 smoothCB.setToolTipText("Snapping delay");
11721400 smoothCB.addItemListener(this);
11731401
1174
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1175
- slowCB.setToolTipText("Smooth interpolation");
1176
- slowCB.addItemListener(this);
1402
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1403
+// slowCB.setToolTipText("Smooth interpolation");
1404
+// slowCB.addItemListener(this);
1405
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1406
+ minshaderCB.setToolTipText("Minimal fast shader");
1407
+ minshaderCB.addItemListener(this);
11771408
11781409 // constraints.gridy += 1;
11791410 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1252,6 +1483,14 @@
12521483
12531484 void EditObject(Object3D obj)
12541485 {
1486
+ assert(obj instanceof Composite);
1487
+
1488
+// if (obj.versionlist == null)
1489
+// {
1490
+// obj.versionlist = new Object3D[100];
1491
+// obj.versionindex = -1;
1492
+// }
1493
+
12551494 cRadio radioButton = new cRadio(obj.name);
12561495
12571496 // June 2019. Patch to avoid bug with transparency.
....@@ -1262,7 +1501,7 @@
12621501 }
12631502
12641503 radioButton.SetObject(obj);
1265
- radioButton.layout = sixButton; // sevenButton;
1504
+ radioButton.layout = threeButton; // sixButton;
12661505 radioButton.SetCamera(cameraView.renderCamera, false);
12671506 radioButton.addActionListener(this);
12681507 radioPanel.add(radioButton);
....@@ -1276,6 +1515,7 @@
12761515
12771516 oe.SetupViews();
12781517
1518
+ if (Globals.DEBUG)
12791519 System.out.println("SetupViews");
12801520 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
12811521 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1287,6 +1527,8 @@
12871527 cCheckBox localCB;
12881528 cCheckBox crowdCB;
12891529 cCheckBox smoothCB;
1530
+ cCheckBox minshaderCB;
1531
+
12901532 cToggleButton fastCB;
12911533 cCheckBox slowCB;
12921534 cCheckBox boxCB;
....@@ -1357,6 +1599,12 @@
13571599 {
13581600 cameraView.ToggleInertia();
13591601 cameraView.repaint();
1602
+ }
1603
+ else if(e.getSource() == minshaderCB)
1604
+ {
1605
+ Globals.MINSHADER ^= true;
1606
+ cameraView.programInitialized = false;
1607
+ cameraView.repaint();
13601608 }
13611609 else if(e.getSource() == localCB)
13621610 {
....@@ -1634,7 +1882,12 @@
16341882 TreePath path;
16351883
16361884 public TransferableTreePath(TreePath tp) {
1637
- path = tp;
1885
+ Object[] objs = new Object[tp.getPathCount()];
1886
+ for (int i=0; i<objs.length; i++)
1887
+ {
1888
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1889
+ }
1890
+ path = new TreePath(objs);
16381891 }
16391892
16401893 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1924,7 +2177,11 @@
19242177 shadow.material = new cMaterial(obj.material);
19252178 shadow.material.diffuse = 0.0001f;
19262179 shadow.material.specular = 0.0001f;
1927
- //shadow.projectedVertices[1].x = 300;
2180
+ shadow.material.opacity = 0.75f;
2181
+
2182
+ AllocProjectedVertices(shadow);
2183
+
2184
+ shadow.projectedVertices[1].x = 300;
19282185
19292186 makeSomething(shadow);
19302187 }
....@@ -2445,27 +2702,35 @@
24452702 } else
24462703 if (source == loopItem || source == loopButton)
24472704 {
2705
+ if (!group.selection.isEmpty())
2706
+ {
24482707 Composite csg = new GroupLeaf();
24492708 csg.count = 5;
2450
- group(csg);
24512709 Composite child = new cGroup("Branch");
24522710 csg.addChild(child);
24532711 child.addChild(csg);
2712
+ group(csg);
2713
+ }
24542714 } else
24552715 if (source == doubleItem)
24562716 {
2717
+ if (!group.selection.isEmpty())
2718
+ {
24572719 Composite csg = new GroupLeaf("Fork");
24582720 csg.count = 5;
2459
- group(csg);
24602721 Composite child = new cGroup("Branch A");
24612722 csg.addChild(child);
24622723 child.addChild(csg);
24632724 child = new cGroup("Branch B");
24642725 csg.addChild(child);
24652726 child.addChild(csg);
2727
+ group(csg);
2728
+ }
24662729 } else
24672730 if (source == tripleItem)
24682731 {
2732
+ if (!group.selection.isEmpty())
2733
+ {
24692734 Composite csg = new GroupLeaf("Trident");
24702735 csg.count = 4;
24712736 group(csg);
....@@ -2478,6 +2743,7 @@
24782743 child = new cGroup();
24792744 csg.addChild(child);
24802745 child.addChild(csg);
2746
+ }
24812747 } else
24822748 if (source == computeAOItem)
24832749 {
....@@ -2497,7 +2763,7 @@
24972763 if (source == invariantsItem)
24982764 {
24992765 System.out.println("Invariants:");
2500
- Grafreed.grafreeD.universe.invariants();
2766
+ Grafreed.grafreed.universe.invariants();
25012767 } else
25022768 if (source == memoryItem)
25032769 {
....@@ -2528,33 +2794,52 @@
25282794 {
25292795 ToggleFullScreen();
25302796 } else
2531
- if (source == undoButton)
2797
+ if (source == collapseButton)
2798
+ {
2799
+ this.expandedLayout = radio.layout;
2800
+ CollapseToolbar();
2801
+ } else
2802
+ if (source == maximize3DButton)
2803
+ {
2804
+ this.expandedLayout = radio.layout;
2805
+ radio.layout = twoButton;
2806
+ Show3DView();
2807
+ CollapseToolbar();
2808
+ } else
2809
+ if (source == previousVersionButton)
25322810 {
25332811 // Go to previous version
25342812 //if (!Undo())
25352813 //java.awt.Toolkit.getDefaultToolkit().beep();
2536
- Undo();
2814
+ PreviousVersion();
25372815 } else
25382816 if (source == restoreButton)
25392817 {
25402818 // Restore current version
25412819 Restore();
2820
+ //restoreButton.setEnabled(false);
25422821 } else
25432822 if (source == replaceButton)
25442823 {
25452824 // Overwrite current version
25462825 Replace();
2826
+ //replaceButton.setEnabled(false);
25472827 } else
2548
- if (source == redoButton)
2828
+ if (source == nextVersionButton)
25492829 {
25502830 // Go to next version
2551
- Redo();
2831
+ NextVersion();
25522832 } else
2553
- if (source == saveButton)
2833
+ if (source == saveVersionButton)
25542834 {
25552835 // Save a new version
25562836 if (!Save(true))
25572837 java.awt.Toolkit.getDefaultToolkit().beep();
2838
+ } else
2839
+ if (source == deleteVersionButton)
2840
+ {
2841
+ // Delete a new version
2842
+ DeleteVersion();
25582843 } else
25592844 if (source == oneStepButton)
25602845 {
....@@ -2609,11 +2894,11 @@
26092894 } else
26102895 if (source == undoItem)
26112896 {
2612
- Undo();
2897
+ PreviousVersion();
26132898 } else
26142899 if (source == redoItem)
26152900 {
2616
- Redo();
2901
+ NextVersion();
26172902 } else
26182903 if (source == duplicateItem)
26192904 {
....@@ -3094,22 +3379,34 @@
30943379 } else
30953380 if (source == ungroupItem || source == ungroupButton)
30963381 {
3097
- boolean hasRoot = false;
3382
+ boolean canUngroup = true;
30983383
30993384 for (int i=0; i<group.selection.size(); i++)
31003385 {
3101
- if (group.selection.get(i) == group)
3386
+ Object3D selectedItem = group.selection.get(i);
3387
+
3388
+ if (selectedItem.Size() == 0)
31023389 {
3103
- hasRoot = true;
3390
+ // Cannot ungroup leaves
3391
+ canUngroup = false;
3392
+ break;
3393
+ }
3394
+
3395
+ if (selectedItem == group)
3396
+ {
3397
+ // Cannot ungroup root
3398
+ canUngroup = false;
31043399 break;
31053400 }
31063401 }
31073402
3108
- if (!hasRoot)
3403
+ if (canUngroup)
31093404 {
31103405 for (int i=0; i<group.selection.size(); i++)
31113406 {
3112
- Ungroup(group.selection.get(i));
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ Ungroup(selectedItem);
31133410 }
31143411
31153412 ClearSelection(false);
....@@ -3472,38 +3769,7 @@
34723769 if (CameraPane.FULLSCREEN)
34733770 fullscreenLayout = radio.layout;
34743771
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();
3772
+ Show3DView();
35073773
35083774 cameraView.requestFocusInWindow();
35093775
....@@ -3689,6 +3955,7 @@
36893955 } else
36903956 if (source == rootButton)
36913957 {
3958
+ Replace();
36923959 Object3D obj;
36933960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
36943961 {
....@@ -3703,6 +3970,8 @@
37033970 if (source == closeButton)
37043971 {
37053972 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3973
+ Replace();
3974
+
37063975 cRadio ab;
37073976 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37083977 {
....@@ -3746,10 +4015,10 @@
37464015 {
37474016 Object3D child = (Object3D)e.nextElement();
37484017 if(child.editWindow != null)
3749
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37504018 child.pinned = false;
37514019 child.CloseUI();
37524020 listUI.remove(child);
4021
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37534022
37544023 //child.editWindow = null; // ???????????
37554024 }
....@@ -3768,6 +4037,7 @@
37684037 obj.CloseUI();
37694038 }
37704039 listUI.clear();
4040
+ SetPinStates(group.selection.size() > 0);
37714041 refreshContents(true);
37724042 } else
37734043 if (source == allParamsButton)
....@@ -3800,6 +4070,8 @@
38004070 } else
38014071 if(source instanceof cRadio)
38024072 {
4073
+ Replace();
4074
+
38034075 group.parent = keepparent;
38044076 group.attributes = 0;
38054077 //group.editWindow = null;
....@@ -3824,8 +4096,6 @@
38244096
38254097 copy = group;
38264098
3827
- SetUndoStates();
3828
-
38294099 //Globals.theRenderer.object = group;
38304100 if(!useclient)
38314101 {
....@@ -3853,7 +4123,31 @@
38534123 */
38544124 radio.layout.doClick();
38554125
4126
+ assert(copy instanceof Composite);
4127
+
4128
+ if (copy.versionlist == null)
4129
+ {
4130
+ copy.versionindex = -1;
4131
+
4132
+ // Cannot work with loops
4133
+ // To fix this issue, we first mark all nodes above the root,
4134
+ // and check if any of these nodes are reachable below the root.
4135
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4136
+
4137
+ if (!copy.HasTags())
4138
+ {
4139
+ copy.versionlist = new Object3D[100];
4140
+
4141
+ Save(true);
4142
+ }
4143
+
4144
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4145
+ }
4146
+
4147
+ SetVersionStates();
4148
+
38564149 ClearUnpinned();
4150
+
38574151 //Grafreed.Assert(group != null);
38584152 //Grafreed.Assert(group.selection != null);
38594153 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3870,11 +4164,13 @@
38704164 } else if (event.getSource() == editCameraItem)
38714165 {
38724166 cameraView.ProtectCamera();
4167
+ cameraView.requestFocusInWindow();
38734168 cameraView.repaint();
38744169 return;
38754170 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
38764171 {
38774172 cameraView.RevertCamera();
4173
+ cameraView.requestFocusInWindow();
38784174 cameraView.repaint();
38794175 return;
38804176 // } else if (event.getSource() == textureButton)
....@@ -3993,7 +4289,7 @@
39934289 TouchTransform(obj);
39944290 continue;
39954291 }
3996
- if ((mask&2) != 0) // Scale
4292
+ if ((mask&2) != 0) // Scale/rotation
39974293 {
39984294 obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
39994295 obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
....@@ -4001,10 +4297,6 @@
40014297 obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
40024298 obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
40034299 obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4004
- }
4005
- if ((mask&4) != 0) // Rotation
4006
- {
4007
- // ?
40084300 }
40094301 if ((mask&1) != 0) // Translation
40104302 {
....@@ -5007,9 +5299,7 @@
50075299
50085300 freezemodel = false;
50095301 }
5010
-
5011
- boolean flashIt = true;
5012
-
5302
+
50135303 public void valueChanged(TreeSelectionEvent e)
50145304 //public boolean handleEvent(Event event)
50155305 {
....@@ -5082,13 +5372,31 @@
50825372 {
50835373 editButton.setEnabled(enabled);
50845374 uneditButton.setEnabled(enabled);
5085
- unselectButton.setEnabled(enabled);
5375
+ //unselectButton.setEnabled(enabled);
50865376 flashSelectionButton.setEnabled(enabled);
5377
+
5378
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5379
+
5380
+ boolean allComposites = true;
5381
+
5382
+ if (group.selection != null)
5383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5384
+ {
5385
+ Object next = e.nextElement();
5386
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5387
+ {
5388
+ allComposites = false;
5389
+ break;
5390
+ }
5391
+ }
5392
+
5393
+ rootButton.setEnabled(allComposites);
50875394 }
50885395
50895396 void refreshContents(boolean cp)
50905397 {
5091
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5398
+ if (Globals.ADVANCED)
5399
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
50925400 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
50935401 {
50945402 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5098,7 +5406,7 @@
50985406 Object3D child = (Object3D) group.selection.get(i);
50995407
51005408 objEditor.AddInfo(child, this, true);
5101
- System.err.println("info : " + child.GetPath());
5409
+// System.err.println("info : " + child.GetPath());
51025410 }
51035411
51045412 objEditor.SetText(); // jan 2014
....@@ -5924,7 +6232,6 @@
59246232
59256233 cButton restoreCameraButton;
59266234
5927
- cButton saveButton;
59286235 cButton oneStepButton;
59296236
59306237 cButton groupButton;
....@@ -5982,11 +6289,11 @@
59826289 private MenuItem lookAtItem;
59836290 private MenuItem lookFromItem;
59846291 private MenuItem switchViewItem;
5985
- private MenuItem cutItem;
6292
+ private JMenuItem cutItem;
59866293 private MenuItem undoItem;
59876294 private MenuItem redoItem;
59886295 private JMenuItem duplicateItem;
5989
- private MenuItem cloneItem;
6296
+ private JMenuItem cloneItem;
59906297 private MenuItem cloneSupportItem;
59916298 private MenuItem overwriteGeoItem;
59926299 private MenuItem overwriteMatItem;
....@@ -6007,13 +6314,13 @@
60076314 private MenuItem cloneGeometriesItem;
60086315 private MenuItem shareGeometriesItem;
60096316 private MenuItem mergeGeometriesItem;
6010
- private MenuItem copyItem;
6317
+ private JMenuItem copyItem;
60116318 private MenuItem pasteItem;
6012
- private MenuItem pasteIntoItem;
6013
- private MenuItem pasteLinkItem;
6014
- private MenuItem pasteCloneItem;
6015
- private MenuItem pasteExpandItem;
6016
- private MenuItem deleteItem;
6319
+ private JMenuItem pasteIntoItem;
6320
+ private JMenuItem pasteLinkItem;
6321
+ private JMenuItem pasteCloneItem;
6322
+ private JMenuItem pasteExpandItem;
6323
+ private JMenuItem deleteItem;
60176324 private MenuItem clearAllItem;
60186325 private MenuItem genUVItem;
60196326 private MenuItem genNormalsMESHItem;
....@@ -6068,7 +6375,7 @@
60686375 private MenuItem transformGeometryItem;
60696376 private MenuItem transformChildrenItem;
60706377 private MenuItem hideItem;
6071
- private MenuItem grabItem;
6378
+ private JMenuItem grabItem;
60726379 private MenuItem backItem;
60736380 private MenuItem frontItem;
60746381 private MenuItem cameraItem;
....@@ -6081,7 +6388,7 @@
60816388 private MenuItem switchTransfoItem;
60826389 private MenuItem morphItem;
60836390 private MenuItem linkerItem;
6084
- private MenuItem ungroupItem;
6391
+ private JMenuItem ungroupItem;
60856392 private MenuItem editItem;
60866393 private MenuItem openWindowItem;
60876394 private MenuItem editLeafItem;