Normand Briere
2019-08-07 59de607850161a26863f92961d53caae7a2dabc8
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,314 @@
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 AddSkyboxTab0(JTabbedPane skyboxpanel)
46
+ {
47
+ cGridBag tab0 = new cGridBag().setVertical(true);
48
+
49
+ tab0.setName("Urban");
50
+ skyboxpanel.add(tab0);
51
+
52
+ cGridBag row0 = new cGridBag();
53
+ cGridBag row1 = new cGridBag();
54
+ cGridBag row2 = new cGridBag();
55
+ cGridBag row3 = new cGridBag();
56
+ cGridBag row4 = new cGridBag();
57
+ cGridBag row5 = new cGridBag();
58
+ cGridBag row6 = new cGridBag();
59
+
60
+ AddSkyboxButton("default", "rgb", row0);
61
+ //AddSkyboxButton("default", "cornell", row0);
62
+ AddSkyboxButton("penguins", "dust", row0);
63
+ AddSkyboxButton("penguins", "tropic", row0);
64
+ AddSkyboxButton("penguins", "yonder", row0);
65
+
66
+ AddSkyboxButton("default", "uffizi", row1);
67
+ AddSkyboxButton("bridge", "Bridge", row1);
68
+ AddSkyboxButton("bridge", "Bridge2", row1);
69
+ AddSkyboxButton("urban", "GamlaStan2", row1);
70
+
71
+ AddSkyboxButton("urban", "Parliament", row2);
72
+ AddSkyboxButton("urban", "Roundabout", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
74
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
75
+
76
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
77
+ AddSkyboxButton("urban", "UnionSquare", row3);
78
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
79
+ AddSkyboxButton("park", "BerzeliiPark", row3);
80
+
81
+ AddSkyboxButton("park", "Buddha", row4);
82
+ AddSkyboxButton("park", "CNTower2", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
84
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
85
+
86
+ AddSkyboxButton("park", "Park", row5);
87
+ AddSkyboxButton("park", "Pond", row5);
88
+ AddSkyboxButton("park", "Skansen", row5);
89
+ AddSkyboxButton("park", "Skansen2", row5);
90
+
91
+ AddSkyboxButton("park", "Skansen3", row6);
92
+ AddSkyboxButton("park", "Skansen4", row6);
93
+ AddSkyboxButton("park", "Skansen5", row6);
94
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
95
+
96
+ tab0.add(row0);
97
+ tab0.add(row1);
98
+ tab0.add(row2);
99
+ tab0.add(row3);
100
+ tab0.add(row4);
101
+ tab0.add(row5);
102
+ tab0.add(row6);
103
+
104
+ for (int i=5; --i>=0;)
105
+ {
106
+ //oe.toolboxPanel.Return();
107
+ //tab0.add(new cGridBag());
108
+ }
109
+ }
110
+
111
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
112
+ {
113
+ cGridBag tab0 = new cGridBag().setVertical(true);
114
+
115
+ tab0.setName("Nature");
116
+ skyboxpanel.add(tab0);
117
+
118
+ cGridBag row0 = new cGridBag();
119
+ cGridBag row1 = new cGridBag();
120
+ cGridBag row2 = new cGridBag();
121
+ cGridBag row3 = new cGridBag();
122
+ cGridBag row4 = new cGridBag();
123
+ cGridBag row5 = new cGridBag();
124
+ cGridBag row6 = new cGridBag();
125
+
126
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
127
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
128
+ AddSkyboxButton("beach", "PalmTrees", row0);
129
+ AddSkyboxButton("beach", "Tenerife", row0);
130
+
131
+ AddSkyboxButton("beach", "Tenerife2", row1);
132
+ AddSkyboxButton("beach", "Tenerife3", row1);
133
+ AddSkyboxButton("field", "FishPond", row1);
134
+ AddSkyboxButton("field", "Footballfield", row1);
135
+
136
+ AddSkyboxButton("field", "Meadow", row2);
137
+ AddSkyboxButton("field", "Sorsele", row2);
138
+ AddSkyboxButton("field", "Sorsele2", row2);
139
+ AddSkyboxButton("field", "Sorsele3", row2);
140
+
141
+ AddSkyboxButton("forest", "Brudslojan", row3);
142
+ AddSkyboxButton("forest", "Langholmen2", row3);
143
+ AddSkyboxButton("forest", "Plants", row3);
144
+ AddSkyboxButton("mountain", "Maskonaive", row3);
145
+
146
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
147
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("park", "Stairs", row5);
152
+ AddSkyboxButton("default", "skycube", row6);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+
156
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "MountainTrail", row6);
160
+ /*
161
+Autumn
162
+Greenlands
163
+MountainTrail
164
+Oasis
165
+TheRock
166
+TopOfTheWorld
167
+Winter
168
+ */
169
+
170
+ tab0.add(row0);
171
+ tab0.add(row1);
172
+ tab0.add(row2);
173
+ tab0.add(row3);
174
+ tab0.add(row4);
175
+ tab0.add(row5);
176
+ tab0.add(row6);
177
+
178
+ for (int i=5; --i>=0;)
179
+ {
180
+ //oe.toolboxPanel.Return();
181
+ //tab0.add(new cGridBag());
182
+ }
183
+ }
184
+
185
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
186
+ {
187
+ cGridBag tab0 = new cGridBag().setVertical(true);
188
+
189
+ tab0.setName("Night");
190
+ skyboxpanel.add(tab0);
191
+
192
+ cGridBag row0 = new cGridBag();
193
+ cGridBag row1 = new cGridBag();
194
+ cGridBag row2 = new cGridBag();
195
+ cGridBag row3 = new cGridBag();
196
+ cGridBag row4 = new cGridBag();
197
+ cGridBag row5 = new cGridBag();
198
+ cGridBag row6 = new cGridBag();
199
+
200
+ AddSkyboxButton("night", "NightPath", row0);
201
+ AddSkyboxButton("night", "PondNight", row0);
202
+ AddSkyboxButton("night", "Powerlines", row0);
203
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
204
+
205
+ AddSkyboxButton("urban", "CNTower", row1);
206
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
207
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
208
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
209
+
210
+ AddSkyboxButton("penguins", "kenon_star", row2);
211
+ AddSkyboxButton("persson", "corona", row2);
212
+ AddSkyboxButton("persson", "spaceskybox", row2);
213
+ AddSkyboxButton("indoors", "Vasa", row2);
214
+
215
+ AddSkyboxButton("winter", "Backyard", row3);
216
+ AddSkyboxButton("winter", "Creek", row3);
217
+ AddSkyboxButton("winter", "FootballField3", row3);
218
+ AddSkyboxButton("winter", "Forest", row3);
219
+
220
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
221
+ AddSkyboxButton("winter", "House", row4);
222
+ AddSkyboxButton("winter", "IceLake", row4);
223
+ AddSkyboxButton("winter", "IceRiver", row4);
224
+
225
+ AddSkyboxButton("winter", "Park3", row5);
226
+ AddSkyboxButton("winter", "PondWinter", row5);
227
+ AddSkyboxButton("winter", "Tantolunden5", row5);
228
+ AddSkyboxButton("winter", "Vindelalven", row5);
229
+
230
+ AddSkyboxButton("daz", "TheRock", row6);
231
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
232
+ AddSkyboxButton("daz", "Winter", row6);
233
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
234
+
235
+ tab0.add(row0);
236
+ tab0.add(row1);
237
+ tab0.add(row2);
238
+ tab0.add(row3);
239
+ tab0.add(row4);
240
+ tab0.add(row5);
241
+ tab0.add(row6);
242
+
243
+ for (int i=5; --i>=0;)
244
+ {
245
+ //oe.toolboxPanel.Return();
246
+ //tab0.add(new cGridBag());
247
+ }
248
+ }
249
+
250
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
251
+ {
252
+ cGridBag tab0 = new cGridBag().setVertical(true);
253
+
254
+ tab0.setName("Others");
255
+ skyboxpanel.add(tab0);
256
+
257
+ cGridBag row0 = new cGridBag();
258
+ cGridBag row1 = new cGridBag();
259
+ cGridBag row2 = new cGridBag();
260
+ cGridBag row3 = new cGridBag();
261
+ cGridBag row4 = new cGridBag();
262
+ cGridBag row5 = new cGridBag();
263
+ cGridBag row6 = new cGridBag();
264
+
265
+ AddSkyboxButton("mayhem", "afterrain", row0);
266
+ AddSkyboxButton("mayhem", "aqua4", row0);
267
+ AddSkyboxButton("mayhem", "aqua9", row0);
268
+ AddSkyboxButton("mayhem", "flame", row0);
269
+
270
+ AddSkyboxButton("mayhem", "h2s", row1);
271
+ AddSkyboxButton("mayhem", "prehistoric", row1);
272
+ AddSkyboxButton("mayhem", "scorched", row1);
273
+ AddSkyboxButton("penguins", "desertdawn", row1);
274
+
275
+ AddSkyboxButton("persson", "Citadella", row2);
276
+ AddSkyboxButton("persson", "Citadella2", row2);
277
+ AddSkyboxButton("persson", "clouds1", row2);
278
+ AddSkyboxButton("penguins", "wrath", row2);
279
+
280
+ AddSkyboxButton("persson", "FishermansBastion", row3);
281
+ AddSkyboxButton("persson", "HeroesSquare", row3);
282
+ AddSkyboxButton("indoors", "DallasW", row3);
283
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
284
+
285
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
286
+ AddSkyboxButton("persson", "PereaBeach1", row4);
287
+ AddSkyboxButton("persson", "PereaBeach2", row4);
288
+ AddSkyboxButton("persson", "redeclipse", row4);
289
+
290
+ AddSkyboxButton("daz", "Greenlands", row5);
291
+ AddSkyboxButton("daz", "Oasis", row5);
292
+ AddSkyboxButton("elyvisions", "arch3", row5);
293
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
294
+
295
+ AddSkyboxButton("elyvisions", "rainbow", row6);
296
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
297
+ AddSkyboxButton("elyvisions", "heaven", row6);
298
+ AddSkyboxButton("elyvisions", "hot", row6);
299
+
300
+ tab0.add(row0);
301
+ tab0.add(row1);
302
+ tab0.add(row2);
303
+ tab0.add(row3);
304
+ tab0.add(row4);
305
+ tab0.add(row5);
306
+ tab0.add(row6);
307
+
308
+ for (int i=5; --i>=0;)
309
+ {
310
+ //oe.toolboxPanel.Return();
311
+ //tab0.add(new cGridBag());
312
+ }
313
+ }
314
+
315
+ public void CallBack(String[] path)
316
+ {
317
+ for (int i = 0; i < path.length; i++)
318
+ {
319
+ System.out.print(path[i] + "/");
320
+ }
321
+
322
+ System.out.println();
323
+ }
324
+
325
+ public void ChangeSkybox(String skybox)
326
+ {
327
+ //cameraView.envyoff = false;
328
+ group.skyboxname = skybox;
329
+ group.skyboxext = "jpg";
330
+ cameraView.repaint();
331
+
332
+ Grafreed.ParseResources("textures", this);
333
+ }
334
+
26335 //ObjEditor objEditor;
27336 public void closeUI2()
28337 {
....@@ -60,6 +369,12 @@
60369 this.copy = this.group = group;
61370 //selectees = this.group.selectees;
62371
372
+ if (copy.versionlist == null)
373
+ {
374
+ copy.versionlist = new Object3D[100];
375
+ copy.versionindex = -1;
376
+ }
377
+
63378 if(ui)
64379 SetupUI(objEditor);
65380 }
....@@ -80,10 +395,22 @@
80395 SetupViews(objEditor);
81396
82397 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
398
+
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+
404
+ Save(true);
405
+ }
83406 }
84407
85408 void CloneSelection(boolean supports)
86409 {
410
+ if (Globals.REPLACEONMAKE)
411
+ Save();
412
+ boolean keep = Globals.REPLACEONMAKE;
413
+ Globals.REPLACEONMAKE = false;
87414 // Object3D keep = GrafreeD.clipboard;
88415 //Object3D obj;
89416 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +421,7 @@
94421
95422 makeSomething(clone, i==group.selection.size()-1);
96423 }
424
+ Globals.REPLACEONMAKE = keep;
97425 }
98426
99427 void CloneClipboard(boolean supports)
....@@ -150,6 +478,8 @@
150478
151479 void SetupMenu2(GroupEditor oe)
152480 {
481
+ oe.jTree = new cTree();
482
+
153483 Menu menu;
154484 oe.menuBar.add(menu = new Menu("Edit"));
155485 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +490,7 @@
160490 // redoItem = menu.add(new MenuItem("Redo"));
161491 // redoItem.addActionListener(this);
162492 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
493
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164494 duplicateItem.addActionListener(this);
165495 cloneItem = menu.add(new MenuItem("Clone"));
166496 cloneItem.addActionListener(this);
....@@ -187,8 +517,8 @@
187517 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188518 // pasteExpandItem.addActionListener(this);
189519 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
520
+ deleteItem = menu.add(new MenuItem("Delete"));
521
+ deleteItem.addActionListener(this);
192522
193523 if (Globals.ADVANCED)
194524 {
....@@ -202,23 +532,23 @@
202532 //zBufferItem.addActionListener(this);
203533 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204534 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
535
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
536
+ restoreCameraItem.addActionListener(this);
207537
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
538
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
539
+// toggleFullScreenItem.addItemListener(this);
540
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
541
+// cameraMenu.add("-");
542
+//
543
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
544
+// toggleTextureItem.addItemListener(this);
545
+// toggleTextureItem.setState(CameraPane.textureon);
546
+//
547
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
548
+// toggleSwitchItem.addItemListener(this);
549
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212550
213
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
- toggleTextureItem.addItemListener(this);
215
- toggleTextureItem.setState(CameraPane.textureon);
216
-
217
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
- toggleSwitchItem.addItemListener(this);
219
- toggleSwitchItem.setState(CameraPane.SWITCH);
220
-
221
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
551
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222552 toggleHandleItem.addItemListener(this);
223553 toggleHandleItem.setState(CameraPane.HANDLES);
224554
....@@ -273,7 +603,7 @@
273603 {
274604 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275605 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
606
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277607 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278608 oe.cameraMenu.add("-");
279609 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +611,7 @@
281611 editLeafItem.addActionListener(this);
282612 lookAtItem.addActionListener(this);
283613 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
614
+ //switchViewItem.addActionListener(this);
285615 }
286616
287617 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +656,29 @@
326656 }
327657
328658 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
659
+// grabItem = menu.add(new MenuItem("Grab"));
660
+// grabItem.addActionListener(this);
331661 backItem = menu.add(new MenuItem("Back"));
332662 backItem.addActionListener(this);
333663 frontItem = menu.add(new MenuItem("Front"));
334664 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
665
+// compositeItem = menu.add(new MenuItem("Composite"));
666
+// compositeItem.addActionListener(this);
667
+
668
+ if (Globals.ADVANCED)
669
+ {
337670 hideItem = menu.add(new MenuItem("Hidden Group"));
338671 hideItem.addActionListener(this);
672
+ }
339673 ungroupItem = menu.add(new MenuItem("Ungroup"));
340674 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
675
+
676
+// menu.add("-");
677
+//
678
+// switchItem = menu.add(new MenuItem("Switch node"));
679
+// switchItem.addActionListener(this);
680
+ if (Globals.ADVANCED)
681
+ {
344682 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345683 switchGeoItem.addActionListener(this);
346684 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +686,6 @@
348686 morphItem = menu.add(new MenuItem("Morph Group"));
349687 morphItem.addActionListener(this);
350688
351
- if (Globals.ADVANCED)
352
- {
353689 menu.add("-");
354690 physicsItem = menu.add(new MenuItem("Physics"));
355691 physicsItem.addActionListener(this);
....@@ -357,13 +693,11 @@
357693 frameselectorItem.addActionListener(this);
358694 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359695 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362696 }
363697
364698 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
699
+// textureItem = menu.add(new MenuItem("Texture"));
700
+// textureItem.addActionListener(this);
367701 billboardItem = menu.add(new MenuItem("Billboard"));
368702 billboardItem.addActionListener(this);
369703 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +708,14 @@
374708 shadowYItem.addActionListener(this);
375709 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376710 shadowZItem.addActionListener(this);
711
+ attributeItem = menu.add(new MenuItem("Attribute"));
712
+ attributeItem.addActionListener(this);
713
+
377714 if (Globals.ADVANCED)
378715 {
379716 menu.add("-");
380717 linkerItem = menu.add(new MenuItem("Linker"));
381718 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384719 templateItem = menu.add(new MenuItem("Template"));
385720 templateItem.addActionListener(this);
386721 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +744,7 @@
409744 genNormalsMESHItem.addActionListener(this);
410745 if (Globals.ADVANCED)
411746 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
747
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413748 genNormalsMINEItem.addActionListener(this);
414749 }
415750 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -502,10 +837,15 @@
502837 attachBumpItem.addActionListener(this);
503838 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
504839 pigmentBumpItem.addActionListener(this);
840
+ //embedTexturesItem
505841 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
506842 detachPigmentItem.addActionListener(this);
507843 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
508844 detachBumpItem.addActionListener(this);
845
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
846
+ embedTexturesItem.addActionListener(this);
847
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
848
+ deEmbedTexturesItem.addActionListener(this);
509849 menu.add("-");
510850 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
511851 sortbysizeItem.addActionListener(this);
....@@ -532,6 +872,7 @@
532872 buildToolsMenu(menu);
533873 }
534874
875
+
535876 void SetupUI2(ObjEditor oe)
536877 {
537878 // June 2019
....@@ -574,51 +915,83 @@
574915 oe.radioPanel.add(dummyButton);
575916 oe.buttonGroup.add(dummyButton);
576917 */
918
+ cGridBag copyOptionsPanel = new cGridBag();
919
+
920
+ copyOptionsPanel.preferredHeight = 2;
921
+
577922 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578923
579924 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580925 //minButton.setToolTipText("Minimize window");
581926 //minButton.addActionListener(this);
582927
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
928
+ if (Globals.ADVANCED)
929
+ {
930
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ maxButton.setToolTipText("Maximize window");
932
+ maxButton.addActionListener(this);
933
+ }
586934
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588936 fullButton.setToolTipText("Full-screen window");
589937 fullButton.addActionListener(this);
590938
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
939
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
940
+ screenfitButton.setToolTipText("Screen fit");
941
+ screenfitButton.addActionListener(this);
942
+
943
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
944
+ restoreCameraButton.setToolTipText("Restore viewpoint");
945
+ restoreCameraButton.addActionListener(this);
594946
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
947
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
948
+ saveVersionButton.setToolTipText("Duplicate current version");
949
+ saveVersionButton.addActionListener(this);
950
+
951
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
952
+ deleteVersionButton.setToolTipText("Delete current version");
953
+ deleteVersionButton.addActionListener(this);
954
+
955
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
956
+ previousVersionButton.setToolTipText("Previous version");
957
+ previousVersionButton.addActionListener(this);
958
+ previousVersionButton.setEnabled(false);
598959
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
601
- saveButton.addActionListener(this);
960
+ cGridBag updown = new cGridBag().setVertical(true);
961
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
962
+ restoreButton.setToolTipText("Undo (restore current version)");
963
+ restoreButton.addActionListener(this);
964
+ //restoreButton.setEnabled(false);
602965
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
966
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ replaceButton.setToolTipText("Save (replace current version)");
968
+ replaceButton.addActionListener(this);
969
+ //replaceButton.setEnabled(false);
970
+
971
+ copyOptionsPanel.add(updown);
972
+
973
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
974
+ nextVersionButton.setToolTipText("Next version");
975
+ nextVersionButton.addActionListener(this);
976
+ nextVersionButton.setEnabled(false);
977
+
978
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604979 liveCB.setToolTipText("Enable animation");
605980 liveCB.addItemListener(this);
606981
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
982
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608983 oneStepButton.setToolTipText("Animate one step forward");
609984 oneStepButton.addActionListener(this);
610985
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
986
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612987 fastCB.setToolTipText("Fast mode");
613988 fastCB.addItemListener(this);
614989
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
990
+ //oe.toolboxPanel.Return();
991
+
992
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
993
+// trackCB.setToolTipText("Enable tracking");
994
+// trackCB.addItemListener(this);
622995
623996 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624997 // screenfitpointButton.addActionListener(this);
....@@ -628,63 +1001,154 @@
6281001 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6291002 snapobjectButton.addActionListener(this);
6301003 snapobjectButton.setToolTipText("Snap Object");
1004
+
1005
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ fourButton.addActionListener(this);
1007
+ fourButton.setToolTipText("Show control panel only");
6311008 }
6321009
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
1010
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
6361011
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638
-
639
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640
- twoButton.setToolTipText("Show center view only");
1012
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ twoButton.setToolTipText("Show 3D view only");
6411014 twoButton.addActionListener(this);
642
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643
- fourButton.addActionListener(this);
644
- fourButton.setToolTipText("Show left panel only");
645
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- sixButton.setToolTipText("2-column layout left");
647
- sixButton.addActionListener(this);
648
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
- threeButton.setToolTipText("2-column layout right");
1015
+ this.fullscreenLayout = twoButton;
1016
+
1017
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ threeButton.setToolTipText("Show controls and 3D view");
6501019 threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
1020
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
+ sixButton.setToolTipText("Show 3D view and controls");
1022
+ sixButton.addActionListener(this);
1023
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
+// sevenButton.setToolTipText("3-column layout");
1025
+// sevenButton.addActionListener(this);
6541026 //
6551027
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
1028
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ rootButton.setToolTipText("Open selection in new tab");
6581030 rootButton.addActionListener(this);
6591031
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1032
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6611033 closeButton.setToolTipText("Close tab");
6621034 closeButton.addActionListener(this);
6631035 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6641036 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
1037
+
1038
+ cGridBag row1 = new cGridBag();
1039
+
1040
+ // INSERT
1041
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ gridButton.setToolTipText("Create grid");
1043
+ gridButton.addActionListener(this);
1044
+
1045
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ boxButton.setToolTipText("Create box");
1047
+ boxButton.addActionListener(this);
1048
+
1049
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ sphereButton.setToolTipText("Create sphere");
1051
+ sphereButton.addActionListener(this);
1052
+
1053
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ coneButton.setToolTipText("Create cone");
1055
+ coneButton.addActionListener(this);
1056
+
1057
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ torusButton.setToolTipText("Create torus");
1059
+ torusButton.addActionListener(this);
1060
+
1061
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
+ superButton.setToolTipText("Create superellipsoid");
1063
+ superButton.addActionListener(this);
1064
+
1065
+ if (Globals.ADVANCED)
1066
+ {
1067
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ kleinButton.setToolTipText("Create Klein bottle");
1069
+ kleinButton.addActionListener(this);
1070
+ }
1071
+
1072
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ particlesButton.setToolTipText("Create particle system");
1074
+ particlesButton.addActionListener(this);
1075
+
1076
+ oe.toolboxPanel.add(row1);
1077
+
1078
+ cGridBag row2 = new cGridBag();
1079
+
1080
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ groupButton.setToolTipText("Create group");
1082
+ groupButton.addActionListener(this);
1083
+
1084
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1085
+ compositeButton.setToolTipText("Create composite");
1086
+ compositeButton.addActionListener(this);
1087
+
1088
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ switchButton.setToolTipText("Create item switcher");
1090
+ switchButton.addActionListener(this);
1091
+
1092
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ loopButton.setToolTipText("Create loop");
1094
+ loopButton.addActionListener(this);
1095
+
1096
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ textureButton.setToolTipText("Create texture");
1098
+ textureButton.addActionListener(this);
1099
+
1100
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ overlayButton.setToolTipText("Create overlay");
1102
+ overlayButton.addActionListener(this);
1103
+
1104
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ lightButton.setToolTipText("Create light");
1106
+ lightButton.addActionListener(this);
1107
+
1108
+ oe.toolboxPanel.add(row2);
1109
+
1110
+ // ENVYMAPS
1111
+ cGridBag skyboxpane = new cGridBag();
1112
+ skyboxpane.preferredHeight = 100;
1113
+
1114
+ oe.skyboxPanel.add(skyboxpane);
1115
+
1116
+ JTabbedPane skyboxpanel = new JTabbedPane();
1117
+ skyboxpane.add(skyboxpanel);
1118
+
1119
+ AddSkyboxTab0(skyboxpanel);
1120
+ AddSkyboxTab1(skyboxpanel);
1121
+ AddSkyboxTab2(skyboxpanel);
1122
+ AddSkyboxTab3(skyboxpanel);
1123
+
1124
+ // EDIT panel
1125
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1126
+ editButton.setToolTipText("Pin selection controls");
6681127 editButton.addActionListener(this);
6691128
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
1129
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1130
+ uneditButton.setToolTipText("Unpin and remove selection controls");
6721131 uneditButton.addActionListener(this);
6731132
6741133 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
1134
+ allParamsButton.setToolTipText("Show all controle");
6761135 allParamsButton.addActionListener(this);
6771136
678
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1137
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6791138 clearPanelButton.setToolTipText("Clear edit panel");
6801139 clearPanelButton.addActionListener(this);
6811140
682
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
683
- unselectButton.setToolTipText("Unselect");
684
- unselectButton.addActionListener(this);
1141
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1142
+ //unselectButton.setToolTipText("Unselect");
1143
+ //unselectButton.addActionListener(this);
6851144
1145
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1146
+ flashSelectionButton.setToolTipText("Highlight selection");
1147
+ flashSelectionButton.addActionListener(this);
1148
+
6861149 editCommandsPanel.preferredHeight = 1;
6871150
1151
+ SetPinStates(false);
6881152 // oe.treePanel.add(commandsPanel);
6891153 // oe.treePanel.Return();
6901154
....@@ -703,32 +1167,20 @@
7031167
7041168 JScrollPane jSP;
7051169 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1170
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
7071171 ResetModel();
7081172
7091173 oe.treePanel.add(jSPPanel);
7101174 oe.treePanel.Return();
7111175
712
- cGridBag copyOptionsPanel = new cGridBag();
713
-
714
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
715
- colorCB.setToolTipText("Copy color when dropped");
716
- colorCB.addItemListener(this);
717
-
718
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
719
- materialCB.setToolTipText("Copy material when dropped");
720
- materialCB.addItemListener(this);
721
-
722
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
723
- textureCB.setToolTipText("Copy texture when dropped");
724
- textureCB.addItemListener(this);
725
-
726
- copyOptionsPanel.preferredHeight = 1;
7271176 oe.treePanel.add(copyOptionsPanel);
7281177 oe.treePanel.Return();
1178
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1179
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1180
+ sliderPane.preferredHeight = 1;
7291181
730
-// mainPanel.setDividerLocation(0.5); //1.0);
731
-// mainPanel.setResizeWeight(0.5);
1182
+// mainPanel.setDividerLocation(0.1); //1.0);
1183
+ mainPanel.setResizeWeight(0.4);
7321184
7331185 //jList.addListSelectionListener(this);
7341186 oe.jTree.addTreeSelectionListener(this);
....@@ -736,7 +1188,7 @@
7361188 //jTree.setEditable(true);
7371189 oe.jTree.setDragEnabled(true);
7381190 //jTree.setPreferredSize(new Dimension(10,10));
739
- jSP.setPreferredSize(new Dimension(100,200));
1191
+ //jSP.setPreferredSize(new Dimension(100,200));
7401192
7411193 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7421194
....@@ -748,29 +1200,49 @@
7481200 dgr.addDragGestureListener(this);
7491201 }catch(Exception e) {}
7501202 */
751
- radio.layout = sevenButton;
1203
+ radio.layout = threeButton; // sixButton;
7521204 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7531205 }
7541206
7551207 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7561208 {
1209
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1210
+ colorCB.setToolTipText("Copy color when dropped");
1211
+ colorCB.addItemListener(this);
1212
+
1213
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1214
+ materialCB.setToolTipText("Copy material when dropped");
1215
+ materialCB.addItemListener(this);
1216
+
1217
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1218
+ textureCB.setToolTipText("Copy texture when dropped");
1219
+ textureCB.addItemListener(this);
1220
+
1221
+ panel.Return();
1222
+
7571223 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7581224 boxCB.setToolTipText("Display bounding boxes");
7591225 boxCB.addItemListener(this);
7601226
7611227 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1228
+ zoomBoxCB.setToolTipText("Display only for wheel");
7631229 zoomBoxCB.addItemListener(this);
7641230
7651231 if (true) // Globals.ADVANCED)
7661232 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
1233
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1234
+// supportCB.setToolTipText("Enable rigging");
1235
+// supportCB.addItemListener(this);
1236
+
1237
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1238
+ freezeCB.setToolTipText("Fast moving camera");
1239
+ freezeCB.addItemListener(this);
7701240
7711241 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7721242 // localCB.addItemListener(this);
7731243
1244
+ panel.Return();
1245
+
7741246 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7751247 crowdCB.setToolTipText("Used for crowds");
7761248 crowdCB.addItemListener(this);
....@@ -779,14 +1251,19 @@
7791251 smoothCB.setToolTipText("Snapping delay");
7801252 smoothCB.addItemListener(this);
7811253
782
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
- slowCB.setToolTipText("Smooth interpolation");
784
- slowCB.addItemListener(this);
1254
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1255
+// slowCB.setToolTipText("Smooth interpolation");
1256
+// slowCB.addItemListener(this);
1257
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1258
+ minshaderCB.setToolTipText("Minimal fast shader");
1259
+ minshaderCB.addItemListener(this);
7851260
7861261 // constraints.gridy += 1;
7871262 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7881263 // speakerMocapCB.addItemListener(this);
7891264
1265
+ panel.Return();
1266
+
7901267 if (false)
7911268 {
7921269 // handled in scripts
....@@ -801,20 +1278,39 @@
8011278 //constraints.gridy += 1;
8021279 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8031280 smoothfocusCB.addItemListener(this);
1281
+ panel.Return();
8041282 }
8051283
8061284 //constraints.gridx += 1;
8071285 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8081286 // debugCB.addItemListener(this);
8091287
1288
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1289
+ trackCB.setToolTipText("Enable tracking target");
1290
+ trackCB.addItemListener(this);
1291
+
8101292 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
1293
+ oeilCB.setToolTipText("Move camera when tracking");
8121294 oeilCB.addItemListener(this);
8131295
8141296 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
1297
+ shadowCB.setToolTipText("When live compute shadows");
8161298 shadowCB.addItemListener(this);
8171299
1300
+ panel.Return();
1301
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1302
+ toggleTextureCB.setToolTipText("Load textures");
1303
+ toggleTextureCB.addItemListener(this);
1304
+
1305
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1306
+ toggleSwitchCB.setToolTipText("Choose a single item");
1307
+ toggleSwitchCB.addItemListener(this);
1308
+
1309
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1310
+ autokeepCB.setToolTipText("On structure change");
1311
+ autokeepCB.addItemListener(this);
1312
+
1313
+ panel.Return();
8181314 if (Globals.ADVANCED)
8191315 {
8201316 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -825,10 +1321,15 @@
8251321 }
8261322
8271323 cGridBag fill = new cGridBag();
828
-
8291324 fill.preferredHeight = 200;
1325
+ cGridBag fill2 = new cGridBag();
1326
+ fill2.preferredHeight = 200;
1327
+ cGridBag fill3 = new cGridBag();
1328
+ fill3.preferredHeight = 200;
8301329
8311330 panel.add(fill);
1331
+ panel.add(fill2);
1332
+ panel.add(fill3);
8321333
8331334 }
8341335
....@@ -836,7 +1337,7 @@
8361337 {
8371338 cRadio radioButton = new cRadio(obj.name);
8381339
839
- // Patch to avoid bug with transparency.
1340
+ // June 2019. Patch to avoid bug with transparency.
8401341 radioButton.hadMaterial = obj.material != null;
8411342 if (!radioButton.hadMaterial)
8421343 {
....@@ -844,7 +1345,7 @@
8441345 }
8451346
8461347 radioButton.SetObject(obj);
847
- radioButton.layout = sevenButton;
1348
+ radioButton.layout = threeButton; // sixButton;
8481349 radioButton.SetCamera(cameraView.renderCamera, false);
8491350 radioButton.addActionListener(this);
8501351 radioPanel.add(radioButton);
....@@ -864,25 +1365,30 @@
8641365 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8651366 }
8661367
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- JCheckBox smoothfocusCB;
878
-// JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
1368
+ cToggleButton liveCB;
1369
+ cCheckBox supportCB;
1370
+ cCheckBox localCB;
1371
+ cCheckBox crowdCB;
1372
+ cCheckBox smoothCB;
1373
+ cCheckBox minshaderCB;
8821374
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
1375
+ cToggleButton fastCB;
1376
+ cCheckBox slowCB;
1377
+ cCheckBox boxCB;
1378
+ cCheckBox zoomBoxCB;
1379
+ cCheckBox freezeCB;
1380
+ //cToggleButton trackCB;
1381
+ cCheckBox trackCB;
1382
+ cCheckBox smoothfocusCB;
1383
+// JCheckBox speakerMocapCB;
1384
+ cCheckBox speakerCameraCB;
1385
+ cCheckBox speakerFocusCB;
1386
+ cCheckBox debugCB;
1387
+
1388
+ cCheckBox oeilCB;
1389
+ cCheckBox shadowCB;
1390
+ cCheckBox autokeepCB;
1391
+ cCheckBox lookAtCB;
8861392
8871393 // static int COLOR = 1;
8881394 // static int MATERIAL = 2;
....@@ -890,9 +1396,9 @@
8901396
8911397 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8921398
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
1399
+ cCheckBox colorCB;
1400
+ cCheckBox materialCB;
1401
+ cCheckBox textureCB;
8961402
8971403 public void itemStateChanged(ItemEvent e)
8981404 {
....@@ -936,6 +1442,12 @@
9361442 {
9371443 cameraView.ToggleInertia();
9381444 cameraView.repaint();
1445
+ }
1446
+ else if(e.getSource() == minshaderCB)
1447
+ {
1448
+ Globals.MINSHADER ^= true;
1449
+ cameraView.programInitialized = false;
1450
+ cameraView.repaint();
9391451 }
9401452 else if(e.getSource() == localCB)
9411453 {
....@@ -989,6 +1501,14 @@
9891501 {
9901502 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911503 }
1504
+ else if(e.getSource() == freezeCB)
1505
+ {
1506
+ Globals.FREEZEONMOVE ^= true;
1507
+ }
1508
+ else if(e.getSource() == autokeepCB)
1509
+ {
1510
+ Globals.REPLACEONMAKE ^= true;
1511
+ }
9921512 else if(e.getSource() == lookAtCB)
9931513 {
9941514 cameraView.ToggleLookAt();
....@@ -1005,7 +1525,8 @@
10051525
10061526 /**/
10071527 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1528
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1529
+ TreePath path = objEditor.jTree.getSelectionPath();
10091530 if ((path == null) || (path.getPathCount() <= 1)) {
10101531 // We can't move the root node or an empty selection
10111532 return;
....@@ -1068,8 +1589,6 @@
10681589 }
10691590 }
10701591
1071
- String string = (String) object;
1072
-
10731592 System.out.println("Transfer = " + object + "; drop : " + target);
10741593 // if( object instanceof java.io.File[])
10751594 // {
....@@ -1077,6 +1596,8 @@
10771596 // objEditor.DropFile((java.io.File[]) object, true);
10781597 // return;
10791598 // }
1599
+
1600
+ String string = object.toString();
10801601
10811602 // File path for Mac and Windows
10821603 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1122,23 +1643,33 @@
11221643
11231644 assert target == objEditor.jTree;
11241645 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1646
+ Object3D destinationLeaf;
11251647 try {
1126
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1648
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11271649 } catch (Exception e) {
11281650 System.out.println("destinationPath : " + destinationPath);
11291651 return;
11301652 }
11311653
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1654
+ for (int i=group.selection.size(); --i>=0;)
11331655 {
1656
+ Object3D child = (Object3D)group.selection.elementAt(i);
1657
+
1658
+ // Cannot move into itself
1659
+ if (child == destinationLeaf)
1660
+ return;
1661
+ }
1662
+
1663
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1664
+// {
11341665 loadClipboard(true);
11351666 objEditor.jTree.setSelectionPath(destinationPath);
11361667 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1668
+// } else {
1669
+// loadClipboard(false);
1670
+// objEditor.jTree.setSelectionPath(destinationPath);
1671
+// pasteInto(false, false); // true); // ???
1672
+// }
11421673 }
11431674 public void dropActionChanged(DropTargetDragEvent dtde)
11441675 // Called if the user has modified the current drop gesture
....@@ -1243,22 +1774,30 @@
12431774 {
12441775 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12451776 //heightFieldItem.addActionListener(this);
1246
- gridItem = menu.add(new MenuItem("Grid"));
1247
- gridItem.addActionListener(this);
1248
- rectoidItem = menu.add(new MenuItem("Box"));
1249
- rectoidItem.addActionListener(this);
1250
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1251
- ellipsoidItem.addActionListener(this);
1252
- coneItem = menu.add(new MenuItem("Cone"));
1253
- coneItem.addActionListener(this);
1254
- torusItem = menu.add(new MenuItem("Torus"));
1255
- torusItem.addActionListener(this);
1256
- superItem = menu.add(new MenuItem("Superellipsoid"));
1257
- superItem.addActionListener(this);
1777
+// gridItem = menu.add(new MenuItem("Grid"));
1778
+// gridItem.addActionListener(this);
1779
+// rectoidItem = menu.add(new MenuItem("Box"));
1780
+// rectoidItem.addActionListener(this);
1781
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1782
+// ellipsoidItem.addActionListener(this);
1783
+// coneItem = menu.add(new MenuItem("Cone"));
1784
+// coneItem.addActionListener(this);
1785
+// torusItem = menu.add(new MenuItem("Torus"));
1786
+// torusItem.addActionListener(this);
1787
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1788
+// superItem.addActionListener(this);
1789
+
1790
+ cameraItem = menu.add(new MenuItem("Camera"));
1791
+ cameraItem.addActionListener(this);
1792
+
1793
+ if (!Globals.ADVANCED)
1794
+ {
12581795 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12591796 kleinItem.addActionListener(this);
1260
- particleItem = menu.add(new MenuItem("Particle system"));
1261
- particleItem.addActionListener(this);
1797
+ }
1798
+
1799
+// particleItem = menu.add(new MenuItem("Particle system"));
1800
+// particleItem.addActionListener(this);
12621801 if (Globals.ADVANCED)
12631802 {
12641803 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1284,15 +1823,15 @@
12841823 }
12851824 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12861825 bezierItem.addActionListener(this);
1287
- overlayItem = menu.add(new MenuItem("Overlay"));
1288
- overlayItem.addActionListener(this);
1289
- lightItem = menu.add(new MenuItem("Light"));
1290
- lightItem.addActionListener(this);
1826
+// overlayItem = menu.add(new MenuItem("Overlay"));
1827
+// overlayItem.addActionListener(this);
1828
+// lightItem = menu.add(new MenuItem("Light"));
1829
+// lightItem.addActionListener(this);
12911830 menu.add("-");
12921831 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12931832 //superLoopItem.addActionListener(this);
1294
- loopItem = menu.add(new MenuItem("Loop"));
1295
- loopItem.addActionListener(this);
1833
+// loopItem = menu.add(new MenuItem("Loop"));
1834
+// loopItem.addActionListener(this);
12961835 doubleItem = menu.add(new MenuItem("Fork"));
12971836 doubleItem.addActionListener(this);
12981837 if (Globals.ADVANCED)
....@@ -1308,6 +1847,9 @@
13081847 animationItem.addItemListener(this);
13091848 animationItem.setState(Globals.ANIMATION);
13101849
1850
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1851
+ archiveItem.addActionListener(this);
1852
+
13111853 menu.add("-");
13121854 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13131855 parseverticesItem.addActionListener(this);
....@@ -1320,6 +1862,8 @@
13201862 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13211863 reduce34MorphItem.addActionListener(this);
13221864 menu.add("-");
1865
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1866
+ memoryItem.addActionListener(this);
13231867 menu.add(computeAOItem = new MenuItem("Compute AO"));
13241868 computeAOItem.addActionListener(this);
13251869
....@@ -1328,8 +1872,6 @@
13281872 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13291873 mirrorItem.addActionListener(this);
13301874 menu.add("-");
1331
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1332
- memoryItem.addActionListener(this);
13331875 menu.add(analyzeItem = new MenuItem("Analyze"));
13341876 analyzeItem.addActionListener(this);
13351877 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1477,6 +2019,30 @@
14772019
14782020 makeSomething(shadow);
14792021 }
2022
+
2023
+ private void ClearUnpinned()
2024
+ {
2025
+ //for (Object3D obj : listUI)
2026
+ for (int i=listUI.size(); --i>=0;)
2027
+ {
2028
+ Object3D obj = listUI.elementAt(i);
2029
+ if (!obj.pinned)
2030
+ {
2031
+ obj.CloseUI();
2032
+ listUI.remove(i);
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ private void EditElement(Object3D elem, boolean newWindow)
2038
+ {
2039
+ // if (!(elem instanceof Composite))
2040
+ // newWindow = false;
2041
+ listUI.add(elem);
2042
+ elem.openEditWindow(this, newWindow); //, false);
2043
+ System.out.println("edit : " + elem);
2044
+ elem.editWindow.refreshContents(true); // ? new
2045
+ }
14802046
14812047 /**
14822048 * applyExample
....@@ -1721,7 +2287,7 @@
17212287 {
17222288 ScreenFit();
17232289 } else
1724
- if (source == switchItem)
2290
+ if (source == switchViewItem)
17252291 {
17262292 cVector v1 = new cVector();
17272293 cVector v2 = new cVector();
....@@ -1730,11 +2296,11 @@
17302296 objEditor.cameraView.renderCamera.setAim(v2, v1);
17312297 objEditor.cameraView.repaint();
17322298 } else
1733
- if (source == rectoidItem)
2299
+ if (source == rectoidItem || source == boxButton)
17342300 {
17352301 makeSomething(new Box());
17362302 } else
1737
- if (source == particleItem)
2303
+ if (source == particleItem || source == particlesButton)
17382304 {
17392305 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17402306 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +2379,27 @@
18132379
18142380 makeSomething(obj);
18152381 } else
1816
- if (source == gridItem)
2382
+ if (source == gridItem || source == gridButton)
18172383 {
18182384 makeSomething(new Grid());
18192385 } else
1820
- if (source == ellipsoidItem)
2386
+ if (source == ellipsoidItem || source == sphereButton)
18212387 {
18222388 makeSomething(new Sphere());
18232389 } else
1824
- if (source == coneItem)
2390
+ if (source == coneItem || source == coneButton)
18252391 {
18262392 makeSomething(new Cone());
18272393 } else
1828
- if (source == torusItem)
2394
+ if (source == torusItem || source == torusButton)
18292395 {
18302396 makeSomething(new Torus());
18312397 } else
1832
- if (source == superItem)
2398
+ if (source == superItem || source == superButton)
18332399 {
18342400 makeSomething(new Superellipsoid());
18352401 } else
1836
- if (source == kleinItem)
2402
+ if (source == kleinItem || source == kleinButton)
18372403 {
18382404 makeSomething(new Klein());
18392405 } else
....@@ -1853,7 +2419,7 @@
18532419 {
18542420 makeSomething(new BezierSurface());
18552421 } else
1856
- if (source == overlayItem)
2422
+ if (source == overlayItem || source == overlayButton)
18572423 {
18582424 /*
18592425 Object3D obj = new BezierSurface(5,8);
....@@ -1901,10 +2467,27 @@
19012467 s.setup();
19022468 makeSomething(s);
19032469 } else
1904
- if (source == lightItem)
2470
+ if (source == lightItem || source == lightButton)
19052471 {
19062472 makeSomething(new Light());
19072473 } else
2474
+// if (source == skybox1Button ||
2475
+// source == skybox2Button ||
2476
+// source == skybox3Button ||
2477
+// source == skybox4Button ||
2478
+// source == skybox5Button ||
2479
+// source == skybox6Button ||
2480
+// source == skybox7Button ||
2481
+// source == skybox11Button ||
2482
+// source == skybox12Button ||
2483
+// source == skybox13Button ||
2484
+// source == skybox14Button ||
2485
+// source == skybox15Button ||
2486
+// source == skybox16Button ||
2487
+// source == skybox17Button)
2488
+// {
2489
+// ChangeSkybox(source);
2490
+// } else
19082491 if (source == csgItem)
19092492 {
19102493 group(new CSG());
....@@ -1951,30 +2534,30 @@
19512534
19522535 group(g);
19532536 } else
1954
- if (source == loopItem)
2537
+ if (source == loopItem || source == loopButton)
19552538 {
19562539 Composite csg = new GroupLeaf();
19572540 csg.count = 5;
19582541 group(csg);
1959
- Composite child = new cGroup();
2542
+ Composite child = new cGroup("Branch");
19602543 csg.addChild(child);
19612544 child.addChild(csg);
19622545 } else
19632546 if (source == doubleItem)
19642547 {
1965
- Composite csg = new GroupLeaf();
2548
+ Composite csg = new GroupLeaf("Fork");
19662549 csg.count = 5;
19672550 group(csg);
1968
- Composite child = new cGroup();
2551
+ Composite child = new cGroup("Branch A");
19692552 csg.addChild(child);
19702553 child.addChild(csg);
1971
- child = new cGroup();
2554
+ child = new cGroup("Branch B");
19722555 csg.addChild(child);
19732556 child.addChild(csg);
19742557 } else
19752558 if (source == tripleItem)
19762559 {
1977
- Composite csg = new GroupLeaf();
2560
+ Composite csg = new GroupLeaf("Trident");
19782561 csg.count = 4;
19792562 group(csg);
19802563 Composite child = new cGroup();
....@@ -1990,7 +2573,7 @@
19902573 if (source == computeAOItem)
19912574 {
19922575 Globals.drawMode = CameraPane.OCCLUSION;
1993
- Globals.theRenderer.repaint();
2576
+ cameraView.repaint();
19942577 } else
19952578 if (source == recompileItem)
19962579 {
....@@ -2005,7 +2588,7 @@
20052588 if (source == invariantsItem)
20062589 {
20072590 System.out.println("Invariants:");
2008
- Grafreed.grafreeD.universe.invariants();
2591
+ Grafreed.grafreed.universe.invariants();
20092592 } else
20102593 if (source == memoryItem)
20112594 {
....@@ -2036,17 +2619,40 @@
20362619 {
20372620 ToggleFullScreen();
20382621 } else
2039
- if (source == undoButton)
2622
+ if (source == previousVersionButton)
20402623 {
2041
- Undo();
2624
+ // Go to previous version
2625
+ //if (!Undo())
2626
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2627
+ PreviousVersion();
20422628 } else
2043
- if (source == redoButton)
2629
+ if (source == restoreButton)
20442630 {
2045
- Redo();
2631
+ // Restore current version
2632
+ Restore();
2633
+ //restoreButton.setEnabled(false);
20462634 } else
2047
- if (source == saveButton)
2635
+ if (source == replaceButton)
20482636 {
2049
- Save();
2637
+ // Overwrite current version
2638
+ Replace();
2639
+ //replaceButton.setEnabled(false);
2640
+ } else
2641
+ if (source == nextVersionButton)
2642
+ {
2643
+ // Go to next version
2644
+ NextVersion();
2645
+ } else
2646
+ if (source == saveVersionButton)
2647
+ {
2648
+ // Save a new version
2649
+ if (!Save(true))
2650
+ java.awt.Toolkit.getDefaultToolkit().beep();
2651
+ } else
2652
+ if (source == deleteVersionButton)
2653
+ {
2654
+ // Delete a new version
2655
+ DeleteVersion();
20502656 } else
20512657 if (source == oneStepButton)
20522658 {
....@@ -2055,17 +2661,14 @@
20552661 } else
20562662 if (source == screenfitButton)
20572663 {
2058
- //Reload(lastConverter, lastFilename, true);
20592664 ScreenFit();
20602665 } else
20612666 if (source == screenfitpointButton)
20622667 {
2063
- //Reload(lastConverter, lastFilename, true);
20642668 ScreenFitPoint();
20652669 } else
20662670 if (source == snapobjectButton)
20672671 {
2068
- //Reload(lastConverter, lastFilename, true);
20692672 SnapObject();
20702673 } else
20712674 // if (event.getSource() == recompileButton)
....@@ -2104,11 +2707,11 @@
21042707 } else
21052708 if (source == undoItem)
21062709 {
2107
- Undo();
2710
+ PreviousVersion();
21082711 } else
21092712 if (source == redoItem)
21102713 {
2111
- Redo();
2714
+ NextVersion();
21122715 } else
21132716 if (source == duplicateItem)
21142717 {
....@@ -2429,7 +3032,7 @@
24293032 {
24303033 StepAll();
24313034 } else
2432
- if (source == clearItem) // || event.getSource() == clearButton)
3035
+ if (source == deleteItem) // || event.getSource() == clearButton)
24333036 {
24343037 //int indices[] = jList.getSelectedIndices();
24353038 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2441,9 +3044,9 @@
24413044 {
24423045 ClearSelection(true);
24433046 } else
2444
- if (source == grabItem)
3047
+ if (source == grabItem || source == groupButton)
24453048 {
2446
- group(new cGroup(), true);
3049
+ group(new cGroup(), false); // true);
24473050 } else
24483051 if (source == hideItem)
24493052 {
....@@ -2461,11 +3064,11 @@
24613064 {
24623065 makeSomething(new Camera());
24633066 } else
2464
- if (source == compositeItem)
3067
+ if (source == compositeItem || source == compositeButton)
24653068 {
24663069 group(new Composite());
24673070 } else
2468
- if (source == randomItem)
3071
+ if (source == switchItem || source == switchButton)
24693072 {
24703073 RandomNode random = new RandomNode();
24713074 group(random);
....@@ -2567,7 +3170,7 @@
25673170 {
25683171 group(new cLinker());
25693172 } else
2570
- if (source == textureItem)
3173
+ if (source == textureItem || source == textureButton)
25713174 {
25723175 group(new TextureNode());
25733176 } else
....@@ -2587,17 +3190,30 @@
25873190 {
25883191 CastShadow(2);
25893192 } else
2590
- if (source == ungroupItem)
3193
+ if (source == ungroupItem || source == ungroupButton)
25913194 {
2592
- //ungroup();
3195
+ boolean hasRoot = false;
3196
+
25933197 for (int i=0; i<group.selection.size(); i++)
25943198 {
2595
- Ungroup(group.selection.get(i));
3199
+ if (group.selection.get(i) == group)
3200
+ {
3201
+ hasRoot = true;
3202
+ break;
3203
+ }
25963204 }
25973205
2598
- ClearSelection(false);
2599
-
2600
- refreshContents();
3206
+ if (!hasRoot)
3207
+ {
3208
+ for (int i=0; i<group.selection.size(); i++)
3209
+ {
3210
+ Ungroup(group.selection.get(i));
3211
+ }
3212
+
3213
+ ClearSelection(false);
3214
+
3215
+ refreshContents();
3216
+ }
26013217 } else
26023218 if (source == genUVItem)
26033219 {
....@@ -2898,7 +3514,7 @@
28983514 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28993515 {
29003516 obj = (Object3D)e.nextElement();
2901
- obj.SetBumpTexture(null);
3517
+ obj.ResetBumpTexture();
29023518 }
29033519
29043520 refreshContents();
....@@ -2914,6 +3530,31 @@
29143530
29153531 refreshContents();
29163532 } else
3533
+ if (source == embedTexturesItem)
3534
+ {
3535
+ Object3D obj;
3536
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3537
+ {
3538
+ obj = (Object3D)e.nextElement();
3539
+ obj.EmbedTextures(true);
3540
+ }
3541
+
3542
+ refreshContents();
3543
+ } else
3544
+ if (source == deEmbedTexturesItem)
3545
+ {
3546
+ Object3D obj;
3547
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3548
+ {
3549
+ obj = (Object3D)e.nextElement();
3550
+ obj.EmbedTextures(false);
3551
+ }
3552
+
3553
+ CameraPane.texturepigment.clear();
3554
+ CameraPane.texturebump.clear();
3555
+
3556
+ refreshContents();
3557
+ } else
29173558 if (source == flashSelectionButton)
29183559 {
29193560 CameraPane.flash = true;
....@@ -2925,6 +3566,10 @@
29253566 if (source == twoButton)
29263567 {
29273568 radio.layout = twoButton;
3569
+
3570
+ if (CameraPane.FULLSCREEN)
3571
+ fullscreenLayout = radio.layout;
3572
+
29283573 // bug
29293574 //gridPanel.setDividerLocation(1.0);
29303575 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3625,9 @@
29803625 {
29813626 radio.layout = threeButton;
29823627
3628
+ if (CameraPane.FULLSCREEN)
3629
+ fullscreenLayout = radio.layout;
3630
+
29833631 // bigThree.remove(scenePanel);
29843632 // bigThree.remove(centralPanel);
29853633 // bigThree.remove(XYZPanel);
....@@ -3008,8 +3656,8 @@
30083656 // centralPanel.setVisible(true);
30093657 // XYZPanel.setVisible(true);
30103658 bigThree.ClearUI();
3659
+ bigThree.add(scenePanel);
30113660 bigThree.add(centralPanel);
3012
- bigThree.add(XYZPanel);
30133661 bigThree.FlushUI();
30143662
30153663 cameraView.requestFocusInWindow();
....@@ -3017,6 +3665,9 @@
30173665 if (source == fourButton)
30183666 {
30193667 radio.layout = fourButton;
3668
+
3669
+ if (CameraPane.FULLSCREEN)
3670
+ fullscreenLayout = radio.layout;
30203671
30213672 // bigThree.remove(scenePanel);
30223673 // bigThree.remove(centralPanel);
....@@ -3055,6 +3706,9 @@
30553706 {
30563707 radio.layout = sixButton;
30573708
3709
+ if (CameraPane.FULLSCREEN)
3710
+ fullscreenLayout = radio.layout;
3711
+
30583712 // bigThree.remove(scenePanel);
30593713 // bigThree.remove(centralPanel);
30603714 // bigThree.remove(XYZPanel);
....@@ -3083,8 +3737,8 @@
30833737 // centralPanel.setVisible(true);
30843738 // XYZPanel.setVisible(false);
30853739 bigThree.ClearUI();
3086
- bigThree.add(scenePanel);
30873740 bigThree.add(centralPanel);
3741
+ bigThree.add(scenePanel);
30883742 bigThree.FlushUI();
30893743
30903744 cameraView.requestFocusInWindow();
....@@ -3092,6 +3746,9 @@
30923746 if (source == sevenButton)
30933747 {
30943748 radio.layout = sevenButton;
3749
+
3750
+ if (CameraPane.FULLSCREEN)
3751
+ fullscreenLayout = radio.layout;
30953752
30963753 // bigThree.remove(scenePanel);
30973754 // bigThree.remove(centralPanel);
....@@ -3159,7 +3816,8 @@
31593816 buttonGroup.remove(ab);
31603817 radioPanel.remove(ab);
31613818
3162
- ab.GetObject().editWindow = null;
3819
+ //ab.GetObject().editWindow = null;
3820
+ ab.GetObject().manipWindow = null;
31633821 // ab.GetObject().objectUI = null; // ?????????
31643822
31653823 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3172,6 +3830,12 @@
31723830 } else
31733831 if (source == editItem || source == editButton)
31743832 {
3833
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3834
+ {
3835
+ Object3D child = (Object3D)e.nextElement();
3836
+ child.pinned = true;
3837
+ }
3838
+
31753839 EditSelection(false);
31763840 } else
31773841 if (source == uneditButton)
....@@ -3180,9 +3844,10 @@
31803844 {
31813845 Object3D child = (Object3D)e.nextElement();
31823846 if(child.editWindow != null)
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3847
+ child.pinned = false;
31843848 child.CloseUI();
31853849 listUI.remove(child);
3850
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31863851
31873852 //child.editWindow = null; // ???????????
31883853 }
....@@ -3197,16 +3862,18 @@
31973862 //copy.ClearUI();
31983863 for (Object3D obj : listUI)
31993864 {
3865
+ obj.pinned = false;
32003866 obj.CloseUI();
32013867 }
32023868 listUI.clear();
3869
+ SetPinStates(group.selection.size() > 0);
32033870 refreshContents(true);
32043871 } else
32053872 if (source == allParamsButton)
32063873 {
32073874 assert(copy == group);
32083875
3209
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3876
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32103877
32113878 for (Object3D obj : listUI)
32123879 {
....@@ -3255,6 +3922,9 @@
32553922 }
32563923
32573924 copy = group;
3925
+
3926
+ SetUndoStates();
3927
+
32583928 //Globals.theRenderer.object = group;
32593929 if(!useclient)
32603930 {
....@@ -3273,6 +3943,7 @@
32733943
32743944 // fix "+" issue
32753945 //group.editWindow = this;
3946
+ group.manipWindow = this;
32763947
32773948 /*
32783949 currentLayout = radio.layout;
....@@ -3280,6 +3951,14 @@
32803951 currentLayout = sevenButton;
32813952 */
32823953 radio.layout.doClick();
3954
+
3955
+ ClearUnpinned();
3956
+
3957
+ //Grafreed.Assert(group != null);
3958
+ //Grafreed.Assert(group.selection != null);
3959
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3960
+ if (group.selection == null || group.selection.size() == 1)
3961
+ EditSelection(false);
32833962 keepparent = group.parent;
32843963 // PARENT = NULL or not???
32853964 //group.parent = null; // ROOT
....@@ -3291,11 +3970,13 @@
32913970 } else if (event.getSource() == editCameraItem)
32923971 {
32933972 cameraView.ProtectCamera();
3973
+ cameraView.requestFocusInWindow();
32943974 cameraView.repaint();
32953975 return;
3296
- } else if (event.getSource() == revertCameraItem)
3976
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32973977 {
32983978 cameraView.RevertCamera();
3979
+ cameraView.requestFocusInWindow();
32993980 cameraView.repaint();
33003981 return;
33013982 // } else if (event.getSource() == textureButton)
....@@ -3872,7 +4553,7 @@
38724553
38734554 try
38744555 {
3875
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4556
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38764557 }
38774558 catch (Exception e)
38784559 {
....@@ -4347,28 +5028,25 @@
43475028 // }
43485029 // }
43495030
4350
- static boolean allparams = true;
4351
-
4352
- static Vector<Object3D> listUI = new Vector<Object3D>();
4353
-
43545031 void EditSelection(boolean newWindow)
43555032 {
5033
+ if (group.selection == null)
5034
+ {
5035
+ EditElement(group, newWindow); // ? new
5036
+ return;
5037
+ }
5038
+
43565039 // aConstraints.gridy = 0;
43575040 for (int i=0; i<group.selection.size(); i++)
43585041 {
43595042 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43605043 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5044
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43625045
43635046 Object3D elem = (Object3D)group.selection.elementAt(i);
43645047 if(elem != group || !newWindow)
43655048 {
4366
- // if (!(elem instanceof Composite))
4367
- // newWindow = false;
4368
- listUI.add(elem);
4369
- elem.openEditWindow(this, newWindow); //, false);
4370
- System.out.println("edit : " + elem);
4371
- elem.editWindow.refreshContents(true); // ? new
5049
+ EditElement(elem, newWindow); // ? new
43725050 }
43735051 }
43745052 }
....@@ -4431,9 +5109,7 @@
44315109
44325110 freezemodel = false;
44335111 }
4434
-
4435
- boolean flashIt = true;
4436
-
5112
+
44375113 public void valueChanged(TreeSelectionEvent e)
44385114 //public boolean handleEvent(Event event)
44395115 {
....@@ -4443,7 +5119,8 @@
44435119 //new Exception().printStackTrace();
44445120
44455121 freezemodel = true;
4446
-
5122
+ ClearUnpinned();
5123
+
44475124 /**/
44485125 //switch (event.id)
44495126 {
....@@ -4476,7 +5153,7 @@
44765153 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44775154 // a camera
44785155 {
4479
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5156
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44805157 {
44815158 CameraPane.camerachangeframe = 0; // don't refuse it
44825159 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4485,6 +5162,13 @@
44855162 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44865163 }
44875164
5165
+ if (tps != null && tps.length == 1)
5166
+ {
5167
+ EditSelection(false);
5168
+ }
5169
+
5170
+ SetPinStates(tps != null && tps.length > 0);
5171
+
44885172 refreshContents();
44895173 //return true;
44905174 }
....@@ -4494,9 +5178,20 @@
44945178 freezemodel = false;
44955179 }
44965180
5181
+ void SetPinStates(boolean enabled)
5182
+ {
5183
+ editButton.setEnabled(enabled);
5184
+ uneditButton.setEnabled(enabled);
5185
+ //unselectButton.setEnabled(enabled);
5186
+ flashSelectionButton.setEnabled(enabled);
5187
+
5188
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5189
+ }
5190
+
44975191 void refreshContents(boolean cp)
44985192 {
4499
- if (!Globals.MOUSEDRAGGED)
5193
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5194
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45005195 {
45015196 objEditor.ClearInfo(); // .GetMaterial());
45025197
....@@ -4595,7 +5290,8 @@
45955290
45965291 if (cut)
45975292 {
4598
- Save();
5293
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5294
+// Save();
45995295 //int indices[] = jList.getSelectedIndices();
46005296 //for (int i = indices.length - 1; i >= 0; i--)
46015297 //jList.remove(indices[i]);
....@@ -4698,6 +5394,10 @@
46985394
46995395 void paste(boolean expand)
47005396 {
5397
+ if (Globals.REPLACEONMAKE)
5398
+ Save();
5399
+ boolean keep = Globals.REPLACEONMAKE;
5400
+ Globals.REPLACEONMAKE = false;
47015401 // if (GrafreeD.clipboard == null)
47025402 // return;
47035403 boolean first = true;
....@@ -4757,6 +5457,7 @@
47575457 Grafreed.clipboard.get(0).parent = keepparent;
47585458 }
47595459
5460
+ Globals.REPLACEONMAKE = keep;
47605461 ResetModel();
47615462 refreshContents();
47625463 }
....@@ -4892,6 +5593,10 @@
48925593
48935594 void group(Object3D csg, boolean grab)
48945595 {
5596
+ if (Globals.REPLACEONMAKE)
5597
+ Save();
5598
+ boolean keep = Globals.REPLACEONMAKE;
5599
+ Globals.REPLACEONMAKE = false;
48955600 if (//false) // why??
48965601 !group.selection.isEmpty())
48975602 {
....@@ -5005,10 +5710,15 @@
50055710 //node.add(csg);
50065711 //makeSomething(node);
50075712 makeSomething(csg);
5713
+ Globals.REPLACEONMAKE = keep;
50085714 }
50095715
50105716 void Ungroup(Object3D g)
50115717 {
5718
+ if (Globals.REPLACEONMAKE)
5719
+ Save();
5720
+ boolean keep = Globals.REPLACEONMAKE;
5721
+ Globals.REPLACEONMAKE = false;
50125722 if (g instanceof HiddenObject)
50135723 {
50145724 HiddenObject h = (HiddenObject) g;
....@@ -5025,6 +5735,7 @@
50255735 objEditor.makeSomething(g.get(i), false);
50265736 }
50275737 }
5738
+ Globals.REPLACEONMAKE = keep;
50285739 }
50295740
50305741 void ungroup()
....@@ -5313,13 +6024,43 @@
53136024 cButton clearpanelButton;
53146025 cButton unselectButton;
53156026
5316
- cButton minButton;
5317
- cButton maxButton;
5318
- cButton fullButton;
5319
- cButton undoButton;
5320
- cButton redoButton;
5321
- cButton saveButton;
6027
+ cButton restoreCameraButton;
6028
+
53226029 cButton oneStepButton;
6030
+
6031
+ cButton groupButton;
6032
+ cButton ungroupButton;
6033
+ cButton compositeButton;
6034
+ cButton switchButton;
6035
+ cButton loopButton;
6036
+ cButton textureButton;
6037
+
6038
+ cButton skybox1Button;
6039
+ cButton skybox2Button;
6040
+ cButton skybox3Button;
6041
+ cButton skybox4Button;
6042
+ cButton skybox5Button;
6043
+ cButton skybox6Button;
6044
+ cButton skybox7Button;
6045
+
6046
+ cButton skybox11Button;
6047
+ cButton skybox12Button;
6048
+ cButton skybox13Button;
6049
+ cButton skybox14Button;
6050
+ cButton skybox15Button;
6051
+ cButton skybox16Button;
6052
+ cButton skybox17Button;
6053
+
6054
+ cButton gridButton;
6055
+ cButton boxButton;
6056
+ cButton sphereButton;
6057
+ cButton coneButton;
6058
+ cButton torusButton;
6059
+ cButton superButton;
6060
+ cButton kleinButton;
6061
+ cButton particlesButton;
6062
+ cButton overlayButton;
6063
+ cButton lightButton;
53236064
53246065 cButton screenfitButton;
53256066 cButton screenfitpointButton;
....@@ -5341,11 +6082,11 @@
53416082 //JTree jTree;
53426083 private MenuItem lookAtItem;
53436084 private MenuItem lookFromItem;
5344
- private MenuItem switchItem;
6085
+ private MenuItem switchViewItem;
53456086 private MenuItem cutItem;
53466087 private MenuItem undoItem;
53476088 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
6089
+ private JMenuItem duplicateItem;
53496090 private MenuItem cloneItem;
53506091 private MenuItem cloneSupportItem;
53516092 private MenuItem overwriteGeoItem;
....@@ -5373,7 +6114,7 @@
53736114 private MenuItem pasteLinkItem;
53746115 private MenuItem pasteCloneItem;
53756116 private MenuItem pasteExpandItem;
5376
- private MenuItem clearItem;
6117
+ private MenuItem deleteItem;
53776118 private MenuItem clearAllItem;
53786119 private MenuItem genUVItem;
53796120 private MenuItem genNormalsMESHItem;
....@@ -5433,7 +6174,7 @@
54336174 private MenuItem frontItem;
54346175 private MenuItem cameraItem;
54356176 private MenuItem compositeItem;
5436
- private MenuItem randomItem;
6177
+ private MenuItem switchItem;
54376178 private MenuItem physicsItem;
54386179 private MenuItem frameselectorItem;
54396180 private MenuItem scriptNodeItem;
....@@ -5457,6 +6198,8 @@
54576198 private MenuItem attachBumpItem;
54586199 private MenuItem detachBumpItem;
54596200 private MenuItem pigmentBumpItem;
6201
+ private MenuItem embedTexturesItem;
6202
+ private MenuItem deEmbedTexturesItem;
54606203
54616204 private MenuItem particleItem;
54626205 private MenuItem ragdollItem;
....@@ -5507,5 +6250,5 @@
55076250
55086251 Menu cameraMenu;
55096252 MenuItem editCameraItem;
5510
- MenuItem revertCameraItem;
6253
+ MenuItem restoreCameraItem;
55116254 }