Normand Briere
2019-09-02 21ac57b36a9e3b909853c7d64ac29b7ad72490a3
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,
....@@ -23,6 +24,350 @@
2324 DragGestureListener, DragSourceListener, DropTargetListener,
2425 ItemListener // ListSelectionListener
2526 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + 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);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
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
+
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
+
26371 //ObjEditor objEditor;
27372 public void closeUI2()
28373 {
....@@ -60,6 +405,16 @@
60405 this.copy = this.group = group;
61406 //selectees = this.group.selectees;
62407
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
+// }
417
+
63418 if(ui)
64419 SetupUI(objEditor);
65420 }
....@@ -80,10 +435,22 @@
80435 SetupViews(objEditor);
81436
82437 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
438
+
439
+// if (copy.versionlist == null)
440
+// {
441
+// copy.versionlist = new Object3D[100];
442
+// copy.versionindex = -1;
443
+//
444
+// //Save(true);
445
+// }
83446 }
84447
85448 void CloneSelection(boolean supports)
86449 {
450
+ if (Globals.REPLACEONMAKE)
451
+ Save();
452
+ boolean keep = Globals.REPLACEONMAKE;
453
+ Globals.REPLACEONMAKE = false;
87454 // Object3D keep = GrafreeD.clipboard;
88455 //Object3D obj;
89456 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +461,7 @@
94461
95462 makeSomething(clone, i==group.selection.size()-1);
96463 }
464
+ Globals.REPLACEONMAKE = keep;
97465 }
98466
99467 void CloneClipboard(boolean supports)
....@@ -164,33 +532,35 @@
164532 // menu.add("-");
165533 duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
166534 duplicateItem.addActionListener(this);
167
- cloneItem = menu.add(new MenuItem("Clone"));
535
+
536
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
168537 cloneItem.addActionListener(this);
169
- if (Globals.ADVANCED)
538
+ //if (Globals.ADVANCED)
170539 {
171540 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
172541 cloneSupportItem.addActionListener(this);
173542 }
543
+ oe.jTree.popup.addSeparator();
174544 menu.add("-");
175
- cutItem = menu.add(new MenuItem("Cut"));
545
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
176546 cutItem.addActionListener(this);
177
- copyItem = menu.add(new MenuItem("Copy"));
547
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
178548 copyItem.addActionListener(this);
179549 pasteItem = menu.add(new MenuItem("Paste"));
180550 pasteItem.addActionListener(this);
181551
182
- menu.add("-");
183
- pasteIntoItem = menu.add(new MenuItem("Paste into"));
552
+ oe.jTree.popup.addSeparator();
553
+ //menu.add("-");
554
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
184555 pasteIntoItem.addActionListener(this);
185
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
556
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
186557 pasteLinkItem.addActionListener(this);
187
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
558
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
188559 pasteCloneItem.addActionListener(this);
189
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
560
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
190561 // pasteExpandItem.addActionListener(this);
191
- menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
562
+ //menu.add("-");
563
+ oe.jTree.popup.addSeparator();
194564
195565 if (Globals.ADVANCED)
196566 {
....@@ -276,11 +646,9 @@
276646 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277647 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278648 //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280649 oe.cameraMenu.add("-");
281650 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
282651 openWindowItem.addActionListener(this);
283
- editLeafItem.addActionListener(this);
284652 lookAtItem.addActionListener(this);
285653 //lookFromItem.addActinoListener(this);
286654 //switchViewItem.addActionListener(this);
....@@ -327,9 +695,8 @@
327695 setMasterItem.addActionListener(this);
328696 }
329697
330
- oe.menuBar.add(menu = new Menu("Group"));
331
-// grabItem = menu.add(new MenuItem("Grab"));
332
-// grabItem.addActionListener(this);
698
+ oe.menuBar.add(menu = new Menu("Order"));
699
+
333700 backItem = menu.add(new MenuItem("Back"));
334701 backItem.addActionListener(this);
335702 frontItem = menu.add(new MenuItem("Front"));
....@@ -337,13 +704,21 @@
337704 // compositeItem = menu.add(new MenuItem("Composite"));
338705 // compositeItem.addActionListener(this);
339706
707
+ grabItem = oe.jTree.popup.add(new JMenuItem("Group"));
708
+ grabItem.addActionListener(this);
709
+
340710 if (Globals.ADVANCED)
341711 {
342712 hideItem = menu.add(new MenuItem("Hidden Group"));
343713 hideItem.addActionListener(this);
344714 }
345
- ungroupItem = menu.add(new MenuItem("Ungroup"));
715
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
346716 ungroupItem.addActionListener(this);
717
+
718
+ oe.jTree.popup.addSeparator();
719
+
720
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
721
+ deleteItem.addActionListener(this);
347722
348723 // menu.add("-");
349724 //
....@@ -380,24 +755,32 @@
380755 shadowYItem.addActionListener(this);
381756 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382757 shadowZItem.addActionListener(this);
758
+
759
+ attributeItem = menu.add(new MenuItem("Attribute"));
760
+ attributeItem.addActionListener(this);
383761 if (Globals.ADVANCED)
384762 {
385763 menu.add("-");
386764 linkerItem = menu.add(new MenuItem("Linker"));
387765 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390766 templateItem = menu.add(new MenuItem("Template"));
391767 templateItem.addActionListener(this);
392768 pointflowItem = menu.add(new MenuItem("Point Flow"));
393769 pointflowItem.addActionListener(this);
394770 }
395771 menu.add("-");
772
+ textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red"));
773
+ textureRatioRItem.addActionListener(this);
774
+ textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green"));
775
+ textureRatioGItem.addActionListener(this);
776
+ textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue"));
777
+ textureRatioBItem.addActionListener(this);
778
+ menu.add("-");
396779 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
397780 resetTransformItem.addActionListener(this);
398781 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
399782 resetCentroidItem.addActionListener(this);
400
- resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
783
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ"));
401784 resetCentroidXZItem.addActionListener(this);
402785 transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
403786 transformGeometryItem.addActionListener(this);
....@@ -415,7 +798,7 @@
415798 genNormalsMESHItem.addActionListener(this);
416799 if (Globals.ADVANCED)
417800 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
801
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419802 genNormalsMINEItem.addActionListener(this);
420803 }
421804 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -449,6 +832,8 @@
449832 }
450833
451834 oe.menuBar.add(menu = new Menu("Attributes"));
835
+ clearVersionsItem = menu.add(new MenuItem("Clear Versions"));
836
+ clearVersionsItem.addActionListener(this);
452837 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
453838 clearMaterialsItem.addActionListener(this);
454839 resetAllItem = menu.add(new MenuItem("Reset All"));
....@@ -471,9 +856,9 @@
471856 hideleavesItem.addActionListener(this);
472857 showleavesItem = menu.add(new MenuItem("Show Leaves"));
473858 showleavesItem.addActionListener(this);
474
- markleavesItem = menu.add(new MenuItem("Mark Leaves"));
859
+ markleavesItem = menu.add(new MenuItem("Anim Leaves"));
475860 markleavesItem.addActionListener(this);
476
- unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
861
+ unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves"));
477862 unmarkleavesItem.addActionListener(this);
478863 rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479864 rewindleavesItem.addActionListener(this);
....@@ -508,10 +893,15 @@
508893 attachBumpItem.addActionListener(this);
509894 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
510895 pigmentBumpItem.addActionListener(this);
896
+ //embedTexturesItem
511897 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
512898 detachPigmentItem.addActionListener(this);
513899 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
514900 detachBumpItem.addActionListener(this);
901
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
902
+ embedTexturesItem.addActionListener(this);
903
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
904
+ deEmbedTexturesItem.addActionListener(this);
515905 menu.add("-");
516906 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
517907 sortbysizeItem.addActionListener(this);
....@@ -522,6 +912,9 @@
522912 shareGeometriesItem.addActionListener(this);
523913 mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
524914 mergeGeometriesItem.addActionListener(this);
915
+ menu.add("-");
916
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
917
+ editLeafItem.addActionListener(this);
525918 if (Globals.ADVANCED)
526919 {
527920 // Pretty much the same as duplicate and clone.
....@@ -538,6 +931,80 @@
538931 buildToolsMenu(menu);
539932 }
540933
934
+ JTabbedPane resourcecontainer;
935
+ cGridBag currenttab;
936
+ //boolean added; // patch for jar
937
+
938
+ int totalcount = 0;
939
+
940
+ int tabcount = 0;
941
+ int colcount = 0;
942
+ int rowcount = 0;
943
+ int texturecount = 0;
944
+
945
+ int columns = 5;
946
+ int rows = 7;
947
+
948
+ public void ResourceCallBack(String[] path)
949
+ {
950
+// for (int i = 0; i < path.length; i++)
951
+// System.out.print(path[i] + "/");
952
+// System.out.println();
953
+
954
+ if (//rowcount == 0 ||
955
+ path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store"))
956
+ {
957
+ currenttab = new cGridBag();
958
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
959
+ currenttab.setName(tabname);
960
+ //added = false;
961
+ resourcecontainer.add(currenttab);
962
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
963
+ rowcount = 1;
964
+ colcount = 0;
965
+ texturecount = 0;
966
+ }
967
+
968
+ if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png")))
969
+ {
970
+ //if (!added)
971
+ {
972
+ //added = true;
973
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
974
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
975
+ }
976
+
977
+ AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab);
978
+ totalcount++;
979
+
980
+ if (++colcount >= columns)
981
+ {
982
+ colcount = 0;
983
+ currenttab.Return();
984
+
985
+ if (rowcount++ >= rows)
986
+ {
987
+ rowcount = 0;
988
+ }
989
+ }
990
+ }
991
+ else
992
+ {
993
+// if (!path[path.length-1].equals("icons"))
994
+// resourcecontainer.Return();
995
+ }
996
+ }
997
+
998
+ void CreateTexturePanel(cGridBag container)
999
+ {
1000
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
1001
+ container.add(resourcecontainer);
1002
+
1003
+ Grafreed.ParseResources("textures", this);
1004
+
1005
+ // 935. System.out.println("Total = " + totalcount);
1006
+ }
1007
+
5411008 void SetupUI2(ObjEditor oe)
5421009 {
5431010 // June 2019
....@@ -555,11 +1022,6 @@
5551022 //new Exception().printStackTrace();
5561023
5571024 oe.radioPanel = new JPanel(new GridBagLayout());
558
- oe.aConstraints.weightx = 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
561
- oe.aConstraints.gridwidth = 100;
562
- oe.aConstraints.gridheight = 1;
5631025 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
5641026
5651027 oe.buttonGroup = new ButtonGroup();
....@@ -580,9 +1042,9 @@
5801042 oe.radioPanel.add(dummyButton);
5811043 oe.buttonGroup.add(dummyButton);
5821044 */
583
- cGridBag copyOptionsPanel = new cGridBag();
1045
+ cGridBag versionManagerPanel = new cGridBag();
5841046
585
- copyOptionsPanel.preferredHeight = 1;
1047
+ versionManagerPanel.preferredHeight = 4;
5861048
5871049 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
5881050
....@@ -592,51 +1054,108 @@
5921054
5931055 if (Globals.ADVANCED)
5941056 {
595
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- maxButton.setToolTipText("Maximize window");
597
- maxButton.addActionListener(this);
1057
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+// maxButton.setToolTipText("Maximize window");
1059
+// maxButton.addActionListener(this);
5981060 }
5991061
600
- oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
- fullButton.setToolTipText("Full-screen window");
602
- fullButton.addActionListener(this);
1062
+ cButton gcButton;
6031063
604
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+// gcButton.setToolTipText("Garbage collect");
1066
+// gcButton.addActionListener(new ActionListener()
1067
+// {
1068
+// public void actionPerformed(ActionEvent e)
1069
+// {
1070
+// System.gc();
1071
+// }
1072
+// });
1073
+
1074
+ oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1075
+ fullScreenButton.setToolTipText("Full-screen window");
1076
+ fullScreenButton.addActionListener(this);
1077
+
1078
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1079
+ collapseButton.setToolTipText("Collapse toolbar");
1080
+ collapseButton.addActionListener(this);
1081
+
1082
+// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1083
+// maximize3DButton.setToolTipText("Maximize 3D view");
1084
+// maximize3DButton.addActionListener(this);
1085
+
1086
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1087
+ twoButton.setToolTipText("Show 3D view only");
1088
+ twoButton.addActionListener(this);
1089
+ this.fullscreenLayout = twoButton;
1090
+
1091
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1092
+ threeButton.setToolTipText("Show controls and 3D view");
1093
+ threeButton.addActionListener(this);
1094
+ if (Globals.ADVANCED)
1095
+ {
1096
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1097
+ sixButton.setToolTipText("Show 3D view and controls");
1098
+ sixButton.addActionListener(this);
1099
+ }
1100
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+// sevenButton.setToolTipText("3-column layout");
1102
+// sevenButton.addActionListener(this);
1103
+ //
1104
+
1105
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1106
+ screenfitButton.setToolTipText("Screen fit");
1107
+ screenfitButton.addActionListener(this);
1108
+
1109
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6051110 restoreCameraButton.setToolTipText("Restore viewpoint");
6061111 restoreCameraButton.addActionListener(this);
6071112
608
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- undoButton.setToolTipText("Undo changes");
610
- undoButton.addActionListener(this);
611
- undoButton.setEnabled(false);
1113
+ versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1114
+ saveVersionButton.setToolTipText("Duplicate current version");
1115
+ saveVersionButton.addActionListener(this);
1116
+
1117
+ versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1118
+ deleteVersionButton.setToolTipText("Delete current version");
1119
+ deleteVersionButton.addActionListener(this);
1120
+ deleteVersionButton.setEnabled(false);
1121
+
1122
+ versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1123
+ previousVersionButton.setToolTipText("Previous version");
1124
+ previousVersionButton.addActionListener(this);
1125
+ previousVersionButton.setEnabled(false);
6121126
613
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
- redoButton.setToolTipText("Redo changes");
615
- redoButton.addActionListener(this);
616
- redoButton.setEnabled(false);
1127
+ cGridBag updown = new cGridBag().setVertical(true);
1128
+ updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1129
+ restoreButton.setToolTipText("Undo (restore current version)");
1130
+ restoreButton.addActionListener(this);
1131
+ restoreButton.setEnabled(false);
6171132
618
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
- saveButton.setToolTipText("Save changes");
620
- saveButton.addActionListener(this);
1133
+ updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1134
+ replaceButton.setToolTipText("Save (replace current version)");
1135
+ replaceButton.addActionListener(this);
1136
+ replaceButton.setEnabled(false);
6211137
622
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
623
- liveCB.setToolTipText("Enable animation");
624
- liveCB.addItemListener(this);
625
-
626
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1138
+ versionManagerPanel.add(updown);
1139
+
1140
+ versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1141
+ nextVersionButton.setToolTipText("Next version");
1142
+ nextVersionButton.addActionListener(this);
1143
+ nextVersionButton.setEnabled(false);
1144
+
1145
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6271146 oneStepButton.setToolTipText("Animate one step forward");
6281147 oneStepButton.addActionListener(this);
6291148
630
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1149
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1150
+ liveCB.setToolTipText("Enable animation");
1151
+ liveCB.addItemListener(this);
1152
+
1153
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
6311154 fastCB.setToolTipText("Fast mode");
6321155 fastCB.addItemListener(this);
6331156
6341157 //oe.toolboxPanel.Return();
6351158
636
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
- screenfitButton.setToolTipText("Screen fit");
638
- screenfitButton.addActionListener(this);
639
-
6401159 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
6411160 // trackCB.setToolTipText("Enable tracking");
6421161 // trackCB.addItemListener(this);
....@@ -646,142 +1165,137 @@
6461165
6471166 if (Globals.ADVANCED)
6481167 {
649
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6501169 snapobjectButton.addActionListener(this);
6511170 snapobjectButton.setToolTipText("Snap Object");
1171
+
1172
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1173
+ fourButton.addActionListener(this);
1174
+ fourButton.setToolTipText("Show control panel only");
6521175 }
6531176
6541177 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
6551178
656
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- twoButton.setToolTipText("Show center view only");
658
- twoButton.addActionListener(this);
659
- this.fullscreenLayout = twoButton;
660
-
661
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
- fourButton.addActionListener(this);
663
- fourButton.setToolTipText("Show left panel only");
664
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
- sixButton.setToolTipText("2-column layout left");
666
- sixButton.addActionListener(this);
667
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- threeButton.setToolTipText("2-column layout right");
669
- threeButton.addActionListener(this);
670
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- sevenButton.setToolTipText("3-column layout");
672
- sevenButton.addActionListener(this);
673
- //
6741179
675
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
- rootButton.setToolTipText("Edit selection in new tab");
1180
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1181
+ rootButton.setToolTipText("Open selection in new tab");
6771182 rootButton.addActionListener(this);
6781183
679
- oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6801185 closeButton.setToolTipText("Close tab");
6811186 closeButton.addActionListener(this);
6821187 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6831188 //clearButton.addActionListener(this);
6841189
1190
+ cGridBag row1 = new cGridBag();
1191
+
6851192 // INSERT
686
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
- gridButton.setToolTipText("Create grid");
1193
+ row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1194
+ gridButton.setToolTipText("Create ground");
6881195 gridButton.addActionListener(this);
6891196
690
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
6911198 boxButton.setToolTipText("Create box");
6921199 boxButton.addActionListener(this);
6931200
694
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
- sphereButton.setToolTipText("Create sphere");
696
- sphereButton.addActionListener(this);
697
-
698
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
- coneButton.setToolTipText("Create cone");
700
- coneButton.addActionListener(this);
701
-
702
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
- torusButton.setToolTipText("Create torus");
704
- torusButton.addActionListener(this);
705
-
706
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1201
+ row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7071202 superButton.setToolTipText("Create superellipsoid");
7081203 superButton.addActionListener(this);
7091204
710
- if (Globals.ADVANCED)
1205
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1206
+ sphereButton.setToolTipText("Create sphere");
1207
+ sphereButton.addActionListener(this);
1208
+
1209
+ row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1210
+ coneButton.setToolTipText("Create cone");
1211
+ coneButton.addActionListener(this);
1212
+
1213
+ row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1214
+ torusButton.setToolTipText("Create torus");
1215
+ torusButton.addActionListener(this);
1216
+
1217
+ if (false) //Globals.ADVANCED)
7111218 {
712
- oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7131220 kleinButton.setToolTipText("Create Klein bottle");
7141221 kleinButton.addActionListener(this);
7151222 }
7161223
717
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7181225 particlesButton.setToolTipText("Create particle system");
7191226 particlesButton.addActionListener(this);
7201227
721
- oe.toolboxPanel.Return();
1228
+ oe.toolboxPanel.add(row1);
7221229
723
- oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1230
+ cGridBag row2 = new cGridBag();
1231
+
1232
+ row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7241233 groupButton.setToolTipText("Create group");
7251234 groupButton.addActionListener(this);
7261235
727
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7281237 compositeButton.setToolTipText("Create composite");
7291238 compositeButton.addActionListener(this);
7301239
731
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7321241 switchButton.setToolTipText("Create item switcher");
7331242 switchButton.addActionListener(this);
7341243
735
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1244
+ row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7361245 loopButton.setToolTipText("Create loop");
7371246 loopButton.addActionListener(this);
7381247
739
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7401249 textureButton.setToolTipText("Create texture");
7411250 textureButton.addActionListener(this);
7421251
743
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7441253 overlayButton.setToolTipText("Create overlay");
7451254 overlayButton.addActionListener(this);
7461255
747
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1256
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7481257 lightButton.setToolTipText("Create light");
7491258 lightButton.addActionListener(this);
7501259
751
- for (int i=6; --i>=0;)
752
- {
753
- oe.toolboxPanel.Return();
754
- oe.toolboxPanel.add(new cGridBag());
755
- oe.toolboxPanel.add(new cGridBag());
756
- oe.toolboxPanel.add(new cGridBag());
757
- oe.toolboxPanel.add(new cGridBag());
758
- oe.toolboxPanel.add(new cGridBag());
759
- oe.toolboxPanel.add(new cGridBag());
760
- oe.toolboxPanel.add(new cGridBag());
761
- }
1260
+ oe.toolboxPanel.add(row2);
1261
+
1262
+ cGridBag textures = new cGridBag();
1263
+
1264
+ CreateTexturePanel(textures);
1265
+
1266
+ int tabCount = resourcecontainer.getTabCount();
1267
+
1268
+ if (tabCount > 0)
1269
+ resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount));
1270
+
1271
+ oe.toolboxPanel.add(textures);
1272
+
1273
+ textures.preferredHeight = 100;
1274
+
1275
+ CreateSkyboxPanel(oe.skyboxPanel);
7621276
7631277 // EDIT panel
764
- editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7651279 editButton.setToolTipText("Pin selection controls");
7661280 editButton.addActionListener(this);
7671281
768
- editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
- uneditButton.setToolTipText("Remove selection controls");
1282
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1283
+ uneditButton.setToolTipText("Unpin and remove selection controls");
7701284 uneditButton.addActionListener(this);
7711285
7721286 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
773
- allParamsButton.setToolTipText("Show all controle");
1287
+ allParamsButton.setToolTipText("Show all controls");
7741288 allParamsButton.addActionListener(this);
7751289
776
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
- clearPanelButton.setToolTipText("Clear edit panel");
1290
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1291
+ clearPanelButton.setToolTipText("Clear all controls");
7781292 clearPanelButton.addActionListener(this);
7791293
780
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
- unselectButton.setToolTipText("Unselect");
782
- unselectButton.addActionListener(this);
1294
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1295
+ //unselectButton.setToolTipText("Unselect");
1296
+ //unselectButton.addActionListener(this);
7831297
784
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1298
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
7851299 flashSelectionButton.setToolTipText("Highlight selection");
7861300 flashSelectionButton.addActionListener(this);
7871301
....@@ -804,6 +1318,8 @@
8041318
8051319 cGridBag jSPPanel = new cGridBag();
8061320
1321
+ jSPPanel.preferredHeight = 20;
1322
+
8071323 JScrollPane jSP;
8081324 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
8091325 jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
....@@ -812,11 +1328,14 @@
8121328 oe.treePanel.add(jSPPanel);
8131329 oe.treePanel.Return();
8141330
815
- oe.treePanel.add(copyOptionsPanel);
1331
+ oe.treePanel.add(versionManagerPanel);
8161332 oe.treePanel.Return();
1333
+ versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1334
+ versionSlider = (cNumberSlider)versionSliderPane.getComponent(1);
1335
+ versionSliderPane.preferredHeight = 3;
8171336
818
-// mainPanel.setDividerLocation(0.5); //1.0);
819
-// mainPanel.setResizeWeight(0.5);
1337
+// mainPanel.setDividerLocation(0.1); //1.0);
1338
+ mainPanel.setResizeWeight(0.4);
8201339
8211340 //jList.addListSelectionListener(this);
8221341 oe.jTree.addTreeSelectionListener(this);
....@@ -824,7 +1343,7 @@
8241343 //jTree.setEditable(true);
8251344 oe.jTree.setDragEnabled(true);
8261345 //jTree.setPreferredSize(new Dimension(10,10));
827
- jSP.setPreferredSize(new Dimension(100,200));
1346
+ //jSP.setPreferredSize(new Dimension(100,200));
8281347
8291348 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
8301349
....@@ -836,7 +1355,7 @@
8361355 dgr.addDragGestureListener(this);
8371356 }catch(Exception e) {}
8381357 */
839
- radio.layout = sevenButton;
1358
+ radio.layout = threeButton; // sixButton;
8401359 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8411360 }
8421361
....@@ -887,9 +1406,12 @@
8871406 smoothCB.setToolTipText("Snapping delay");
8881407 smoothCB.addItemListener(this);
8891408
890
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
891
- slowCB.setToolTipText("Smooth interpolation");
892
- slowCB.addItemListener(this);
1409
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1410
+// slowCB.setToolTipText("Smooth interpolation");
1411
+// slowCB.addItemListener(this);
1412
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1413
+ minshaderCB.setToolTipText("Minimal fast shader");
1414
+ minshaderCB.addItemListener(this);
8931415
8941416 // constraints.gridy += 1;
8951417 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -939,9 +1461,9 @@
9391461 toggleSwitchCB.setToolTipText("Choose a single item");
9401462 toggleSwitchCB.addItemListener(this);
9411463
942
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
943
- autosaveCB.setToolTipText("On structure change");
944
- autosaveCB.addItemListener(this);
1464
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1465
+ autokeepCB.setToolTipText("On structure change");
1466
+ autokeepCB.addItemListener(this);
9451467
9461468 panel.Return();
9471469 if (Globals.ADVANCED)
....@@ -968,9 +1490,17 @@
9681490
9691491 void EditObject(Object3D obj)
9701492 {
1493
+ //assert(obj instanceof Composite);
1494
+
1495
+// if (obj.versionlist == null)
1496
+// {
1497
+// obj.versionlist = new Object3D[100];
1498
+// obj.versionindex = -1;
1499
+// }
1500
+
9711501 cRadio radioButton = new cRadio(obj.name);
9721502
973
- // Patch to avoid bug with transparency.
1503
+ // June 2019. Patch to avoid bug with transparency.
9741504 radioButton.hadMaterial = obj.material != null;
9751505 if (!radioButton.hadMaterial)
9761506 {
....@@ -978,7 +1508,7 @@
9781508 }
9791509
9801510 radioButton.SetObject(obj);
981
- radioButton.layout = sevenButton;
1511
+ radioButton.layout = threeButton; // sixButton;
9821512 radioButton.SetCamera(cameraView.renderCamera, false);
9831513 radioButton.addActionListener(this);
9841514 radioPanel.add(radioButton);
....@@ -992,6 +1522,7 @@
9921522
9931523 oe.SetupViews();
9941524
1525
+ if (Globals.DEBUG)
9951526 System.out.println("SetupViews");
9961527 DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(
9971528 oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ??
....@@ -1003,6 +1534,8 @@
10031534 cCheckBox localCB;
10041535 cCheckBox crowdCB;
10051536 cCheckBox smoothCB;
1537
+ cCheckBox minshaderCB;
1538
+
10061539 cToggleButton fastCB;
10071540 cCheckBox slowCB;
10081541 cCheckBox boxCB;
....@@ -1018,7 +1551,7 @@
10181551
10191552 cCheckBox oeilCB;
10201553 cCheckBox shadowCB;
1021
- cCheckBox autosaveCB;
1554
+ cCheckBox autokeepCB;
10221555 cCheckBox lookAtCB;
10231556
10241557 // static int COLOR = 1;
....@@ -1073,6 +1606,12 @@
10731606 {
10741607 cameraView.ToggleInertia();
10751608 cameraView.repaint();
1609
+ }
1610
+ else if(e.getSource() == minshaderCB)
1611
+ {
1612
+ Globals.MINSHADER ^= true;
1613
+ cameraView.programInitialized = false;
1614
+ cameraView.repaint();
10761615 }
10771616 else if(e.getSource() == localCB)
10781617 {
....@@ -1130,9 +1669,9 @@
11301669 {
11311670 Globals.FREEZEONMOVE ^= true;
11321671 }
1133
- else if(e.getSource() == autosaveCB)
1672
+ else if(e.getSource() == autokeepCB)
11341673 {
1135
- Globals.SAVEONMAKE ^= true;
1674
+ Globals.REPLACEONMAKE ^= true;
11361675 }
11371676 else if(e.getSource() == lookAtCB)
11381677 {
....@@ -1214,8 +1753,6 @@
12141753 }
12151754 }
12161755
1217
- String string = (String) object;
1218
-
12191756 System.out.println("Transfer = " + object + "; drop : " + target);
12201757 // if( object instanceof java.io.File[])
12211758 // {
....@@ -1223,6 +1760,8 @@
12231760 // objEditor.DropFile((java.io.File[]) object, true);
12241761 // return;
12251762 // }
1763
+
1764
+ String string = object.toString();
12261765
12271766 // File path for Mac and Windows
12281767 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1350,7 +1889,12 @@
13501889 TreePath path;
13511890
13521891 public TransferableTreePath(TreePath tp) {
1353
- path = tp;
1892
+ Object[] objs = new Object[tp.getPathCount()];
1893
+ for (int i=0; i<objs.length; i++)
1894
+ {
1895
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1896
+ }
1897
+ path = new TreePath(objs);
13541898 }
13551899
13561900 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1487,6 +2031,8 @@
14872031 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14882032 reduce34MorphItem.addActionListener(this);
14892033 menu.add("-");
2034
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
2035
+ memoryItem.addActionListener(this);
14902036 menu.add(computeAOItem = new MenuItem("Compute AO"));
14912037 computeAOItem.addActionListener(this);
14922038
....@@ -1495,8 +2041,6 @@
14952041 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14962042 mirrorItem.addActionListener(this);
14972043 menu.add("-");
1498
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1499
- memoryItem.addActionListener(this);
15002044 menu.add(analyzeItem = new MenuItem("Analyze"));
15012045 analyzeItem.addActionListener(this);
15022046 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1582,24 +2126,24 @@
15822126 switch(axis)
15832127 {
15842128 case 0 :
1585
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1586
- vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z;
1587
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1588
- vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z;
2129
+ vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z;
2130
+ vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z;
2131
+ vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z;
2132
+ vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z;
15892133 norm = cVector.X;
15902134 break;
15912135 case 1 :
1592
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1593
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1594
- vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z;
1595
- vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z;
2136
+ vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z;
2137
+ vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z;
2138
+ vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z;
2139
+ vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z;
15962140 norm = cVector.Y;
15972141 break;
15982142 case 2 :
1599
- vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z;
1600
- vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z;
1601
- vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z;
1602
- vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z;
2143
+ vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f;
2144
+ vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f;
2145
+ vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f;
2146
+ vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f;
16032147 norm = cVector.Z;
16042148 break;
16052149 }
....@@ -1640,7 +2184,11 @@
16402184 shadow.material = new cMaterial(obj.material);
16412185 shadow.material.diffuse = 0.0001f;
16422186 shadow.material.specular = 0.0001f;
1643
- //shadow.projectedVertices[1].x = 300;
2187
+ shadow.material.opacity = 0.75f;
2188
+
2189
+ AllocProjectedVertices(shadow);
2190
+
2191
+ shadow.projectedVertices[1].x = 300;
16442192
16452193 makeSomething(shadow);
16462194 }
....@@ -1657,6 +2205,16 @@
16572205 listUI.remove(i);
16582206 }
16592207 }
2208
+ }
2209
+
2210
+ private void EditElement(Object3D elem, boolean newWindow)
2211
+ {
2212
+ // if (!(elem instanceof Composite))
2213
+ // newWindow = false;
2214
+ listUI.add(elem);
2215
+ elem.openEditWindow(this, newWindow); //, false);
2216
+ System.out.println("edit : " + elem);
2217
+ elem.editWindow.refreshContents(true); // ? new
16602218 }
16612219
16622220 /**
....@@ -2086,6 +2644,23 @@
20862644 {
20872645 makeSomething(new Light());
20882646 } else
2647
+// if (source == skybox1Button ||
2648
+// source == skybox2Button ||
2649
+// source == skybox3Button ||
2650
+// source == skybox4Button ||
2651
+// source == skybox5Button ||
2652
+// source == skybox6Button ||
2653
+// source == skybox7Button ||
2654
+// source == skybox11Button ||
2655
+// source == skybox12Button ||
2656
+// source == skybox13Button ||
2657
+// source == skybox14Button ||
2658
+// source == skybox15Button ||
2659
+// source == skybox16Button ||
2660
+// source == skybox17Button)
2661
+// {
2662
+// ChangeSkybox(source);
2663
+// } else
20892664 if (source == csgItem)
20902665 {
20912666 group(new CSG());
....@@ -2134,27 +2709,35 @@
21342709 } else
21352710 if (source == loopItem || source == loopButton)
21362711 {
2712
+ if (!group.selection.isEmpty())
2713
+ {
21372714 Composite csg = new GroupLeaf();
2138
- csg.count = 5;
21392715 group(csg);
2716
+ csg.count = 5;
21402717 Composite child = new cGroup("Branch");
21412718 csg.addChild(child);
21422719 child.addChild(csg);
2720
+ }
21432721 } else
21442722 if (source == doubleItem)
21452723 {
2724
+ if (!group.selection.isEmpty())
2725
+ {
21462726 Composite csg = new GroupLeaf("Fork");
2147
- csg.count = 5;
21482727 group(csg);
2728
+ csg.count = 5;
21492729 Composite child = new cGroup("Branch A");
21502730 csg.addChild(child);
21512731 child.addChild(csg);
21522732 child = new cGroup("Branch B");
21532733 csg.addChild(child);
21542734 child.addChild(csg);
2735
+ }
21552736 } else
21562737 if (source == tripleItem)
21572738 {
2739
+ if (!group.selection.isEmpty())
2740
+ {
21582741 Composite csg = new GroupLeaf("Trident");
21592742 csg.count = 4;
21602743 group(csg);
....@@ -2167,11 +2750,12 @@
21672750 child = new cGroup();
21682751 csg.addChild(child);
21692752 child.addChild(csg);
2753
+ }
21702754 } else
21712755 if (source == computeAOItem)
21722756 {
21732757 Globals.drawMode = CameraPane.OCCLUSION;
2174
- Globals.theRenderer.repaint();
2758
+ cameraView.repaint();
21752759 } else
21762760 if (source == recompileItem)
21772761 {
....@@ -2186,7 +2770,7 @@
21862770 if (source == invariantsItem)
21872771 {
21882772 System.out.println("Invariants:");
2189
- Grafreed.grafreeD.universe.invariants();
2773
+ Grafreed.grafreed.universe.invariants();
21902774 } else
21912775 if (source == memoryItem)
21922776 {
....@@ -2213,21 +2797,56 @@
22132797 {
22142798 Maximize();
22152799 } else
2216
- if (source == fullButton)
2800
+ if (source == fullScreenButton)
22172801 {
22182802 ToggleFullScreen();
22192803 } else
2220
- if (source == undoButton)
2804
+ if (source == collapseButton)
22212805 {
2222
- Undo();
2806
+ this.expandedLayout = radio.layout;
2807
+ CollapseToolbar();
22232808 } else
2224
- if (source == redoButton)
2809
+// if (source == maximize3DButton)
2810
+// {
2811
+// this.expandedLayout = radio.layout;
2812
+// radio.layout = twoButton;
2813
+// CollapseToolbar();
2814
+// Show3DView();
2815
+// } else
2816
+ if (source == previousVersionButton)
22252817 {
2226
- Redo();
2818
+ // Go to previous version
2819
+ //if (!Undo())
2820
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2821
+ PreviousVersion();
22272822 } else
2228
- if (source == saveButton)
2823
+ if (source == restoreButton)
22292824 {
2230
- Save();
2825
+ // Restore current version
2826
+ Restore();
2827
+ //restoreButton.setEnabled(false);
2828
+ } else
2829
+ if (source == replaceButton)
2830
+ {
2831
+ // Overwrite current version
2832
+ Replace();
2833
+ //replaceButton.setEnabled(false);
2834
+ } else
2835
+ if (source == nextVersionButton)
2836
+ {
2837
+ // Go to next version
2838
+ NextVersion();
2839
+ } else
2840
+ if (source == saveVersionButton)
2841
+ {
2842
+ // Save a new version
2843
+ if (!Save(true))
2844
+ java.awt.Toolkit.getDefaultToolkit().beep();
2845
+ } else
2846
+ if (source == deleteVersionButton)
2847
+ {
2848
+ // Delete a new version
2849
+ DeleteVersion();
22312850 } else
22322851 if (source == oneStepButton)
22332852 {
....@@ -2236,17 +2855,14 @@
22362855 } else
22372856 if (source == screenfitButton)
22382857 {
2239
- //Reload(lastConverter, lastFilename, true);
22402858 ScreenFit();
22412859 } else
22422860 if (source == screenfitpointButton)
22432861 {
2244
- //Reload(lastConverter, lastFilename, true);
22452862 ScreenFitPoint();
22462863 } else
22472864 if (source == snapobjectButton)
22482865 {
2249
- //Reload(lastConverter, lastFilename, true);
22502866 SnapObject();
22512867 } else
22522868 // if (event.getSource() == recompileButton)
....@@ -2285,11 +2901,11 @@
22852901 } else
22862902 if (source == undoItem)
22872903 {
2288
- Undo();
2904
+ PreviousVersion();
22892905 } else
22902906 if (source == redoItem)
22912907 {
2292
- Redo();
2908
+ NextVersion();
22932909 } else
22942910 if (source == duplicateItem)
22952911 {
....@@ -2610,7 +3226,7 @@
26103226 {
26113227 StepAll();
26123228 } else
2613
- if (source == clearItem) // || event.getSource() == clearButton)
3229
+ if (source == deleteItem) // || event.getSource() == clearButton)
26143230 {
26153231 //int indices[] = jList.getSelectedIndices();
26163232 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2770,22 +3386,34 @@
27703386 } else
27713387 if (source == ungroupItem || source == ungroupButton)
27723388 {
2773
- boolean hasRoot = false;
3389
+ boolean canUngroup = true;
27743390
27753391 for (int i=0; i<group.selection.size(); i++)
27763392 {
2777
- if (group.selection.get(i) == group)
3393
+ Object3D selectedItem = group.selection.get(i);
3394
+
3395
+ if (selectedItem.Size() == 0)
27783396 {
2779
- hasRoot = true;
3397
+ // Cannot ungroup leaves
3398
+ canUngroup = false;
3399
+ break;
3400
+ }
3401
+
3402
+ if (selectedItem == group)
3403
+ {
3404
+ // Cannot ungroup root
3405
+ canUngroup = false;
27803406 break;
27813407 }
27823408 }
27833409
2784
- if (!hasRoot)
3410
+ if (canUngroup)
27853411 {
27863412 for (int i=0; i<group.selection.size(); i++)
27873413 {
2788
- Ungroup(group.selection.get(i));
3414
+ Object3D selectedItem = group.selection.get(i);
3415
+
3416
+ Ungroup(selectedItem);
27893417 }
27903418
27913419 ClearSelection(false);
....@@ -2836,6 +3464,10 @@
28363464 if (source == clearMaterialsItem)
28373465 {
28383466 ClearMaterials();
3467
+ } else
3468
+ if (source == clearVersionsItem)
3469
+ {
3470
+ ClearVersions();
28393471 } else
28403472 if (source == liveleavesItem)
28413473 {
....@@ -2977,6 +3609,18 @@
29773609 {
29783610 TransformChildren();
29793611 } else
3612
+ if (source == textureRatioRItem)
3613
+ {
3614
+ TextureRatio(0);
3615
+ } else
3616
+ if (source == textureRatioGItem)
3617
+ {
3618
+ TextureRatio(1);
3619
+ } else
3620
+ if (source == textureRatioBItem)
3621
+ {
3622
+ TextureRatio(2);
3623
+ } else
29803624 if (source == resetTransformItem)
29813625 {
29823626 ResetTransform();
....@@ -3092,7 +3736,7 @@
30923736 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30933737 {
30943738 obj = (Object3D)e.nextElement();
3095
- obj.SetBumpTexture(null);
3739
+ obj.ResetBumpTexture();
30963740 }
30973741
30983742 refreshContents();
....@@ -3106,6 +3750,31 @@
31063750 obj.SetBumpTexture(obj.GetPigmentTexture());
31073751 }
31083752
3753
+ refreshContents();
3754
+ } else
3755
+ if (source == embedTexturesItem)
3756
+ {
3757
+ Object3D obj;
3758
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3759
+ {
3760
+ obj = (Object3D)e.nextElement();
3761
+ obj.EmbedTextures(true);
3762
+ }
3763
+
3764
+ refreshContents();
3765
+ } else
3766
+ if (source == deEmbedTexturesItem)
3767
+ {
3768
+ Object3D obj;
3769
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3770
+ {
3771
+ obj = (Object3D)e.nextElement();
3772
+ obj.EmbedTextures(false);
3773
+ }
3774
+
3775
+ CameraPane.texturepigment.clear();
3776
+ CameraPane.texturebump.clear();
3777
+
31093778 refreshContents();
31103779 } else
31113780 if (source == flashSelectionButton)
....@@ -3123,38 +3792,7 @@
31233792 if (CameraPane.FULLSCREEN)
31243793 fullscreenLayout = radio.layout;
31253794
3126
- // bug
3127
- //gridPanel.setDividerLocation(1.0);
3128
- //bigPanel.setDividerLocation(0.0);
3129
-// bigThree.remove(scenePanel);
3130
-// bigThree.remove(centralPanel);
3131
-// bigThree.remove(XYZPanel);
3132
-// aWindowConstraints.gridx = 0;
3133
-// aWindowConstraints.gridy = 0;
3134
-// aWindowConstraints.gridwidth = 1;
3135
-// // aConstraints.gridheight = 3;
3136
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3137
-// aWindowConstraints.weightx = 0;
3138
-// aWindowConstraints.weighty = 1;
3139
-// //bigThree.add(jtp, aWindowConstraints);
3140
-// aWindowConstraints.weightx = 1;
3141
-// aWindowConstraints.gridwidth = 3;
3142
-// // aConstraints.gridheight = 3;
3143
-// aWindowConstraints.gridx = 1;
3144
-// aWindowConstraints.fill = GridBagConstraints.BOTH;
3145
-// bigThree.add(centralPanel, aWindowConstraints);
3146
-// aWindowConstraints.weightx = 0;
3147
-// aWindowConstraints.gridx = 4;
3148
-// aWindowConstraints.gridwidth = 1;
3149
-// // aConstraints.gridheight = 3;
3150
-// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3151
-// //bigThree.add(XYZPanel, aWindowConstraints);
3152
-// scenePanel.setVisible(false);
3153
-// centralPanel.setVisible(true);
3154
-// XYZPanel.setVisible(false);
3155
- bigThree.ClearUI();
3156
- bigThree.add(centralPanel);
3157
- bigThree.FlushUI();
3795
+ Show3DView();
31583796
31593797 cameraView.requestFocusInWindow();
31603798
....@@ -3209,8 +3847,8 @@
32093847 // centralPanel.setVisible(true);
32103848 // XYZPanel.setVisible(true);
32113849 bigThree.ClearUI();
3850
+ bigThree.add(scenePanel);
32123851 bigThree.add(centralPanel);
3213
- bigThree.add(XYZPanel);
32143852 bigThree.FlushUI();
32153853
32163854 cameraView.requestFocusInWindow();
....@@ -3290,8 +3928,8 @@
32903928 // centralPanel.setVisible(true);
32913929 // XYZPanel.setVisible(false);
32923930 bigThree.ClearUI();
3293
- bigThree.add(scenePanel);
32943931 bigThree.add(centralPanel);
3932
+ bigThree.add(scenePanel);
32953933 bigThree.FlushUI();
32963934
32973935 cameraView.requestFocusInWindow();
....@@ -3340,6 +3978,7 @@
33403978 } else
33413979 if (source == rootButton)
33423980 {
3981
+ Replace();
33433982 Object3D obj;
33443983 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
33453984 {
....@@ -3354,6 +3993,9 @@
33543993 if (source == closeButton)
33553994 {
33563995 //System.out.println("CLOSE: " + buttonGroup.getSelection());
3996
+ if (copy.versionlist != null)
3997
+ Replace();
3998
+
33573999 cRadio ab;
33584000 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
33594001 {
....@@ -3397,10 +4039,10 @@
33974039 {
33984040 Object3D child = (Object3D)e.nextElement();
33994041 if(child.editWindow != null)
3400
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
34014042 child.pinned = false;
34024043 child.CloseUI();
34034044 listUI.remove(child);
4045
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
34044046
34054047 //child.editWindow = null; // ???????????
34064048 }
....@@ -3419,6 +4061,7 @@
34194061 obj.CloseUI();
34204062 }
34214063 listUI.clear();
4064
+ SetPinStates(group.selection.size() > 0);
34224065 refreshContents(true);
34234066 } else
34244067 if (source == allParamsButton)
....@@ -3451,6 +4094,9 @@
34514094 } else
34524095 if(source instanceof cRadio)
34534096 {
4097
+ if (copy.versionlist != null)
4098
+ Replace();
4099
+
34544100 group.parent = keepparent;
34554101 group.attributes = 0;
34564102 //group.editWindow = null;
....@@ -3474,6 +4120,7 @@
34744120 }
34754121
34764122 copy = group;
4123
+
34774124 //Globals.theRenderer.object = group;
34784125 if(!useclient)
34794126 {
....@@ -3501,9 +4148,38 @@
35014148 */
35024149 radio.layout.doClick();
35034150
4151
+ //assert(copy instanceof Composite);
4152
+
4153
+ if (copy.versionlist == null)
4154
+ {
4155
+ copy.versionindex = -1;
4156
+
4157
+ // Cannot work with loops
4158
+ // To fix this issue, we first mark all nodes above the root,
4159
+ // and check if any of these nodes are reachable below the root.
4160
+ Grafreed.grafreed.universe.TagObjects(copy, true);
4161
+
4162
+ if (copy instanceof Composite && !copy.HasTags())
4163
+ {
4164
+ if (copy.versionlist == null)
4165
+ copy.versionlist = new Object3D[100];
4166
+
4167
+ //Save(true);
4168
+ }
4169
+ else
4170
+ copy.versionindex = -2;
4171
+
4172
+ Grafreed.grafreed.universe.TagObjects(copy, false);
4173
+ }
4174
+
4175
+ SetVersionStates();
4176
+
35044177 ClearUnpinned();
3505
- SetPinStates(group.selection.size() > 0);
3506
- if (group.selection.size() == 1)
4178
+
4179
+ //Grafreed.Assert(group != null);
4180
+ //Grafreed.Assert(group.selection != null);
4181
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4182
+ if (group.selection == null || group.selection.size() == 1)
35074183 EditSelection(false);
35084184 keepparent = group.parent;
35094185 // PARENT = NULL or not???
....@@ -3516,11 +4192,13 @@
35164192 } else if (event.getSource() == editCameraItem)
35174193 {
35184194 cameraView.ProtectCamera();
4195
+ cameraView.requestFocusInWindow();
35194196 cameraView.repaint();
35204197 return;
35214198 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
35224199 {
35234200 cameraView.RevertCamera();
4201
+ cameraView.requestFocusInWindow();
35244202 cameraView.repaint();
35254203 return;
35264204 // } else if (event.getSource() == textureButton)
....@@ -3609,6 +4287,18 @@
36094287 refreshContents();
36104288 }
36114289
4290
+ void TextureRatio(int axis)
4291
+ {
4292
+ Object3D obj;
4293
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4294
+ {
4295
+ obj = (Object3D)e.nextElement();
4296
+ obj.TextureRatio(axis);
4297
+ }
4298
+
4299
+ refreshContents();
4300
+ }
4301
+
36124302 void ResetTransform()
36134303 {
36144304 ResetTransform(-1);
....@@ -3624,42 +4314,8 @@
36244314 if (obj.toParent == null)
36254315 continue;
36264316
3627
- if (mask == -1)
3628
- {
3629
- if (obj instanceof Camera) // jan 2014
3630
- {
3631
- LA.matIdentity(obj.toParent);
3632
- LA.matIdentity(obj.fromParent);
3633
- }
3634
- else
3635
- {
3636
- obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent);
3637
- obj.fromParent = null; // LA.matIdentity(obj.fromParent);
3638
- }
3639
- TouchTransform(obj);
3640
- continue;
3641
- }
3642
- if ((mask&2) != 0) // Scale
3643
- {
3644
- obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1;
3645
- obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0;
3646
- obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0;
3647
- obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1;
3648
- obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0;
3649
- obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0;
3650
- }
3651
- if ((mask&4) != 0) // Rotation
3652
- {
3653
- // ?
3654
- }
3655
- if ((mask&1) != 0) // Translation
3656
- {
3657
- if (obj.toParent != null)
3658
- {
3659
- obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0;
3660
- obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0;
3661
- }
3662
- }
4317
+ obj.ResetTransform(mask);
4318
+
36634319 if (obj.parent == null)
36644320 {
36654321 System.out.println("NULL PARENT!");
....@@ -4097,7 +4753,7 @@
40974753
40984754 try
40994755 {
4100
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4756
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41014757 }
41024758 catch (Exception e)
41034759 {
....@@ -4167,6 +4823,12 @@
41674823 for (int i=0; i<group.selection.size(); i++)
41684824 {
41694825 Object3D obj = group.selection.get(i);
4826
+
4827
+ if (obj.toParent == null)
4828
+ {
4829
+ obj.toParent = LA.newMatrix();
4830
+ obj.fromParent = LA.newMatrix();
4831
+ }
41704832
41714833 LA.matTranslate(obj.toParent, i * scale, 0, 0);
41724834 LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
....@@ -4459,6 +5121,12 @@
44595121 refreshContents();
44605122 }
44615123
5124
+ void ClearVersions()
5125
+ {
5126
+ group.selection.ClearVersions();
5127
+ refreshContents();
5128
+ }
5129
+
44625130 void FlipV(boolean flip)
44635131 {
44645132 group.selection.FlipV(flip);
....@@ -4574,6 +5242,12 @@
45745242
45755243 void EditSelection(boolean newWindow)
45765244 {
5245
+ if (group.selection == null)
5246
+ {
5247
+ EditElement(group, newWindow); // ? new
5248
+ return;
5249
+ }
5250
+
45775251 // aConstraints.gridy = 0;
45785252 for (int i=0; i<group.selection.size(); i++)
45795253 {
....@@ -4584,12 +5258,7 @@
45845258 Object3D elem = (Object3D)group.selection.elementAt(i);
45855259 if(elem != group || !newWindow)
45865260 {
4587
- // if (!(elem instanceof Composite))
4588
- // newWindow = false;
4589
- listUI.add(elem);
4590
- elem.openEditWindow(this, newWindow); //, false);
4591
- System.out.println("edit : " + elem);
4592
- elem.editWindow.refreshContents(true); // ? new
5261
+ EditElement(elem, newWindow); // ? new
45935262 }
45945263 }
45955264 }
....@@ -4652,9 +5321,7 @@
46525321
46535322 freezemodel = false;
46545323 }
4655
-
4656
- boolean flashIt = true;
4657
-
5324
+
46585325 public void valueChanged(TreeSelectionEvent e)
46595326 //public boolean handleEvent(Event event)
46605327 {
....@@ -4698,7 +5365,7 @@
46985365 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46995366 // a camera
47005367 {
4701
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5368
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace
47025369 {
47035370 CameraPane.camerachangeframe = 0; // don't refuse it
47045371 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4727,13 +5394,31 @@
47275394 {
47285395 editButton.setEnabled(enabled);
47295396 uneditButton.setEnabled(enabled);
4730
- unselectButton.setEnabled(enabled);
5397
+ //unselectButton.setEnabled(enabled);
47315398 flashSelectionButton.setEnabled(enabled);
5399
+
5400
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5401
+
5402
+ boolean allComposites = true;
5403
+
5404
+ if (group.selection != null)
5405
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5406
+ {
5407
+ Object next = e.nextElement();
5408
+ if (!(next instanceof Composite)) // || (next instanceof GroupLeaf))
5409
+ {
5410
+ allComposites = false;
5411
+ break;
5412
+ }
5413
+ }
5414
+
5415
+ rootButton.setEnabled(true); // allComposites);
47325416 }
47335417
47345418 void refreshContents(boolean cp)
47355419 {
4736
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
5420
+ if (Globals.SHOWINFO)
5421
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
47375422 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47385423 {
47395424 objEditor.ClearInfo(); // .GetMaterial());
....@@ -4743,7 +5428,7 @@
47435428 Object3D child = (Object3D) group.selection.get(i);
47445429
47455430 objEditor.AddInfo(child, this, true);
4746
- System.err.println("info : " + child.GetPath());
5431
+// System.err.println("info : " + child.GetPath());
47475432 }
47485433
47495434 objEditor.SetText(); // jan 2014
....@@ -4833,8 +5518,8 @@
48335518
48345519 if (cut)
48355520 {
4836
- if (Globals.SAVEONMAKE)
4837
- Save();
5521
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5522
+// Save();
48385523 //int indices[] = jList.getSelectedIndices();
48395524 //for (int i = indices.length - 1; i >= 0; i--)
48405525 //jList.remove(indices[i]);
....@@ -4937,6 +5622,10 @@
49375622
49385623 void paste(boolean expand)
49395624 {
5625
+ if (Globals.REPLACEONMAKE)
5626
+ Save();
5627
+ boolean keep = Globals.REPLACEONMAKE;
5628
+ Globals.REPLACEONMAKE = false;
49405629 // if (GrafreeD.clipboard == null)
49415630 // return;
49425631 boolean first = true;
....@@ -4996,6 +5685,7 @@
49965685 Grafreed.clipboard.get(0).parent = keepparent;
49975686 }
49985687
5688
+ Globals.REPLACEONMAKE = keep;
49995689 ResetModel();
50005690 refreshContents();
50015691 }
....@@ -5131,6 +5821,10 @@
51315821
51325822 void group(Object3D csg, boolean grab)
51335823 {
5824
+ if (Globals.REPLACEONMAKE)
5825
+ Save();
5826
+ boolean keep = Globals.REPLACEONMAKE;
5827
+ Globals.REPLACEONMAKE = false;
51345828 if (//false) // why??
51355829 !group.selection.isEmpty())
51365830 {
....@@ -5244,10 +5938,15 @@
52445938 //node.add(csg);
52455939 //makeSomething(node);
52465940 makeSomething(csg);
5941
+ Globals.REPLACEONMAKE = keep;
52475942 }
52485943
52495944 void Ungroup(Object3D g)
52505945 {
5946
+ if (Globals.REPLACEONMAKE)
5947
+ Save();
5948
+ boolean keep = Globals.REPLACEONMAKE;
5949
+ Globals.REPLACEONMAKE = false;
52515950 if (g instanceof HiddenObject)
52525951 {
52535952 HiddenObject h = (HiddenObject) g;
....@@ -5264,6 +5963,7 @@
52645963 objEditor.makeSomething(g.get(i), false);
52655964 }
52665965 }
5966
+ Globals.REPLACEONMAKE = keep;
52675967 }
52685968
52695969 void ungroup()
....@@ -5554,7 +6254,6 @@
55546254
55556255 cButton restoreCameraButton;
55566256
5557
- cButton saveButton;
55586257 cButton oneStepButton;
55596258
55606259 cButton groupButton;
....@@ -5563,6 +6262,22 @@
55636262 cButton switchButton;
55646263 cButton loopButton;
55656264 cButton textureButton;
6265
+
6266
+ cButton skybox1Button;
6267
+ cButton skybox2Button;
6268
+ cButton skybox3Button;
6269
+ cButton skybox4Button;
6270
+ cButton skybox5Button;
6271
+ cButton skybox6Button;
6272
+ cButton skybox7Button;
6273
+
6274
+ cButton skybox11Button;
6275
+ cButton skybox12Button;
6276
+ cButton skybox13Button;
6277
+ cButton skybox14Button;
6278
+ cButton skybox15Button;
6279
+ cButton skybox16Button;
6280
+ cButton skybox17Button;
55666281
55676282 cButton gridButton;
55686283 cButton boxButton;
....@@ -5596,11 +6311,11 @@
55966311 private MenuItem lookAtItem;
55976312 private MenuItem lookFromItem;
55986313 private MenuItem switchViewItem;
5599
- private MenuItem cutItem;
6314
+ private JMenuItem cutItem;
56006315 private MenuItem undoItem;
56016316 private MenuItem redoItem;
56026317 private JMenuItem duplicateItem;
5603
- private MenuItem cloneItem;
6318
+ private JMenuItem cloneItem;
56046319 private MenuItem cloneSupportItem;
56056320 private MenuItem overwriteGeoItem;
56066321 private MenuItem overwriteMatItem;
....@@ -5621,13 +6336,13 @@
56216336 private MenuItem cloneGeometriesItem;
56226337 private MenuItem shareGeometriesItem;
56236338 private MenuItem mergeGeometriesItem;
5624
- private MenuItem copyItem;
6339
+ private JMenuItem copyItem;
56256340 private MenuItem pasteItem;
5626
- private MenuItem pasteIntoItem;
5627
- private MenuItem pasteLinkItem;
5628
- private MenuItem pasteCloneItem;
5629
- private MenuItem pasteExpandItem;
5630
- private MenuItem clearItem;
6341
+ private JMenuItem pasteIntoItem;
6342
+ private JMenuItem pasteLinkItem;
6343
+ private JMenuItem pasteCloneItem;
6344
+ private JMenuItem pasteExpandItem;
6345
+ private JMenuItem deleteItem;
56316346 private MenuItem clearAllItem;
56326347 private MenuItem genUVItem;
56336348 private MenuItem genNormalsMESHItem;
....@@ -5653,6 +6368,7 @@
56536368 private MenuItem clipMeshItem;
56546369 private MenuItem smoothMeshItem;
56556370 private MenuItem clearMaterialsItem;
6371
+ private MenuItem clearVersionsItem;
56566372
56576373 private MenuItem liveleavesItem;
56586374 private MenuItem unliveleavesItem;
....@@ -5676,13 +6392,16 @@
56766392 private MenuItem maxTexturesItem;
56776393 private MenuItem panoTexturesItem;
56786394
6395
+ private MenuItem textureRatioRItem;
6396
+ private MenuItem textureRatioGItem;
6397
+ private MenuItem textureRatioBItem;
56796398 private MenuItem resetCentroidItem;
56806399 private MenuItem resetCentroidXZItem;
56816400 private MenuItem resetTransformItem;
56826401 private MenuItem transformGeometryItem;
56836402 private MenuItem transformChildrenItem;
56846403 private MenuItem hideItem;
5685
- private MenuItem grabItem;
6404
+ private JMenuItem grabItem;
56866405 private MenuItem backItem;
56876406 private MenuItem frontItem;
56886407 private MenuItem cameraItem;
....@@ -5695,7 +6414,7 @@
56956414 private MenuItem switchTransfoItem;
56966415 private MenuItem morphItem;
56976416 private MenuItem linkerItem;
5698
- private MenuItem ungroupItem;
6417
+ private JMenuItem ungroupItem;
56996418 private MenuItem editItem;
57006419 private MenuItem openWindowItem;
57016420 private MenuItem editLeafItem;
....@@ -5711,6 +6430,8 @@
57116430 private MenuItem attachBumpItem;
57126431 private MenuItem detachBumpItem;
57136432 private MenuItem pigmentBumpItem;
6433
+ private MenuItem embedTexturesItem;
6434
+ private MenuItem deEmbedTexturesItem;
57146435
57156436 private MenuItem particleItem;
57166437 private MenuItem ragdollItem;