Normand Briere
2019-09-20 cbe4e90105d07d7d3fecabffaa01342403aa2ae3
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 + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
- row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
- skyboxButton.setToolTipText(s);
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
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,12 +73,13 @@
5673 cGridBag row5 = new cGridBag();
5774 cGridBag row6 = new cGridBag();
5875
59
- AddSkyboxButton("default", "rgb", row0);
60
- AddSkyboxButton("default", "cornell", row0);
61
- AddSkyboxButton("default", "uffizi", row0);
62
- AddSkyboxButton("default", "CloudyHills", row0);
63
-
64
- AddSkyboxButton("default", "skycube", row1);
76
+ AddSkyboxButton("default", "", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
6583 AddSkyboxButton("bridge", "Bridge", row1);
6684 AddSkyboxButton("bridge", "Bridge2", row1);
6785 AddSkyboxButton("urban", "GamlaStan2", row1);
....@@ -73,23 +91,23 @@
7391
7492 AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
7593 AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
7695 AddSkyboxButton("park", "BerzeliiPark", row3);
77
- AddSkyboxButton("park", "Buddha", row3);
7896
97
+ AddSkyboxButton("park", "Buddha", row4);
7998 AddSkyboxButton("park", "CNTower2", row4);
8099 AddSkyboxButton("park", "NiagaraFalls1", row4);
81100 AddSkyboxButton("park", "NiagaraFalls3", row4);
82
- AddSkyboxButton("park", "Park", row4);
83101
102
+ AddSkyboxButton("park", "Park", row5);
84103 AddSkyboxButton("park", "Pond", row5);
85104 AddSkyboxButton("park", "Skansen", row5);
86105 AddSkyboxButton("park", "Skansen2", row5);
87
- AddSkyboxButton("park", "Skansen3", row5);
88106
107
+ AddSkyboxButton("park", "Skansen3", row6);
89108 AddSkyboxButton("park", "Skansen4", row6);
90109 AddSkyboxButton("park", "Skansen5", row6);
91
- AddSkyboxButton("park", "Stairs", row6);
92
- AddSkyboxButton("park", "Tantolunden4", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
93111
94112 tab0.add(row0);
95113 tab0.add(row1);
....@@ -140,24 +158,29 @@
140158 AddSkyboxButton("forest", "Langholmen2", row3);
141159 AddSkyboxButton("forest", "Plants", row3);
142160 AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
143162 AddSkyboxButton("mountain", "Maskonaive2", row4);
144
-
145163 AddSkyboxButton("mountain", "Maskonaive3", row4);
146
- AddSkyboxButton("mountain", "Ryfjallet", row4);
147
- AddSkyboxButton("mountain", "Teide", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
148166
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
149169 AddSkyboxButton("rocky", "Langholmen", row5);
150
- AddSkyboxButton("rocky", "Riddarfjarden", row5);
151170 AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
152172 AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
153176 /*
154
-Kastellholmen
155
-Langholmen
156
-Riddarfjarden
157
-Skinnarviksberget
158
-Tanto
159
-Tantolunden2
160
-Tantolunden6
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
161184 */
162185
163186 tab0.add(row0);
....@@ -197,39 +220,33 @@
197220
198221 AddSkyboxButton("urban", "CNTower", row1);
199222 AddSkyboxButton("bridge", "ArstaBridge", row1);
200
- AddSkyboxButton("indoors", "DallasW", row1);
201
- AddSkyboxButton("indoors", "MarriottMadisonWest", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
202225
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
203229 AddSkyboxButton("indoors", "Vasa", row2);
204
- AddSkyboxButton("winter", "Backyard", row2);
205
- AddSkyboxButton("winter", "Creek", row2);
206
- AddSkyboxButton("winter", "FootballField3", row2);
207230
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
208234 AddSkyboxButton("winter", "Forest", row3);
209
- AddSkyboxButton("winter", "HornstullsStrand2", row3);
210
- AddSkyboxButton("winter", "House", row3);
211
- AddSkyboxButton("winter", "IceLake", row3);
212235
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
213239 AddSkyboxButton("winter", "IceRiver", row4);
214
- AddSkyboxButton("winter", "Park3", row4);
215
- AddSkyboxButton("winter", "PondWinter", row4);
216240
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
217243 AddSkyboxButton("winter", "Tantolunden5", row5);
218244 AddSkyboxButton("winter", "Vindelalven", row5);
219
- /*
220
-Backyard
221
-Creek
222
-FootballField3
223
-Forest
224
-HornstullsStrand2
225
-House
226
-IceLake
227
-IceRiver
228
-Park3
229
-PondWinter
230
-Tantolunden5
231
-Vindelalven *
232
- */
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233250
234251 tab0.add(row0);
235252 tab0.add(row1);
....@@ -245,15 +262,112 @@
245262 //tab0.add(new cGridBag());
246263 }
247264 }
248
-
249
- public void ChangeSkybox(String name)
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250267 {
251
- cameraView.envyoff = false;
252
- cameraView.skyboxname = name;
253
- cameraView.skyboxext = "jpg";
254
- 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);
255358 }
256359
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
+
257371 //ObjEditor objEditor;
258372 public void closeUI2()
259373 {
....@@ -291,11 +405,15 @@
291405 this.copy = this.group = group;
292406 //selectees = this.group.selectees;
293407
294
- if (copy.versions == null)
295
- {
296
- copy.versions = new byte[100][];
297
- copy.versionindex = -1;
298
- }
408
+ assert(false);
409
+
410
+// if (copy.versionlist == null)
411
+// {
412
+// copy.versionlist = new Object3D[100];
413
+// copy.versionindex = -1;
414
+//
415
+// //Save(true);
416
+// }
299417
300418 if(ui)
301419 SetupUI(objEditor);
....@@ -318,13 +436,13 @@
318436
319437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
320438
321
- if (copy.versions == null)
322
- {
323
- copy.versions = new byte[100][];
324
- copy.versionindex = -1;
325
-
326
- Save(true);
327
- }
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
328446 }
329447
330448 void CloneSelection(boolean supports)
....@@ -365,11 +483,16 @@
365483
366484 Object3D parent = obj.parent;
367485 obj.parent = null;
486
+
368487 // Object3D support = obj.support;
369488 // obj.support = null;
370489 if (!supports)
371490 obj.SaveSupports();
491
+
372492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
373496 obj.parent = parent;
374497 // obj.support = support;
375498 // clone.support = support; // aout 2013
....@@ -414,33 +537,37 @@
414537 // menu.add("-");
415538 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
416539 duplicateItem.addActionListener(this);
417
- cloneItem = menu.add(new MenuItem("Clone"));
540
+
541
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
418542 cloneItem.addActionListener(this);
419
- if (Globals.ADVANCED)
543
+ //if (Globals.ADVANCED)
420544 {
421545 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
422546 cloneSupportItem.addActionListener(this);
423547 }
548
+ oe.jTree.popup.addSeparator();
424549 menu.add("-");
425
- cutItem = menu.add(new MenuItem("Cut"));
550
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
426551 cutItem.addActionListener(this);
427
- copyItem = menu.add(new MenuItem("Copy"));
552
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
428553 copyItem.addActionListener(this);
429554 pasteItem = menu.add(new MenuItem("Paste"));
430555 pasteItem.addActionListener(this);
431556
432
- menu.add("-");
433
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
557
+ oe.jTree.popup.addSeparator();
558
+ //menu.add("-");
559
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
434560 pasteIntoItem.addActionListener(this);
435
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
561
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
436562 pasteLinkItem.addActionListener(this);
437
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
563
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
438564 pasteCloneItem.addActionListener(this);
439
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
440
-// pasteExpandItem.addActionListener(this);
441
- menu.add("-");
442
- deleteItem = menu.add(new MenuItem("Delete"));
443
- deleteItem.addActionListener(this);
565
+// CRASH
566
+ pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
567
+//
568
+ pasteExpandItem.addActionListener(this);
569
+ //menu.add("-");
570
+ oe.jTree.popup.addSeparator();
444571
445572 if (Globals.ADVANCED)
446573 {
....@@ -526,11 +653,9 @@
526653 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
527654 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
528655 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
529
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
530656 oe.cameraMenu.add("-");
531657 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
532658 openWindowItem.addActionListener(this);
533
- editLeafItem.addActionListener(this);
534659 lookAtItem.addActionListener(this);
535660 //lookFromItem.addActinoListener(this);
536661 //switchViewItem.addActionListener(this);
....@@ -577,9 +702,8 @@
577702 setMasterItem.addActionListener(this);
578703 }
579704
580
- oe.menuBar.add(menu = new Menu("Group"));
581
-// grabItem = menu.add(new MenuItem("Grab"));
582
-// grabItem.addActionListener(this);
705
+ oe.menuBar.add(menu = new Menu("Order"));
706
+
583707 backItem = menu.add(new MenuItem("Back"));
584708 backItem.addActionListener(this);
585709 frontItem = menu.add(new MenuItem("Front"));
....@@ -587,13 +711,21 @@
587711 // compositeItem = menu.add(new MenuItem("Composite"));
588712 // compositeItem.addActionListener(this);
589713
714
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
715
+ grabItem.addActionListener(this);
716
+
590717 if (Globals.ADVANCED)
591718 {
592719 hideItem = menu.add(new MenuItem("Hidden Group"));
593720 hideItem.addActionListener(this);
594721 }
595
- ungroupItem = menu.add(new MenuItem("Ungroup"));
722
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
596723 ungroupItem.addActionListener(this);
724
+
725
+ oe.jTree.popup.addSeparator();
726
+
727
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
728
+ deleteItem.addActionListener(this);
597729
598730 // menu.add("-");
599731 //
....@@ -630,9 +762,9 @@
630762 shadowYItem.addActionListener(this);
631763 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
632764 shadowZItem.addActionListener(this);
765
+
633766 attributeItem = menu.add(new MenuItem("Attribute"));
634767 attributeItem.addActionListener(this);
635
-
636768 if (Globals.ADVANCED)
637769 {
638770 menu.add("-");
....@@ -644,11 +776,18 @@
644776 pointflowItem.addActionListener(this);
645777 }
646778 menu.add("-");
779
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
780
+ textureRatioRItem.addActionListener(this);
781
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
782
+ textureRatioGItem.addActionListener(this);
783
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
784
+ textureRatioBItem.addActionListener(this);
785
+ menu.add("-");
647786 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
648787 resetTransformItem.addActionListener(this);
649788 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
650789 resetCentroidItem.addActionListener(this);
651
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
790
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
652791 resetCentroidXZItem.addActionListener(this);
653792 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
654793 transformGeometryItem.addActionListener(this);
....@@ -664,7 +803,7 @@
664803 genNormalsCADItem.addActionListener(this);
665804 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
666805 genNormalsMESHItem.addActionListener(this);
667
- if (Globals.ADVANCED)
806
+ //if (Globals.ADVANCED)
668807 {
669808 genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
670809 genNormalsMINEItem.addActionListener(this);
....@@ -700,6 +839,8 @@
700839 }
701840
702841 oe.menuBar.add(menu = new Menu("Attributes"));
842
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
843
+ clearVersionsItem.addActionListener(this);
703844 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
704845 clearMaterialsItem.addActionListener(this);
705846 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -722,9 +863,9 @@
722863 hideleavesItem.addActionListener(this);
723864 showleavesItem = menu.add(new MenuItem("Show Leaves"));
724865 showleavesItem.addActionListener(this);
725
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
866
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
726867 markleavesItem.addActionListener(this);
727
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
868
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
728869 unmarkleavesItem.addActionListener(this);
729870 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
730871 rewindleavesItem.addActionListener(this);
....@@ -778,6 +919,9 @@
778919 shareGeometriesItem.addActionListener(this);
779920 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
780921 mergeGeometriesItem.addActionListener(this);
922
+ menu.add("-");
923
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
924
+ editLeafItem.addActionListener(this);
781925 if (Globals.ADVANCED)
782926 {
783927 // Pretty much the same as duplicate and clone.
....@@ -794,6 +938,84 @@
794938 buildToolsMenu(menu);
795939 }
796940
941
+ JTabbedPane resourcecontainer;
942
+ cGridBag currenttab;
943
+ //boolean added; // patch for jar
944
+
945
+ int totalcount = 0;
946
+
947
+ int tabcount = 0;
948
+ int colcount = 0;
949
+ int rowcount = 0;
950
+ int texturecount = 0;
951
+
952
+ int columns = 5;
953
+ int rows = 7;
954
+
955
+ public void ResourceCallBack(String[] path)
956
+ {
957
+// for (int i = 0; i < path.length; i++)
958
+// System.out.print(path[i] + "/");
959
+// System.out.println();
960
+
961
+ if (//rowcount == 0 ||
962
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
963
+ {
964
+ currenttab = new cGridBag();
965
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
+ currenttab.setName(tabname);
967
+ //added = false;
968
+ resourcecontainer.add(currenttab);
969
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture " + tabname);
970
+ rowcount = 1;
971
+ colcount = 0;
972
+ texturecount = 0;
973
+ }
974
+
975
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
976
+ {
977
+ //if (!added)
978
+ {
979
+ //added = true;
980
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
981
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
982
+ }
983
+
984
+ columns = 5;
985
+
986
+ if (path[0].contains("D&R") || path[0].contains("Paint"))
987
+ columns = 4;
988
+
989
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
990
+ totalcount++;
991
+
992
+ if (++colcount >= columns)
993
+ {
994
+ colcount = 0;
995
+ currenttab.Return();
996
+
997
+ if (rowcount++ >= rows)
998
+ {
999
+ rowcount = 0;
1000
+ }
1001
+ }
1002
+ }
1003
+ else
1004
+ {
1005
+// if (!path[path.length-1].equals("icons"))
1006
+// resourcecontainer.Return();
1007
+ }
1008
+ }
1009
+
1010
+ void CreateTexturePanel(cGridBag container)
1011
+ {
1012
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
1013
+ container.add(resourcecontainer);
1014
+
1015
+ Grafreed.ParseResources("textures", this);
1016
+
1017
+ // 935. System.out.println("Total = " + totalcount);
1018
+ }
7971019
7981020 void SetupUI2(ObjEditor oe)
7991021 {
....@@ -812,11 +1034,6 @@
8121034 //new Exception().printStackTrace();
8131035
8141036 oe.radioPanel = new JPanel(new GridBagLayout());
815
- oe.aConstraints.weightx = 1;
816
- oe.aConstraints.weighty = 0;
817
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
818
- oe.aConstraints.gridwidth = 100;
819
- oe.aConstraints.gridheight = 1;
8201037 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8211038
8221039 oe.buttonGroup = new ButtonGroup();
....@@ -837,9 +1054,9 @@
8371054 oe.radioPanel.add(dummyButton);
8381055 oe.buttonGroup.add(dummyButton);
8391056 */
840
- cGridBag copyOptionsPanel = new cGridBag();
1057
+ cGridBag versionManagerPanel = new cGridBag();
8411058
842
- copyOptionsPanel.preferredHeight = 2;
1059
+ versionManagerPanel.preferredHeight = 4;
8431060
8441061 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
8451062
....@@ -849,58 +1066,102 @@
8491066
8501067 if (Globals.ADVANCED)
8511068 {
852
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
853
- maxButton.setToolTipText("Maximize window");
854
- maxButton.addActionListener(this);
1069
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1070
+// maxButton.setToolTipText("Maximize window");
1071
+// maxButton.addActionListener(this);
8551072 }
8561073
857
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
858
- fullButton.setToolTipText("Full-screen window");
859
- fullButton.addActionListener(this);
1074
+ cButton gcButton;
8601075
861
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+// gcButton.setToolTipText("Garbage collect");
1078
+// gcButton.addActionListener(new ActionListener()
1079
+// {
1080
+// public void actionPerformed(ActionEvent e)
1081
+// {
1082
+// System.gc();
1083
+// }
1084
+// });
1085
+
1086
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ fullScreenButton.setToolTipText("Full-screen window");
1088
+ fullScreenButton.addActionListener(this);
1089
+
1090
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1091
+ collapseButton.setToolTipText("Collapse toolbar");
1092
+ collapseButton.addActionListener(this);
1093
+
1094
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1095
+// maximize3DButton.setToolTipText("Maximize 3D view");
1096
+// maximize3DButton.addActionListener(this);
1097
+
1098
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1099
+ twoButton.setToolTipText("Show 3D view only");
1100
+ twoButton.addActionListener(this);
1101
+ this.fullscreenLayout = twoButton;
1102
+
1103
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1104
+ threeButton.setToolTipText("Show controls and 3D view");
1105
+ threeButton.addActionListener(this);
1106
+ if (Globals.ADVANCED)
1107
+ {
1108
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1109
+ sixButton.setToolTipText("Show 3D view and controls");
1110
+ sixButton.addActionListener(this);
1111
+ }
1112
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+// sevenButton.setToolTipText("3-column layout");
1114
+// sevenButton.addActionListener(this);
1115
+ //
1116
+
1117
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8621118 screenfitButton.setToolTipText("Screen fit");
8631119 screenfitButton.addActionListener(this);
8641120
865
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8661122 restoreCameraButton.setToolTipText("Restore viewpoint");
8671123 restoreCameraButton.addActionListener(this);
8681124
869
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
- saveButton.setToolTipText("New version");
871
- saveButton.addActionListener(this);
1125
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1126
+ saveVersionButton.setToolTipText("Duplicate current version");
1127
+ saveVersionButton.addActionListener(this);
8721128
873
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
874
- undoButton.setToolTipText("Previous version");
875
- undoButton.addActionListener(this);
876
- undoButton.setEnabled(false);
1129
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1130
+ deleteVersionButton.setToolTipText("Delete current version");
1131
+ deleteVersionButton.addActionListener(this);
1132
+ deleteVersionButton.setEnabled(false);
1133
+
1134
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1135
+ previousVersionButton.setToolTipText("Previous version");
1136
+ previousVersionButton.addActionListener(this);
1137
+ previousVersionButton.setEnabled(false);
8771138
8781139 cGridBag updown = new cGridBag().setVertical(true);
879
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
- restoreButton.setToolTipText("Restore current");
1140
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1141
+ restoreButton.setToolTipText("Undo (restore current version)");
8811142 restoreButton.addActionListener(this);
8821143 restoreButton.setEnabled(false);
8831144
884
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
- replaceButton.setToolTipText("Replace current");
1145
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1146
+ replaceButton.setToolTipText("Save (replace current version)");
8861147 replaceButton.addActionListener(this);
8871148 replaceButton.setEnabled(false);
8881149
889
- copyOptionsPanel.add(updown);
1150
+ versionManagerPanel.add(updown);
8901151
891
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
892
- redoButton.setToolTipText("Next version");
893
- redoButton.addActionListener(this);
894
- redoButton.setEnabled(false);
1152
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1153
+ nextVersionButton.setToolTipText("Next version");
1154
+ nextVersionButton.addActionListener(this);
1155
+ nextVersionButton.setEnabled(false);
1156
+
1157
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1158
+ oneStepButton.setToolTipText("Animate one step forward");
1159
+ oneStepButton.addActionListener(this);
8951160
8961161 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
8971162 liveCB.setToolTipText("Enable animation");
8981163 liveCB.addItemListener(this);
8991164
900
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
901
- oneStepButton.setToolTipText("Animate one step forward");
902
- oneStepButton.addActionListener(this);
903
-
9041165 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
9051166 fastCB.setToolTipText("Fast mode");
9061167 fastCB.addItemListener(this);
....@@ -916,150 +1177,139 @@
9161177
9171178 if (Globals.ADVANCED)
9181179 {
919
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9201181 snapobjectButton.addActionListener(this);
9211182 snapobjectButton.setToolTipText("Snap Object");
9221183
923
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9241185 fourButton.addActionListener(this);
9251186 fourButton.setToolTipText("Show control panel only");
9261187 }
9271188
9281189 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
9291190
930
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
- twoButton.setToolTipText("Show 3D view only");
932
- twoButton.addActionListener(this);
933
- this.fullscreenLayout = twoButton;
934
-
935
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
- threeButton.setToolTipText("Show controls and 3D view");
937
- threeButton.addActionListener(this);
938
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
- sixButton.setToolTipText("Show 3D view and controls");
940
- sixButton.addActionListener(this);
941
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
-// sevenButton.setToolTipText("3-column layout");
943
-// sevenButton.addActionListener(this);
944
- //
9451191
946
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1192
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9471193 rootButton.setToolTipText("Open selection in new tab");
9481194 rootButton.addActionListener(this);
9491195
950
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1196
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9511197 closeButton.setToolTipText("Close tab");
9521198 closeButton.addActionListener(this);
9531199 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
9541200 //clearButton.addActionListener(this);
9551201
9561202 cGridBag row1 = new cGridBag();
1203
+ row1.preferredHeight = 8;
9571204
9581205 // INSERT
959
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
960
- gridButton.setToolTipText("Create grid");
1206
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1207
+ gridButton.setToolTipText("Create ground");
9611208 gridButton.addActionListener(this);
9621209
963
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1210
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9641211 boxButton.setToolTipText("Create box");
9651212 boxButton.addActionListener(this);
9661213
967
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
968
- sphereButton.setToolTipText("Create sphere");
969
- sphereButton.addActionListener(this);
970
-
971
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
972
- coneButton.setToolTipText("Create cone");
973
- coneButton.addActionListener(this);
974
-
975
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
976
- torusButton.setToolTipText("Create torus");
977
- torusButton.addActionListener(this);
978
-
979
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9801215 superButton.setToolTipText("Create superellipsoid");
9811216 superButton.addActionListener(this);
9821217
983
- if (Globals.ADVANCED)
1218
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1219
+ sphereButton.setToolTipText("Create sphere");
1220
+ sphereButton.addActionListener(this);
1221
+
1222
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1223
+ coneButton.setToolTipText("Create cone");
1224
+ coneButton.addActionListener(this);
1225
+
1226
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1227
+ torusButton.setToolTipText("Create torus");
1228
+ torusButton.addActionListener(this);
1229
+
1230
+ if (false) //Globals.ADVANCED)
9841231 {
985
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9861233 kleinButton.setToolTipText("Create Klein bottle");
9871234 kleinButton.addActionListener(this);
9881235 }
9891236
990
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9911238 particlesButton.setToolTipText("Create particle system");
9921239 particlesButton.addActionListener(this);
9931240
9941241 oe.toolboxPanel.add(row1);
9951242
9961243 cGridBag row2 = new cGridBag();
1244
+ row2.preferredHeight = 8;
9971245
998
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9991247 groupButton.setToolTipText("Create group");
10001248 groupButton.addActionListener(this);
10011249
1002
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10031251 compositeButton.setToolTipText("Create composite");
10041252 compositeButton.addActionListener(this);
10051253
1006
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10071255 switchButton.setToolTipText("Create item switcher");
10081256 switchButton.addActionListener(this);
10091257
1010
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10111259 loopButton.setToolTipText("Create loop");
10121260 loopButton.addActionListener(this);
10131261
1014
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10151263 textureButton.setToolTipText("Create texture");
10161264 textureButton.addActionListener(this);
10171265
1018
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10191267 overlayButton.setToolTipText("Create overlay");
10201268 overlayButton.addActionListener(this);
10211269
1022
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1270
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10231271 lightButton.setToolTipText("Create light");
10241272 lightButton.addActionListener(this);
10251273
10261274 oe.toolboxPanel.add(row2);
10271275
1028
- // ENVYMAPS
1029
- cGridBag skyboxpane = new cGridBag();
1030
- skyboxpane.preferredHeight = 100;
1276
+ cGridBag textures = new cGridBag();
10311277
1032
- oe.toolboxPanel.add(skyboxpane);
1278
+ CreateTexturePanel(textures);
10331279
1034
- JTabbedPane skyboxpanel = new JTabbedPane();
1035
- skyboxpane.add(skyboxpanel);
1280
+ int tabCount = resourcecontainer.getTabCount();
10361281
1037
- AddSkyboxTab0(skyboxpanel);
1038
- AddSkyboxTab1(skyboxpanel);
1039
- AddSkyboxTab2(skyboxpanel);
1282
+ if (tabCount > 0)
1283
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1284
+
1285
+ oe.toolboxPanel.add(textures);
1286
+
1287
+ textures.preferredHeight = 100;
1288
+
1289
+ CreateSkyboxPanel(oe.skyboxPanel);
10401290
10411291 // EDIT panel
1042
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1292
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10431293 editButton.setToolTipText("Pin selection controls");
10441294 editButton.addActionListener(this);
10451295
1046
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
- uneditButton.setToolTipText("Remove selection controls");
1296
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1297
+ uneditButton.setToolTipText("Unpin and remove selection controls");
10481298 uneditButton.addActionListener(this);
10491299
10501300 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1051
- allParamsButton.setToolTipText("Show all controle");
1301
+ allParamsButton.setToolTipText("Show all controls");
10521302 allParamsButton.addActionListener(this);
10531303
1054
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
- clearPanelButton.setToolTipText("Clear edit panel");
1304
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1305
+ clearPanelButton.setToolTipText("Clear all controls");
10561306 clearPanelButton.addActionListener(this);
10571307
1058
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
- unselectButton.setToolTipText("Unselect");
1060
- unselectButton.addActionListener(this);
1308
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1309
+ //unselectButton.setToolTipText("Unselect");
1310
+ //unselectButton.addActionListener(this);
10611311
1062
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1312
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
10631313 flashSelectionButton.setToolTipText("Highlight selection");
10641314 flashSelectionButton.addActionListener(this);
10651315
....@@ -1082,6 +1332,8 @@
10821332
10831333 cGridBag jSPPanel = new cGridBag();
10841334
1335
+ jSPPanel.preferredHeight = 20;
1336
+
10851337 JScrollPane jSP;
10861338 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
10871339 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -1090,11 +1342,12 @@
10901342 oe.treePanel.add(jSPPanel);
10911343 oe.treePanel.Return();
10921344
1093
- oe.treePanel.add(copyOptionsPanel);
1345
+ oe.treePanel.add(versionManagerPanel);
10941346 oe.treePanel.Return();
1095
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1096
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1097
- sliderPane.preferredHeight = 1;
1347
+
1348
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1349
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1350
+ versionSliderPane.preferredHeight = 3;
10981351
10991352 // mainPanel.setDividerLocation(0.1); //1.0);
11001353 mainPanel.setResizeWeight(0.4);
....@@ -1117,7 +1370,7 @@
11171370 dgr.addDragGestureListener(this);
11181371 }catch(Exception e) {}
11191372 */
1120
- radio.layout = sixButton; // sevenButton;
1373
+ radio.layout = threeButton; // sixButton;
11211374 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
11221375 }
11231376
....@@ -1151,7 +1404,7 @@
11511404 // supportCB.setToolTipText("Enable rigging");
11521405 // supportCB.addItemListener(this);
11531406
1154
- panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1407
+ panel.add(freezeCB = new cCheckBox("Fast cam", Globals.FREEZEONMOVE)); //, constraints);
11551408 freezeCB.setToolTipText("Fast moving camera");
11561409 freezeCB.addItemListener(this);
11571410
....@@ -1160,42 +1413,44 @@
11601413
11611414 panel.Return();
11621415
1416
+ if (Globals.ADVANCED)
1417
+ {
11631418 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
11641419 crowdCB.setToolTipText("Used for crowds");
11651420 crowdCB.addItemListener(this);
1421
+ }
11661422
11671423 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
11681424 smoothCB.setToolTipText("Snapping delay");
11691425 smoothCB.addItemListener(this);
11701426
1171
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1172
- slowCB.setToolTipText("Smooth interpolation");
1173
- slowCB.addItemListener(this);
1427
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1428
+// slowCB.setToolTipText("Smooth interpolation");
1429
+// slowCB.addItemListener(this);
1430
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1431
+ minshaderCB.setToolTipText("Minimal fast shader");
1432
+ minshaderCB.addItemListener(this);
11741433
1175
-// constraints.gridy += 1;
11761434 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
11771435 // speakerMocapCB.addItemListener(this);
11781436
1179
- panel.Return();
1180
-
11811437 if (false)
11821438 {
11831439 // handled in scripts
1184
- //constraints.gridy += 1;
11851440 panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
11861441 speakerCameraCB.addItemListener(this);
11871442
1188
- //constraints.gridy += 1;
11891443 panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
11901444 speakerFocusCB.addItemListener(this);
11911445
1192
- //constraints.gridy += 1;
1193
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1194
- smoothfocusCB.addItemListener(this);
11951446 panel.Return();
11961447 }
11971448
1198
-//constraints.gridx += 1;
1449
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1450
+ smoothfocusCB.addItemListener(this);
1451
+
1452
+ panel.Return();
1453
+
11991454 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
12001455 // debugCB.addItemListener(this);
12011456
....@@ -1249,6 +1504,14 @@
12491504
12501505 void EditObject(Object3D obj)
12511506 {
1507
+ //assert(obj instanceof Composite);
1508
+
1509
+// if (obj.versionlist == null)
1510
+// {
1511
+// obj.versionlist = new Object3D[100];
1512
+// obj.versionindex = -1;
1513
+// }
1514
+
12521515 cRadio radioButton = new cRadio(obj.name);
12531516
12541517 // June 2019. Patch to avoid bug with transparency.
....@@ -1259,7 +1522,7 @@
12591522 }
12601523
12611524 radioButton.SetObject(obj);
1262
- radioButton.layout = sixButton; // sevenButton;
1525
+ radioButton.layout = threeButton; // sixButton;
12631526 radioButton.SetCamera(cameraView.renderCamera, false);
12641527 radioButton.addActionListener(this);
12651528 radioPanel.add(radioButton);
....@@ -1273,6 +1536,7 @@
12731536
12741537 oe.SetupViews();
12751538
1539
+ if (Globals.DEBUG)
12761540 System.out.println("SetupViews");
12771541 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
12781542 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1284,6 +1548,8 @@
12841548 cCheckBox localCB;
12851549 cCheckBox crowdCB;
12861550 cCheckBox smoothCB;
1551
+ cCheckBox minshaderCB;
1552
+
12871553 cToggleButton fastCB;
12881554 cCheckBox slowCB;
12891555 cCheckBox boxCB;
....@@ -1354,6 +1620,12 @@
13541620 {
13551621 cameraView.ToggleInertia();
13561622 cameraView.repaint();
1623
+ }
1624
+ else if(e.getSource() == minshaderCB)
1625
+ {
1626
+ Globals.MINSHADER ^= true;
1627
+ cameraView.programInitialized = false;
1628
+ cameraView.repaint();
13571629 }
13581630 else if(e.getSource() == localCB)
13591631 {
....@@ -1631,7 +1903,12 @@
16311903 TreePath path;
16321904
16331905 public TransferableTreePath(TreePath tp) {
1634
- path = tp;
1906
+ Object[] objs = new Object[tp.getPathCount()];
1907
+ for (int i=0; i<objs.length; i++)
1908
+ {
1909
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1910
+ }
1911
+ path = new TreePath(objs);
16351912 }
16361913
16371914 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1812,7 +2089,7 @@
18122089 Object3D obj = (Object3D)group.selection.elementAt(0);
18132090 objEditor.ScreenFit(obj, false);
18142091
1815
- cameraView.pingthread.StepToTarget(true);
2092
+ cameraView.pingthread.StepToTarget(); //true);
18162093 refreshContents();
18172094 }
18182095
....@@ -1849,7 +2126,7 @@
18492126 obj.parent.TransformToWorld(maxima); //, maxima);
18502127 }
18512128
1852
- Object3D shadow = new Object3D("Shadow " + obj.name);
2129
+ Object3D shadow = new Object3D("Shadow" + obj.name);
18532130
18542131 shadow.toParent = LA.newMatrix();
18552132 shadow.fromParent = LA.newMatrix();
....@@ -1863,24 +2140,24 @@
18632140 switch(axis)
18642141 {
18652142 case 0 :
1866
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1867
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1868
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1869
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2143
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2144
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2145
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2146
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
18702147 norm = cVector.X;
18712148 break;
18722149 case 1 :
1873
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1874
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1875
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1876
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2150
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2151
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2152
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2153
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
18772154 norm = cVector.Y;
18782155 break;
18792156 case 2 :
1880
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1881
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1882
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1883
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2157
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2158
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2159
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2160
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
18842161 norm = cVector.Z;
18852162 break;
18862163 }
....@@ -1921,7 +2198,11 @@
19212198 shadow.material = new cMaterial(obj.material);
19222199 shadow.material.diffuse = 0.0001f;
19232200 shadow.material.specular = 0.0001f;
1924
- //shadow.projectedVertices[1].x = 300;
2201
+ shadow.material.opacity = 0.75f;
2202
+
2203
+ AllocProjectedVertices(shadow);
2204
+
2205
+ shadow.projectedVertices[1].x = 300;
19252206
19262207 makeSomething(shadow);
19272208 }
....@@ -2442,27 +2723,35 @@
24422723 } else
24432724 if (source == loopItem || source == loopButton)
24442725 {
2726
+ if (!group.selection.isEmpty())
2727
+ {
24452728 Composite csg = new GroupLeaf();
2446
- csg.count = 5;
24472729 group(csg);
2730
+ csg.count = 5;
24482731 Composite child = new cGroup("Branch");
24492732 csg.addChild(child);
24502733 child.addChild(csg);
2734
+ }
24512735 } else
24522736 if (source == doubleItem)
24532737 {
2738
+ if (!group.selection.isEmpty())
2739
+ {
24542740 Composite csg = new GroupLeaf("Fork");
2455
- csg.count = 5;
24562741 group(csg);
2742
+ csg.count = 5;
24572743 Composite child = new cGroup("Branch A");
24582744 csg.addChild(child);
24592745 child.addChild(csg);
24602746 child = new cGroup("Branch B");
24612747 csg.addChild(child);
24622748 child.addChild(csg);
2749
+ }
24632750 } else
24642751 if (source == tripleItem)
24652752 {
2753
+ if (!group.selection.isEmpty())
2754
+ {
24662755 Composite csg = new GroupLeaf("Trident");
24672756 csg.count = 4;
24682757 group(csg);
....@@ -2475,6 +2764,7 @@
24752764 child = new cGroup();
24762765 csg.addChild(child);
24772766 child.addChild(csg);
2767
+ }
24782768 } else
24792769 if (source == computeAOItem)
24802770 {
....@@ -2494,7 +2784,7 @@
24942784 if (source == invariantsItem)
24952785 {
24962786 System.out.println("Invariants:");
2497
- Grafreed.grafreeD.universe.invariants();
2787
+ Grafreed.grafreed.universe.invariants();
24982788 } else
24992789 if (source == memoryItem)
25002790 {
....@@ -2521,37 +2811,56 @@
25212811 {
25222812 Maximize();
25232813 } else
2524
- if (source == fullButton)
2814
+ if (source == fullScreenButton)
25252815 {
25262816 ToggleFullScreen();
25272817 } else
2528
- if (source == undoButton)
2818
+ if (source == collapseButton)
2819
+ {
2820
+ this.expandedLayout = radio.layout;
2821
+ CollapseToolbar();
2822
+ } else
2823
+// if (source == maximize3DButton)
2824
+// {
2825
+// this.expandedLayout = radio.layout;
2826
+// radio.layout = twoButton;
2827
+// CollapseToolbar();
2828
+// Show3DView();
2829
+// } else
2830
+ if (source == previousVersionButton)
25292831 {
25302832 // Go to previous version
25312833 //if (!Undo())
25322834 //java.awt.Toolkit.getDefaultToolkit().beep();
2533
- Undo();
2835
+ PreviousVersion();
25342836 } else
25352837 if (source == restoreButton)
25362838 {
25372839 // Restore current version
25382840 Restore();
2841
+ //restoreButton.setEnabled(false);
25392842 } else
25402843 if (source == replaceButton)
25412844 {
25422845 // Overwrite current version
25432846 Replace();
2847
+ //replaceButton.setEnabled(false);
25442848 } else
2545
- if (source == redoButton)
2849
+ if (source == nextVersionButton)
25462850 {
25472851 // Go to next version
2548
- Redo();
2852
+ NextVersion();
25492853 } else
2550
- if (source == saveButton)
2854
+ if (source == saveVersionButton)
25512855 {
25522856 // Save a new version
2553
- if (!Save(true))
2857
+ if (!DuplicateVersion()) //true))
25542858 java.awt.Toolkit.getDefaultToolkit().beep();
2859
+ } else
2860
+ if (source == deleteVersionButton)
2861
+ {
2862
+ // Delete a new version
2863
+ DeleteVersion();
25552864 } else
25562865 if (source == oneStepButton)
25572866 {
....@@ -2606,11 +2915,11 @@
26062915 } else
26072916 if (source == undoItem)
26082917 {
2609
- Undo();
2918
+ PreviousVersion();
26102919 } else
26112920 if (source == redoItem)
26122921 {
2613
- Redo();
2922
+ NextVersion();
26142923 } else
26152924 if (source == duplicateItem)
26162925 {
....@@ -3091,22 +3400,34 @@
30913400 } else
30923401 if (source == ungroupItem || source == ungroupButton)
30933402 {
3094
- boolean hasRoot = false;
3403
+ boolean canUngroup = true;
30953404
30963405 for (int i=0; i<group.selection.size(); i++)
30973406 {
3098
- if (group.selection.get(i) == group)
3407
+ Object3D selectedItem = group.selection.get(i);
3408
+
3409
+ if (selectedItem.Size() == 0)
30993410 {
3100
- hasRoot = true;
3411
+ // Cannot ungroup leaves
3412
+ canUngroup = false;
3413
+ break;
3414
+ }
3415
+
3416
+ if (selectedItem == group)
3417
+ {
3418
+ // Cannot ungroup root
3419
+ canUngroup = false;
31013420 break;
31023421 }
31033422 }
31043423
3105
- if (!hasRoot)
3424
+ if (canUngroup)
31063425 {
31073426 for (int i=0; i<group.selection.size(); i++)
31083427 {
3109
- Ungroup(group.selection.get(i));
3428
+ Object3D selectedItem = group.selection.get(i);
3429
+
3430
+ Ungroup(selectedItem);
31103431 }
31113432
31123433 ClearSelection(false);
....@@ -3157,6 +3478,10 @@
31573478 if (source == clearMaterialsItem)
31583479 {
31593480 ClearMaterials();
3481
+ } else
3482
+ if (source == clearVersionsItem)
3483
+ {
3484
+ ClearVersions();
31603485 } else
31613486 if (source == liveleavesItem)
31623487 {
....@@ -3297,6 +3622,18 @@
32973622 if (source == transformChildrenItem)
32983623 {
32993624 TransformChildren();
3625
+ } else
3626
+ if (source == textureRatioRItem)
3627
+ {
3628
+ TextureRatio(0);
3629
+ } else
3630
+ if (source == textureRatioGItem)
3631
+ {
3632
+ TextureRatio(1);
3633
+ } else
3634
+ if (source == textureRatioBItem)
3635
+ {
3636
+ TextureRatio(2);
33003637 } else
33013638 if (source == resetTransformItem)
33023639 {
....@@ -3469,38 +3806,7 @@
34693806 if (CameraPane.FULLSCREEN)
34703807 fullscreenLayout = radio.layout;
34713808
3472
- // bug
3473
- //gridPanel.setDividerLocation(1.0);
3474
- //bigPanel.setDividerLocation(0.0);
3475
-// bigThree.remove(scenePanel);
3476
-// bigThree.remove(centralPanel);
3477
-// bigThree.remove(XYZPanel);
3478
-// aWindowConstraints.gridx = 0;
3479
-// aWindowConstraints.gridy = 0;
3480
-// aWindowConstraints.gridwidth = 1;
3481
-// // aConstraints.gridheight = 3;
3482
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3483
-// aWindowConstraints.weightx = 0;
3484
-// aWindowConstraints.weighty = 1;
3485
-// //bigThree.add(jtp, aWindowConstraints);
3486
-// aWindowConstraints.weightx = 1;
3487
-// aWindowConstraints.gridwidth = 3;
3488
-// // aConstraints.gridheight = 3;
3489
-// aWindowConstraints.gridx = 1;
3490
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3491
-// bigThree.add(centralPanel, aWindowConstraints);
3492
-// aWindowConstraints.weightx = 0;
3493
-// aWindowConstraints.gridx = 4;
3494
-// aWindowConstraints.gridwidth = 1;
3495
-// // aConstraints.gridheight = 3;
3496
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3497
-// //bigThree.add(XYZPanel, aWindowConstraints);
3498
-// scenePanel.setVisible(false);
3499
-// centralPanel.setVisible(true);
3500
-// XYZPanel.setVisible(false);
3501
- bigThree.ClearUI();
3502
- bigThree.add(centralPanel);
3503
- bigThree.FlushUI();
3809
+ Show3DView();
35043810
35053811 cameraView.requestFocusInWindow();
35063812
....@@ -3686,6 +3992,7 @@
36863992 } else
36873993 if (source == rootButton)
36883994 {
3995
+ Replace();
36893996 Object3D obj;
36903997 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
36913998 {
....@@ -3700,6 +4007,9 @@
37004007 if (source == closeButton)
37014008 {
37024009 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4010
+ if (copy.versionlist != null)
4011
+ Replace();
4012
+
37034013 cRadio ab;
37044014 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
37054015 {
....@@ -3743,10 +4053,10 @@
37434053 {
37444054 Object3D child = (Object3D)e.nextElement();
37454055 if(child.editWindow != null)
3746
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37474056 child.pinned = false;
37484057 child.CloseUI();
37494058 listUI.remove(child);
4059
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
37504060
37514061 //child.editWindow = null; // ???????????
37524062 }
....@@ -3765,6 +4075,7 @@
37654075 obj.CloseUI();
37664076 }
37674077 listUI.clear();
4078
+ SetPinStates(group.selection.size() > 0);
37684079 refreshContents(true);
37694080 } else
37704081 if (source == allParamsButton)
....@@ -3797,6 +4108,9 @@
37974108 } else
37984109 if(source instanceof cRadio)
37994110 {
4111
+ if (copy.versionlist != null)
4112
+ Replace();
4113
+
38004114 group.parent = keepparent;
38014115 group.attributes = 0;
38024116 //group.editWindow = null;
....@@ -3821,8 +4135,6 @@
38214135
38224136 copy = group;
38234137
3824
- SetUndoStates();
3825
-
38264138 //Globals.theRenderer.object = group;
38274139 if(!useclient)
38284140 {
....@@ -3850,7 +4162,34 @@
38504162 */
38514163 radio.layout.doClick();
38524164
4165
+ //assert(copy instanceof Composite);
4166
+
4167
+ if (copy.versionlist == null)
4168
+ {
4169
+ copy.versionindex = -1;
4170
+
4171
+ // Cannot work with loops
4172
+ // To fix this issue, we first mark all nodes above the root,
4173
+ // and check if any of these nodes are reachable below the root.
4174
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4175
+
4176
+ if (copy instanceof Composite && !copy.HasTags())
4177
+ {
4178
+ if (copy.versionlist == null)
4179
+ copy.versionlist = new Object3D[100];
4180
+
4181
+ //Save(true);
4182
+ }
4183
+ else
4184
+ copy.versionindex = -2;
4185
+
4186
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4187
+ }
4188
+
4189
+ SetVersionStates();
4190
+
38534191 ClearUnpinned();
4192
+
38544193 //Grafreed.Assert(group != null);
38554194 //Grafreed.Assert(group.selection != null);
38564195 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3867,11 +4206,13 @@
38674206 } else if (event.getSource() == editCameraItem)
38684207 {
38694208 cameraView.ProtectCamera();
4209
+ cameraView.requestFocusInWindow();
38704210 cameraView.repaint();
38714211 return;
38724212 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
38734213 {
38744214 cameraView.RevertCamera();
4215
+ cameraView.requestFocusInWindow();
38754216 cameraView.repaint();
38764217 return;
38774218 // } else if (event.getSource() == textureButton)
....@@ -3960,9 +4301,46 @@
39604301 refreshContents();
39614302 }
39624303
4304
+ void TextureRatio(int axis)
4305
+ {
4306
+ Object3D obj;
4307
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4308
+ {
4309
+ obj = (Object3D)e.nextElement();
4310
+ obj.TextureRatio(axis);
4311
+ }
4312
+
4313
+ refreshContents();
4314
+ }
4315
+
39634316 void ResetTransform()
39644317 {
39654318 ResetTransform(-1);
4319
+ }
4320
+
4321
+ void ScaleSelection(int scale)
4322
+ {
4323
+ Object3D obj;
4324
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4325
+ {
4326
+ obj = (Object3D)e.nextElement();
4327
+
4328
+ if (obj.toParent == null)
4329
+ continue;
4330
+
4331
+ obj.Scale(scale);
4332
+
4333
+ if (obj.parent == null)
4334
+ {
4335
+ System.out.println("NULL PARENT!");
4336
+ // new Exception().printStackTrace();
4337
+ }
4338
+ else
4339
+ TouchTransform(obj);
4340
+ //obj.parent.Touch();
4341
+ }
4342
+
4343
+ refreshContents();
39664344 }
39674345
39684346 void ResetTransform(int mask)
....@@ -3975,42 +4353,8 @@
39754353 if (obj.toParent == null)
39764354 continue;
39774355
3978
- if (mask == -1)
3979
- {
3980
- if (obj instanceof Camera) // jan 2014
3981
- {
3982
- LA.matIdentity(obj.toParent);
3983
- LA.matIdentity(obj.fromParent);
3984
- }
3985
- else
3986
- {
3987
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
3988
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
3989
- }
3990
- TouchTransform(obj);
3991
- continue;
3992
- }
3993
- if ((mask&2) != 0) // Scale
3994
- {
3995
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
3996
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
3997
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
3998
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
3999
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
4000
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
4001
- }
4002
- if ((mask&4) != 0) // Rotation
4003
- {
4004
- // ?
4005
- }
4006
- if ((mask&1) != 0) // Translation
4007
- {
4008
- if (obj.toParent != null)
4009
- {
4010
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
4011
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
4012
- }
4013
- }
4356
+ obj.ResetTransform(mask);
4357
+
40144358 if (obj.parent == null)
40154359 {
40164360 System.out.println("NULL PARENT!");
....@@ -4519,10 +4863,17 @@
45194863 {
45204864 Object3D obj = group.selection.get(i);
45214865
4866
+ if (obj.toParent == null)
4867
+ {
4868
+ obj.toParent = LA.newMatrix();
4869
+ obj.fromParent = LA.newMatrix();
4870
+ }
4871
+
45224872 LA.matTranslate(obj.toParent, i * scale, 0, 0);
45234873 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
45244874 }
45254875
4876
+ Globals.lighttouched = true;
45264877 refreshContents();
45274878 }
45284879
....@@ -4810,6 +5161,12 @@
48105161 refreshContents();
48115162 }
48125163
5164
+ void ClearVersions()
5165
+ {
5166
+ group.selection.ClearVersions();
5167
+ refreshContents();
5168
+ }
5169
+
48135170 void FlipV(boolean flip)
48145171 {
48155172 group.selection.FlipV(flip);
....@@ -5004,9 +5361,7 @@
50045361
50055362 freezemodel = false;
50065363 }
5007
-
5008
- boolean flashIt = true;
5009
-
5364
+
50105365 public void valueChanged(TreeSelectionEvent e)
50115366 //public boolean handleEvent(Event event)
50125367 {
....@@ -5050,10 +5405,10 @@
50505405 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
50515406 // a camera
50525407 {
5053
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5408
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
50545409 {
50555410 CameraPane.camerachangeframe = 0; // don't refuse it
5056
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5411
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent(), true);
50575412 }
50585413 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
50595414 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
....@@ -5079,13 +5434,31 @@
50795434 {
50805435 editButton.setEnabled(enabled);
50815436 uneditButton.setEnabled(enabled);
5082
- unselectButton.setEnabled(enabled);
5437
+ //unselectButton.setEnabled(enabled);
50835438 flashSelectionButton.setEnabled(enabled);
5439
+
5440
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5441
+
5442
+ boolean allComposites = true;
5443
+
5444
+ if (group.selection != null)
5445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5446
+ {
5447
+ Object next = e.nextElement();
5448
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5449
+ {
5450
+ allComposites = false;
5451
+ break;
5452
+ }
5453
+ }
5454
+
5455
+ rootButton.setEnabled(true); // allComposites);
50845456 }
50855457
50865458 void refreshContents(boolean cp)
50875459 {
5088
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5460
+ if (Globals.SHOWINFO)
5461
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
50895462 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
50905463 {
50915464 objEditor.ClearInfo(); // .GetMaterial());
....@@ -5095,7 +5468,7 @@
50955468 Object3D child = (Object3D) group.selection.get(i);
50965469
50975470 objEditor.AddInfo(child, this, true);
5098
- System.err.println("info : " + child.GetPath());
5471
+// System.err.println("info : " + child.GetPath());
50995472 }
51005473
51015474 objEditor.SetText(); // jan 2014
....@@ -5921,7 +6294,6 @@
59216294
59226295 cButton restoreCameraButton;
59236296
5924
- cButton saveButton;
59256297 cButton oneStepButton;
59266298
59276299 cButton groupButton;
....@@ -5979,11 +6351,11 @@
59796351 private MenuItem lookAtItem;
59806352 private MenuItem lookFromItem;
59816353 private MenuItem switchViewItem;
5982
- private MenuItem cutItem;
6354
+ private JMenuItem cutItem;
59836355 private MenuItem undoItem;
59846356 private MenuItem redoItem;
59856357 private JMenuItem duplicateItem;
5986
- private MenuItem cloneItem;
6358
+ private JMenuItem cloneItem;
59876359 private MenuItem cloneSupportItem;
59886360 private MenuItem overwriteGeoItem;
59896361 private MenuItem overwriteMatItem;
....@@ -6004,13 +6376,13 @@
60046376 private MenuItem cloneGeometriesItem;
60056377 private MenuItem shareGeometriesItem;
60066378 private MenuItem mergeGeometriesItem;
6007
- private MenuItem copyItem;
6379
+ private JMenuItem copyItem;
60086380 private MenuItem pasteItem;
6009
- private MenuItem pasteIntoItem;
6010
- private MenuItem pasteLinkItem;
6011
- private MenuItem pasteCloneItem;
6012
- private MenuItem pasteExpandItem;
6013
- private MenuItem deleteItem;
6381
+ private JMenuItem pasteIntoItem;
6382
+ private JMenuItem pasteLinkItem;
6383
+ private JMenuItem pasteCloneItem;
6384
+ private JMenuItem pasteExpandItem;
6385
+ private JMenuItem deleteItem;
60146386 private MenuItem clearAllItem;
60156387 private MenuItem genUVItem;
60166388 private MenuItem genNormalsMESHItem;
....@@ -6036,6 +6408,7 @@
60366408 private MenuItem clipMeshItem;
60376409 private MenuItem smoothMeshItem;
60386410 private MenuItem clearMaterialsItem;
6411
+ private MenuItem clearVersionsItem;
60396412
60406413 private MenuItem liveleavesItem;
60416414 private MenuItem unliveleavesItem;
....@@ -6059,13 +6432,16 @@
60596432 private MenuItem maxTexturesItem;
60606433 private MenuItem panoTexturesItem;
60616434
6435
+ private MenuItem textureRatioRItem;
6436
+ private MenuItem textureRatioGItem;
6437
+ private MenuItem textureRatioBItem;
60626438 private MenuItem resetCentroidItem;
60636439 private MenuItem resetCentroidXZItem;
60646440 private MenuItem resetTransformItem;
60656441 private MenuItem transformGeometryItem;
60666442 private MenuItem transformChildrenItem;
60676443 private MenuItem hideItem;
6068
- private MenuItem grabItem;
6444
+ private JMenuItem grabItem;
60696445 private MenuItem backItem;
60706446 private MenuItem frontItem;
60716447 private MenuItem cameraItem;
....@@ -6078,7 +6454,7 @@
60786454 private MenuItem switchTransfoItem;
60796455 private MenuItem morphItem;
60806456 private MenuItem linkerItem;
6081
- private MenuItem ungroupItem;
6457
+ private JMenuItem ungroupItem;
60826458 private MenuItem editItem;
60836459 private MenuItem openWindowItem;
60846460 private MenuItem editLeafItem;