Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
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,335 @@
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", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(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, final String t, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(f + "s");
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", "rgb", 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
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ cameraView.repaint();
354
+ }
355
+
26356 //ObjEditor objEditor;
27357 public void closeUI2()
28358 {
....@@ -60,6 +390,12 @@
60390 this.copy = this.group = group;
61391 //selectees = this.group.selectees;
62392
393
+ if (copy.versionlist == null)
394
+ {
395
+ copy.versionlist = new Object3D[100];
396
+ copy.versionindex = -1;
397
+ }
398
+
63399 if(ui)
64400 SetupUI(objEditor);
65401 }
....@@ -80,10 +416,22 @@
80416 SetupViews(objEditor);
81417
82418 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
419
+
420
+ if (copy.versionlist == null)
421
+ {
422
+ copy.versionlist = new Object3D[100];
423
+ copy.versionindex = -1;
424
+
425
+ Save(true);
426
+ }
83427 }
84428
85429 void CloneSelection(boolean supports)
86430 {
431
+ if (Globals.REPLACEONMAKE)
432
+ Save();
433
+ boolean keep = Globals.REPLACEONMAKE;
434
+ Globals.REPLACEONMAKE = false;
87435 // Object3D keep = GrafreeD.clipboard;
88436 //Object3D obj;
89437 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +442,7 @@
94442
95443 makeSomething(clone, i==group.selection.size()-1);
96444 }
445
+ Globals.REPLACEONMAKE = keep;
97446 }
98447
99448 void CloneClipboard(boolean supports)
....@@ -189,8 +538,8 @@
189538 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190539 // pasteExpandItem.addActionListener(this);
191540 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
541
+ deleteItem = menu.add(new MenuItem("Delete"));
542
+ deleteItem.addActionListener(this);
194543
195544 if (Globals.ADVANCED)
196545 {
....@@ -204,23 +553,23 @@
204553 //zBufferItem.addActionListener(this);
205554 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206555 //normalLensItem.addActionListener(this);
207
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
208
- revertCameraItem.addActionListener(this);
556
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
557
+ restoreCameraItem.addActionListener(this);
209558
210
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
- toggleFullScreenItem.addItemListener(this);
212
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
- cameraMenu.add("-");
559
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
560
+// toggleFullScreenItem.addItemListener(this);
561
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
562
+// cameraMenu.add("-");
563
+//
564
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
565
+// toggleTextureItem.addItemListener(this);
566
+// toggleTextureItem.setState(CameraPane.textureon);
567
+//
568
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
569
+// toggleSwitchItem.addItemListener(this);
570
+// toggleSwitchItem.setState(CameraPane.SWITCH);
214571
215
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
- toggleTextureItem.addItemListener(this);
217
- toggleTextureItem.setState(CameraPane.textureon);
218
-
219
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
- toggleSwitchItem.addItemListener(this);
221
- toggleSwitchItem.setState(CameraPane.SWITCH);
222
-
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
572
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224573 toggleHandleItem.addItemListener(this);
225574 toggleHandleItem.setState(CameraPane.HANDLES);
226575
....@@ -275,7 +624,7 @@
275624 {
276625 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277626 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
627
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279628 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280629 oe.cameraMenu.add("-");
281630 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -283,7 +632,7 @@
283632 editLeafItem.addActionListener(this);
284633 lookAtItem.addActionListener(this);
285634 //lookFromItem.addActinoListener(this);
286
- //switchItem.addActionListener(this);
635
+ //switchViewItem.addActionListener(this);
287636 }
288637
289638 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -328,14 +677,14 @@
328677 }
329678
330679 oe.menuBar.add(menu = new Menu("Group"));
331
- grabItem = menu.add(new MenuItem("Grab"));
332
- grabItem.addActionListener(this);
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
333682 backItem = menu.add(new MenuItem("Back"));
334683 backItem.addActionListener(this);
335684 frontItem = menu.add(new MenuItem("Front"));
336685 frontItem.addActionListener(this);
337
- compositeItem = menu.add(new MenuItem("Composite"));
338
- compositeItem.addActionListener(this);
686
+// compositeItem = menu.add(new MenuItem("Composite"));
687
+// compositeItem.addActionListener(this);
339688
340689 if (Globals.ADVANCED)
341690 {
....@@ -345,10 +694,10 @@
345694 ungroupItem = menu.add(new MenuItem("Ungroup"));
346695 ungroupItem.addActionListener(this);
347696
348
- menu.add("-");
349
-
350
- randomItem = menu.add(new MenuItem("Switch node"));
351
- randomItem.addActionListener(this);
697
+// menu.add("-");
698
+//
699
+// switchItem = menu.add(new MenuItem("Switch node"));
700
+// switchItem.addActionListener(this);
352701 if (Globals.ADVANCED)
353702 {
354703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
....@@ -365,13 +714,11 @@
365714 frameselectorItem.addActionListener(this);
366715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
367716 scriptNodeItem.addActionListener(this);
368
- cameraItem = menu.add(new MenuItem("Camera"));
369
- cameraItem.addActionListener(this);
370717 }
371718
372719 oe.menuBar.add(menu = new Menu("Object"));
373
- textureItem = menu.add(new MenuItem("Texture"));
374
- textureItem.addActionListener(this);
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
375722 billboardItem = menu.add(new MenuItem("Billboard"));
376723 billboardItem.addActionListener(this);
377724 csgItem = menu.add(new MenuItem("CSG"));
....@@ -382,13 +729,14 @@
382729 shadowYItem.addActionListener(this);
383730 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
384731 shadowZItem.addActionListener(this);
732
+ attributeItem = menu.add(new MenuItem("Attribute"));
733
+ attributeItem.addActionListener(this);
734
+
385735 if (Globals.ADVANCED)
386736 {
387737 menu.add("-");
388738 linkerItem = menu.add(new MenuItem("Linker"));
389739 linkerItem.addActionListener(this);
390
- attributeItem = menu.add(new MenuItem("Attribute"));
391
- attributeItem.addActionListener(this);
392740 templateItem = menu.add(new MenuItem("Template"));
393741 templateItem.addActionListener(this);
394742 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -417,7 +765,7 @@
417765 genNormalsMESHItem.addActionListener(this);
418766 if (Globals.ADVANCED)
419767 {
420
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
421769 genNormalsMINEItem.addActionListener(this);
422770 }
423771 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -510,10 +858,15 @@
510858 attachBumpItem.addActionListener(this);
511859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
512860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
513862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
514863 detachPigmentItem.addActionListener(this);
515864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
516865 detachBumpItem.addActionListener(this);
866
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
867
+ embedTexturesItem.addActionListener(this);
868
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
869
+ deEmbedTexturesItem.addActionListener(this);
517870 menu.add("-");
518871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
519872 sortbysizeItem.addActionListener(this);
....@@ -540,6 +893,68 @@
540893 buildToolsMenu(menu);
541894 }
542895
896
+ JTabbedPane resourcecontainer;
897
+ cGridBag currenttab;
898
+ boolean added; // patch for jar
899
+
900
+ int tabcount = 0;
901
+ int colcount = 0;
902
+ int rowcount = 0;
903
+
904
+ int columns = 5;
905
+ int rows = 7;
906
+
907
+ public void ResourceCallBack(String[] path)
908
+ {
909
+ for (int i = 0; i < path.length; i++)
910
+ System.out.print(path[i] + "/");
911
+ System.out.println();
912
+ if (rowcount == 0)
913
+ {
914
+ currenttab = new cGridBag();
915
+ added = false;
916
+ String tabname = String.valueOf((char)('A'+tabcount));
917
+ currenttab.setName(tabname);
918
+ rowcount = 1;
919
+ }
920
+
921
+ if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
922
+ {
923
+ if (!added)
924
+ {
925
+ added = true;
926
+ resourcecontainer.add(currenttab);
927
+ String tabname = String.valueOf((char)('A'+tabcount));
928
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929
+ }
930
+
931
+ AddTextureButton(path[0], path[1], currenttab);
932
+ if (++colcount >= columns)
933
+ {
934
+ colcount = 0;
935
+ currenttab.Return();
936
+
937
+ if (rowcount++ >= rows)
938
+ {
939
+ rowcount = 0;
940
+ }
941
+ }
942
+ }
943
+ else
944
+ {
945
+// if (!path[path.length-1].equals("icons"))
946
+// resourcecontainer.Return();
947
+ }
948
+ }
949
+
950
+ void CreateTexturePanel(cGridBag container)
951
+ {
952
+ resourcecontainer = new JTabbedPane();
953
+ container.add(resourcecontainer);
954
+
955
+ Grafreed.ParseResources("textures", this);
956
+ }
957
+
543958 void SetupUI2(ObjEditor oe)
544959 {
545960 // June 2019
....@@ -582,53 +997,83 @@
582997 oe.radioPanel.add(dummyButton);
583998 oe.buttonGroup.add(dummyButton);
584999 */
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
1003
+
5851004 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
5861005
5871006 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5881007 //minButton.setToolTipText("Minimize window");
5891008 //minButton.addActionListener(this);
5901009
591
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- maxButton.setToolTipText("Maximize window");
593
- maxButton.addActionListener(this);
1010
+ if (Globals.ADVANCED)
1011
+ {
1012
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ maxButton.setToolTipText("Maximize window");
1014
+ maxButton.addActionListener(this);
1015
+ }
5941016
5951017 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5961018 fullButton.setToolTipText("Full-screen window");
5971019 fullButton.addActionListener(this);
5981020
599
- oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- undoButton.setToolTipText("Undo changes");
601
- undoButton.addActionListener(this);
1021
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ screenfitButton.setToolTipText("Screen fit");
1023
+ screenfitButton.addActionListener(this);
1024
+
1025
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1027
+ restoreCameraButton.addActionListener(this);
6021028
603
- oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
604
- redoButton.setToolTipText("Redo changes");
605
- redoButton.addActionListener(this);
1029
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ saveVersionButton.setToolTipText("Duplicate current version");
1031
+ saveVersionButton.addActionListener(this);
1032
+
1033
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ deleteVersionButton.setToolTipText("Delete current version");
1035
+ deleteVersionButton.addActionListener(this);
1036
+
1037
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ previousVersionButton.setToolTipText("Previous version");
1039
+ previousVersionButton.addActionListener(this);
1040
+ previousVersionButton.setEnabled(false);
6061041
607
- oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- saveButton.setToolTipText("Save changes");
609
- saveButton.addActionListener(this);
1042
+ cGridBag updown = new cGridBag().setVertical(true);
1043
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1044
+ restoreButton.setToolTipText("Undo (restore current version)");
1045
+ restoreButton.addActionListener(this);
1046
+ //restoreButton.setEnabled(false);
6101047
611
- oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1048
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ replaceButton.setToolTipText("Save (replace current version)");
1050
+ replaceButton.addActionListener(this);
1051
+ //replaceButton.setEnabled(false);
1052
+
1053
+ copyOptionsPanel.add(updown);
1054
+
1055
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ nextVersionButton.setToolTipText("Next version");
1057
+ nextVersionButton.addActionListener(this);
1058
+ nextVersionButton.setEnabled(false);
1059
+
1060
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
6121061 liveCB.setToolTipText("Enable animation");
6131062 liveCB.addItemListener(this);
6141063
615
- oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6161065 oneStepButton.setToolTipText("Animate one step forward");
6171066 oneStepButton.addActionListener(this);
6181067
619
- oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1068
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
6201069 fastCB.setToolTipText("Fast mode");
6211070 fastCB.addItemListener(this);
6221071
623
- oe.toolboxPanel.Return();
1072
+ //oe.toolboxPanel.Return();
6241073
625
- oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
626
- trackCB.setToolTipText("Enable tracking");
627
- trackCB.addItemListener(this);
628
-
629
- oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
- screenfitButton.setToolTipText("Screen fit");
631
- screenfitButton.addActionListener(this);
1074
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1075
+// trackCB.setToolTipText("Enable tracking");
1076
+// trackCB.addItemListener(this);
6321077
6331078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
6341079 // screenfitpointButton.addActionListener(this);
....@@ -638,35 +1083,32 @@
6381083 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6391084 snapobjectButton.addActionListener(this);
6401085 snapobjectButton.setToolTipText("Snap Object");
1086
+
1087
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ fourButton.addActionListener(this);
1089
+ fourButton.setToolTipText("Show control panel only");
6411090 }
6421091
643
- oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- flashSelectionButton.setToolTipText("Highlight selection");
645
- flashSelectionButton.addActionListener(this);
646
-
6471092 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
6481093
649
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- twoButton.setToolTipText("Show center view only");
1094
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ twoButton.setToolTipText("Show 3D view only");
6511096 twoButton.addActionListener(this);
6521097 this.fullscreenLayout = twoButton;
6531098
654
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
655
- fourButton.addActionListener(this);
656
- fourButton.setToolTipText("Show left panel only");
657
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- sixButton.setToolTipText("2-column layout left");
659
- sixButton.addActionListener(this);
660
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661
- threeButton.setToolTipText("2-column layout right");
1099
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ threeButton.setToolTipText("Show controls and 3D view");
6621101 threeButton.addActionListener(this);
663
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
664
- sevenButton.setToolTipText("3-column layout");
665
- sevenButton.addActionListener(this);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ sixButton.setToolTipText("Show 3D view and controls");
1104
+ sixButton.addActionListener(this);
1105
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+// sevenButton.setToolTipText("3-column layout");
1107
+// sevenButton.addActionListener(this);
6661108 //
6671109
668
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
669
- rootButton.setToolTipText("Edit selection in new tab");
1110
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ rootButton.setToolTipText("Open selection in new tab");
6701112 rootButton.addActionListener(this);
6711113
6721114 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -675,30 +1117,30 @@
6751117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6761118 //clearButton.addActionListener(this);
6771119
1120
+ cGridBag row1 = new cGridBag();
1121
+
6781122 // INSERT
679
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6801124 gridButton.setToolTipText("Create grid");
6811125 gridButton.addActionListener(this);
6821126
683
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1127
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6841128 boxButton.setToolTipText("Create box");
6851129 boxButton.addActionListener(this);
6861130
687
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1131
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6881132 sphereButton.setToolTipText("Create sphere");
6891133 sphereButton.addActionListener(this);
6901134
691
- oe.toolboxPanel.Return();
692
-
693
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1135
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6941136 coneButton.setToolTipText("Create cone");
6951137 coneButton.addActionListener(this);
6961138
697
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1139
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6981140 torusButton.setToolTipText("Create torus");
6991141 torusButton.addActionListener(this);
7001142
701
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7021144 superButton.setToolTipText("Create superellipsoid");
7031145 superButton.addActionListener(this);
7041146
....@@ -709,41 +1151,82 @@
7091151 kleinButton.addActionListener(this);
7101152 }
7111153
712
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1154
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7131155 particlesButton.setToolTipText("Create particle system");
7141156 particlesButton.addActionListener(this);
7151157
716
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1158
+ oe.toolboxPanel.add(row1);
1159
+
1160
+ cGridBag row2 = new cGridBag();
1161
+
1162
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1163
+ groupButton.setToolTipText("Create group");
1164
+ groupButton.addActionListener(this);
1165
+
1166
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ compositeButton.setToolTipText("Create composite");
1168
+ compositeButton.addActionListener(this);
1169
+
1170
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ switchButton.setToolTipText("Create item switcher");
1172
+ switchButton.addActionListener(this);
1173
+
1174
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ loopButton.setToolTipText("Create loop");
1176
+ loopButton.addActionListener(this);
1177
+
1178
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ textureButton.setToolTipText("Create texture");
1180
+ textureButton.addActionListener(this);
1181
+
1182
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7171183 overlayButton.setToolTipText("Create overlay");
7181184 overlayButton.addActionListener(this);
7191185
720
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1186
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7211187 lightButton.setToolTipText("Create light");
7221188 lightButton.addActionListener(this);
7231189
1190
+ oe.toolboxPanel.add(row2);
1191
+
1192
+ cGridBag textures = new cGridBag();
1193
+
1194
+ CreateTexturePanel(textures);
1195
+
1196
+ oe.toolboxPanel.add(textures);
1197
+
1198
+ textures.preferredHeight = 100;
1199
+
1200
+ CreateSkyboxPanel(oe.skyboxPanel);
1201
+
7241202 // EDIT panel
725
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
726
- editButton.setToolTipText("Edit selection");
1203
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ editButton.setToolTipText("Pin selection controls");
7271205 editButton.addActionListener(this);
7281206
729
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730
- uneditButton.setToolTipText("Unedit selection");
1207
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ uneditButton.setToolTipText("Unpin and remove selection controls");
7311209 uneditButton.addActionListener(this);
7321210
7331211 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
734
- allParamsButton.setToolTipText("Edit all params");
1212
+ allParamsButton.setToolTipText("Show all controls");
7351213 allParamsButton.addActionListener(this);
7361214
737
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
738
- clearPanelButton.setToolTipText("Clear edit panel");
1215
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ clearPanelButton.setToolTipText("Clear all controls");
7391217 clearPanelButton.addActionListener(this);
7401218
741
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
742
- unselectButton.setToolTipText("Unselect");
743
- unselectButton.addActionListener(this);
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
7441222
1223
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ flashSelectionButton.setToolTipText("Highlight selection");
1225
+ flashSelectionButton.addActionListener(this);
1226
+
7451227 editCommandsPanel.preferredHeight = 1;
7461228
1229
+ SetPinStates(false);
7471230 // oe.treePanel.add(commandsPanel);
7481231 // oe.treePanel.Return();
7491232
....@@ -768,26 +1251,14 @@
7681251 oe.treePanel.add(jSPPanel);
7691252 oe.treePanel.Return();
7701253
771
- cGridBag copyOptionsPanel = new cGridBag();
772
-
773
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
774
- colorCB.setToolTipText("Copy color when dropped");
775
- colorCB.addItemListener(this);
776
-
777
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
778
- materialCB.setToolTipText("Copy material when dropped");
779
- materialCB.addItemListener(this);
780
-
781
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
782
- textureCB.setToolTipText("Copy texture when dropped");
783
- textureCB.addItemListener(this);
784
-
785
- copyOptionsPanel.preferredHeight = 1;
7861254 oe.treePanel.add(copyOptionsPanel);
7871255 oe.treePanel.Return();
1256
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
+ sliderPane.preferredHeight = 1;
7881259
789
-// mainPanel.setDividerLocation(0.5); //1.0);
790
-// mainPanel.setResizeWeight(0.5);
1260
+// mainPanel.setDividerLocation(0.1); //1.0);
1261
+ mainPanel.setResizeWeight(0.4);
7911262
7921263 //jList.addListSelectionListener(this);
7931264 oe.jTree.addTreeSelectionListener(this);
....@@ -795,7 +1266,7 @@
7951266 //jTree.setEditable(true);
7961267 oe.jTree.setDragEnabled(true);
7971268 //jTree.setPreferredSize(new Dimension(10,10));
798
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
7991270
8001271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
8011272
....@@ -807,29 +1278,49 @@
8071278 dgr.addDragGestureListener(this);
8081279 }catch(Exception e) {}
8091280 */
810
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
8111282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8121283 }
8131284
8141285 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
8151286 {
1287
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1288
+ colorCB.setToolTipText("Copy color when dropped");
1289
+ colorCB.addItemListener(this);
1290
+
1291
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1292
+ materialCB.setToolTipText("Copy material when dropped");
1293
+ materialCB.addItemListener(this);
1294
+
1295
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1296
+ textureCB.setToolTipText("Copy texture when dropped");
1297
+ textureCB.addItemListener(this);
1298
+
1299
+ panel.Return();
1300
+
8161301 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
8171302 boxCB.setToolTipText("Display bounding boxes");
8181303 boxCB.addItemListener(this);
8191304
8201305 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
821
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1306
+ zoomBoxCB.setToolTipText("Display only for wheel");
8221307 zoomBoxCB.addItemListener(this);
8231308
8241309 if (true) // Globals.ADVANCED)
8251310 {
826
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
827
- supportCB.setToolTipText("Enable rigging");
828
- supportCB.addItemListener(this);
1311
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1312
+// supportCB.setToolTipText("Enable rigging");
1313
+// supportCB.addItemListener(this);
1314
+
1315
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1316
+ freezeCB.setToolTipText("Fast moving camera");
1317
+ freezeCB.addItemListener(this);
8291318
8301319 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
8311320 // localCB.addItemListener(this);
8321321
1322
+ panel.Return();
1323
+
8331324 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
8341325 crowdCB.setToolTipText("Used for crowds");
8351326 crowdCB.addItemListener(this);
....@@ -838,14 +1329,19 @@
8381329 smoothCB.setToolTipText("Snapping delay");
8391330 smoothCB.addItemListener(this);
8401331
841
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
842
- slowCB.setToolTipText("Smooth interpolation");
843
- slowCB.addItemListener(this);
1332
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1333
+// slowCB.setToolTipText("Smooth interpolation");
1334
+// slowCB.addItemListener(this);
1335
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1336
+ minshaderCB.setToolTipText("Minimal fast shader");
1337
+ minshaderCB.addItemListener(this);
8441338
8451339 // constraints.gridy += 1;
8461340 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
8471341 // speakerMocapCB.addItemListener(this);
8481342
1343
+ panel.Return();
1344
+
8491345 if (false)
8501346 {
8511347 // handled in scripts
....@@ -860,24 +1356,39 @@
8601356 //constraints.gridy += 1;
8611357 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8621358 smoothfocusCB.addItemListener(this);
1359
+ panel.Return();
8631360 }
8641361
8651362 //constraints.gridx += 1;
8661363 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8671364 // debugCB.addItemListener(this);
8681365
1366
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1367
+ trackCB.setToolTipText("Enable tracking target");
1368
+ trackCB.addItemListener(this);
1369
+
8691370 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
- oeilCB.setToolTipText("Move camera when tracking target");
1371
+ oeilCB.setToolTipText("Move camera when tracking");
8711372 oeilCB.addItemListener(this);
8721373
8731374 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
- shadowCB.setToolTipText("Compute shadows when live");
1375
+ shadowCB.setToolTipText("When live compute shadows");
8751376 shadowCB.addItemListener(this);
8761377
877
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
- autosaveCB.setToolTipText("Auto-save on structure change");
879
- autosaveCB.addItemListener(this);
1378
+ panel.Return();
1379
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1380
+ toggleTextureCB.setToolTipText("Load textures");
1381
+ toggleTextureCB.addItemListener(this);
1382
+
1383
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1384
+ toggleSwitchCB.setToolTipText("Choose a single item");
1385
+ toggleSwitchCB.addItemListener(this);
1386
+
1387
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1388
+ autokeepCB.setToolTipText("On structure change");
1389
+ autokeepCB.addItemListener(this);
8801390
1391
+ panel.Return();
8811392 if (Globals.ADVANCED)
8821393 {
8831394 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -888,10 +1399,15 @@
8881399 }
8891400
8901401 cGridBag fill = new cGridBag();
891
-
8921402 fill.preferredHeight = 200;
1403
+ cGridBag fill2 = new cGridBag();
1404
+ fill2.preferredHeight = 200;
1405
+ cGridBag fill3 = new cGridBag();
1406
+ fill3.preferredHeight = 200;
8931407
8941408 panel.add(fill);
1409
+ panel.add(fill2);
1410
+ panel.add(fill3);
8951411
8961412 }
8971413
....@@ -899,7 +1415,7 @@
8991415 {
9001416 cRadio radioButton = new cRadio(obj.name);
9011417
902
- // Patch to avoid bug with transparency.
1418
+ // June 2019. Patch to avoid bug with transparency.
9031419 radioButton.hadMaterial = obj.material != null;
9041420 if (!radioButton.hadMaterial)
9051421 {
....@@ -907,7 +1423,7 @@
9071423 }
9081424
9091425 radioButton.SetObject(obj);
910
- radioButton.layout = sevenButton;
1426
+ radioButton.layout = threeButton; // sixButton;
9111427 radioButton.SetCamera(cameraView.renderCamera, false);
9121428 radioButton.addActionListener(this);
9131429 radioPanel.add(radioButton);
....@@ -932,11 +1448,15 @@
9321448 cCheckBox localCB;
9331449 cCheckBox crowdCB;
9341450 cCheckBox smoothCB;
1451
+ cCheckBox minshaderCB;
1452
+
9351453 cToggleButton fastCB;
9361454 cCheckBox slowCB;
9371455 cCheckBox boxCB;
9381456 cCheckBox zoomBoxCB;
939
- cToggleButton trackCB;
1457
+ cCheckBox freezeCB;
1458
+ //cToggleButton trackCB;
1459
+ cCheckBox trackCB;
9401460 cCheckBox smoothfocusCB;
9411461 // JCheckBox speakerMocapCB;
9421462 cCheckBox speakerCameraCB;
....@@ -945,7 +1465,7 @@
9451465
9461466 cCheckBox oeilCB;
9471467 cCheckBox shadowCB;
948
- cCheckBox autosaveCB;
1468
+ cCheckBox autokeepCB;
9491469 cCheckBox lookAtCB;
9501470
9511471 // static int COLOR = 1;
....@@ -1001,6 +1521,12 @@
10011521 cameraView.ToggleInertia();
10021522 cameraView.repaint();
10031523 }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
1529
+ }
10041530 else if(e.getSource() == localCB)
10051531 {
10061532 cameraView.ToggleLocal();
....@@ -1053,9 +1579,13 @@
10531579 {
10541580 Globals.COMPUTESHADOWWHENLIVE ^= true;
10551581 }
1056
- else if(e.getSource() == autosaveCB)
1582
+ else if(e.getSource() == freezeCB)
10571583 {
1058
- Globals.SAVEONMAKE ^= true;
1584
+ Globals.FREEZEONMOVE ^= true;
1585
+ }
1586
+ else if(e.getSource() == autokeepCB)
1587
+ {
1588
+ Globals.REPLACEONMAKE ^= true;
10591589 }
10601590 else if(e.getSource() == lookAtCB)
10611591 {
....@@ -1137,8 +1667,6 @@
11371667 }
11381668 }
11391669
1140
- String string = (String) object;
1141
-
11421670 System.out.println("Transfer = " + object + "; drop : " + target);
11431671 // if( object instanceof java.io.File[])
11441672 // {
....@@ -1146,6 +1674,8 @@
11461674 // objEditor.DropFile((java.io.File[]) object, true);
11471675 // return;
11481676 // }
1677
+
1678
+ String string = object.toString();
11491679
11501680 // File path for Mac and Windows
11511681 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1191,13 +1721,23 @@
11911721
11921722 assert target == objEditor.jTree;
11931723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
11941725 try {
1195
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11961727 } catch (Exception e) {
11971728 System.out.println("destinationPath : " + destinationPath);
11981729 return;
11991730 }
12001731
1732
+ for (int i=group.selection.size(); --i>=0;)
1733
+ {
1734
+ Object3D child = (Object3D)group.selection.elementAt(i);
1735
+
1736
+ // Cannot move into itself
1737
+ if (child == destinationLeaf)
1738
+ return;
1739
+ }
1740
+
12011741 // june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
12021742 // {
12031743 loadClipboard(true);
....@@ -1312,22 +1852,30 @@
13121852 {
13131853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
13141854 //heightFieldItem.addActionListener(this);
1315
- gridItem = menu.add(new MenuItem("Grid"));
1316
- gridItem.addActionListener(this);
1317
- rectoidItem = menu.add(new MenuItem("Box"));
1318
- rectoidItem.addActionListener(this);
1319
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1320
- ellipsoidItem.addActionListener(this);
1321
- coneItem = menu.add(new MenuItem("Cone"));
1322
- coneItem.addActionListener(this);
1323
- torusItem = menu.add(new MenuItem("Torus"));
1324
- torusItem.addActionListener(this);
1325
- superItem = menu.add(new MenuItem("Superellipsoid"));
1326
- superItem.addActionListener(this);
1855
+// gridItem = menu.add(new MenuItem("Grid"));
1856
+// gridItem.addActionListener(this);
1857
+// rectoidItem = menu.add(new MenuItem("Box"));
1858
+// rectoidItem.addActionListener(this);
1859
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1860
+// ellipsoidItem.addActionListener(this);
1861
+// coneItem = menu.add(new MenuItem("Cone"));
1862
+// coneItem.addActionListener(this);
1863
+// torusItem = menu.add(new MenuItem("Torus"));
1864
+// torusItem.addActionListener(this);
1865
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1866
+// superItem.addActionListener(this);
1867
+
1868
+ cameraItem = menu.add(new MenuItem("Camera"));
1869
+ cameraItem.addActionListener(this);
1870
+
1871
+ if (!Globals.ADVANCED)
1872
+ {
13271873 kleinItem = menu.add(new MenuItem("Klein Bottle"));
13281874 kleinItem.addActionListener(this);
1329
- particleItem = menu.add(new MenuItem("Particle system"));
1330
- particleItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
13311879 if (Globals.ADVANCED)
13321880 {
13331881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1353,15 +1901,15 @@
13531901 }
13541902 bezierItem = menu.add(new MenuItem("Bezier Patch"));
13551903 bezierItem.addActionListener(this);
1356
- overlayItem = menu.add(new MenuItem("Overlay"));
1357
- overlayItem.addActionListener(this);
1358
- lightItem = menu.add(new MenuItem("Light"));
1359
- lightItem.addActionListener(this);
1904
+// overlayItem = menu.add(new MenuItem("Overlay"));
1905
+// overlayItem.addActionListener(this);
1906
+// lightItem = menu.add(new MenuItem("Light"));
1907
+// lightItem.addActionListener(this);
13601908 menu.add("-");
13611909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13621910 //superLoopItem.addActionListener(this);
1363
- loopItem = menu.add(new MenuItem("Loop"));
1364
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
13651913 doubleItem = menu.add(new MenuItem("Fork"));
13661914 doubleItem.addActionListener(this);
13671915 if (Globals.ADVANCED)
....@@ -1377,6 +1925,9 @@
13771925 animationItem.addItemListener(this);
13781926 animationItem.setState(Globals.ANIMATION);
13791927
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
1930
+
13801931 menu.add("-");
13811932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13821933 parseverticesItem.addActionListener(this);
....@@ -1389,6 +1940,8 @@
13891940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13901941 reduce34MorphItem.addActionListener(this);
13911942 menu.add("-");
1943
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1944
+ memoryItem.addActionListener(this);
13921945 menu.add(computeAOItem = new MenuItem("Compute AO"));
13931946 computeAOItem.addActionListener(this);
13941947
....@@ -1397,8 +1950,6 @@
13971950 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13981951 mirrorItem.addActionListener(this);
13991952 menu.add("-");
1400
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1401
- memoryItem.addActionListener(this);
14021953 menu.add(analyzeItem = new MenuItem("Analyze"));
14031954 analyzeItem.addActionListener(this);
14041955 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1546,6 +2097,30 @@
15462097
15472098 makeSomething(shadow);
15482099 }
2100
+
2101
+ private void ClearUnpinned()
2102
+ {
2103
+ //for (Object3D obj : listUI)
2104
+ for (int i=listUI.size(); --i>=0;)
2105
+ {
2106
+ Object3D obj = listUI.elementAt(i);
2107
+ if (!obj.pinned)
2108
+ {
2109
+ obj.CloseUI();
2110
+ listUI.remove(i);
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+ private void EditElement(Object3D elem, boolean newWindow)
2116
+ {
2117
+ // if (!(elem instanceof Composite))
2118
+ // newWindow = false;
2119
+ listUI.add(elem);
2120
+ elem.openEditWindow(this, newWindow); //, false);
2121
+ System.out.println("edit : " + elem);
2122
+ elem.editWindow.refreshContents(true); // ? new
2123
+ }
15492124
15502125 /**
15512126 * applyExample
....@@ -1790,7 +2365,7 @@
17902365 {
17912366 ScreenFit();
17922367 } else
1793
- if (source == switchItem)
2368
+ if (source == switchViewItem)
17942369 {
17952370 cVector v1 = new cVector();
17962371 cVector v2 = new cVector();
....@@ -1974,6 +2549,23 @@
19742549 {
19752550 makeSomething(new Light());
19762551 } else
2552
+// if (source == skybox1Button ||
2553
+// source == skybox2Button ||
2554
+// source == skybox3Button ||
2555
+// source == skybox4Button ||
2556
+// source == skybox5Button ||
2557
+// source == skybox6Button ||
2558
+// source == skybox7Button ||
2559
+// source == skybox11Button ||
2560
+// source == skybox12Button ||
2561
+// source == skybox13Button ||
2562
+// source == skybox14Button ||
2563
+// source == skybox15Button ||
2564
+// source == skybox16Button ||
2565
+// source == skybox17Button)
2566
+// {
2567
+// ChangeSkybox(source);
2568
+// } else
19772569 if (source == csgItem)
19782570 {
19792571 group(new CSG());
....@@ -2020,30 +2612,30 @@
20202612
20212613 group(g);
20222614 } else
2023
- if (source == loopItem)
2615
+ if (source == loopItem || source == loopButton)
20242616 {
20252617 Composite csg = new GroupLeaf();
20262618 csg.count = 5;
20272619 group(csg);
2028
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
20292621 csg.addChild(child);
20302622 child.addChild(csg);
20312623 } else
20322624 if (source == doubleItem)
20332625 {
2034
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
20352627 csg.count = 5;
20362628 group(csg);
2037
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
20382630 csg.addChild(child);
20392631 child.addChild(csg);
2040
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
20412633 csg.addChild(child);
20422634 child.addChild(csg);
20432635 } else
20442636 if (source == tripleItem)
20452637 {
2046
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
20472639 csg.count = 4;
20482640 group(csg);
20492641 Composite child = new cGroup();
....@@ -2059,7 +2651,7 @@
20592651 if (source == computeAOItem)
20602652 {
20612653 Globals.drawMode = CameraPane.OCCLUSION;
2062
- Globals.theRenderer.repaint();
2654
+ cameraView.repaint();
20632655 } else
20642656 if (source == recompileItem)
20652657 {
....@@ -2074,7 +2666,7 @@
20742666 if (source == invariantsItem)
20752667 {
20762668 System.out.println("Invariants:");
2077
- Grafreed.grafreeD.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
20782670 } else
20792671 if (source == memoryItem)
20802672 {
....@@ -2105,17 +2697,40 @@
21052697 {
21062698 ToggleFullScreen();
21072699 } else
2108
- if (source == undoButton)
2700
+ if (source == previousVersionButton)
21092701 {
2110
- Undo();
2702
+ // Go to previous version
2703
+ //if (!Undo())
2704
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2705
+ PreviousVersion();
21112706 } else
2112
- if (source == redoButton)
2707
+ if (source == restoreButton)
21132708 {
2114
- Redo();
2709
+ // Restore current version
2710
+ Restore();
2711
+ //restoreButton.setEnabled(false);
21152712 } else
2116
- if (source == saveButton)
2713
+ if (source == replaceButton)
21172714 {
2118
- Save();
2715
+ // Overwrite current version
2716
+ Replace();
2717
+ //replaceButton.setEnabled(false);
2718
+ } else
2719
+ if (source == nextVersionButton)
2720
+ {
2721
+ // Go to next version
2722
+ NextVersion();
2723
+ } else
2724
+ if (source == saveVersionButton)
2725
+ {
2726
+ // Save a new version
2727
+ if (!Save(true))
2728
+ java.awt.Toolkit.getDefaultToolkit().beep();
2729
+ } else
2730
+ if (source == deleteVersionButton)
2731
+ {
2732
+ // Delete a new version
2733
+ DeleteVersion();
21192734 } else
21202735 if (source == oneStepButton)
21212736 {
....@@ -2124,17 +2739,14 @@
21242739 } else
21252740 if (source == screenfitButton)
21262741 {
2127
- //Reload(lastConverter, lastFilename, true);
21282742 ScreenFit();
21292743 } else
21302744 if (source == screenfitpointButton)
21312745 {
2132
- //Reload(lastConverter, lastFilename, true);
21332746 ScreenFitPoint();
21342747 } else
21352748 if (source == snapobjectButton)
21362749 {
2137
- //Reload(lastConverter, lastFilename, true);
21382750 SnapObject();
21392751 } else
21402752 // if (event.getSource() == recompileButton)
....@@ -2173,11 +2785,11 @@
21732785 } else
21742786 if (source == undoItem)
21752787 {
2176
- Undo();
2788
+ PreviousVersion();
21772789 } else
21782790 if (source == redoItem)
21792791 {
2180
- Redo();
2792
+ NextVersion();
21812793 } else
21822794 if (source == duplicateItem)
21832795 {
....@@ -2498,7 +3110,7 @@
24983110 {
24993111 StepAll();
25003112 } else
2501
- if (source == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
25023114 {
25033115 //int indices[] = jList.getSelectedIndices();
25043116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2510,9 +3122,9 @@
25103122 {
25113123 ClearSelection(true);
25123124 } else
2513
- if (source == grabItem)
3125
+ if (source == grabItem || source == groupButton)
25143126 {
2515
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
25163128 } else
25173129 if (source == hideItem)
25183130 {
....@@ -2530,11 +3142,11 @@
25303142 {
25313143 makeSomething(new Camera());
25323144 } else
2533
- if (source == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
25343146 {
25353147 group(new Composite());
25363148 } else
2537
- if (source == randomItem)
3149
+ if (source == switchItem || source == switchButton)
25383150 {
25393151 RandomNode random = new RandomNode();
25403152 group(random);
....@@ -2636,7 +3248,7 @@
26363248 {
26373249 group(new cLinker());
26383250 } else
2639
- if (source == textureItem)
3251
+ if (source == textureItem || source == textureButton)
26403252 {
26413253 group(new TextureNode());
26423254 } else
....@@ -2658,15 +3270,28 @@
26583270 } else
26593271 if (source == ungroupItem || source == ungroupButton)
26603272 {
2661
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
26623275 for (int i=0; i<group.selection.size(); i++)
26633276 {
2664
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
26653282 }
26663283
2667
- ClearSelection(false);
2668
-
2669
- refreshContents();
3284
+ if (!hasRoot)
3285
+ {
3286
+ for (int i=0; i<group.selection.size(); i++)
3287
+ {
3288
+ Ungroup(group.selection.get(i));
3289
+ }
3290
+
3291
+ ClearSelection(false);
3292
+
3293
+ refreshContents();
3294
+ }
26703295 } else
26713296 if (source == genUVItem)
26723297 {
....@@ -2967,7 +3592,7 @@
29673592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
29683593 {
29693594 obj = (Object3D)e.nextElement();
2970
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
29713596 }
29723597
29733598 refreshContents();
....@@ -2981,6 +3606,31 @@
29813606 obj.SetBumpTexture(obj.GetPigmentTexture());
29823607 }
29833608
3609
+ refreshContents();
3610
+ } else
3611
+ if (source == embedTexturesItem)
3612
+ {
3613
+ Object3D obj;
3614
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3615
+ {
3616
+ obj = (Object3D)e.nextElement();
3617
+ obj.EmbedTextures(true);
3618
+ }
3619
+
3620
+ refreshContents();
3621
+ } else
3622
+ if (source == deEmbedTexturesItem)
3623
+ {
3624
+ Object3D obj;
3625
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3626
+ {
3627
+ obj = (Object3D)e.nextElement();
3628
+ obj.EmbedTextures(false);
3629
+ }
3630
+
3631
+ CameraPane.texturepigment.clear();
3632
+ CameraPane.texturebump.clear();
3633
+
29843634 refreshContents();
29853635 } else
29863636 if (source == flashSelectionButton)
....@@ -3084,8 +3734,8 @@
30843734 // centralPanel.setVisible(true);
30853735 // XYZPanel.setVisible(true);
30863736 bigThree.ClearUI();
3737
+ bigThree.add(scenePanel);
30873738 bigThree.add(centralPanel);
3088
- bigThree.add(XYZPanel);
30893739 bigThree.FlushUI();
30903740
30913741 cameraView.requestFocusInWindow();
....@@ -3165,8 +3815,8 @@
31653815 // centralPanel.setVisible(true);
31663816 // XYZPanel.setVisible(false);
31673817 bigThree.ClearUI();
3168
- bigThree.add(scenePanel);
31693818 bigThree.add(centralPanel);
3819
+ bigThree.add(scenePanel);
31703820 bigThree.FlushUI();
31713821
31723822 cameraView.requestFocusInWindow();
....@@ -3258,6 +3908,12 @@
32583908 } else
32593909 if (source == editItem || source == editButton)
32603910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
32613917 EditSelection(false);
32623918 } else
32633919 if (source == uneditButton)
....@@ -3266,9 +3922,10 @@
32663922 {
32673923 Object3D child = (Object3D)e.nextElement();
32683924 if(child.editWindow != null)
3269
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
32703926 child.CloseUI();
32713927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32723929
32733930 //child.editWindow = null; // ???????????
32743931 }
....@@ -3283,16 +3940,18 @@
32833940 //copy.ClearUI();
32843941 for (Object3D obj : listUI)
32853942 {
3943
+ obj.pinned = false;
32863944 obj.CloseUI();
32873945 }
32883946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
32893948 refreshContents(true);
32903949 } else
32913950 if (source == allParamsButton)
32923951 {
32933952 assert(copy == group);
32943953
3295
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32963955
32973956 for (Object3D obj : listUI)
32983957 {
....@@ -3341,6 +4000,9 @@
33414000 }
33424001
33434002 copy = group;
4003
+
4004
+ SetUndoStates();
4005
+
33444006 //Globals.theRenderer.object = group;
33454007 if(!useclient)
33464008 {
....@@ -3367,6 +4029,14 @@
33674029 currentLayout = sevenButton;
33684030 */
33694031 radio.layout.doClick();
4032
+
4033
+ ClearUnpinned();
4034
+
4035
+ //Grafreed.Assert(group != null);
4036
+ //Grafreed.Assert(group.selection != null);
4037
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4038
+ if (group.selection == null || group.selection.size() == 1)
4039
+ EditSelection(false);
33704040 keepparent = group.parent;
33714041 // PARENT = NULL or not???
33724042 //group.parent = null; // ROOT
....@@ -3378,11 +4048,13 @@
33784048 } else if (event.getSource() == editCameraItem)
33794049 {
33804050 cameraView.ProtectCamera();
4051
+ cameraView.requestFocusInWindow();
33814052 cameraView.repaint();
33824053 return;
3383
- } else if (event.getSource() == revertCameraItem)
4054
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33844055 {
33854056 cameraView.RevertCamera();
4057
+ cameraView.requestFocusInWindow();
33864058 cameraView.repaint();
33874059 return;
33884060 // } else if (event.getSource() == textureButton)
....@@ -3959,7 +4631,7 @@
39594631
39604632 try
39614633 {
3962
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4634
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
39634635 }
39644636 catch (Exception e)
39654637 {
....@@ -4434,12 +5106,14 @@
44345106 // }
44355107 // }
44365108
4437
- static boolean allparams = true;
4438
-
4439
- static Vector<Object3D> listUI = new Vector<Object3D>();
4440
-
44415109 void EditSelection(boolean newWindow)
44425110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
44435117 // aConstraints.gridy = 0;
44445118 for (int i=0; i<group.selection.size(); i++)
44455119 {
....@@ -4450,12 +5124,7 @@
44505124 Object3D elem = (Object3D)group.selection.elementAt(i);
44515125 if(elem != group || !newWindow)
44525126 {
4453
- // if (!(elem instanceof Composite))
4454
- // newWindow = false;
4455
- listUI.add(elem);
4456
- elem.openEditWindow(this, newWindow); //, false);
4457
- System.out.println("edit : " + elem);
4458
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
44595128 }
44605129 }
44615130 }
....@@ -4518,9 +5187,7 @@
45185187
45195188 freezemodel = false;
45205189 }
4521
-
4522
- boolean flashIt = true;
4523
-
5190
+
45245191 public void valueChanged(TreeSelectionEvent e)
45255192 //public boolean handleEvent(Event event)
45265193 {
....@@ -4530,7 +5197,8 @@
45305197 //new Exception().printStackTrace();
45315198
45325199 freezemodel = true;
4533
-
5200
+ ClearUnpinned();
5201
+
45345202 /**/
45355203 //switch (event.id)
45365204 {
....@@ -4563,7 +5231,7 @@
45635231 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
45645232 // a camera
45655233 {
4566
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5234
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
45675235 {
45685236 CameraPane.camerachangeframe = 0; // don't refuse it
45695237 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4572,6 +5240,13 @@
45725240 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
45735241 }
45745242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
45755250 refreshContents();
45765251 //return true;
45775252 }
....@@ -4581,9 +5256,20 @@
45815256 freezemodel = false;
45825257 }
45835258
5259
+ void SetPinStates(boolean enabled)
5260
+ {
5261
+ editButton.setEnabled(enabled);
5262
+ uneditButton.setEnabled(enabled);
5263
+ //unselectButton.setEnabled(enabled);
5264
+ flashSelectionButton.setEnabled(enabled);
5265
+
5266
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5267
+ }
5268
+
45845269 void refreshContents(boolean cp)
45855270 {
4586
- if (!Globals.MOUSEDRAGGED)
5271
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5272
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45875273 {
45885274 objEditor.ClearInfo(); // .GetMaterial());
45895275
....@@ -4682,8 +5368,8 @@
46825368
46835369 if (cut)
46845370 {
4685
- if (Globals.SAVEONMAKE)
4686
- Save();
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
46875373 //int indices[] = jList.getSelectedIndices();
46885374 //for (int i = indices.length - 1; i >= 0; i--)
46895375 //jList.remove(indices[i]);
....@@ -4786,6 +5472,10 @@
47865472
47875473 void paste(boolean expand)
47885474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
47895479 // if (GrafreeD.clipboard == null)
47905480 // return;
47915481 boolean first = true;
....@@ -4845,6 +5535,7 @@
48455535 Grafreed.clipboard.get(0).parent = keepparent;
48465536 }
48475537
5538
+ Globals.REPLACEONMAKE = keep;
48485539 ResetModel();
48495540 refreshContents();
48505541 }
....@@ -4980,6 +5671,10 @@
49805671
49815672 void group(Object3D csg, boolean grab)
49825673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
49835678 if (//false) // why??
49845679 !group.selection.isEmpty())
49855680 {
....@@ -5093,10 +5788,15 @@
50935788 //node.add(csg);
50945789 //makeSomething(node);
50955790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
50965792 }
50975793
50985794 void Ungroup(Object3D g)
50995795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
51005800 if (g instanceof HiddenObject)
51015801 {
51025802 HiddenObject h = (HiddenObject) g;
....@@ -5113,6 +5813,7 @@
51135813 objEditor.makeSomething(g.get(i), false);
51145814 }
51155815 }
5816
+ Globals.REPLACEONMAKE = keep;
51165817 }
51175818
51185819 void ungroup()
....@@ -5401,17 +6102,32 @@
54016102 cButton clearpanelButton;
54026103 cButton unselectButton;
54036104
5404
- cButton minButton;
5405
- cButton maxButton;
5406
- cButton fullButton;
5407
- cButton undoButton;
5408
- cButton redoButton;
5409
- cButton saveButton;
6105
+ cButton restoreCameraButton;
6106
+
54106107 cButton oneStepButton;
54116108
54126109 cButton groupButton;
54136110 cButton ungroupButton;
54146111 cButton compositeButton;
6112
+ cButton switchButton;
6113
+ cButton loopButton;
6114
+ cButton textureButton;
6115
+
6116
+ cButton skybox1Button;
6117
+ cButton skybox2Button;
6118
+ cButton skybox3Button;
6119
+ cButton skybox4Button;
6120
+ cButton skybox5Button;
6121
+ cButton skybox6Button;
6122
+ cButton skybox7Button;
6123
+
6124
+ cButton skybox11Button;
6125
+ cButton skybox12Button;
6126
+ cButton skybox13Button;
6127
+ cButton skybox14Button;
6128
+ cButton skybox15Button;
6129
+ cButton skybox16Button;
6130
+ cButton skybox17Button;
54156131
54166132 cButton gridButton;
54176133 cButton boxButton;
....@@ -5444,7 +6160,7 @@
54446160 //JTree jTree;
54456161 private MenuItem lookAtItem;
54466162 private MenuItem lookFromItem;
5447
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
54486164 private MenuItem cutItem;
54496165 private MenuItem undoItem;
54506166 private MenuItem redoItem;
....@@ -5476,7 +6192,7 @@
54766192 private MenuItem pasteLinkItem;
54776193 private MenuItem pasteCloneItem;
54786194 private MenuItem pasteExpandItem;
5479
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
54806196 private MenuItem clearAllItem;
54816197 private MenuItem genUVItem;
54826198 private MenuItem genNormalsMESHItem;
....@@ -5536,7 +6252,7 @@
55366252 private MenuItem frontItem;
55376253 private MenuItem cameraItem;
55386254 private MenuItem compositeItem;
5539
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
55406256 private MenuItem physicsItem;
55416257 private MenuItem frameselectorItem;
55426258 private MenuItem scriptNodeItem;
....@@ -5560,6 +6276,8 @@
55606276 private MenuItem attachBumpItem;
55616277 private MenuItem detachBumpItem;
55626278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
55636281
55646282 private MenuItem particleItem;
55656283 private MenuItem ragdollItem;
....@@ -5610,5 +6328,5 @@
56106328
56116329 Menu cameraMenu;
56126330 MenuItem editCameraItem;
5613
- MenuItem revertCameraItem;
6331
+ MenuItem restoreCameraItem;
56146332 }