Normand Briere
2019-08-26 6266c8a4b2485b29a7d5bcb217460d7aad3e1c4a
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,
....@@ -24,12 +25,13 @@
2425 ItemListener // ListSelectionListener
2526 {
2627
27
- public void AddSkyboxButton(String f, String s, cGridBag row3)
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
2829 {
2930 cButton skyboxButton;
3031 final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
- row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
- 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);
3335 skyboxButton.addActionListener(new ActionListener()
3436 {
3537 @Override
....@@ -40,14 +42,342 @@
4042 });
4143 }
4244
43
- public void ChangeSkybox(String name)
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
4446 {
45
- cameraView.envyoff = false;
46
- cameraView.skyboxname = name;
47
- cameraView.skyboxext = "jpg";
48
- cameraView.repaint();
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
+ });
4959 }
5060
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
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);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
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);
358
+ }
359
+
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
+
51381 //ObjEditor objEditor;
52382 public void closeUI2()
53383 {
....@@ -85,11 +415,15 @@
85415 this.copy = this.group = group;
86416 //selectees = this.group.selectees;
87417
88
- if (copy.versions == null)
89
- {
90
- copy.versions = new byte[100][];
91
- copy.versionindex = -1;
92
- }
418
+ assert(false);
419
+
420
+// if (copy.versionlist == null)
421
+// {
422
+// copy.versionlist = new Object3D[100];
423
+// copy.versionindex = -1;
424
+//
425
+// //Save(true);
426
+// }
93427
94428 if(ui)
95429 SetupUI(objEditor);
....@@ -112,13 +446,13 @@
112446
113447 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
114448
115
- if (copy.versions == null)
116
- {
117
- copy.versions = new byte[100][];
118
- copy.versionindex = -1;
119
-
120
- Save(true);
121
- }
449
+// if (copy.versionlist == null)
450
+// {
451
+// copy.versionlist = new Object3D[100];
452
+// copy.versionindex = -1;
453
+//
454
+// //Save(true);
455
+// }
122456 }
123457
124458 void CloneSelection(boolean supports)
....@@ -208,33 +542,35 @@
208542 // menu.add("-");
209543 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
210544 duplicateItem.addActionListener(this);
211
- cloneItem = menu.add(new MenuItem("Clone"));
545
+
546
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
212547 cloneItem.addActionListener(this);
213
- if (Globals.ADVANCED)
548
+ //if (Globals.ADVANCED)
214549 {
215550 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
216551 cloneSupportItem.addActionListener(this);
217552 }
553
+ oe.jTree.popup.addSeparator();
218554 menu.add("-");
219
- cutItem = menu.add(new MenuItem("Cut"));
555
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
220556 cutItem.addActionListener(this);
221
- copyItem = menu.add(new MenuItem("Copy"));
557
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
222558 copyItem.addActionListener(this);
223559 pasteItem = menu.add(new MenuItem("Paste"));
224560 pasteItem.addActionListener(this);
225561
226
- menu.add("-");
227
- 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"));
228565 pasteIntoItem.addActionListener(this);
229
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
566
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
230567 pasteLinkItem.addActionListener(this);
231
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
568
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
232569 pasteCloneItem.addActionListener(this);
233
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
570
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
234571 // pasteExpandItem.addActionListener(this);
235
- menu.add("-");
236
- deleteItem = menu.add(new MenuItem("Delete"));
237
- deleteItem.addActionListener(this);
572
+ //menu.add("-");
573
+ oe.jTree.popup.addSeparator();
238574
239575 if (Globals.ADVANCED)
240576 {
....@@ -320,11 +656,9 @@
320656 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
321657 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
322658 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
323
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
324659 oe.cameraMenu.add("-");
325660 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
326661 openWindowItem.addActionListener(this);
327
- editLeafItem.addActionListener(this);
328662 lookAtItem.addActionListener(this);
329663 //lookFromItem.addActinoListener(this);
330664 //switchViewItem.addActionListener(this);
....@@ -371,9 +705,8 @@
371705 setMasterItem.addActionListener(this);
372706 }
373707
374
- oe.menuBar.add(menu = new Menu("Group"));
375
-// grabItem = menu.add(new MenuItem("Grab"));
376
-// grabItem.addActionListener(this);
708
+ oe.menuBar.add(menu = new Menu("Order"));
709
+
377710 backItem = menu.add(new MenuItem("Back"));
378711 backItem.addActionListener(this);
379712 frontItem = menu.add(new MenuItem("Front"));
....@@ -381,13 +714,21 @@
381714 // compositeItem = menu.add(new MenuItem("Composite"));
382715 // compositeItem.addActionListener(this);
383716
717
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
718
+ grabItem.addActionListener(this);
719
+
384720 if (Globals.ADVANCED)
385721 {
386722 hideItem = menu.add(new MenuItem("Hidden Group"));
387723 hideItem.addActionListener(this);
388724 }
389
- ungroupItem = menu.add(new MenuItem("Ungroup"));
725
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
390726 ungroupItem.addActionListener(this);
727
+
728
+ oe.jTree.popup.addSeparator();
729
+
730
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
731
+ deleteItem.addActionListener(this);
391732
392733 // menu.add("-");
393734 //
....@@ -424,11 +765,11 @@
424765 shadowYItem.addActionListener(this);
425766 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
426767 shadowZItem.addActionListener(this);
427
- attributeItem = menu.add(new MenuItem("Attribute"));
428
- attributeItem.addActionListener(this);
429768
430769 if (Globals.ADVANCED)
431770 {
771
+ attributeItem = menu.add(new MenuItem("Attribute"));
772
+ attributeItem.addActionListener(this);
432773 menu.add("-");
433774 linkerItem = menu.add(new MenuItem("Linker"));
434775 linkerItem.addActionListener(this);
....@@ -438,11 +779,18 @@
438779 pointflowItem.addActionListener(this);
439780 }
440781 menu.add("-");
782
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
783
+ textureRatioRItem.addActionListener(this);
784
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
785
+ textureRatioGItem.addActionListener(this);
786
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
787
+ textureRatioBItem.addActionListener(this);
788
+ menu.add("-");
441789 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
442790 resetTransformItem.addActionListener(this);
443791 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
444792 resetCentroidItem.addActionListener(this);
445
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
793
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
446794 resetCentroidXZItem.addActionListener(this);
447795 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
448796 transformGeometryItem.addActionListener(this);
....@@ -494,6 +842,8 @@
494842 }
495843
496844 oe.menuBar.add(menu = new Menu("Attributes"));
845
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
846
+ clearVersionsItem.addActionListener(this);
497847 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
498848 clearMaterialsItem.addActionListener(this);
499849 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -516,9 +866,9 @@
516866 hideleavesItem.addActionListener(this);
517867 showleavesItem = menu.add(new MenuItem("Show Leaves"));
518868 showleavesItem.addActionListener(this);
519
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
869
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
520870 markleavesItem.addActionListener(this);
521
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
871
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
522872 unmarkleavesItem.addActionListener(this);
523873 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
524874 rewindleavesItem.addActionListener(this);
....@@ -572,6 +922,9 @@
572922 shareGeometriesItem.addActionListener(this);
573923 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
574924 mergeGeometriesItem.addActionListener(this);
925
+ menu.add("-");
926
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
927
+ editLeafItem.addActionListener(this);
575928 if (Globals.ADVANCED)
576929 {
577930 // Pretty much the same as duplicate and clone.
....@@ -588,6 +941,79 @@
588941 buildToolsMenu(menu);
589942 }
590943
944
+ JTabbedPane resourcecontainer;
945
+ cGridBag currenttab;
946
+ //boolean added; // patch for jar
947
+
948
+ int totalcount = 0;
949
+
950
+ int tabcount = 0;
951
+ int colcount = 0;
952
+ int rowcount = 0;
953
+ int texturecount = 0;
954
+
955
+ int columns = 5;
956
+ int rows = 7;
957
+
958
+ public void ResourceCallBack(String[] path)
959
+ {
960
+// for (int i = 0; i < path.length; i++)
961
+// System.out.print(path[i] + "/");
962
+// System.out.println();
963
+
964
+ if (//rowcount == 0 ||
965
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
966
+ {
967
+ currenttab = new cGridBag();
968
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
969
+ currenttab.setName(tabname);
970
+ //added = false;
971
+ resourcecontainer.add(currenttab);
972
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
973
+ rowcount = 1;
974
+ colcount = 0;
975
+ texturecount = 0;
976
+ }
977
+
978
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
979
+ {
980
+ //if (!added)
981
+ {
982
+ //added = true;
983
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
984
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
985
+ }
986
+
987
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
988
+ totalcount++;
989
+
990
+ if (++colcount >= columns)
991
+ {
992
+ colcount = 0;
993
+ currenttab.Return();
994
+
995
+ if (rowcount++ >= rows)
996
+ {
997
+ rowcount = 0;
998
+ }
999
+ }
1000
+ }
1001
+ else
1002
+ {
1003
+// if (!path[path.length-1].equals("icons"))
1004
+// resourcecontainer.Return();
1005
+ }
1006
+ }
1007
+
1008
+ void CreateTexturePanel(cGridBag container)
1009
+ {
1010
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
1011
+ container.add(resourcecontainer);
1012
+
1013
+ Grafreed.ParseResources("textures", this);
1014
+
1015
+ // 935. System.out.println("Total = " + totalcount);
1016
+ }
5911017
5921018 void SetupUI2(ObjEditor oe)
5931019 {
....@@ -606,11 +1032,6 @@
6061032 //new Exception().printStackTrace();
6071033
6081034 oe.radioPanel = new JPanel(new GridBagLayout());
609
- oe.aConstraints.weightx = 1;
610
- oe.aConstraints.weighty = 0;
611
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
612
- oe.aConstraints.gridwidth = 100;
613
- oe.aConstraints.gridheight = 1;
6141035 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6151036
6161037 oe.buttonGroup = new ButtonGroup();
....@@ -631,9 +1052,9 @@
6311052 oe.radioPanel.add(dummyButton);
6321053 oe.buttonGroup.add(dummyButton);
6331054 */
634
- cGridBag copyOptionsPanel = new cGridBag();
1055
+ cGridBag versionManagerPanel = new cGridBag();
6351056
636
- copyOptionsPanel.preferredHeight = 2;
1057
+ versionManagerPanel.preferredHeight = 4;
6371058
6381059 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
6391060
....@@ -643,58 +1064,102 @@
6431064
6441065 if (Globals.ADVANCED)
6451066 {
646
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
- maxButton.setToolTipText("Maximize window");
648
- maxButton.addActionListener(this);
1067
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+// maxButton.setToolTipText("Maximize window");
1069
+// maxButton.addActionListener(this);
6491070 }
6501071
651
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ cButton gcButton;
1073
+
1074
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1075
+// gcButton.setToolTipText("Garbage collect");
1076
+// gcButton.addActionListener(new ActionListener()
1077
+// {
1078
+// public void actionPerformed(ActionEvent e)
1079
+// {
1080
+// System.gc();
1081
+// }
1082
+// });
1083
+
1084
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1085
+ collapseButton.setToolTipText("Collapse toolbar");
1086
+ collapseButton.addActionListener(this);
1087
+
1088
+ oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1089
+ maximize3DButton.setToolTipText("Maximize 3D view");
1090
+ maximize3DButton.addActionListener(this);
1091
+
1092
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1093
+ twoButton.setToolTipText("Show 3D view only");
1094
+ twoButton.addActionListener(this);
1095
+ this.fullscreenLayout = twoButton;
1096
+
1097
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1098
+ threeButton.setToolTipText("Show controls and 3D view");
1099
+ threeButton.addActionListener(this);
1100
+ if (Globals.ADVANCED)
1101
+ {
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1103
+ sixButton.setToolTipText("Show 3D view and controls");
1104
+ sixButton.addActionListener(this);
1105
+ }
1106
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
+// sevenButton.setToolTipText("3-column layout");
1108
+// sevenButton.addActionListener(this);
1109
+ //
1110
+
1111
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6521112 fullButton.setToolTipText("Full-screen window");
6531113 fullButton.addActionListener(this);
6541114
655
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6561116 screenfitButton.setToolTipText("Screen fit");
6571117 screenfitButton.addActionListener(this);
6581118
659
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1119
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6601120 restoreCameraButton.setToolTipText("Restore viewpoint");
6611121 restoreCameraButton.addActionListener(this);
6621122
663
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
- saveButton.setToolTipText("New version");
665
- saveButton.addActionListener(this);
1123
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1124
+ saveVersionButton.setToolTipText("Duplicate current version");
1125
+ saveVersionButton.addActionListener(this);
6661126
667
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- undoButton.setToolTipText("Previous version");
669
- undoButton.addActionListener(this);
670
- undoButton.setEnabled(false);
1127
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1128
+ deleteVersionButton.setToolTipText("Delete current version");
1129
+ deleteVersionButton.addActionListener(this);
1130
+ deleteVersionButton.setEnabled(false);
1131
+
1132
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1133
+ previousVersionButton.setToolTipText("Previous version");
1134
+ previousVersionButton.addActionListener(this);
1135
+ previousVersionButton.setEnabled(false);
6711136
6721137 cGridBag updown = new cGridBag().setVertical(true);
673
- updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- restoreButton.setToolTipText("Restore current");
1138
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1139
+ restoreButton.setToolTipText("Undo (restore current version)");
6751140 restoreButton.addActionListener(this);
6761141 restoreButton.setEnabled(false);
6771142
678
- updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
679
- replaceButton.setToolTipText("Replace current");
1143
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1144
+ replaceButton.setToolTipText("Save (replace current version)");
6801145 replaceButton.addActionListener(this);
6811146 replaceButton.setEnabled(false);
6821147
683
- copyOptionsPanel.add(updown);
1148
+ versionManagerPanel.add(updown);
6841149
685
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
686
- redoButton.setToolTipText("Next version");
687
- redoButton.addActionListener(this);
688
- redoButton.setEnabled(false);
1150
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1151
+ nextVersionButton.setToolTipText("Next version");
1152
+ nextVersionButton.addActionListener(this);
1153
+ nextVersionButton.setEnabled(false);
1154
+
1155
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1156
+ oneStepButton.setToolTipText("Animate one step forward");
1157
+ oneStepButton.addActionListener(this);
6891158
6901159 oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
6911160 liveCB.setToolTipText("Enable animation");
6921161 liveCB.addItemListener(this);
6931162
694
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
- oneStepButton.setToolTipText("Animate one step forward");
696
- oneStepButton.addActionListener(this);
697
-
6981163 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
6991164 fastCB.setToolTipText("Fast mode");
7001165 fastCB.addItemListener(this);
....@@ -710,38 +1175,23 @@
7101175
7111176 if (Globals.ADVANCED)
7121177 {
713
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1178
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7141179 snapobjectButton.addActionListener(this);
7151180 snapobjectButton.setToolTipText("Snap Object");
7161181
717
- oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1182
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7181183 fourButton.addActionListener(this);
7191184 fourButton.setToolTipText("Show control panel only");
7201185 }
7211186
7221187 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
7231188
724
- oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
725
- twoButton.setToolTipText("Show 3D view only");
726
- twoButton.addActionListener(this);
727
- this.fullscreenLayout = twoButton;
728
-
729
- oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- threeButton.setToolTipText("Show controls and 3D view");
731
- threeButton.addActionListener(this);
732
- oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
733
- sixButton.setToolTipText("Show 3D view and controls");
734
- sixButton.addActionListener(this);
735
-// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
-// sevenButton.setToolTipText("3-column layout");
737
-// sevenButton.addActionListener(this);
738
- //
7391189
740
- oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1190
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7411191 rootButton.setToolTipText("Open selection in new tab");
7421192 rootButton.addActionListener(this);
7431193
744
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7451195 closeButton.setToolTipText("Close tab");
7461196 closeButton.addActionListener(this);
7471197 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
....@@ -750,38 +1200,38 @@
7501200 cGridBag row1 = new cGridBag();
7511201
7521202 // INSERT
753
- row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
754
- gridButton.setToolTipText("Create grid");
1203
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1204
+ gridButton.setToolTipText("Create ground");
7551205 gridButton.addActionListener(this);
7561206
757
- row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1207
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7581208 boxButton.setToolTipText("Create box");
7591209 boxButton.addActionListener(this);
7601210
761
- row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
762
- sphereButton.setToolTipText("Create sphere");
763
- sphereButton.addActionListener(this);
764
-
765
- row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
766
- coneButton.setToolTipText("Create cone");
767
- coneButton.addActionListener(this);
768
-
769
- row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
770
- torusButton.setToolTipText("Create torus");
771
- torusButton.addActionListener(this);
772
-
773
- row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1211
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7741212 superButton.setToolTipText("Create superellipsoid");
7751213 superButton.addActionListener(this);
7761214
777
- if (Globals.ADVANCED)
1215
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1216
+ sphereButton.setToolTipText("Create sphere");
1217
+ sphereButton.addActionListener(this);
1218
+
1219
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1220
+ coneButton.setToolTipText("Create cone");
1221
+ coneButton.addActionListener(this);
1222
+
1223
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1224
+ torusButton.setToolTipText("Create torus");
1225
+ torusButton.addActionListener(this);
1226
+
1227
+ if (false) //Globals.ADVANCED)
7781228 {
779
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1229
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7801230 kleinButton.setToolTipText("Create Klein bottle");
7811231 kleinButton.addActionListener(this);
7821232 }
7831233
784
- row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1234
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7851235 particlesButton.setToolTipText("Create particle system");
7861236 particlesButton.addActionListener(this);
7871237
....@@ -789,160 +1239,73 @@
7891239
7901240 cGridBag row2 = new cGridBag();
7911241
792
- row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1242
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7931243 groupButton.setToolTipText("Create group");
7941244 groupButton.addActionListener(this);
7951245
796
- row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7971247 compositeButton.setToolTipText("Create composite");
7981248 compositeButton.addActionListener(this);
7991249
800
- row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1250
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8011251 switchButton.setToolTipText("Create item switcher");
8021252 switchButton.addActionListener(this);
8031253
804
- row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1254
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8051255 loopButton.setToolTipText("Create loop");
8061256 loopButton.addActionListener(this);
8071257
808
- row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1258
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8091259 textureButton.setToolTipText("Create texture");
8101260 textureButton.addActionListener(this);
8111261
812
- row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8131263 overlayButton.setToolTipText("Create overlay");
8141264 overlayButton.addActionListener(this);
8151265
816
- row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
8171267 lightButton.setToolTipText("Create light");
8181268 lightButton.addActionListener(this);
8191269
8201270 oe.toolboxPanel.add(row2);
8211271
822
- // ENVYMAPS
823
- cGridBag row3 = new cGridBag();
824
- row3.preferredHeight = 20;
1272
+ cGridBag textures = new cGridBag();
8251273
826
- AddSkyboxButton("default", "rgb", row3);
827
- AddSkyboxButton("default", "cornell", row3);
828
- AddSkyboxButton("default", "uffizi", row3);
829
- AddSkyboxButton("default", "CloudyHills", row3);
830
- AddSkyboxButton("default", "skycube", row3);
831
-
832
- oe.toolboxPanel.add(row3);
833
-
834
- cGridBag row4 = new cGridBag();
835
- row4.preferredHeight = 20;
1274
+ CreateTexturePanel(textures);
8361275
837
- AddSkyboxButton("bridge", "Bridge2", row4);
838
- AddSkyboxButton("urban", "GamlaStan2", row4);
839
- AddSkyboxButton("urban", "Parliament", row4);
840
- AddSkyboxButton("urban", "Roundabout", row4);
1276
+ int tabCount = resourcecontainer.getTabCount();
8411277
842
- oe.toolboxPanel.add(row4);
843
-
844
- cGridBag row5 = new cGridBag();
845
- row5.preferredHeight = 20;
1278
+ if (tabCount > 0)
1279
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
8461280
847
- AddSkyboxButton("urban", "SaintLazarusChurch", row5);
848
- AddSkyboxButton("urban", "SaintLazarusChurch2", row5);
849
- AddSkyboxButton("urban", "SaintLazarusChurch3", row5);
850
- AddSkyboxButton("urban", "UnionSquare", row5);
1281
+ oe.toolboxPanel.add(textures);
8511282
852
- oe.toolboxPanel.add(row5);
853
-
854
- cGridBag row6 = new cGridBag();
855
- row6.preferredHeight = 20;
1283
+ textures.preferredHeight = 100;
8561284
857
- AddSkyboxButton("park", "BerzeliiPark", row6);
858
- AddSkyboxButton("park", "Buddha", row6);
859
- AddSkyboxButton("park", "CNTower2", row6);
860
- //AddSkyboxButton("park", "Fatbursparken", row6);
861
- AddSkyboxButton("park", "NiagaraFalls1", row6);
862
-
863
- oe.toolboxPanel.add(row6);
864
-
865
- cGridBag row7 = new cGridBag();
866
- row7.preferredHeight = 20;
867
-
868
- AddSkyboxButton("park", "NiagaraFalls3", row7);
869
- AddSkyboxButton("park", "Park", row7);
870
- //AddSkyboxButton("park", "Park2", row6);
871
- //AddSkyboxButton("park", "Path", row6);
872
- AddSkyboxButton("park", "Pond", row7);
873
- AddSkyboxButton("park", "Skansen", row7);
874
-
875
- oe.toolboxPanel.add(row7);
876
-
877
- cGridBag row8 = new cGridBag();
878
- row8.preferredHeight = 20;
879
-
880
- AddSkyboxButton("park", "Skansen2", row8);
881
- AddSkyboxButton("park", "Skansen3", row8);
882
- AddSkyboxButton("park", "Skansen4", row8);
883
- AddSkyboxButton("park", "Skansen5", row8);
884
-
885
- oe.toolboxPanel.add(row8);
886
-
887
- cGridBag row9 = new cGridBag();
888
- row9.preferredHeight = 20;
889
-
890
- AddSkyboxButton("park", "Stairs", row9);
891
- //AddSkyboxButton("park", "Tantolunden", row6);
892
- //AddSkyboxButton("park", "Tantolunden3", row6);
893
- AddSkyboxButton("park", "Tantolunden4", row9);
894
-
895
- oe.toolboxPanel.add(row9);
896
-/*
897
-BerzeliiPark
898
-Buddha
899
-CNTower2
900
-Fatbursparken
901
-NiagaraFalls1
902
-NiagaraFalls3
903
-Park
904
-Park2
905
-Path
906
-Pond
907
-Skansen
908
-Skansen2
909
-Skansen3
910
-Skansen4
911
-Skansen5
912
-Stairs
913
-Tantolunden
914
-Tantolunden3
915
-Tantolunden4
916
- */
917
-
918
- for (int i=1; --i>=0;)
919
- {
920
- //oe.toolboxPanel.Return();
921
- oe.toolboxPanel.add(new cGridBag());
922
- }
1285
+ CreateSkyboxPanel(oe.skyboxPanel);
9231286
9241287 // EDIT panel
925
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1288
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9261289 editButton.setToolTipText("Pin selection controls");
9271290 editButton.addActionListener(this);
9281291
929
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
930
- uneditButton.setToolTipText("Remove selection controls");
1292
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1293
+ uneditButton.setToolTipText("Unpin and remove selection controls");
9311294 uneditButton.addActionListener(this);
9321295
9331296 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
934
- allParamsButton.setToolTipText("Show all controle");
1297
+ allParamsButton.setToolTipText("Show all controls");
9351298 allParamsButton.addActionListener(this);
9361299
937
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
938
- clearPanelButton.setToolTipText("Clear edit panel");
1300
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1301
+ clearPanelButton.setToolTipText("Clear all controls");
9391302 clearPanelButton.addActionListener(this);
9401303
941
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
- unselectButton.setToolTipText("Unselect");
943
- unselectButton.addActionListener(this);
1304
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1305
+ //unselectButton.setToolTipText("Unselect");
1306
+ //unselectButton.addActionListener(this);
9441307
945
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1308
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
9461309 flashSelectionButton.setToolTipText("Highlight selection");
9471310 flashSelectionButton.addActionListener(this);
9481311
....@@ -965,6 +1328,8 @@
9651328
9661329 cGridBag jSPPanel = new cGridBag();
9671330
1331
+ jSPPanel.preferredHeight = 20;
1332
+
9681333 JScrollPane jSP;
9691334 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
9701335 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -973,11 +1338,11 @@
9731338 oe.treePanel.add(jSPPanel);
9741339 oe.treePanel.Return();
9751340
976
- oe.treePanel.add(copyOptionsPanel);
1341
+ oe.treePanel.add(versionManagerPanel);
9771342 oe.treePanel.Return();
978
- cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
979
- versionSlider = (cNumberSlider)sliderPane.getComponent(1);
980
- sliderPane.preferredHeight = 1;
1343
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1344
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1345
+ versionSliderPane.preferredHeight = 3;
9811346
9821347 // mainPanel.setDividerLocation(0.1); //1.0);
9831348 mainPanel.setResizeWeight(0.4);
....@@ -1000,7 +1365,7 @@
10001365 dgr.addDragGestureListener(this);
10011366 }catch(Exception e) {}
10021367 */
1003
- radio.layout = sixButton; // sevenButton;
1368
+ radio.layout = threeButton; // sixButton;
10041369 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
10051370 }
10061371
....@@ -1051,9 +1416,12 @@
10511416 smoothCB.setToolTipText("Snapping delay");
10521417 smoothCB.addItemListener(this);
10531418
1054
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1055
- slowCB.setToolTipText("Smooth interpolation");
1056
- slowCB.addItemListener(this);
1419
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1420
+// slowCB.setToolTipText("Smooth interpolation");
1421
+// slowCB.addItemListener(this);
1422
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1423
+ minshaderCB.setToolTipText("Minimal fast shader");
1424
+ minshaderCB.addItemListener(this);
10571425
10581426 // constraints.gridy += 1;
10591427 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -1132,6 +1500,14 @@
11321500
11331501 void EditObject(Object3D obj)
11341502 {
1503
+ //assert(obj instanceof Composite);
1504
+
1505
+// if (obj.versionlist == null)
1506
+// {
1507
+// obj.versionlist = new Object3D[100];
1508
+// obj.versionindex = -1;
1509
+// }
1510
+
11351511 cRadio radioButton = new cRadio(obj.name);
11361512
11371513 // June 2019. Patch to avoid bug with transparency.
....@@ -1142,7 +1518,7 @@
11421518 }
11431519
11441520 radioButton.SetObject(obj);
1145
- radioButton.layout = sixButton; // sevenButton;
1521
+ radioButton.layout = threeButton; // sixButton;
11461522 radioButton.SetCamera(cameraView.renderCamera, false);
11471523 radioButton.addActionListener(this);
11481524 radioPanel.add(radioButton);
....@@ -1156,6 +1532,7 @@
11561532
11571533 oe.SetupViews();
11581534
1535
+ if (Globals.DEBUG)
11591536 System.out.println("SetupViews");
11601537 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
11611538 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1167,6 +1544,8 @@
11671544 cCheckBox localCB;
11681545 cCheckBox crowdCB;
11691546 cCheckBox smoothCB;
1547
+ cCheckBox minshaderCB;
1548
+
11701549 cToggleButton fastCB;
11711550 cCheckBox slowCB;
11721551 cCheckBox boxCB;
....@@ -1237,6 +1616,12 @@
12371616 {
12381617 cameraView.ToggleInertia();
12391618 cameraView.repaint();
1619
+ }
1620
+ else if(e.getSource() == minshaderCB)
1621
+ {
1622
+ Globals.MINSHADER ^= true;
1623
+ cameraView.programInitialized = false;
1624
+ cameraView.repaint();
12401625 }
12411626 else if(e.getSource() == localCB)
12421627 {
....@@ -1514,7 +1899,12 @@
15141899 TreePath path;
15151900
15161901 public TransferableTreePath(TreePath tp) {
1517
- path = tp;
1902
+ Object[] objs = new Object[tp.getPathCount()];
1903
+ for (int i=0; i<objs.length; i++)
1904
+ {
1905
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1906
+ }
1907
+ path = new TreePath(objs);
15181908 }
15191909
15201910 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1746,24 +2136,24 @@
17462136 switch(axis)
17472137 {
17482138 case 0 :
1749
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1750
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1751
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1752
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2139
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2140
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2141
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2142
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
17532143 norm = cVector.X;
17542144 break;
17552145 case 1 :
1756
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1757
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1758
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1759
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2146
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2147
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2148
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2149
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
17602150 norm = cVector.Y;
17612151 break;
17622152 case 2 :
1763
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1764
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1765
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1766
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2153
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2154
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2155
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2156
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
17672157 norm = cVector.Z;
17682158 break;
17692159 }
....@@ -1804,7 +2194,11 @@
18042194 shadow.material = new cMaterial(obj.material);
18052195 shadow.material.diffuse = 0.0001f;
18062196 shadow.material.specular = 0.0001f;
1807
- //shadow.projectedVertices[1].x = 300;
2197
+ shadow.material.opacity = 0.75f;
2198
+
2199
+ AllocProjectedVertices(shadow);
2200
+
2201
+ shadow.projectedVertices[1].x = 300;
18082202
18092203 makeSomething(shadow);
18102204 }
....@@ -2325,27 +2719,35 @@
23252719 } else
23262720 if (source == loopItem || source == loopButton)
23272721 {
2722
+ if (!group.selection.isEmpty())
2723
+ {
23282724 Composite csg = new GroupLeaf();
23292725 csg.count = 5;
2330
- group(csg);
23312726 Composite child = new cGroup("Branch");
23322727 csg.addChild(child);
23332728 child.addChild(csg);
2729
+ group(csg);
2730
+ }
23342731 } else
23352732 if (source == doubleItem)
23362733 {
2734
+ if (!group.selection.isEmpty())
2735
+ {
23372736 Composite csg = new GroupLeaf("Fork");
23382737 csg.count = 5;
2339
- group(csg);
23402738 Composite child = new cGroup("Branch A");
23412739 csg.addChild(child);
23422740 child.addChild(csg);
23432741 child = new cGroup("Branch B");
23442742 csg.addChild(child);
23452743 child.addChild(csg);
2744
+ group(csg);
2745
+ }
23462746 } else
23472747 if (source == tripleItem)
23482748 {
2749
+ if (!group.selection.isEmpty())
2750
+ {
23492751 Composite csg = new GroupLeaf("Trident");
23502752 csg.count = 4;
23512753 group(csg);
....@@ -2358,6 +2760,7 @@
23582760 child = new cGroup();
23592761 csg.addChild(child);
23602762 child.addChild(csg);
2763
+ }
23612764 } else
23622765 if (source == computeAOItem)
23632766 {
....@@ -2377,7 +2780,7 @@
23772780 if (source == invariantsItem)
23782781 {
23792782 System.out.println("Invariants:");
2380
- Grafreed.grafreeD.universe.invariants();
2783
+ Grafreed.grafreed.universe.invariants();
23812784 } else
23822785 if (source == memoryItem)
23832786 {
....@@ -2408,33 +2811,52 @@
24082811 {
24092812 ToggleFullScreen();
24102813 } else
2411
- if (source == undoButton)
2814
+ if (source == collapseButton)
2815
+ {
2816
+ this.expandedLayout = radio.layout;
2817
+ CollapseToolbar();
2818
+ } else
2819
+ if (source == maximize3DButton)
2820
+ {
2821
+ this.expandedLayout = radio.layout;
2822
+ radio.layout = twoButton;
2823
+ Show3DView();
2824
+ CollapseToolbar();
2825
+ } else
2826
+ if (source == previousVersionButton)
24122827 {
24132828 // Go to previous version
24142829 //if (!Undo())
24152830 //java.awt.Toolkit.getDefaultToolkit().beep();
2416
- Undo();
2831
+ PreviousVersion();
24172832 } else
24182833 if (source == restoreButton)
24192834 {
24202835 // Restore current version
24212836 Restore();
2837
+ //restoreButton.setEnabled(false);
24222838 } else
24232839 if (source == replaceButton)
24242840 {
24252841 // Overwrite current version
24262842 Replace();
2843
+ //replaceButton.setEnabled(false);
24272844 } else
2428
- if (source == redoButton)
2845
+ if (source == nextVersionButton)
24292846 {
24302847 // Go to next version
2431
- Redo();
2848
+ NextVersion();
24322849 } else
2433
- if (source == saveButton)
2850
+ if (source == saveVersionButton)
24342851 {
24352852 // Save a new version
24362853 if (!Save(true))
24372854 java.awt.Toolkit.getDefaultToolkit().beep();
2855
+ } else
2856
+ if (source == deleteVersionButton)
2857
+ {
2858
+ // Delete a new version
2859
+ DeleteVersion();
24382860 } else
24392861 if (source == oneStepButton)
24402862 {
....@@ -2489,11 +2911,11 @@
24892911 } else
24902912 if (source == undoItem)
24912913 {
2492
- Undo();
2914
+ PreviousVersion();
24932915 } else
24942916 if (source == redoItem)
24952917 {
2496
- Redo();
2918
+ NextVersion();
24972919 } else
24982920 if (source == duplicateItem)
24992921 {
....@@ -2974,22 +3396,34 @@
29743396 } else
29753397 if (source == ungroupItem || source == ungroupButton)
29763398 {
2977
- boolean hasRoot = false;
3399
+ boolean canUngroup = true;
29783400
29793401 for (int i=0; i<group.selection.size(); i++)
29803402 {
2981
- if (group.selection.get(i) == group)
3403
+ Object3D selectedItem = group.selection.get(i);
3404
+
3405
+ if (selectedItem.Size() == 0)
29823406 {
2983
- hasRoot = true;
3407
+ // Cannot ungroup leaves
3408
+ canUngroup = false;
3409
+ break;
3410
+ }
3411
+
3412
+ if (selectedItem == group)
3413
+ {
3414
+ // Cannot ungroup root
3415
+ canUngroup = false;
29843416 break;
29853417 }
29863418 }
29873419
2988
- if (!hasRoot)
3420
+ if (canUngroup)
29893421 {
29903422 for (int i=0; i<group.selection.size(); i++)
29913423 {
2992
- Ungroup(group.selection.get(i));
3424
+ Object3D selectedItem = group.selection.get(i);
3425
+
3426
+ Ungroup(selectedItem);
29933427 }
29943428
29953429 ClearSelection(false);
....@@ -3040,6 +3474,10 @@
30403474 if (source == clearMaterialsItem)
30413475 {
30423476 ClearMaterials();
3477
+ } else
3478
+ if (source == clearVersionsItem)
3479
+ {
3480
+ ClearVersions();
30433481 } else
30443482 if (source == liveleavesItem)
30453483 {
....@@ -3180,6 +3618,18 @@
31803618 if (source == transformChildrenItem)
31813619 {
31823620 TransformChildren();
3621
+ } else
3622
+ if (source == textureRatioRItem)
3623
+ {
3624
+ TextureRatio(0);
3625
+ } else
3626
+ if (source == textureRatioGItem)
3627
+ {
3628
+ TextureRatio(1);
3629
+ } else
3630
+ if (source == textureRatioBItem)
3631
+ {
3632
+ TextureRatio(2);
31833633 } else
31843634 if (source == resetTransformItem)
31853635 {
....@@ -3352,38 +3802,7 @@
33523802 if (CameraPane.FULLSCREEN)
33533803 fullscreenLayout = radio.layout;
33543804
3355
- // bug
3356
- //gridPanel.setDividerLocation(1.0);
3357
- //bigPanel.setDividerLocation(0.0);
3358
-// bigThree.remove(scenePanel);
3359
-// bigThree.remove(centralPanel);
3360
-// bigThree.remove(XYZPanel);
3361
-// aWindowConstraints.gridx = 0;
3362
-// aWindowConstraints.gridy = 0;
3363
-// aWindowConstraints.gridwidth = 1;
3364
-// // aConstraints.gridheight = 3;
3365
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3366
-// aWindowConstraints.weightx = 0;
3367
-// aWindowConstraints.weighty = 1;
3368
-// //bigThree.add(jtp, aWindowConstraints);
3369
-// aWindowConstraints.weightx = 1;
3370
-// aWindowConstraints.gridwidth = 3;
3371
-// // aConstraints.gridheight = 3;
3372
-// aWindowConstraints.gridx = 1;
3373
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3374
-// bigThree.add(centralPanel, aWindowConstraints);
3375
-// aWindowConstraints.weightx = 0;
3376
-// aWindowConstraints.gridx = 4;
3377
-// aWindowConstraints.gridwidth = 1;
3378
-// // aConstraints.gridheight = 3;
3379
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3380
-// //bigThree.add(XYZPanel, aWindowConstraints);
3381
-// scenePanel.setVisible(false);
3382
-// centralPanel.setVisible(true);
3383
-// XYZPanel.setVisible(false);
3384
- bigThree.ClearUI();
3385
- bigThree.add(centralPanel);
3386
- bigThree.FlushUI();
3805
+ Show3DView();
33873806
33883807 cameraView.requestFocusInWindow();
33893808
....@@ -3569,6 +3988,7 @@
35693988 } else
35703989 if (source == rootButton)
35713990 {
3991
+ Replace();
35723992 Object3D obj;
35733993 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
35743994 {
....@@ -3583,6 +4003,9 @@
35834003 if (source == closeButton)
35844004 {
35854005 //System.out.println("CLOSE: " + buttonGroup.getSelection());
4006
+ if (copy.versionlist != null)
4007
+ Replace();
4008
+
35864009 cRadio ab;
35874010 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
35884011 {
....@@ -3626,10 +4049,10 @@
36264049 {
36274050 Object3D child = (Object3D)e.nextElement();
36284051 if(child.editWindow != null)
3629
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36304052 child.pinned = false;
36314053 child.CloseUI();
36324054 listUI.remove(child);
4055
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36334056
36344057 //child.editWindow = null; // ???????????
36354058 }
....@@ -3648,6 +4071,7 @@
36484071 obj.CloseUI();
36494072 }
36504073 listUI.clear();
4074
+ SetPinStates(group.selection.size() > 0);
36514075 refreshContents(true);
36524076 } else
36534077 if (source == allParamsButton)
....@@ -3680,6 +4104,9 @@
36804104 } else
36814105 if(source instanceof cRadio)
36824106 {
4107
+ if (copy.versionlist != null)
4108
+ Replace();
4109
+
36834110 group.parent = keepparent;
36844111 group.attributes = 0;
36854112 //group.editWindow = null;
....@@ -3704,8 +4131,6 @@
37044131
37054132 copy = group;
37064133
3707
- SetUndoStates();
3708
-
37094134 //Globals.theRenderer.object = group;
37104135 if(!useclient)
37114136 {
....@@ -3733,7 +4158,33 @@
37334158 */
37344159 radio.layout.doClick();
37354160
4161
+ //assert(copy instanceof Composite);
4162
+
4163
+ if (copy.versionlist == null)
4164
+ {
4165
+ copy.versionindex = -1;
4166
+
4167
+ // Cannot work with loops
4168
+ // To fix this issue, we first mark all nodes above the root,
4169
+ // and check if any of these nodes are reachable below the root.
4170
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4171
+
4172
+ if (copy instanceof Composite && copy.versionlist == null && !copy.HasTags())
4173
+ {
4174
+ copy.versionlist = new Object3D[100];
4175
+
4176
+ //Save(true);
4177
+ }
4178
+ else
4179
+ copy.versionindex = -2;
4180
+
4181
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4182
+ }
4183
+
4184
+ SetVersionStates();
4185
+
37364186 ClearUnpinned();
4187
+
37374188 //Grafreed.Assert(group != null);
37384189 //Grafreed.Assert(group.selection != null);
37394190 SetPinStates(group.selection == null || group.selection.size() > 0);
....@@ -3750,11 +4201,13 @@
37504201 } else if (event.getSource() == editCameraItem)
37514202 {
37524203 cameraView.ProtectCamera();
4204
+ cameraView.requestFocusInWindow();
37534205 cameraView.repaint();
37544206 return;
37554207 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
37564208 {
37574209 cameraView.RevertCamera();
4210
+ cameraView.requestFocusInWindow();
37584211 cameraView.repaint();
37594212 return;
37604213 // } else if (event.getSource() == textureButton)
....@@ -3843,6 +4296,18 @@
38434296 refreshContents();
38444297 }
38454298
4299
+ void TextureRatio(int axis)
4300
+ {
4301
+ Object3D obj;
4302
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4303
+ {
4304
+ obj = (Object3D)e.nextElement();
4305
+ obj.TextureRatio(axis);
4306
+ }
4307
+
4308
+ refreshContents();
4309
+ }
4310
+
38464311 void ResetTransform()
38474312 {
38484313 ResetTransform(-1);
....@@ -3858,42 +4323,8 @@
38584323 if (obj.toParent == null)
38594324 continue;
38604325
3861
- if (mask == -1)
3862
- {
3863
- if (obj instanceof Camera) // jan 2014
3864
- {
3865
- LA.matIdentity(obj.toParent);
3866
- LA.matIdentity(obj.fromParent);
3867
- }
3868
- else
3869
- {
3870
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
3871
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
3872
- }
3873
- TouchTransform(obj);
3874
- continue;
3875
- }
3876
- if ((mask&2) != 0) // Scale
3877
- {
3878
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
3879
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
3880
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
3881
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
3882
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
3883
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
3884
- }
3885
- if ((mask&4) != 0) // Rotation
3886
- {
3887
- // ?
3888
- }
3889
- if ((mask&1) != 0) // Translation
3890
- {
3891
- if (obj.toParent != null)
3892
- {
3893
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
3894
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
3895
- }
3896
- }
4326
+ obj.ResetTransform(mask);
4327
+
38974328 if (obj.parent == null)
38984329 {
38994330 System.out.println("NULL PARENT!");
....@@ -4402,6 +4833,12 @@
44024833 {
44034834 Object3D obj = group.selection.get(i);
44044835
4836
+ if (obj.toParent == null)
4837
+ {
4838
+ obj.toParent = LA.newMatrix();
4839
+ obj.fromParent = LA.newMatrix();
4840
+ }
4841
+
44054842 LA.matTranslate(obj.toParent, i * scale, 0, 0);
44064843 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
44074844 }
....@@ -4693,6 +5130,12 @@
46935130 refreshContents();
46945131 }
46955132
5133
+ void ClearVersions()
5134
+ {
5135
+ group.selection.ClearVersions();
5136
+ refreshContents();
5137
+ }
5138
+
46965139 void FlipV(boolean flip)
46975140 {
46985141 group.selection.FlipV(flip);
....@@ -4887,9 +5330,7 @@
48875330
48885331 freezemodel = false;
48895332 }
4890
-
4891
- boolean flashIt = true;
4892
-
5333
+
48935334 public void valueChanged(TreeSelectionEvent e)
48945335 //public boolean handleEvent(Event event)
48955336 {
....@@ -4962,13 +5403,31 @@
49625403 {
49635404 editButton.setEnabled(enabled);
49645405 uneditButton.setEnabled(enabled);
4965
- unselectButton.setEnabled(enabled);
5406
+ //unselectButton.setEnabled(enabled);
49665407 flashSelectionButton.setEnabled(enabled);
5408
+
5409
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5410
+
5411
+ boolean allComposites = true;
5412
+
5413
+ if (group.selection != null)
5414
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5415
+ {
5416
+ Object next = e.nextElement();
5417
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5418
+ {
5419
+ allComposites = false;
5420
+ break;
5421
+ }
5422
+ }
5423
+
5424
+ rootButton.setEnabled(true); // allComposites);
49675425 }
49685426
49695427 void refreshContents(boolean cp)
49705428 {
4971
- if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5429
+ if (Globals.ADVANCED)
5430
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
49725431 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
49735432 {
49745433 objEditor.ClearInfo(); // .GetMaterial());
....@@ -4978,7 +5437,7 @@
49785437 Object3D child = (Object3D) group.selection.get(i);
49795438
49805439 objEditor.AddInfo(child, this, true);
4981
- System.err.println("info : " + child.GetPath());
5440
+// System.err.println("info : " + child.GetPath());
49825441 }
49835442
49845443 objEditor.SetText(); // jan 2014
....@@ -5804,7 +6263,6 @@
58046263
58056264 cButton restoreCameraButton;
58066265
5807
- cButton saveButton;
58086266 cButton oneStepButton;
58096267
58106268 cButton groupButton;
....@@ -5862,11 +6320,11 @@
58626320 private MenuItem lookAtItem;
58636321 private MenuItem lookFromItem;
58646322 private MenuItem switchViewItem;
5865
- private MenuItem cutItem;
6323
+ private JMenuItem cutItem;
58666324 private MenuItem undoItem;
58676325 private MenuItem redoItem;
58686326 private JMenuItem duplicateItem;
5869
- private MenuItem cloneItem;
6327
+ private JMenuItem cloneItem;
58706328 private MenuItem cloneSupportItem;
58716329 private MenuItem overwriteGeoItem;
58726330 private MenuItem overwriteMatItem;
....@@ -5887,13 +6345,13 @@
58876345 private MenuItem cloneGeometriesItem;
58886346 private MenuItem shareGeometriesItem;
58896347 private MenuItem mergeGeometriesItem;
5890
- private MenuItem copyItem;
6348
+ private JMenuItem copyItem;
58916349 private MenuItem pasteItem;
5892
- private MenuItem pasteIntoItem;
5893
- private MenuItem pasteLinkItem;
5894
- private MenuItem pasteCloneItem;
5895
- private MenuItem pasteExpandItem;
5896
- private MenuItem deleteItem;
6350
+ private JMenuItem pasteIntoItem;
6351
+ private JMenuItem pasteLinkItem;
6352
+ private JMenuItem pasteCloneItem;
6353
+ private JMenuItem pasteExpandItem;
6354
+ private JMenuItem deleteItem;
58976355 private MenuItem clearAllItem;
58986356 private MenuItem genUVItem;
58996357 private MenuItem genNormalsMESHItem;
....@@ -5919,6 +6377,7 @@
59196377 private MenuItem clipMeshItem;
59206378 private MenuItem smoothMeshItem;
59216379 private MenuItem clearMaterialsItem;
6380
+ private MenuItem clearVersionsItem;
59226381
59236382 private MenuItem liveleavesItem;
59246383 private MenuItem unliveleavesItem;
....@@ -5942,13 +6401,16 @@
59426401 private MenuItem maxTexturesItem;
59436402 private MenuItem panoTexturesItem;
59446403
6404
+ private MenuItem textureRatioRItem;
6405
+ private MenuItem textureRatioGItem;
6406
+ private MenuItem textureRatioBItem;
59456407 private MenuItem resetCentroidItem;
59466408 private MenuItem resetCentroidXZItem;
59476409 private MenuItem resetTransformItem;
59486410 private MenuItem transformGeometryItem;
59496411 private MenuItem transformChildrenItem;
59506412 private MenuItem hideItem;
5951
- private MenuItem grabItem;
6413
+ private JMenuItem grabItem;
59526414 private MenuItem backItem;
59536415 private MenuItem frontItem;
59546416 private MenuItem cameraItem;
....@@ -5961,7 +6423,7 @@
59616423 private MenuItem switchTransfoItem;
59626424 private MenuItem morphItem;
59636425 private MenuItem linkerItem;
5964
- private MenuItem ungroupItem;
6426
+ private JMenuItem ungroupItem;
59656427 private MenuItem editItem;
59666428 private MenuItem openWindowItem;
59676429 private MenuItem editLeafItem;