Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
GroupEditor.java
....@@ -23,6 +23,302 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("penguins", "yonder", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
26322 //ObjEditor objEditor;
27323 public void closeUI2()
28324 {
....@@ -60,6 +356,12 @@
60356 this.copy = this.group = group;
61357 //selectees = this.group.selectees;
62358
359
+ if (copy.versionlist == null)
360
+ {
361
+ copy.versionlist = new Object3D[100];
362
+ copy.versionindex = -1;
363
+ }
364
+
63365 if(ui)
64366 SetupUI(objEditor);
65367 }
....@@ -80,10 +382,22 @@
80382 SetupViews(objEditor);
81383
82384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versionlist == null)
387
+ {
388
+ copy.versionlist = new Object3D[100];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
83393 }
84394
85395 void CloneSelection(boolean supports)
86396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
87401 // Object3D keep = GrafreeD.clipboard;
88402 //Object3D obj;
89403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +408,7 @@
94408
95409 makeSomething(clone, i==group.selection.size()-1);
96410 }
411
+ Globals.REPLACEONMAKE = keep;
97412 }
98413
99414 void CloneClipboard(boolean supports)
....@@ -150,6 +465,8 @@
150465
151466 void SetupMenu2(GroupEditor oe)
152467 {
468
+ oe.jTree = new cTree();
469
+
153470 Menu menu;
154471 oe.menuBar.add(menu = new Menu("Edit"));
155472 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +477,7 @@
160477 // redoItem = menu.add(new MenuItem("Redo"));
161478 // redoItem.addActionListener(this);
162479 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
480
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164481 duplicateItem.addActionListener(this);
165482 cloneItem = menu.add(new MenuItem("Clone"));
166483 cloneItem.addActionListener(this);
....@@ -187,8 +504,8 @@
187504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
188505 // pasteExpandItem.addActionListener(this);
189506 menu.add("-");
190
- clearItem = menu.add(new MenuItem("Clear"));
191
- clearItem.addActionListener(this);
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
192509
193510 if (Globals.ADVANCED)
194511 {
....@@ -202,23 +519,23 @@
202519 //zBufferItem.addActionListener(this);
203520 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204521 //normalLensItem.addActionListener(this);
205
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
- revertCameraItem.addActionListener(this);
522
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
523
+ restoreCameraItem.addActionListener(this);
207524
208
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
- toggleFullScreenItem.addItemListener(this);
210
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
- cameraMenu.add("-");
525
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
526
+// toggleFullScreenItem.addItemListener(this);
527
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
528
+// cameraMenu.add("-");
529
+//
530
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
531
+// toggleTextureItem.addItemListener(this);
532
+// toggleTextureItem.setState(CameraPane.textureon);
533
+//
534
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
535
+// toggleSwitchItem.addItemListener(this);
536
+// toggleSwitchItem.setState(CameraPane.SWITCH);
212537
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"));
538
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
222539 toggleHandleItem.addItemListener(this);
223540 toggleHandleItem.setState(CameraPane.HANDLES);
224541
....@@ -273,7 +590,7 @@
273590 {
274591 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275592 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
593
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
277594 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278595 oe.cameraMenu.add("-");
279596 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -281,7 +598,7 @@
281598 editLeafItem.addActionListener(this);
282599 lookAtItem.addActionListener(this);
283600 //lookFromItem.addActinoListener(this);
284
- //switchItem.addActionListener(this);
601
+ //switchViewItem.addActionListener(this);
285602 }
286603
287604 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -326,21 +643,29 @@
326643 }
327644
328645 oe.menuBar.add(menu = new Menu("Group"));
329
- grabItem = menu.add(new MenuItem("Grab"));
330
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
331648 backItem = menu.add(new MenuItem("Back"));
332649 backItem.addActionListener(this);
333650 frontItem = menu.add(new MenuItem("Front"));
334651 frontItem.addActionListener(this);
335
- compositeItem = menu.add(new MenuItem("Composite"));
336
- compositeItem.addActionListener(this);
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
337657 hideItem = menu.add(new MenuItem("Hidden Group"));
338658 hideItem.addActionListener(this);
659
+ }
339660 ungroupItem = menu.add(new MenuItem("Ungroup"));
340661 ungroupItem.addActionListener(this);
341
- menu.add("-");
342
- randomItem = menu.add(new MenuItem("Switch node"));
343
- randomItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
344669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345670 switchGeoItem.addActionListener(this);
346671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +673,6 @@
348673 morphItem = menu.add(new MenuItem("Morph Group"));
349674 morphItem.addActionListener(this);
350675
351
- if (Globals.ADVANCED)
352
- {
353676 menu.add("-");
354677 physicsItem = menu.add(new MenuItem("Physics"));
355678 physicsItem.addActionListener(this);
....@@ -357,13 +680,11 @@
357680 frameselectorItem.addActionListener(this);
358681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
359682 scriptNodeItem.addActionListener(this);
360
- cameraItem = menu.add(new MenuItem("Camera"));
361
- cameraItem.addActionListener(this);
362683 }
363684
364685 oe.menuBar.add(menu = new Menu("Object"));
365
- textureItem = menu.add(new MenuItem("Texture"));
366
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
367688 billboardItem = menu.add(new MenuItem("Billboard"));
368689 billboardItem.addActionListener(this);
369690 csgItem = menu.add(new MenuItem("CSG"));
....@@ -374,13 +695,14 @@
374695 shadowYItem.addActionListener(this);
375696 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
376697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
377701 if (Globals.ADVANCED)
378702 {
379703 menu.add("-");
380704 linkerItem = menu.add(new MenuItem("Linker"));
381705 linkerItem.addActionListener(this);
382
- attributeItem = menu.add(new MenuItem("Attribute"));
383
- attributeItem.addActionListener(this);
384706 templateItem = menu.add(new MenuItem("Template"));
385707 templateItem.addActionListener(this);
386708 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -409,7 +731,7 @@
409731 genNormalsMESHItem.addActionListener(this);
410732 if (Globals.ADVANCED)
411733 {
412
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
413735 genNormalsMINEItem.addActionListener(this);
414736 }
415737 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -502,10 +824,15 @@
502824 attachBumpItem.addActionListener(this);
503825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
504826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
505828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
506829 detachPigmentItem.addActionListener(this);
507830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
508831 detachBumpItem.addActionListener(this);
832
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
833
+ embedTexturesItem.addActionListener(this);
834
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
835
+ deEmbedTexturesItem.addActionListener(this);
509836 menu.add("-");
510837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
511838 sortbysizeItem.addActionListener(this);
....@@ -532,6 +859,7 @@
532859 buildToolsMenu(menu);
533860 }
534861
862
+
535863 void SetupUI2(ObjEditor oe)
536864 {
537865 // June 2019
....@@ -574,51 +902,83 @@
574902 oe.radioPanel.add(dummyButton);
575903 oe.buttonGroup.add(dummyButton);
576904 */
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
908
+
577909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
578910
579911 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580912 //minButton.setToolTipText("Minimize window");
581913 //minButton.addActionListener(this);
582914
583
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
- maxButton.setToolTipText("Maximize window");
585
- maxButton.addActionListener(this);
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
586921
587922 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588923 fullButton.setToolTipText("Full-screen window");
589924 fullButton.addActionListener(this);
590925
591
- oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
- undoButton.setToolTipText("Undo changes");
593
- undoButton.addActionListener(this);
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ screenfitButton.setToolTipText("Screen fit");
928
+ screenfitButton.addActionListener(this);
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
594933
595
- oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
934
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveVersionButton.setToolTipText("Duplicate current version");
936
+ saveVersionButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ deleteVersionButton.setToolTipText("Delete current version");
940
+ deleteVersionButton.addActionListener(this);
941
+
942
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
943
+ previousVersionButton.setToolTipText("Previous version");
944
+ previousVersionButton.addActionListener(this);
945
+ previousVersionButton.setEnabled(false);
598946
599
- oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
601
- saveButton.addActionListener(this);
947
+ cGridBag updown = new cGridBag().setVertical(true);
948
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
949
+ restoreButton.setToolTipText("Undo (restore current version)");
950
+ restoreButton.addActionListener(this);
951
+ //restoreButton.setEnabled(false);
602952
603
- oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
953
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
954
+ replaceButton.setToolTipText("Save (replace current version)");
955
+ replaceButton.addActionListener(this);
956
+ //replaceButton.setEnabled(false);
957
+
958
+ copyOptionsPanel.add(updown);
959
+
960
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
961
+ nextVersionButton.setToolTipText("Next version");
962
+ nextVersionButton.addActionListener(this);
963
+ nextVersionButton.setEnabled(false);
964
+
965
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604966 liveCB.setToolTipText("Enable animation");
605967 liveCB.addItemListener(this);
606968
607
- oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
608
- fastCB.setToolTipText("Fast mode");
609
- fastCB.addItemListener(this);
610
-
611969 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612970 oneStepButton.setToolTipText("Animate one step forward");
613971 oneStepButton.addActionListener(this);
614972
615
- oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616
- trackCB.setToolTipText("Enable tracking");
617
- trackCB.addItemListener(this);
618
-
619
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- screenfitButton.setToolTipText("Screen fit");
621
- screenfitButton.addActionListener(this);
973
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
974
+ fastCB.setToolTipText("Fast mode");
975
+ fastCB.addItemListener(this);
976
+
977
+ //oe.toolboxPanel.Return();
978
+
979
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
980
+// trackCB.setToolTipText("Enable tracking");
981
+// trackCB.addItemListener(this);
622982
623983 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624984 // screenfitpointButton.addActionListener(this);
....@@ -628,54 +988,140 @@
628988 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629989 snapobjectButton.addActionListener(this);
630990 snapobjectButton.setToolTipText("Snap Object");
991
+
992
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
993
+ fourButton.addActionListener(this);
994
+ fourButton.setToolTipText("Show control panel only");
631995 }
632996
633
- oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Highlight selection");
635
- flashSelectionButton.addActionListener(this);
997
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636998
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");
999
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
+ twoButton.setToolTipText("Show 3D view only");
6411001 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");
1002
+ this.fullscreenLayout = twoButton;
1003
+
1004
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
+ threeButton.setToolTipText("Show controls and 3D view");
6501006 threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
1007
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
+ sixButton.setToolTipText("Show 3D view and controls");
1009
+ sixButton.addActionListener(this);
1010
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+// sevenButton.setToolTipText("3-column layout");
1012
+// sevenButton.addActionListener(this);
6541013 //
6551014
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
1015
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1016
+ rootButton.setToolTipText("Open selection in new tab");
6581017 rootButton.addActionListener(this);
6591018
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6611020 closeButton.setToolTipText("Close tab");
6621021 closeButton.addActionListener(this);
6631022 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6641023 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
1024
+
1025
+ cGridBag row1 = new cGridBag();
1026
+
1027
+ // INSERT
1028
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ gridButton.setToolTipText("Create grid");
1030
+ gridButton.addActionListener(this);
1031
+
1032
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ boxButton.setToolTipText("Create box");
1034
+ boxButton.addActionListener(this);
1035
+
1036
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ sphereButton.setToolTipText("Create sphere");
1038
+ sphereButton.addActionListener(this);
1039
+
1040
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ coneButton.setToolTipText("Create cone");
1042
+ coneButton.addActionListener(this);
1043
+
1044
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ torusButton.setToolTipText("Create torus");
1046
+ torusButton.addActionListener(this);
1047
+
1048
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ superButton.setToolTipText("Create superellipsoid");
1050
+ superButton.addActionListener(this);
1051
+
1052
+ if (Globals.ADVANCED)
1053
+ {
1054
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ kleinButton.setToolTipText("Create Klein bottle");
1056
+ kleinButton.addActionListener(this);
1057
+ }
1058
+
1059
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1060
+ particlesButton.setToolTipText("Create particle system");
1061
+ particlesButton.addActionListener(this);
1062
+
1063
+ oe.toolboxPanel.add(row1);
1064
+
1065
+ cGridBag row2 = new cGridBag();
1066
+
1067
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ groupButton.setToolTipText("Create group");
1069
+ groupButton.addActionListener(this);
1070
+
1071
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ compositeButton.setToolTipText("Create composite");
1073
+ compositeButton.addActionListener(this);
1074
+
1075
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ switchButton.setToolTipText("Create item switcher");
1077
+ switchButton.addActionListener(this);
1078
+
1079
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ loopButton.setToolTipText("Create loop");
1081
+ loopButton.addActionListener(this);
1082
+
1083
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ textureButton.setToolTipText("Create texture");
1085
+ textureButton.addActionListener(this);
1086
+
1087
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ overlayButton.setToolTipText("Create overlay");
1089
+ overlayButton.addActionListener(this);
1090
+
1091
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ lightButton.setToolTipText("Create light");
1093
+ lightButton.addActionListener(this);
1094
+
1095
+ oe.toolboxPanel.add(row2);
1096
+
1097
+ // ENVYMAPS
1098
+ cGridBag skyboxpane = new cGridBag();
1099
+ skyboxpane.preferredHeight = 100;
1100
+
1101
+ oe.toolboxPanel.add(skyboxpane);
1102
+
1103
+ JTabbedPane skyboxpanel = new JTabbedPane();
1104
+ skyboxpane.add(skyboxpanel);
1105
+
1106
+ AddSkyboxTab0(skyboxpanel);
1107
+ AddSkyboxTab1(skyboxpanel);
1108
+ AddSkyboxTab2(skyboxpanel);
1109
+ AddSkyboxTab3(skyboxpanel);
1110
+
1111
+ // EDIT panel
1112
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ editButton.setToolTipText("Pin selection controls");
6681114 editButton.addActionListener(this);
6691115
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
1116
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ uneditButton.setToolTipText("Unpin and remove selection controls");
6721118 uneditButton.addActionListener(this);
6731119
6741120 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
1121
+ allParamsButton.setToolTipText("Show all controle");
6761122 allParamsButton.addActionListener(this);
6771123
678
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6791125 clearPanelButton.setToolTipText("Clear edit panel");
6801126 clearPanelButton.addActionListener(this);
6811127
....@@ -683,8 +1129,13 @@
6831129 unselectButton.setToolTipText("Unselect");
6841130 unselectButton.addActionListener(this);
6851131
1132
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ flashSelectionButton.setToolTipText("Highlight selection");
1134
+ flashSelectionButton.addActionListener(this);
1135
+
6861136 editCommandsPanel.preferredHeight = 1;
6871137
1138
+ SetPinStates(false);
6881139 // oe.treePanel.add(commandsPanel);
6891140 // oe.treePanel.Return();
6901141
....@@ -703,32 +1154,20 @@
7031154
7041155 JScrollPane jSP;
7051156 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1157
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
7071158 ResetModel();
7081159
7091160 oe.treePanel.add(jSPPanel);
7101161 oe.treePanel.Return();
7111162
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;
7271163 oe.treePanel.add(copyOptionsPanel);
7281164 oe.treePanel.Return();
1165
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
+ sliderPane.preferredHeight = 1;
7291168
730
-// mainPanel.setDividerLocation(0.5); //1.0);
731
-// mainPanel.setResizeWeight(0.5);
1169
+// mainPanel.setDividerLocation(0.1); //1.0);
1170
+ mainPanel.setResizeWeight(0.4);
7321171
7331172 //jList.addListSelectionListener(this);
7341173 oe.jTree.addTreeSelectionListener(this);
....@@ -736,7 +1175,7 @@
7361175 //jTree.setEditable(true);
7371176 oe.jTree.setDragEnabled(true);
7381177 //jTree.setPreferredSize(new Dimension(10,10));
739
- jSP.setPreferredSize(new Dimension(100,200));
1178
+ //jSP.setPreferredSize(new Dimension(100,200));
7401179
7411180 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7421181
....@@ -748,29 +1187,49 @@
7481187 dgr.addDragGestureListener(this);
7491188 }catch(Exception e) {}
7501189 */
751
- radio.layout = sevenButton;
1190
+ radio.layout = threeButton; // sixButton;
7521191 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7531192 }
7541193
7551194 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7561195 {
1196
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1197
+ colorCB.setToolTipText("Copy color when dropped");
1198
+ colorCB.addItemListener(this);
1199
+
1200
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1201
+ materialCB.setToolTipText("Copy material when dropped");
1202
+ materialCB.addItemListener(this);
1203
+
1204
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1205
+ textureCB.setToolTipText("Copy texture when dropped");
1206
+ textureCB.addItemListener(this);
1207
+
1208
+ panel.Return();
1209
+
7571210 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7581211 boxCB.setToolTipText("Display bounding boxes");
7591212 boxCB.addItemListener(this);
7601213
7611214 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1215
+ zoomBoxCB.setToolTipText("Display only for wheel");
7631216 zoomBoxCB.addItemListener(this);
7641217
7651218 if (true) // Globals.ADVANCED)
7661219 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
1220
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1221
+// supportCB.setToolTipText("Enable rigging");
1222
+// supportCB.addItemListener(this);
1223
+
1224
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1225
+ freezeCB.setToolTipText("Fast moving camera");
1226
+ freezeCB.addItemListener(this);
7701227
7711228 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7721229 // localCB.addItemListener(this);
7731230
1231
+ panel.Return();
1232
+
7741233 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7751234 crowdCB.setToolTipText("Used for crowds");
7761235 crowdCB.addItemListener(this);
....@@ -779,14 +1238,19 @@
7791238 smoothCB.setToolTipText("Snapping delay");
7801239 smoothCB.addItemListener(this);
7811240
782
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
- slowCB.setToolTipText("Smooth interpolation");
784
- slowCB.addItemListener(this);
1241
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1242
+// slowCB.setToolTipText("Smooth interpolation");
1243
+// slowCB.addItemListener(this);
1244
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1245
+ minshaderCB.setToolTipText("Minimal fast shader");
1246
+ minshaderCB.addItemListener(this);
7851247
7861248 // constraints.gridy += 1;
7871249 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7881250 // speakerMocapCB.addItemListener(this);
7891251
1252
+ panel.Return();
1253
+
7901254 if (false)
7911255 {
7921256 // handled in scripts
....@@ -801,24 +1265,39 @@
8011265 //constraints.gridy += 1;
8021266 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8031267 smoothfocusCB.addItemListener(this);
1268
+ panel.Return();
8041269 }
8051270
8061271 //constraints.gridx += 1;
8071272 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8081273 // debugCB.addItemListener(this);
8091274
1275
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1276
+ trackCB.setToolTipText("Enable tracking target");
1277
+ trackCB.addItemListener(this);
1278
+
8101279 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
- oeilCB.setToolTipText("Move camera when tracking target");
1280
+ oeilCB.setToolTipText("Move camera when tracking");
8121281 oeilCB.addItemListener(this);
8131282
8141283 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
- shadowCB.setToolTipText("Compute shadows when live");
1284
+ shadowCB.setToolTipText("When live compute shadows");
8161285 shadowCB.addItemListener(this);
8171286
818
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
819
- autosaveCB.setToolTipText("Auto-save on structure change");
820
- autosaveCB.addItemListener(this);
1287
+ panel.Return();
1288
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1289
+ toggleTextureCB.setToolTipText("Load textures");
1290
+ toggleTextureCB.addItemListener(this);
1291
+
1292
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1293
+ toggleSwitchCB.setToolTipText("Choose a single item");
1294
+ toggleSwitchCB.addItemListener(this);
1295
+
1296
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1297
+ autokeepCB.setToolTipText("On structure change");
1298
+ autokeepCB.addItemListener(this);
8211299
1300
+ panel.Return();
8221301 if (Globals.ADVANCED)
8231302 {
8241303 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -829,10 +1308,15 @@
8291308 }
8301309
8311310 cGridBag fill = new cGridBag();
832
-
8331311 fill.preferredHeight = 200;
1312
+ cGridBag fill2 = new cGridBag();
1313
+ fill2.preferredHeight = 200;
1314
+ cGridBag fill3 = new cGridBag();
1315
+ fill3.preferredHeight = 200;
8341316
8351317 panel.add(fill);
1318
+ panel.add(fill2);
1319
+ panel.add(fill3);
8361320
8371321 }
8381322
....@@ -840,7 +1324,7 @@
8401324 {
8411325 cRadio radioButton = new cRadio(obj.name);
8421326
843
- // Patch to avoid bug with transparency.
1327
+ // June 2019. Patch to avoid bug with transparency.
8441328 radioButton.hadMaterial = obj.material != null;
8451329 if (!radioButton.hadMaterial)
8461330 {
....@@ -848,7 +1332,7 @@
8481332 }
8491333
8501334 radioButton.SetObject(obj);
851
- radioButton.layout = sevenButton;
1335
+ radioButton.layout = threeButton; // sixButton;
8521336 radioButton.SetCamera(cameraView.renderCamera, false);
8531337 radioButton.addActionListener(this);
8541338 radioPanel.add(radioButton);
....@@ -868,15 +1352,19 @@
8681352 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8691353 }
8701354
871
- cCheckBox liveCB;
1355
+ cToggleButton liveCB;
8721356 cCheckBox supportCB;
8731357 cCheckBox localCB;
8741358 cCheckBox crowdCB;
8751359 cCheckBox smoothCB;
876
- cCheckBox fastCB;
1360
+ cCheckBox minshaderCB;
1361
+
1362
+ cToggleButton fastCB;
8771363 cCheckBox slowCB;
8781364 cCheckBox boxCB;
8791365 cCheckBox zoomBoxCB;
1366
+ cCheckBox freezeCB;
1367
+ //cToggleButton trackCB;
8801368 cCheckBox trackCB;
8811369 cCheckBox smoothfocusCB;
8821370 // JCheckBox speakerMocapCB;
....@@ -886,7 +1374,7 @@
8861374
8871375 cCheckBox oeilCB;
8881376 cCheckBox shadowCB;
889
- cCheckBox autosaveCB;
1377
+ cCheckBox autokeepCB;
8901378 cCheckBox lookAtCB;
8911379
8921380 // static int COLOR = 1;
....@@ -942,6 +1430,12 @@
9421430 cameraView.ToggleInertia();
9431431 cameraView.repaint();
9441432 }
1433
+ else if(e.getSource() == minshaderCB)
1434
+ {
1435
+ Globals.MINSHADER ^= true;
1436
+ cameraView.programInitialized = false;
1437
+ cameraView.repaint();
1438
+ }
9451439 else if(e.getSource() == localCB)
9461440 {
9471441 cameraView.ToggleLocal();
....@@ -994,9 +1488,13 @@
9941488 {
9951489 Globals.COMPUTESHADOWWHENLIVE ^= true;
9961490 }
997
- else if(e.getSource() == autosaveCB)
1491
+ else if(e.getSource() == freezeCB)
9981492 {
999
- Globals.SAVEONMAKE ^= true;
1493
+ Globals.FREEZEONMOVE ^= true;
1494
+ }
1495
+ else if(e.getSource() == autokeepCB)
1496
+ {
1497
+ Globals.REPLACEONMAKE ^= true;
10001498 }
10011499 else if(e.getSource() == lookAtCB)
10021500 {
....@@ -1014,7 +1512,8 @@
10141512
10151513 /**/
10161514 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1017
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1515
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1516
+ TreePath path = objEditor.jTree.getSelectionPath();
10181517 if ((path == null) || (path.getPathCount() <= 1)) {
10191518 // We can't move the root node or an empty selection
10201519 return;
....@@ -1077,8 +1576,6 @@
10771576 }
10781577 }
10791578
1080
- String string = (String) object;
1081
-
10821579 System.out.println("Transfer = " + object + "; drop : " + target);
10831580 // if( object instanceof java.io.File[])
10841581 // {
....@@ -1086,6 +1583,8 @@
10861583 // objEditor.DropFile((java.io.File[]) object, true);
10871584 // return;
10881585 // }
1586
+
1587
+ String string = object.toString();
10891588
10901589 // File path for Mac and Windows
10911590 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1131,23 +1630,33 @@
11311630
11321631 assert target == objEditor.jTree;
11331632 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1633
+ Object3D destinationLeaf;
11341634 try {
1135
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1635
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11361636 } catch (Exception e) {
11371637 System.out.println("destinationPath : " + destinationPath);
11381638 return;
11391639 }
11401640
1141
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1641
+ for (int i=group.selection.size(); --i>=0;)
11421642 {
1643
+ Object3D child = (Object3D)group.selection.elementAt(i);
1644
+
1645
+ // Cannot move into itself
1646
+ if (child == destinationLeaf)
1647
+ return;
1648
+ }
1649
+
1650
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1651
+// {
11431652 loadClipboard(true);
11441653 objEditor.jTree.setSelectionPath(destinationPath);
11451654 pasteInto(false, false);
1146
- } else {
1147
- loadClipboard(false);
1148
- objEditor.jTree.setSelectionPath(destinationPath);
1149
- pasteInto(false, false); // true); // ???
1150
- }
1655
+// } else {
1656
+// loadClipboard(false);
1657
+// objEditor.jTree.setSelectionPath(destinationPath);
1658
+// pasteInto(false, false); // true); // ???
1659
+// }
11511660 }
11521661 public void dropActionChanged(DropTargetDragEvent dtde)
11531662 // Called if the user has modified the current drop gesture
....@@ -1252,22 +1761,30 @@
12521761 {
12531762 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12541763 //heightFieldItem.addActionListener(this);
1255
- gridItem = menu.add(new MenuItem("Grid"));
1256
- gridItem.addActionListener(this);
1257
- rectoidItem = menu.add(new MenuItem("Box"));
1258
- rectoidItem.addActionListener(this);
1259
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1260
- ellipsoidItem.addActionListener(this);
1261
- coneItem = menu.add(new MenuItem("Cone"));
1262
- coneItem.addActionListener(this);
1263
- torusItem = menu.add(new MenuItem("Torus"));
1264
- torusItem.addActionListener(this);
1265
- superItem = menu.add(new MenuItem("Superellipsoid"));
1266
- superItem.addActionListener(this);
1764
+// gridItem = menu.add(new MenuItem("Grid"));
1765
+// gridItem.addActionListener(this);
1766
+// rectoidItem = menu.add(new MenuItem("Box"));
1767
+// rectoidItem.addActionListener(this);
1768
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1769
+// ellipsoidItem.addActionListener(this);
1770
+// coneItem = menu.add(new MenuItem("Cone"));
1771
+// coneItem.addActionListener(this);
1772
+// torusItem = menu.add(new MenuItem("Torus"));
1773
+// torusItem.addActionListener(this);
1774
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1775
+// superItem.addActionListener(this);
1776
+
1777
+ cameraItem = menu.add(new MenuItem("Camera"));
1778
+ cameraItem.addActionListener(this);
1779
+
1780
+ if (!Globals.ADVANCED)
1781
+ {
12671782 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12681783 kleinItem.addActionListener(this);
1269
- particleItem = menu.add(new MenuItem("Particle system"));
1270
- particleItem.addActionListener(this);
1784
+ }
1785
+
1786
+// particleItem = menu.add(new MenuItem("Particle system"));
1787
+// particleItem.addActionListener(this);
12711788 if (Globals.ADVANCED)
12721789 {
12731790 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1293,15 +1810,15 @@
12931810 }
12941811 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12951812 bezierItem.addActionListener(this);
1296
- overlayItem = menu.add(new MenuItem("Overlay"));
1297
- overlayItem.addActionListener(this);
1298
- lightItem = menu.add(new MenuItem("Light"));
1299
- lightItem.addActionListener(this);
1813
+// overlayItem = menu.add(new MenuItem("Overlay"));
1814
+// overlayItem.addActionListener(this);
1815
+// lightItem = menu.add(new MenuItem("Light"));
1816
+// lightItem.addActionListener(this);
13001817 menu.add("-");
13011818 //superLoopItem = menu.add(new MenuItem("Super Loop"));
13021819 //superLoopItem.addActionListener(this);
1303
- loopItem = menu.add(new MenuItem("Loop"));
1304
- loopItem.addActionListener(this);
1820
+// loopItem = menu.add(new MenuItem("Loop"));
1821
+// loopItem.addActionListener(this);
13051822 doubleItem = menu.add(new MenuItem("Fork"));
13061823 doubleItem.addActionListener(this);
13071824 if (Globals.ADVANCED)
....@@ -1317,6 +1834,9 @@
13171834 animationItem.addItemListener(this);
13181835 animationItem.setState(Globals.ANIMATION);
13191836
1837
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1838
+ archiveItem.addActionListener(this);
1839
+
13201840 menu.add("-");
13211841 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
13221842 parseverticesItem.addActionListener(this);
....@@ -1329,6 +1849,8 @@
13291849 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13301850 reduce34MorphItem.addActionListener(this);
13311851 menu.add("-");
1852
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1853
+ memoryItem.addActionListener(this);
13321854 menu.add(computeAOItem = new MenuItem("Compute AO"));
13331855 computeAOItem.addActionListener(this);
13341856
....@@ -1337,8 +1859,6 @@
13371859 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13381860 mirrorItem.addActionListener(this);
13391861 menu.add("-");
1340
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1341
- memoryItem.addActionListener(this);
13421862 menu.add(analyzeItem = new MenuItem("Analyze"));
13431863 analyzeItem.addActionListener(this);
13441864 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1486,6 +2006,30 @@
14862006
14872007 makeSomething(shadow);
14882008 }
2009
+
2010
+ private void ClearUnpinned()
2011
+ {
2012
+ //for (Object3D obj : listUI)
2013
+ for (int i=listUI.size(); --i>=0;)
2014
+ {
2015
+ Object3D obj = listUI.elementAt(i);
2016
+ if (!obj.pinned)
2017
+ {
2018
+ obj.CloseUI();
2019
+ listUI.remove(i);
2020
+ }
2021
+ }
2022
+ }
2023
+
2024
+ private void EditElement(Object3D elem, boolean newWindow)
2025
+ {
2026
+ // if (!(elem instanceof Composite))
2027
+ // newWindow = false;
2028
+ listUI.add(elem);
2029
+ elem.openEditWindow(this, newWindow); //, false);
2030
+ System.out.println("edit : " + elem);
2031
+ elem.editWindow.refreshContents(true); // ? new
2032
+ }
14892033
14902034 /**
14912035 * applyExample
....@@ -1730,7 +2274,7 @@
17302274 {
17312275 ScreenFit();
17322276 } else
1733
- if (source == switchItem)
2277
+ if (source == switchViewItem)
17342278 {
17352279 cVector v1 = new cVector();
17362280 cVector v2 = new cVector();
....@@ -1739,11 +2283,11 @@
17392283 objEditor.cameraView.renderCamera.setAim(v2, v1);
17402284 objEditor.cameraView.repaint();
17412285 } else
1742
- if (source == rectoidItem)
2286
+ if (source == rectoidItem || source == boxButton)
17432287 {
17442288 makeSomething(new Box());
17452289 } else
1746
- if (source == particleItem)
2290
+ if (source == particleItem || source == particlesButton)
17472291 {
17482292 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17492293 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1822,27 +2366,27 @@
18222366
18232367 makeSomething(obj);
18242368 } else
1825
- if (source == gridItem)
2369
+ if (source == gridItem || source == gridButton)
18262370 {
18272371 makeSomething(new Grid());
18282372 } else
1829
- if (source == ellipsoidItem)
2373
+ if (source == ellipsoidItem || source == sphereButton)
18302374 {
18312375 makeSomething(new Sphere());
18322376 } else
1833
- if (source == coneItem)
2377
+ if (source == coneItem || source == coneButton)
18342378 {
18352379 makeSomething(new Cone());
18362380 } else
1837
- if (source == torusItem)
2381
+ if (source == torusItem || source == torusButton)
18382382 {
18392383 makeSomething(new Torus());
18402384 } else
1841
- if (source == superItem)
2385
+ if (source == superItem || source == superButton)
18422386 {
18432387 makeSomething(new Superellipsoid());
18442388 } else
1845
- if (source == kleinItem)
2389
+ if (source == kleinItem || source == kleinButton)
18462390 {
18472391 makeSomething(new Klein());
18482392 } else
....@@ -1862,7 +2406,7 @@
18622406 {
18632407 makeSomething(new BezierSurface());
18642408 } else
1865
- if (source == overlayItem)
2409
+ if (source == overlayItem || source == overlayButton)
18662410 {
18672411 /*
18682412 Object3D obj = new BezierSurface(5,8);
....@@ -1910,10 +2454,27 @@
19102454 s.setup();
19112455 makeSomething(s);
19122456 } else
1913
- if (source == lightItem)
2457
+ if (source == lightItem || source == lightButton)
19142458 {
19152459 makeSomething(new Light());
19162460 } else
2461
+// if (source == skybox1Button ||
2462
+// source == skybox2Button ||
2463
+// source == skybox3Button ||
2464
+// source == skybox4Button ||
2465
+// source == skybox5Button ||
2466
+// source == skybox6Button ||
2467
+// source == skybox7Button ||
2468
+// source == skybox11Button ||
2469
+// source == skybox12Button ||
2470
+// source == skybox13Button ||
2471
+// source == skybox14Button ||
2472
+// source == skybox15Button ||
2473
+// source == skybox16Button ||
2474
+// source == skybox17Button)
2475
+// {
2476
+// ChangeSkybox(source);
2477
+// } else
19172478 if (source == csgItem)
19182479 {
19192480 group(new CSG());
....@@ -1960,30 +2521,30 @@
19602521
19612522 group(g);
19622523 } else
1963
- if (source == loopItem)
2524
+ if (source == loopItem || source == loopButton)
19642525 {
19652526 Composite csg = new GroupLeaf();
19662527 csg.count = 5;
19672528 group(csg);
1968
- Composite child = new cGroup();
2529
+ Composite child = new cGroup("Branch");
19692530 csg.addChild(child);
19702531 child.addChild(csg);
19712532 } else
19722533 if (source == doubleItem)
19732534 {
1974
- Composite csg = new GroupLeaf();
2535
+ Composite csg = new GroupLeaf("Fork");
19752536 csg.count = 5;
19762537 group(csg);
1977
- Composite child = new cGroup();
2538
+ Composite child = new cGroup("Branch A");
19782539 csg.addChild(child);
19792540 child.addChild(csg);
1980
- child = new cGroup();
2541
+ child = new cGroup("Branch B");
19812542 csg.addChild(child);
19822543 child.addChild(csg);
19832544 } else
19842545 if (source == tripleItem)
19852546 {
1986
- Composite csg = new GroupLeaf();
2547
+ Composite csg = new GroupLeaf("Trident");
19872548 csg.count = 4;
19882549 group(csg);
19892550 Composite child = new cGroup();
....@@ -1999,7 +2560,7 @@
19992560 if (source == computeAOItem)
20002561 {
20012562 Globals.drawMode = CameraPane.OCCLUSION;
2002
- Globals.theRenderer.repaint();
2563
+ cameraView.repaint();
20032564 } else
20042565 if (source == recompileItem)
20052566 {
....@@ -2014,7 +2575,7 @@
20142575 if (source == invariantsItem)
20152576 {
20162577 System.out.println("Invariants:");
2017
- Grafreed.grafreeD.universe.invariants();
2578
+ Grafreed.grafreed.universe.invariants();
20182579 } else
20192580 if (source == memoryItem)
20202581 {
....@@ -2045,17 +2606,40 @@
20452606 {
20462607 ToggleFullScreen();
20472608 } else
2048
- if (source == undoButton)
2609
+ if (source == previousVersionButton)
20492610 {
2050
- Undo();
2611
+ // Go to previous version
2612
+ //if (!Undo())
2613
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2614
+ PreviousVersion();
20512615 } else
2052
- if (source == redoButton)
2616
+ if (source == restoreButton)
20532617 {
2054
- Redo();
2618
+ // Restore current version
2619
+ Restore();
2620
+ //restoreButton.setEnabled(false);
20552621 } else
2056
- if (source == saveButton)
2622
+ if (source == replaceButton)
20572623 {
2058
- Save();
2624
+ // Overwrite current version
2625
+ Replace();
2626
+ //replaceButton.setEnabled(false);
2627
+ } else
2628
+ if (source == nextVersionButton)
2629
+ {
2630
+ // Go to next version
2631
+ NextVersion();
2632
+ } else
2633
+ if (source == saveVersionButton)
2634
+ {
2635
+ // Save a new version
2636
+ if (!Save(true))
2637
+ java.awt.Toolkit.getDefaultToolkit().beep();
2638
+ } else
2639
+ if (source == deleteVersionButton)
2640
+ {
2641
+ // Delete a new version
2642
+ DeleteVersion();
20592643 } else
20602644 if (source == oneStepButton)
20612645 {
....@@ -2064,17 +2648,14 @@
20642648 } else
20652649 if (source == screenfitButton)
20662650 {
2067
- //Reload(lastConverter, lastFilename, true);
20682651 ScreenFit();
20692652 } else
20702653 if (source == screenfitpointButton)
20712654 {
2072
- //Reload(lastConverter, lastFilename, true);
20732655 ScreenFitPoint();
20742656 } else
20752657 if (source == snapobjectButton)
20762658 {
2077
- //Reload(lastConverter, lastFilename, true);
20782659 SnapObject();
20792660 } else
20802661 // if (event.getSource() == recompileButton)
....@@ -2113,11 +2694,11 @@
21132694 } else
21142695 if (source == undoItem)
21152696 {
2116
- Undo();
2697
+ PreviousVersion();
21172698 } else
21182699 if (source == redoItem)
21192700 {
2120
- Redo();
2701
+ NextVersion();
21212702 } else
21222703 if (source == duplicateItem)
21232704 {
....@@ -2438,7 +3019,7 @@
24383019 {
24393020 StepAll();
24403021 } else
2441
- if (source == clearItem) // || event.getSource() == clearButton)
3022
+ if (source == deleteItem) // || event.getSource() == clearButton)
24423023 {
24433024 //int indices[] = jList.getSelectedIndices();
24443025 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2450,9 +3031,9 @@
24503031 {
24513032 ClearSelection(true);
24523033 } else
2453
- if (source == grabItem)
3034
+ if (source == grabItem || source == groupButton)
24543035 {
2455
- group(new cGroup(), true);
3036
+ group(new cGroup(), false); // true);
24563037 } else
24573038 if (source == hideItem)
24583039 {
....@@ -2470,11 +3051,11 @@
24703051 {
24713052 makeSomething(new Camera());
24723053 } else
2473
- if (source == compositeItem)
3054
+ if (source == compositeItem || source == compositeButton)
24743055 {
24753056 group(new Composite());
24763057 } else
2477
- if (source == randomItem)
3058
+ if (source == switchItem || source == switchButton)
24783059 {
24793060 RandomNode random = new RandomNode();
24803061 group(random);
....@@ -2576,7 +3157,7 @@
25763157 {
25773158 group(new cLinker());
25783159 } else
2579
- if (source == textureItem)
3160
+ if (source == textureItem || source == textureButton)
25803161 {
25813162 group(new TextureNode());
25823163 } else
....@@ -2596,17 +3177,30 @@
25963177 {
25973178 CastShadow(2);
25983179 } else
2599
- if (source == ungroupItem)
3180
+ if (source == ungroupItem || source == ungroupButton)
26003181 {
2601
- //ungroup();
3182
+ boolean hasRoot = false;
3183
+
26023184 for (int i=0; i<group.selection.size(); i++)
26033185 {
2604
- Ungroup(group.selection.get(i));
3186
+ if (group.selection.get(i) == group)
3187
+ {
3188
+ hasRoot = true;
3189
+ break;
3190
+ }
26053191 }
26063192
2607
- ClearSelection(false);
2608
-
2609
- refreshContents();
3193
+ if (!hasRoot)
3194
+ {
3195
+ for (int i=0; i<group.selection.size(); i++)
3196
+ {
3197
+ Ungroup(group.selection.get(i));
3198
+ }
3199
+
3200
+ ClearSelection(false);
3201
+
3202
+ refreshContents();
3203
+ }
26103204 } else
26113205 if (source == genUVItem)
26123206 {
....@@ -2907,7 +3501,7 @@
29073501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
29083502 {
29093503 obj = (Object3D)e.nextElement();
2910
- obj.SetBumpTexture(null);
3504
+ obj.ResetBumpTexture();
29113505 }
29123506
29133507 refreshContents();
....@@ -2923,6 +3517,31 @@
29233517
29243518 refreshContents();
29253519 } else
3520
+ if (source == embedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(true);
3527
+ }
3528
+
3529
+ refreshContents();
3530
+ } else
3531
+ if (source == deEmbedTexturesItem)
3532
+ {
3533
+ Object3D obj;
3534
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3535
+ {
3536
+ obj = (Object3D)e.nextElement();
3537
+ obj.EmbedTextures(false);
3538
+ }
3539
+
3540
+ CameraPane.texturepigment.clear();
3541
+ CameraPane.texturebump.clear();
3542
+
3543
+ refreshContents();
3544
+ } else
29263545 if (source == flashSelectionButton)
29273546 {
29283547 CameraPane.flash = true;
....@@ -2934,6 +3553,10 @@
29343553 if (source == twoButton)
29353554 {
29363555 radio.layout = twoButton;
3556
+
3557
+ if (CameraPane.FULLSCREEN)
3558
+ fullscreenLayout = radio.layout;
3559
+
29373560 // bug
29383561 //gridPanel.setDividerLocation(1.0);
29393562 //bigPanel.setDividerLocation(0.0);
....@@ -2989,6 +3612,9 @@
29893612 {
29903613 radio.layout = threeButton;
29913614
3615
+ if (CameraPane.FULLSCREEN)
3616
+ fullscreenLayout = radio.layout;
3617
+
29923618 // bigThree.remove(scenePanel);
29933619 // bigThree.remove(centralPanel);
29943620 // bigThree.remove(XYZPanel);
....@@ -3017,8 +3643,8 @@
30173643 // centralPanel.setVisible(true);
30183644 // XYZPanel.setVisible(true);
30193645 bigThree.ClearUI();
3646
+ bigThree.add(scenePanel);
30203647 bigThree.add(centralPanel);
3021
- bigThree.add(XYZPanel);
30223648 bigThree.FlushUI();
30233649
30243650 cameraView.requestFocusInWindow();
....@@ -3026,6 +3652,9 @@
30263652 if (source == fourButton)
30273653 {
30283654 radio.layout = fourButton;
3655
+
3656
+ if (CameraPane.FULLSCREEN)
3657
+ fullscreenLayout = radio.layout;
30293658
30303659 // bigThree.remove(scenePanel);
30313660 // bigThree.remove(centralPanel);
....@@ -3064,6 +3693,9 @@
30643693 {
30653694 radio.layout = sixButton;
30663695
3696
+ if (CameraPane.FULLSCREEN)
3697
+ fullscreenLayout = radio.layout;
3698
+
30673699 // bigThree.remove(scenePanel);
30683700 // bigThree.remove(centralPanel);
30693701 // bigThree.remove(XYZPanel);
....@@ -3092,8 +3724,8 @@
30923724 // centralPanel.setVisible(true);
30933725 // XYZPanel.setVisible(false);
30943726 bigThree.ClearUI();
3095
- bigThree.add(scenePanel);
30963727 bigThree.add(centralPanel);
3728
+ bigThree.add(scenePanel);
30973729 bigThree.FlushUI();
30983730
30993731 cameraView.requestFocusInWindow();
....@@ -3101,6 +3733,9 @@
31013733 if (source == sevenButton)
31023734 {
31033735 radio.layout = sevenButton;
3736
+
3737
+ if (CameraPane.FULLSCREEN)
3738
+ fullscreenLayout = radio.layout;
31043739
31053740 // bigThree.remove(scenePanel);
31063741 // bigThree.remove(centralPanel);
....@@ -3182,6 +3817,12 @@
31823817 } else
31833818 if (source == editItem || source == editButton)
31843819 {
3820
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3821
+ {
3822
+ Object3D child = (Object3D)e.nextElement();
3823
+ child.pinned = true;
3824
+ }
3825
+
31853826 EditSelection(false);
31863827 } else
31873828 if (source == uneditButton)
....@@ -3190,9 +3831,10 @@
31903831 {
31913832 Object3D child = (Object3D)e.nextElement();
31923833 if(child.editWindow != null)
3193
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3834
+ child.pinned = false;
31943835 child.CloseUI();
31953836 listUI.remove(child);
3837
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31963838
31973839 //child.editWindow = null; // ???????????
31983840 }
....@@ -3207,16 +3849,18 @@
32073849 //copy.ClearUI();
32083850 for (Object3D obj : listUI)
32093851 {
3852
+ obj.pinned = false;
32103853 obj.CloseUI();
32113854 }
32123855 listUI.clear();
3856
+ SetPinStates(group.selection.size() > 0);
32133857 refreshContents(true);
32143858 } else
32153859 if (source == allParamsButton)
32163860 {
32173861 assert(copy == group);
32183862
3219
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3863
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
32203864
32213865 for (Object3D obj : listUI)
32223866 {
....@@ -3265,6 +3909,9 @@
32653909 }
32663910
32673911 copy = group;
3912
+
3913
+ SetUndoStates();
3914
+
32683915 //Globals.theRenderer.object = group;
32693916 if(!useclient)
32703917 {
....@@ -3291,6 +3938,14 @@
32913938 currentLayout = sevenButton;
32923939 */
32933940 radio.layout.doClick();
3941
+
3942
+ ClearUnpinned();
3943
+
3944
+ //Grafreed.Assert(group != null);
3945
+ //Grafreed.Assert(group.selection != null);
3946
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3947
+ if (group.selection == null || group.selection.size() == 1)
3948
+ EditSelection(false);
32943949 keepparent = group.parent;
32953950 // PARENT = NULL or not???
32963951 //group.parent = null; // ROOT
....@@ -3302,11 +3957,13 @@
33023957 } else if (event.getSource() == editCameraItem)
33033958 {
33043959 cameraView.ProtectCamera();
3960
+ cameraView.requestFocusInWindow();
33053961 cameraView.repaint();
33063962 return;
3307
- } else if (event.getSource() == revertCameraItem)
3963
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
33083964 {
33093965 cameraView.RevertCamera();
3966
+ cameraView.requestFocusInWindow();
33103967 cameraView.repaint();
33113968 return;
33123969 // } else if (event.getSource() == textureButton)
....@@ -3883,7 +4540,7 @@
38834540
38844541 try
38854542 {
3886
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4543
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38874544 }
38884545 catch (Exception e)
38894546 {
....@@ -4358,28 +5015,25 @@
43585015 // }
43595016 // }
43605017
4361
- static boolean allparams = true;
4362
-
4363
- static Vector<Object3D> listUI = new Vector<Object3D>();
4364
-
43655018 void EditSelection(boolean newWindow)
43665019 {
5020
+ if (group.selection == null)
5021
+ {
5022
+ EditElement(group, newWindow); // ? new
5023
+ return;
5024
+ }
5025
+
43675026 // aConstraints.gridy = 0;
43685027 for (int i=0; i<group.selection.size(); i++)
43695028 {
43705029 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43715030 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4372
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5031
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43735032
43745033 Object3D elem = (Object3D)group.selection.elementAt(i);
43755034 if(elem != group || !newWindow)
43765035 {
4377
- // if (!(elem instanceof Composite))
4378
- // newWindow = false;
4379
- listUI.add(elem);
4380
- elem.openEditWindow(this, newWindow); //, false);
4381
- System.out.println("edit : " + elem);
4382
- elem.editWindow.refreshContents(true); // ? new
5036
+ EditElement(elem, newWindow); // ? new
43835037 }
43845038 }
43855039 }
....@@ -4442,9 +5096,7 @@
44425096
44435097 freezemodel = false;
44445098 }
4445
-
4446
- boolean flashIt = true;
4447
-
5099
+
44485100 public void valueChanged(TreeSelectionEvent e)
44495101 //public boolean handleEvent(Event event)
44505102 {
....@@ -4454,7 +5106,8 @@
44545106 //new Exception().printStackTrace();
44555107
44565108 freezemodel = true;
4457
-
5109
+ ClearUnpinned();
5110
+
44585111 /**/
44595112 //switch (event.id)
44605113 {
....@@ -4487,7 +5140,7 @@
44875140 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44885141 // a camera
44895142 {
4490
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5143
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44915144 {
44925145 CameraPane.camerachangeframe = 0; // don't refuse it
44935146 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4496,6 +5149,13 @@
44965149 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44975150 }
44985151
5152
+ if (tps != null && tps.length == 1)
5153
+ {
5154
+ EditSelection(false);
5155
+ }
5156
+
5157
+ SetPinStates(tps != null && tps.length > 0);
5158
+
44995159 refreshContents();
45005160 //return true;
45015161 }
....@@ -4505,9 +5165,20 @@
45055165 freezemodel = false;
45065166 }
45075167
5168
+ void SetPinStates(boolean enabled)
5169
+ {
5170
+ editButton.setEnabled(enabled);
5171
+ uneditButton.setEnabled(enabled);
5172
+ unselectButton.setEnabled(enabled);
5173
+ flashSelectionButton.setEnabled(enabled);
5174
+
5175
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5176
+ }
5177
+
45085178 void refreshContents(boolean cp)
45095179 {
4510
- if (!Globals.MOUSEDRAGGED)
5180
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5181
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
45115182 {
45125183 objEditor.ClearInfo(); // .GetMaterial());
45135184
....@@ -4606,8 +5277,8 @@
46065277
46075278 if (cut)
46085279 {
4609
- if (Globals.SAVEONMAKE)
4610
- Save();
5280
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5281
+// Save();
46115282 //int indices[] = jList.getSelectedIndices();
46125283 //for (int i = indices.length - 1; i >= 0; i--)
46135284 //jList.remove(indices[i]);
....@@ -4710,6 +5381,10 @@
47105381
47115382 void paste(boolean expand)
47125383 {
5384
+ if (Globals.REPLACEONMAKE)
5385
+ Save();
5386
+ boolean keep = Globals.REPLACEONMAKE;
5387
+ Globals.REPLACEONMAKE = false;
47135388 // if (GrafreeD.clipboard == null)
47145389 // return;
47155390 boolean first = true;
....@@ -4769,6 +5444,7 @@
47695444 Grafreed.clipboard.get(0).parent = keepparent;
47705445 }
47715446
5447
+ Globals.REPLACEONMAKE = keep;
47725448 ResetModel();
47735449 refreshContents();
47745450 }
....@@ -4904,6 +5580,10 @@
49045580
49055581 void group(Object3D csg, boolean grab)
49065582 {
5583
+ if (Globals.REPLACEONMAKE)
5584
+ Save();
5585
+ boolean keep = Globals.REPLACEONMAKE;
5586
+ Globals.REPLACEONMAKE = false;
49075587 if (//false) // why??
49085588 !group.selection.isEmpty())
49095589 {
....@@ -5017,10 +5697,15 @@
50175697 //node.add(csg);
50185698 //makeSomething(node);
50195699 makeSomething(csg);
5700
+ Globals.REPLACEONMAKE = keep;
50205701 }
50215702
50225703 void Ungroup(Object3D g)
50235704 {
5705
+ if (Globals.REPLACEONMAKE)
5706
+ Save();
5707
+ boolean keep = Globals.REPLACEONMAKE;
5708
+ Globals.REPLACEONMAKE = false;
50245709 if (g instanceof HiddenObject)
50255710 {
50265711 HiddenObject h = (HiddenObject) g;
....@@ -5037,6 +5722,7 @@
50375722 objEditor.makeSomething(g.get(i), false);
50385723 }
50395724 }
5725
+ Globals.REPLACEONMAKE = keep;
50405726 }
50415727
50425728 void ungroup()
....@@ -5325,13 +6011,43 @@
53256011 cButton clearpanelButton;
53266012 cButton unselectButton;
53276013
5328
- cButton minButton;
5329
- cButton maxButton;
5330
- cButton fullButton;
5331
- cButton undoButton;
5332
- cButton redoButton;
5333
- cButton saveButton;
6014
+ cButton restoreCameraButton;
6015
+
53346016 cButton oneStepButton;
6017
+
6018
+ cButton groupButton;
6019
+ cButton ungroupButton;
6020
+ cButton compositeButton;
6021
+ cButton switchButton;
6022
+ cButton loopButton;
6023
+ cButton textureButton;
6024
+
6025
+ cButton skybox1Button;
6026
+ cButton skybox2Button;
6027
+ cButton skybox3Button;
6028
+ cButton skybox4Button;
6029
+ cButton skybox5Button;
6030
+ cButton skybox6Button;
6031
+ cButton skybox7Button;
6032
+
6033
+ cButton skybox11Button;
6034
+ cButton skybox12Button;
6035
+ cButton skybox13Button;
6036
+ cButton skybox14Button;
6037
+ cButton skybox15Button;
6038
+ cButton skybox16Button;
6039
+ cButton skybox17Button;
6040
+
6041
+ cButton gridButton;
6042
+ cButton boxButton;
6043
+ cButton sphereButton;
6044
+ cButton coneButton;
6045
+ cButton torusButton;
6046
+ cButton superButton;
6047
+ cButton kleinButton;
6048
+ cButton particlesButton;
6049
+ cButton overlayButton;
6050
+ cButton lightButton;
53356051
53366052 cButton screenfitButton;
53376053 cButton screenfitpointButton;
....@@ -5353,11 +6069,11 @@
53536069 //JTree jTree;
53546070 private MenuItem lookAtItem;
53556071 private MenuItem lookFromItem;
5356
- private MenuItem switchItem;
6072
+ private MenuItem switchViewItem;
53576073 private MenuItem cutItem;
53586074 private MenuItem undoItem;
53596075 private MenuItem redoItem;
5360
- private MenuItem duplicateItem;
6076
+ private JMenuItem duplicateItem;
53616077 private MenuItem cloneItem;
53626078 private MenuItem cloneSupportItem;
53636079 private MenuItem overwriteGeoItem;
....@@ -5385,7 +6101,7 @@
53856101 private MenuItem pasteLinkItem;
53866102 private MenuItem pasteCloneItem;
53876103 private MenuItem pasteExpandItem;
5388
- private MenuItem clearItem;
6104
+ private MenuItem deleteItem;
53896105 private MenuItem clearAllItem;
53906106 private MenuItem genUVItem;
53916107 private MenuItem genNormalsMESHItem;
....@@ -5445,7 +6161,7 @@
54456161 private MenuItem frontItem;
54466162 private MenuItem cameraItem;
54476163 private MenuItem compositeItem;
5448
- private MenuItem randomItem;
6164
+ private MenuItem switchItem;
54496165 private MenuItem physicsItem;
54506166 private MenuItem frameselectorItem;
54516167 private MenuItem scriptNodeItem;
....@@ -5469,6 +6185,8 @@
54696185 private MenuItem attachBumpItem;
54706186 private MenuItem detachBumpItem;
54716187 private MenuItem pigmentBumpItem;
6188
+ private MenuItem embedTexturesItem;
6189
+ private MenuItem deEmbedTexturesItem;
54726190
54736191 private MenuItem particleItem;
54746192 private MenuItem ragdollItem;
....@@ -5519,5 +6237,5 @@
55196237
55206238 Menu cameraMenu;
55216239 MenuItem editCameraItem;
5522
- MenuItem revertCameraItem;
6240
+ MenuItem restoreCameraItem;
55236241 }