Normand Briere
2019-08-01 7d02eaffc02895a01d95d8fd7e089044449e1d6d
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.versions == null)
360
+ {
361
+ copy.versions = new byte[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.versions == null)
387
+ {
388
+ copy.versions = new byte[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,79 @@
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 = new cButton("\u271A", !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
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
922
+ 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 = new cButton("\u21a9", !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 = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
- redoButton.setToolTipText("Redo changes");
597
- redoButton.addActionListener(this);
598
-
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- saveButton.setToolTipText("Save changes");
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("Duplicate current version");
601936 saveButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ undoButton.setToolTipText("Previous version");
940
+ undoButton.addActionListener(this);
941
+ undoButton.setEnabled(false);
602942
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
943
+ cGridBag updown = new cGridBag().setVertical(true);
944
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+ restoreButton.setToolTipText("Restore current version (undo latest change)");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Replace current version (save latest change)");
951
+ replaceButton.addActionListener(this);
952
+ replaceButton.setEnabled(false);
953
+
954
+ copyOptionsPanel.add(updown);
955
+
956
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
+ redoButton.setToolTipText("Next version");
958
+ redoButton.addActionListener(this);
959
+ redoButton.setEnabled(false);
960
+
961
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604962 liveCB.setToolTipText("Enable animation");
605963 liveCB.addItemListener(this);
606964
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
965
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608966 oneStepButton.setToolTipText("Animate one step forward");
609967 oneStepButton.addActionListener(this);
610968
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
969
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612970 fastCB.setToolTipText("Fast mode");
613971 fastCB.addItemListener(this);
614972
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);
973
+ //oe.toolboxPanel.Return();
974
+
975
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
976
+// trackCB.setToolTipText("Enable tracking");
977
+// trackCB.addItemListener(this);
622978
623979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
624980 // screenfitpointButton.addActionListener(this);
....@@ -628,51 +984,137 @@
628984 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629985 snapobjectButton.addActionListener(this);
630986 snapobjectButton.setToolTipText("Snap Object");
987
+
988
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ fourButton.addActionListener(this);
990
+ fourButton.setToolTipText("Show control panel only");
631991 }
632992
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
635
- flashSelectionButton.addActionListener(this);
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
636994
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");
995
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
+ twoButton.setToolTipText("Show 3D view only");
641997 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");
998
+ this.fullscreenLayout = twoButton;
999
+
1000
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1001
+ threeButton.setToolTipText("Show controls and 3D view");
6501002 threeButton.addActionListener(this);
651
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- sevenButton.setToolTipText("3-column layout");
653
- sevenButton.addActionListener(this);
1003
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1004
+ sixButton.setToolTipText("Show 3D view and controls");
1005
+ sixButton.addActionListener(this);
1006
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+// sevenButton.setToolTipText("3-column layout");
1008
+// sevenButton.addActionListener(this);
6541009 //
6551010
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- rootButton.setToolTipText("Edit selection in new tab");
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
6581013 rootButton.addActionListener(this);
6591014
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6611016 closeButton.setToolTipText("Close tab");
6621017 closeButton.addActionListener(this);
6631018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6641019 //clearButton.addActionListener(this);
665
-
666
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667
- editButton.setToolTipText("Edit selection");
1020
+
1021
+ cGridBag row1 = new cGridBag();
1022
+
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
6681110 editButton.addActionListener(this);
6691111
670
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- uneditButton.setToolTipText("Unedit selection");
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
6721114 uneditButton.addActionListener(this);
6731115
6741116 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
675
- allParamsButton.setToolTipText("Edit all params");
1117
+ allParamsButton.setToolTipText("Show all controle");
6761118 allParamsButton.addActionListener(this);
6771119
6781120 editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -683,8 +1125,13 @@
6831125 unselectButton.setToolTipText("Unselect");
6841126 unselectButton.addActionListener(this);
6851127
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
1131
+
6861132 editCommandsPanel.preferredHeight = 1;
6871133
1134
+ SetPinStates(false);
6881135 // oe.treePanel.add(commandsPanel);
6891136 // oe.treePanel.Return();
6901137
....@@ -703,32 +1150,20 @@
7031150
7041151 JScrollPane jSP;
7051152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
7071154 ResetModel();
7081155
7091156 oe.treePanel.add(jSPPanel);
7101157 oe.treePanel.Return();
7111158
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;
7271159 oe.treePanel.add(copyOptionsPanel);
7281160 oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
7291164
730
-// mainPanel.setDividerLocation(0.5); //1.0);
731
-// mainPanel.setResizeWeight(0.5);
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
7321167
7331168 //jList.addListSelectionListener(this);
7341169 oe.jTree.addTreeSelectionListener(this);
....@@ -736,7 +1171,7 @@
7361171 //jTree.setEditable(true);
7371172 oe.jTree.setDragEnabled(true);
7381173 //jTree.setPreferredSize(new Dimension(10,10));
739
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
7401175
7411176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7421177
....@@ -748,29 +1183,49 @@
7481183 dgr.addDragGestureListener(this);
7491184 }catch(Exception e) {}
7501185 */
751
- radio.layout = sevenButton;
1186
+ radio.layout = threeButton; // sixButton;
7521187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7531188 }
7541189
7551190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7561191 {
1192
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1193
+ colorCB.setToolTipText("Copy color when dropped");
1194
+ colorCB.addItemListener(this);
1195
+
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
7571206 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7581207 boxCB.setToolTipText("Display bounding boxes");
7591208 boxCB.addItemListener(this);
7601209
7611210 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
762
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
7631212 zoomBoxCB.addItemListener(this);
7641213
7651214 if (true) // Globals.ADVANCED)
7661215 {
767
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
768
- supportCB.setToolTipText("Enable rigging");
769
- supportCB.addItemListener(this);
1216
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1217
+// supportCB.setToolTipText("Enable rigging");
1218
+// supportCB.addItemListener(this);
1219
+
1220
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1221
+ freezeCB.setToolTipText("Fast moving camera");
1222
+ freezeCB.addItemListener(this);
7701223
7711224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7721225 // localCB.addItemListener(this);
7731226
1227
+ panel.Return();
1228
+
7741229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7751230 crowdCB.setToolTipText("Used for crowds");
7761231 crowdCB.addItemListener(this);
....@@ -779,14 +1234,19 @@
7791234 smoothCB.setToolTipText("Snapping delay");
7801235 smoothCB.addItemListener(this);
7811236
782
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
783
- slowCB.setToolTipText("Smooth interpolation");
784
- slowCB.addItemListener(this);
1237
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
+// slowCB.setToolTipText("Smooth interpolation");
1239
+// slowCB.addItemListener(this);
1240
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1241
+ minshaderCB.setToolTipText("Minimal fast shader");
1242
+ minshaderCB.addItemListener(this);
7851243
7861244 // constraints.gridy += 1;
7871245 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7881246 // speakerMocapCB.addItemListener(this);
7891247
1248
+ panel.Return();
1249
+
7901250 if (false)
7911251 {
7921252 // handled in scripts
....@@ -801,34 +1261,74 @@
8011261 //constraints.gridy += 1;
8021262 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8031263 smoothfocusCB.addItemListener(this);
1264
+ panel.Return();
8041265 }
8051266
8061267 //constraints.gridx += 1;
8071268 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8081269 // debugCB.addItemListener(this);
8091270
1271
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1272
+ trackCB.setToolTipText("Enable tracking target");
1273
+ trackCB.addItemListener(this);
1274
+
8101275 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1276
+ oeilCB.setToolTipText("Move camera when tracking");
8111277 oeilCB.addItemListener(this);
8121278
1279
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1280
+ shadowCB.setToolTipText("When live compute shadows");
1281
+ shadowCB.addItemListener(this);
1282
+
1283
+ panel.Return();
1284
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1285
+ toggleTextureCB.setToolTipText("Load textures");
1286
+ toggleTextureCB.addItemListener(this);
1287
+
1288
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1289
+ toggleSwitchCB.setToolTipText("Choose a single item");
1290
+ toggleSwitchCB.addItemListener(this);
1291
+
1292
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1293
+ autokeepCB.setToolTipText("On structure change");
1294
+ autokeepCB.addItemListener(this);
1295
+
1296
+ panel.Return();
1297
+ if (Globals.ADVANCED)
1298
+ {
8131299 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
8141300 lookAtCB.setToolTipText("Look-at target");
8151301 lookAtCB.addItemListener(this);
1302
+ }
8161303
8171304 }
8181305
8191306 cGridBag fill = new cGridBag();
820
-
8211307 fill.preferredHeight = 200;
1308
+ cGridBag fill2 = new cGridBag();
1309
+ fill2.preferredHeight = 200;
1310
+ cGridBag fill3 = new cGridBag();
1311
+ fill3.preferredHeight = 200;
8221312
8231313 panel.add(fill);
1314
+ panel.add(fill2);
1315
+ panel.add(fill3);
8241316
8251317 }
8261318
8271319 void EditObject(Object3D obj)
8281320 {
8291321 cRadio radioButton = new cRadio(obj.name);
1322
+
1323
+ // June 2019. Patch to avoid bug with transparency.
1324
+ radioButton.hadMaterial = obj.material != null;
1325
+ if (!radioButton.hadMaterial)
1326
+ {
1327
+ obj.material = new cMaterial();
1328
+ }
1329
+
8301330 radioButton.SetObject(obj);
831
- radioButton.layout = sevenButton;
1331
+ radioButton.layout = threeButton; // sixButton;
8321332 radioButton.SetCamera(cameraView.renderCamera, false);
8331333 radioButton.addActionListener(this);
8341334 radioPanel.add(radioButton);
....@@ -848,23 +1348,30 @@
8481348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8491349 }
8501350
851
- JCheckBox liveCB;
852
- JCheckBox supportCB;
853
- JCheckBox localCB;
854
- JCheckBox crowdCB;
855
- JCheckBox smoothCB;
856
- JCheckBox fastCB;
857
- JCheckBox slowCB;
858
- JCheckBox boxCB;
859
- JCheckBox zoomBoxCB;
860
- JCheckBox trackCB;
861
- JCheckBox smoothfocusCB;
1351
+ cToggleButton liveCB;
1352
+ cCheckBox supportCB;
1353
+ cCheckBox localCB;
1354
+ cCheckBox crowdCB;
1355
+ cCheckBox smoothCB;
1356
+ cCheckBox minshaderCB;
1357
+
1358
+ cToggleButton fastCB;
1359
+ cCheckBox slowCB;
1360
+ cCheckBox boxCB;
1361
+ cCheckBox zoomBoxCB;
1362
+ cCheckBox freezeCB;
1363
+ //cToggleButton trackCB;
1364
+ cCheckBox trackCB;
1365
+ cCheckBox smoothfocusCB;
8621366 // JCheckBox speakerMocapCB;
863
- JCheckBox speakerCameraCB;
864
- JCheckBox speakerFocusCB;
865
- JCheckBox debugCB;
866
- JCheckBox oeilCB;
867
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
8681375
8691376 // static int COLOR = 1;
8701377 // static int MATERIAL = 2;
....@@ -872,9 +1379,9 @@
8721379
8731380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8741381
875
- JCheckBox colorCB;
876
- JCheckBox materialCB;
877
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
8781385
8791386 public void itemStateChanged(ItemEvent e)
8801387 {
....@@ -918,6 +1425,12 @@
9181425 {
9191426 cameraView.ToggleInertia();
9201427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
9211434 }
9221435 else if(e.getSource() == localCB)
9231436 {
....@@ -967,6 +1480,18 @@
9671480 {
9681481 cameraView.ToggleOeil();
9691482 }
1483
+ else if(e.getSource() == shadowCB)
1484
+ {
1485
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1486
+ }
1487
+ else if(e.getSource() == freezeCB)
1488
+ {
1489
+ Globals.FREEZEONMOVE ^= true;
1490
+ }
1491
+ else if(e.getSource() == autokeepCB)
1492
+ {
1493
+ Globals.REPLACEONMAKE ^= true;
1494
+ }
9701495 else if(e.getSource() == lookAtCB)
9711496 {
9721497 cameraView.ToggleLookAt();
....@@ -983,7 +1508,8 @@
9831508
9841509 /**/
9851510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
986
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
9871513 if ((path == null) || (path.getPathCount() <= 1)) {
9881514 // We can't move the root node or an empty selection
9891515 return;
....@@ -1046,8 +1572,6 @@
10461572 }
10471573 }
10481574
1049
- String string = (String) object;
1050
-
10511575 System.out.println("Transfer = " + object + "; drop : " + target);
10521576 // if( object instanceof java.io.File[])
10531577 // {
....@@ -1055,6 +1579,8 @@
10551579 // objEditor.DropFile((java.io.File[]) object, true);
10561580 // return;
10571581 // }
1582
+
1583
+ String string = object.toString();
10581584
10591585 // File path for Mac and Windows
10601586 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1100,23 +1626,33 @@
11001626
11011627 assert target == objEditor.jTree;
11021628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
11031630 try {
1104
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11051632 } catch (Exception e) {
11061633 System.out.println("destinationPath : " + destinationPath);
11071634 return;
11081635 }
11091636
1110
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
11111638 {
1639
+ Object3D child = (Object3D)group.selection.elementAt(i);
1640
+
1641
+ // Cannot move into itself
1642
+ if (child == destinationLeaf)
1643
+ return;
1644
+ }
1645
+
1646
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1647
+// {
11121648 loadClipboard(true);
11131649 objEditor.jTree.setSelectionPath(destinationPath);
11141650 pasteInto(false, false);
1115
- } else {
1116
- loadClipboard(false);
1117
- objEditor.jTree.setSelectionPath(destinationPath);
1118
- pasteInto(false, false); // true); // ???
1119
- }
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
11201656 }
11211657 public void dropActionChanged(DropTargetDragEvent dtde)
11221658 // Called if the user has modified the current drop gesture
....@@ -1221,22 +1757,30 @@
12211757 {
12221758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12231759 //heightFieldItem.addActionListener(this);
1224
- gridItem = menu.add(new MenuItem("Grid"));
1225
- gridItem.addActionListener(this);
1226
- rectoidItem = menu.add(new MenuItem("Box"));
1227
- rectoidItem.addActionListener(this);
1228
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1229
- ellipsoidItem.addActionListener(this);
1230
- coneItem = menu.add(new MenuItem("Cone"));
1231
- coneItem.addActionListener(this);
1232
- torusItem = menu.add(new MenuItem("Torus"));
1233
- torusItem.addActionListener(this);
1234
- superItem = menu.add(new MenuItem("Superellipsoid"));
1235
- superItem.addActionListener(this);
1760
+// gridItem = menu.add(new MenuItem("Grid"));
1761
+// gridItem.addActionListener(this);
1762
+// rectoidItem = menu.add(new MenuItem("Box"));
1763
+// rectoidItem.addActionListener(this);
1764
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1765
+// ellipsoidItem.addActionListener(this);
1766
+// coneItem = menu.add(new MenuItem("Cone"));
1767
+// coneItem.addActionListener(this);
1768
+// torusItem = menu.add(new MenuItem("Torus"));
1769
+// torusItem.addActionListener(this);
1770
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1771
+// superItem.addActionListener(this);
1772
+
1773
+ cameraItem = menu.add(new MenuItem("Camera"));
1774
+ cameraItem.addActionListener(this);
1775
+
1776
+ if (!Globals.ADVANCED)
1777
+ {
12361778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12371779 kleinItem.addActionListener(this);
1238
- particleItem = menu.add(new MenuItem("Particle system"));
1239
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
12401784 if (Globals.ADVANCED)
12411785 {
12421786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1262,15 +1806,15 @@
12621806 }
12631807 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12641808 bezierItem.addActionListener(this);
1265
- overlayItem = menu.add(new MenuItem("Overlay"));
1266
- overlayItem.addActionListener(this);
1267
- lightItem = menu.add(new MenuItem("Light"));
1268
- lightItem.addActionListener(this);
1809
+// overlayItem = menu.add(new MenuItem("Overlay"));
1810
+// overlayItem.addActionListener(this);
1811
+// lightItem = menu.add(new MenuItem("Light"));
1812
+// lightItem.addActionListener(this);
12691813 menu.add("-");
12701814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12711815 //superLoopItem.addActionListener(this);
1272
- loopItem = menu.add(new MenuItem("Loop"));
1273
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
12741818 doubleItem = menu.add(new MenuItem("Fork"));
12751819 doubleItem.addActionListener(this);
12761820 if (Globals.ADVANCED)
....@@ -1286,6 +1830,9 @@
12861830 animationItem.addItemListener(this);
12871831 animationItem.setState(Globals.ANIMATION);
12881832
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
1835
+
12891836 menu.add("-");
12901837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12911838 parseverticesItem.addActionListener(this);
....@@ -1298,6 +1845,8 @@
12981845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12991846 reduce34MorphItem.addActionListener(this);
13001847 menu.add("-");
1848
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1849
+ memoryItem.addActionListener(this);
13011850 menu.add(computeAOItem = new MenuItem("Compute AO"));
13021851 computeAOItem.addActionListener(this);
13031852
....@@ -1306,8 +1855,6 @@
13061855 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13071856 mirrorItem.addActionListener(this);
13081857 menu.add("-");
1309
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1310
- memoryItem.addActionListener(this);
13111858 menu.add(analyzeItem = new MenuItem("Analyze"));
13121859 analyzeItem.addActionListener(this);
13131860 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1455,6 +2002,30 @@
14552002
14562003 makeSomething(shadow);
14572004 }
2005
+
2006
+ private void ClearUnpinned()
2007
+ {
2008
+ //for (Object3D obj : listUI)
2009
+ for (int i=listUI.size(); --i>=0;)
2010
+ {
2011
+ Object3D obj = listUI.elementAt(i);
2012
+ if (!obj.pinned)
2013
+ {
2014
+ obj.CloseUI();
2015
+ listUI.remove(i);
2016
+ }
2017
+ }
2018
+ }
2019
+
2020
+ private void EditElement(Object3D elem, boolean newWindow)
2021
+ {
2022
+ // if (!(elem instanceof Composite))
2023
+ // newWindow = false;
2024
+ listUI.add(elem);
2025
+ elem.openEditWindow(this, newWindow); //, false);
2026
+ System.out.println("edit : " + elem);
2027
+ elem.editWindow.refreshContents(true); // ? new
2028
+ }
14582029
14592030 /**
14602031 * applyExample
....@@ -1699,7 +2270,7 @@
16992270 {
17002271 ScreenFit();
17012272 } else
1702
- if (source == switchItem)
2273
+ if (source == switchViewItem)
17032274 {
17042275 cVector v1 = new cVector();
17052276 cVector v2 = new cVector();
....@@ -1708,11 +2279,11 @@
17082279 objEditor.cameraView.renderCamera.setAim(v2, v1);
17092280 objEditor.cameraView.repaint();
17102281 } else
1711
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
17122283 {
17132284 makeSomething(new Box());
17142285 } else
1715
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
17162287 {
17172288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17182289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1791,27 +2362,27 @@
17912362
17922363 makeSomething(obj);
17932364 } else
1794
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
17952366 {
17962367 makeSomething(new Grid());
17972368 } else
1798
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
17992370 {
18002371 makeSomething(new Sphere());
18012372 } else
1802
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
18032374 {
18042375 makeSomething(new Cone());
18052376 } else
1806
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
18072378 {
18082379 makeSomething(new Torus());
18092380 } else
1810
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
18112382 {
18122383 makeSomething(new Superellipsoid());
18132384 } else
1814
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
18152386 {
18162387 makeSomething(new Klein());
18172388 } else
....@@ -1831,7 +2402,7 @@
18312402 {
18322403 makeSomething(new BezierSurface());
18332404 } else
1834
- if (source == overlayItem)
2405
+ if (source == overlayItem || source == overlayButton)
18352406 {
18362407 /*
18372408 Object3D obj = new BezierSurface(5,8);
....@@ -1879,10 +2450,27 @@
18792450 s.setup();
18802451 makeSomething(s);
18812452 } else
1882
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
18832454 {
18842455 makeSomething(new Light());
18852456 } else
2457
+// if (source == skybox1Button ||
2458
+// source == skybox2Button ||
2459
+// source == skybox3Button ||
2460
+// source == skybox4Button ||
2461
+// source == skybox5Button ||
2462
+// source == skybox6Button ||
2463
+// source == skybox7Button ||
2464
+// source == skybox11Button ||
2465
+// source == skybox12Button ||
2466
+// source == skybox13Button ||
2467
+// source == skybox14Button ||
2468
+// source == skybox15Button ||
2469
+// source == skybox16Button ||
2470
+// source == skybox17Button)
2471
+// {
2472
+// ChangeSkybox(source);
2473
+// } else
18862474 if (source == csgItem)
18872475 {
18882476 group(new CSG());
....@@ -1929,30 +2517,30 @@
19292517
19302518 group(g);
19312519 } else
1932
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
19332521 {
19342522 Composite csg = new GroupLeaf();
19352523 csg.count = 5;
19362524 group(csg);
1937
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
19382526 csg.addChild(child);
19392527 child.addChild(csg);
19402528 } else
19412529 if (source == doubleItem)
19422530 {
1943
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
19442532 csg.count = 5;
19452533 group(csg);
1946
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
19472535 csg.addChild(child);
19482536 child.addChild(csg);
1949
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
19502538 csg.addChild(child);
19512539 child.addChild(csg);
19522540 } else
19532541 if (source == tripleItem)
19542542 {
1955
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
19562544 csg.count = 4;
19572545 group(csg);
19582546 Composite child = new cGroup();
....@@ -1968,7 +2556,7 @@
19682556 if (source == computeAOItem)
19692557 {
19702558 Globals.drawMode = CameraPane.OCCLUSION;
1971
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
19722560 } else
19732561 if (source == recompileItem)
19742562 {
....@@ -2016,15 +2604,31 @@
20162604 } else
20172605 if (source == undoButton)
20182606 {
2607
+ // Go to previous version
2608
+ //if (!Undo())
2609
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20192610 Undo();
2611
+ } else
2612
+ if (source == restoreButton)
2613
+ {
2614
+ // Restore current version
2615
+ Restore();
2616
+ } else
2617
+ if (source == replaceButton)
2618
+ {
2619
+ // Overwrite current version
2620
+ Replace();
20202621 } else
20212622 if (source == redoButton)
20222623 {
2624
+ // Go to next version
20232625 Redo();
20242626 } else
20252627 if (source == saveButton)
20262628 {
2027
- Save();
2629
+ // Save a new version
2630
+ if (!Save(true))
2631
+ java.awt.Toolkit.getDefaultToolkit().beep();
20282632 } else
20292633 if (source == oneStepButton)
20302634 {
....@@ -2033,17 +2637,14 @@
20332637 } else
20342638 if (source == screenfitButton)
20352639 {
2036
- //Reload(lastConverter, lastFilename, true);
20372640 ScreenFit();
20382641 } else
20392642 if (source == screenfitpointButton)
20402643 {
2041
- //Reload(lastConverter, lastFilename, true);
20422644 ScreenFitPoint();
20432645 } else
20442646 if (source == snapobjectButton)
20452647 {
2046
- //Reload(lastConverter, lastFilename, true);
20472648 SnapObject();
20482649 } else
20492650 // if (event.getSource() == recompileButton)
....@@ -2407,7 +3008,7 @@
24073008 {
24083009 StepAll();
24093010 } else
2410
- if (source == clearItem) // || event.getSource() == clearButton)
3011
+ if (source == deleteItem) // || event.getSource() == clearButton)
24113012 {
24123013 //int indices[] = jList.getSelectedIndices();
24133014 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2419,9 +3020,9 @@
24193020 {
24203021 ClearSelection(true);
24213022 } else
2422
- if (source == grabItem)
3023
+ if (source == grabItem || source == groupButton)
24233024 {
2424
- group(new cGroup(), true);
3025
+ group(new cGroup(), false); // true);
24253026 } else
24263027 if (source == hideItem)
24273028 {
....@@ -2439,11 +3040,11 @@
24393040 {
24403041 makeSomething(new Camera());
24413042 } else
2442
- if (source == compositeItem)
3043
+ if (source == compositeItem || source == compositeButton)
24433044 {
24443045 group(new Composite());
24453046 } else
2446
- if (source == randomItem)
3047
+ if (source == switchItem || source == switchButton)
24473048 {
24483049 RandomNode random = new RandomNode();
24493050 group(random);
....@@ -2545,7 +3146,7 @@
25453146 {
25463147 group(new cLinker());
25473148 } else
2548
- if (source == textureItem)
3149
+ if (source == textureItem || source == textureButton)
25493150 {
25503151 group(new TextureNode());
25513152 } else
....@@ -2565,17 +3166,30 @@
25653166 {
25663167 CastShadow(2);
25673168 } else
2568
- if (source == ungroupItem)
3169
+ if (source == ungroupItem || source == ungroupButton)
25693170 {
2570
- //ungroup();
3171
+ boolean hasRoot = false;
3172
+
25713173 for (int i=0; i<group.selection.size(); i++)
25723174 {
2573
- Ungroup(group.selection.get(i));
3175
+ if (group.selection.get(i) == group)
3176
+ {
3177
+ hasRoot = true;
3178
+ break;
3179
+ }
25743180 }
25753181
2576
- ClearSelection(false);
2577
-
2578
- refreshContents();
3182
+ if (!hasRoot)
3183
+ {
3184
+ for (int i=0; i<group.selection.size(); i++)
3185
+ {
3186
+ Ungroup(group.selection.get(i));
3187
+ }
3188
+
3189
+ ClearSelection(false);
3190
+
3191
+ refreshContents();
3192
+ }
25793193 } else
25803194 if (source == genUVItem)
25813195 {
....@@ -2876,7 +3490,7 @@
28763490 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28773491 {
28783492 obj = (Object3D)e.nextElement();
2879
- obj.SetBumpTexture(null);
3493
+ obj.ResetBumpTexture();
28803494 }
28813495
28823496 refreshContents();
....@@ -2892,6 +3506,31 @@
28923506
28933507 refreshContents();
28943508 } else
3509
+ if (source == embedTexturesItem)
3510
+ {
3511
+ Object3D obj;
3512
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3513
+ {
3514
+ obj = (Object3D)e.nextElement();
3515
+ obj.EmbedTextures(true);
3516
+ }
3517
+
3518
+ refreshContents();
3519
+ } else
3520
+ if (source == deEmbedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(false);
3527
+ }
3528
+
3529
+ CameraPane.texturepigment.clear();
3530
+ CameraPane.texturebump.clear();
3531
+
3532
+ refreshContents();
3533
+ } else
28953534 if (source == flashSelectionButton)
28963535 {
28973536 CameraPane.flash = true;
....@@ -2903,6 +3542,10 @@
29033542 if (source == twoButton)
29043543 {
29053544 radio.layout = twoButton;
3545
+
3546
+ if (CameraPane.FULLSCREEN)
3547
+ fullscreenLayout = radio.layout;
3548
+
29063549 // bug
29073550 //gridPanel.setDividerLocation(1.0);
29083551 //bigPanel.setDividerLocation(0.0);
....@@ -2958,6 +3601,9 @@
29583601 {
29593602 radio.layout = threeButton;
29603603
3604
+ if (CameraPane.FULLSCREEN)
3605
+ fullscreenLayout = radio.layout;
3606
+
29613607 // bigThree.remove(scenePanel);
29623608 // bigThree.remove(centralPanel);
29633609 // bigThree.remove(XYZPanel);
....@@ -2986,8 +3632,8 @@
29863632 // centralPanel.setVisible(true);
29873633 // XYZPanel.setVisible(true);
29883634 bigThree.ClearUI();
3635
+ bigThree.add(scenePanel);
29893636 bigThree.add(centralPanel);
2990
- bigThree.add(XYZPanel);
29913637 bigThree.FlushUI();
29923638
29933639 cameraView.requestFocusInWindow();
....@@ -2995,6 +3641,9 @@
29953641 if (source == fourButton)
29963642 {
29973643 radio.layout = fourButton;
3644
+
3645
+ if (CameraPane.FULLSCREEN)
3646
+ fullscreenLayout = radio.layout;
29983647
29993648 // bigThree.remove(scenePanel);
30003649 // bigThree.remove(centralPanel);
....@@ -3033,6 +3682,9 @@
30333682 {
30343683 radio.layout = sixButton;
30353684
3685
+ if (CameraPane.FULLSCREEN)
3686
+ fullscreenLayout = radio.layout;
3687
+
30363688 // bigThree.remove(scenePanel);
30373689 // bigThree.remove(centralPanel);
30383690 // bigThree.remove(XYZPanel);
....@@ -3061,8 +3713,8 @@
30613713 // centralPanel.setVisible(true);
30623714 // XYZPanel.setVisible(false);
30633715 bigThree.ClearUI();
3064
- bigThree.add(scenePanel);
30653716 bigThree.add(centralPanel);
3717
+ bigThree.add(scenePanel);
30663718 bigThree.FlushUI();
30673719
30683720 cameraView.requestFocusInWindow();
....@@ -3070,6 +3722,9 @@
30703722 if (source == sevenButton)
30713723 {
30723724 radio.layout = sevenButton;
3725
+
3726
+ if (CameraPane.FULLSCREEN)
3727
+ fullscreenLayout = radio.layout;
30733728
30743729 // bigThree.remove(scenePanel);
30753730 // bigThree.remove(centralPanel);
....@@ -3126,12 +3781,19 @@
31263781 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31273782 {
31283783 ab = (cRadio)e.nextElement();
3129
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3784
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31303785 {
3786
+ // Patch to avoid bug with transparency.
3787
+ if (!ab.hadMaterial)
3788
+ {
3789
+ ab.object.material = null;
3790
+ }
3791
+
31313792 buttonGroup.remove(ab);
31323793 radioPanel.remove(ab);
31333794
3134
- ab.GetObject().editWindow = null;
3795
+ //ab.GetObject().editWindow = null;
3796
+ ab.GetObject().manipWindow = null;
31353797 // ab.GetObject().objectUI = null; // ?????????
31363798
31373799 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3144,6 +3806,12 @@
31443806 } else
31453807 if (source == editItem || source == editButton)
31463808 {
3809
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3810
+ {
3811
+ Object3D child = (Object3D)e.nextElement();
3812
+ child.pinned = true;
3813
+ }
3814
+
31473815 EditSelection(false);
31483816 } else
31493817 if (source == uneditButton)
....@@ -3153,6 +3821,7 @@
31533821 Object3D child = (Object3D)e.nextElement();
31543822 if(child.editWindow != null)
31553823 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3824
+ child.pinned = false;
31563825 child.CloseUI();
31573826 listUI.remove(child);
31583827
....@@ -3169,6 +3838,7 @@
31693838 //copy.ClearUI();
31703839 for (Object3D obj : listUI)
31713840 {
3841
+ obj.pinned = false;
31723842 obj.CloseUI();
31733843 }
31743844 listUI.clear();
....@@ -3178,7 +3848,7 @@
31783848 {
31793849 assert(copy == group);
31803850
3181
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3851
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31823852
31833853 for (Object3D obj : listUI)
31843854 {
....@@ -3227,6 +3897,9 @@
32273897 }
32283898
32293899 copy = group;
3900
+
3901
+ SetUndoStates();
3902
+
32303903 //Globals.theRenderer.object = group;
32313904 if(!useclient)
32323905 {
....@@ -3245,6 +3918,7 @@
32453918
32463919 // fix "+" issue
32473920 //group.editWindow = this;
3921
+ group.manipWindow = this;
32483922
32493923 /*
32503924 currentLayout = radio.layout;
....@@ -3252,6 +3926,13 @@
32523926 currentLayout = sevenButton;
32533927 */
32543928 radio.layout.doClick();
3929
+
3930
+ ClearUnpinned();
3931
+ //Grafreed.Assert(group != null);
3932
+ //Grafreed.Assert(group.selection != null);
3933
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3934
+ if (group.selection == null || group.selection.size() == 1)
3935
+ EditSelection(false);
32553936 keepparent = group.parent;
32563937 // PARENT = NULL or not???
32573938 //group.parent = null; // ROOT
....@@ -3263,11 +3944,13 @@
32633944 } else if (event.getSource() == editCameraItem)
32643945 {
32653946 cameraView.ProtectCamera();
3947
+ cameraView.requestFocusInWindow();
32663948 cameraView.repaint();
32673949 return;
3268
- } else if (event.getSource() == revertCameraItem)
3950
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32693951 {
32703952 cameraView.RevertCamera();
3953
+ cameraView.requestFocusInWindow();
32713954 cameraView.repaint();
32723955 return;
32733956 // } else if (event.getSource() == textureButton)
....@@ -3844,7 +4527,7 @@
38444527
38454528 try
38464529 {
3847
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4530
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38484531 }
38494532 catch (Exception e)
38504533 {
....@@ -4319,28 +5002,25 @@
43195002 // }
43205003 // }
43215004
4322
- static boolean allparams = true;
4323
-
4324
- static Vector<Object3D> listUI = new Vector<Object3D>();
4325
-
43265005 void EditSelection(boolean newWindow)
43275006 {
5007
+ if (group.selection == null)
5008
+ {
5009
+ EditElement(group, newWindow); // ? new
5010
+ return;
5011
+ }
5012
+
43285013 // aConstraints.gridy = 0;
43295014 for (int i=0; i<group.selection.size(); i++)
43305015 {
43315016 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43325017 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4333
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5018
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43345019
43355020 Object3D elem = (Object3D)group.selection.elementAt(i);
43365021 if(elem != group || !newWindow)
43375022 {
4338
- // if (!(elem instanceof Composite))
4339
- // newWindow = false;
4340
- listUI.add(elem);
4341
- elem.openEditWindow(this, newWindow); //, false);
4342
- System.out.println("edit : " + elem);
4343
- elem.editWindow.refreshContents(true); // ? new
5023
+ EditElement(elem, newWindow); // ? new
43445024 }
43455025 }
43465026 }
....@@ -4415,7 +5095,8 @@
44155095 //new Exception().printStackTrace();
44165096
44175097 freezemodel = true;
4418
-
5098
+ ClearUnpinned();
5099
+
44195100 /**/
44205101 //switch (event.id)
44215102 {
....@@ -4448,7 +5129,7 @@
44485129 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44495130 // a camera
44505131 {
4451
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5132
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44525133 {
44535134 CameraPane.camerachangeframe = 0; // don't refuse it
44545135 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4457,6 +5138,13 @@
44575138 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44585139 }
44595140
5141
+ if (tps != null && tps.length == 1)
5142
+ {
5143
+ EditSelection(false);
5144
+ }
5145
+
5146
+ SetPinStates(tps != null && tps.length > 0);
5147
+
44605148 refreshContents();
44615149 //return true;
44625150 }
....@@ -4466,9 +5154,18 @@
44665154 freezemodel = false;
44675155 }
44685156
5157
+ void SetPinStates(boolean enabled)
5158
+ {
5159
+ editButton.setEnabled(enabled);
5160
+ uneditButton.setEnabled(enabled);
5161
+ unselectButton.setEnabled(enabled);
5162
+ flashSelectionButton.setEnabled(enabled);
5163
+ }
5164
+
44695165 void refreshContents(boolean cp)
44705166 {
4471
- if (!Globals.MOUSEDRAGGED)
5167
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5168
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44725169 {
44735170 objEditor.ClearInfo(); // .GetMaterial());
44745171
....@@ -4567,7 +5264,8 @@
45675264
45685265 if (cut)
45695266 {
4570
- Save();
5267
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5268
+// Save();
45715269 //int indices[] = jList.getSelectedIndices();
45725270 //for (int i = indices.length - 1; i >= 0; i--)
45735271 //jList.remove(indices[i]);
....@@ -4670,6 +5368,10 @@
46705368
46715369 void paste(boolean expand)
46725370 {
5371
+ if (Globals.REPLACEONMAKE)
5372
+ Save();
5373
+ boolean keep = Globals.REPLACEONMAKE;
5374
+ Globals.REPLACEONMAKE = false;
46735375 // if (GrafreeD.clipboard == null)
46745376 // return;
46755377 boolean first = true;
....@@ -4729,6 +5431,7 @@
47295431 Grafreed.clipboard.get(0).parent = keepparent;
47305432 }
47315433
5434
+ Globals.REPLACEONMAKE = keep;
47325435 ResetModel();
47335436 refreshContents();
47345437 }
....@@ -4864,6 +5567,10 @@
48645567
48655568 void group(Object3D csg, boolean grab)
48665569 {
5570
+ if (Globals.REPLACEONMAKE)
5571
+ Save();
5572
+ boolean keep = Globals.REPLACEONMAKE;
5573
+ Globals.REPLACEONMAKE = false;
48675574 if (//false) // why??
48685575 !group.selection.isEmpty())
48695576 {
....@@ -4977,10 +5684,15 @@
49775684 //node.add(csg);
49785685 //makeSomething(node);
49795686 makeSomething(csg);
5687
+ Globals.REPLACEONMAKE = keep;
49805688 }
49815689
49825690 void Ungroup(Object3D g)
49835691 {
5692
+ if (Globals.REPLACEONMAKE)
5693
+ Save();
5694
+ boolean keep = Globals.REPLACEONMAKE;
5695
+ Globals.REPLACEONMAKE = false;
49845696 if (g instanceof HiddenObject)
49855697 {
49865698 HiddenObject h = (HiddenObject) g;
....@@ -4997,6 +5709,7 @@
49975709 objEditor.makeSomething(g.get(i), false);
49985710 }
49995711 }
5712
+ Globals.REPLACEONMAKE = keep;
50005713 }
50015714
50025715 void ungroup()
....@@ -5285,13 +5998,44 @@
52855998 cButton clearpanelButton;
52865999 cButton unselectButton;
52876000
5288
- cButton minButton;
5289
- cButton maxButton;
5290
- cButton fullButton;
5291
- cButton undoButton;
5292
- cButton redoButton;
6001
+ cButton restoreCameraButton;
6002
+
52936003 cButton saveButton;
52946004 cButton oneStepButton;
6005
+
6006
+ cButton groupButton;
6007
+ cButton ungroupButton;
6008
+ cButton compositeButton;
6009
+ cButton switchButton;
6010
+ cButton loopButton;
6011
+ cButton textureButton;
6012
+
6013
+ cButton skybox1Button;
6014
+ cButton skybox2Button;
6015
+ cButton skybox3Button;
6016
+ cButton skybox4Button;
6017
+ cButton skybox5Button;
6018
+ cButton skybox6Button;
6019
+ cButton skybox7Button;
6020
+
6021
+ cButton skybox11Button;
6022
+ cButton skybox12Button;
6023
+ cButton skybox13Button;
6024
+ cButton skybox14Button;
6025
+ cButton skybox15Button;
6026
+ cButton skybox16Button;
6027
+ cButton skybox17Button;
6028
+
6029
+ cButton gridButton;
6030
+ cButton boxButton;
6031
+ cButton sphereButton;
6032
+ cButton coneButton;
6033
+ cButton torusButton;
6034
+ cButton superButton;
6035
+ cButton kleinButton;
6036
+ cButton particlesButton;
6037
+ cButton overlayButton;
6038
+ cButton lightButton;
52956039
52966040 cButton screenfitButton;
52976041 cButton screenfitpointButton;
....@@ -5313,11 +6057,11 @@
53136057 //JTree jTree;
53146058 private MenuItem lookAtItem;
53156059 private MenuItem lookFromItem;
5316
- private MenuItem switchItem;
6060
+ private MenuItem switchViewItem;
53176061 private MenuItem cutItem;
53186062 private MenuItem undoItem;
53196063 private MenuItem redoItem;
5320
- private MenuItem duplicateItem;
6064
+ private JMenuItem duplicateItem;
53216065 private MenuItem cloneItem;
53226066 private MenuItem cloneSupportItem;
53236067 private MenuItem overwriteGeoItem;
....@@ -5345,7 +6089,7 @@
53456089 private MenuItem pasteLinkItem;
53466090 private MenuItem pasteCloneItem;
53476091 private MenuItem pasteExpandItem;
5348
- private MenuItem clearItem;
6092
+ private MenuItem deleteItem;
53496093 private MenuItem clearAllItem;
53506094 private MenuItem genUVItem;
53516095 private MenuItem genNormalsMESHItem;
....@@ -5405,7 +6149,7 @@
54056149 private MenuItem frontItem;
54066150 private MenuItem cameraItem;
54076151 private MenuItem compositeItem;
5408
- private MenuItem randomItem;
6152
+ private MenuItem switchItem;
54096153 private MenuItem physicsItem;
54106154 private MenuItem frameselectorItem;
54116155 private MenuItem scriptNodeItem;
....@@ -5429,6 +6173,8 @@
54296173 private MenuItem attachBumpItem;
54306174 private MenuItem detachBumpItem;
54316175 private MenuItem pigmentBumpItem;
6176
+ private MenuItem embedTexturesItem;
6177
+ private MenuItem deEmbedTexturesItem;
54326178
54336179 private MenuItem particleItem;
54346180 private MenuItem ragdollItem;
....@@ -5479,5 +6225,5 @@
54796225
54806226 Menu cameraMenu;
54816227 MenuItem editCameraItem;
5482
- MenuItem revertCameraItem;
6228
+ MenuItem restoreCameraItem;
54836229 }