Normand Briere
2019-08-04 0c85af6e46f48b7425d59fc776b193c06a4a1f52
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);
....@@ -176,7 +493,6 @@
176493 copyItem.addActionListener(this);
177494 pasteItem = menu.add(new MenuItem("Paste"));
178495 pasteItem.addActionListener(this);
179
- menu.add("-");
180496
181497 menu.add("-");
182498 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +504,8 @@
188504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189505 // pasteExpandItem.addActionListener(this);
190506 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
193509
194510 if (Globals.ADVANCED)
195511 {
....@@ -203,23 +519,23 @@
203519 //zBufferItem.addActionListener(this);
204520 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205521 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
522
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
523
+ restoreCameraItem.addActionListener(this);
208524
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- 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);
213537
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
538
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223539 toggleHandleItem.addItemListener(this);
224540 toggleHandleItem.setState(CameraPane.HANDLES);
225541
....@@ -246,7 +562,7 @@
246562
247563 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248564 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
565
+ toggleDebugItem.setState(Globals.DEBUG);
250566
251567 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252568 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +590,7 @@
274590 {
275591 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276592 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
593
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278594 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279595 oe.cameraMenu.add("-");
280596 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +598,7 @@
282598 editLeafItem.addActionListener(this);
283599 lookAtItem.addActionListener(this);
284600 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
601
+ //switchViewItem.addActionListener(this);
286602 }
287603
288604 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +643,29 @@
327643 }
328644
329645 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
332648 backItem = menu.add(new MenuItem("Back"));
333649 backItem.addActionListener(this);
334650 frontItem = menu.add(new MenuItem("Front"));
335651 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
338657 hideItem = menu.add(new MenuItem("Hidden Group"));
339658 hideItem.addActionListener(this);
659
+ }
340660 ungroupItem = menu.add(new MenuItem("Ungroup"));
341661 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- 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
+ {
345669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346670 switchGeoItem.addActionListener(this);
347671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +673,6 @@
349673 morphItem = menu.add(new MenuItem("Morph Group"));
350674 morphItem.addActionListener(this);
351675
352
- if (Globals.ADVANCED)
353
- {
354676 menu.add("-");
355677 physicsItem = menu.add(new MenuItem("Physics"));
356678 physicsItem.addActionListener(this);
....@@ -358,30 +680,29 @@
358680 frameselectorItem.addActionListener(this);
359681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360682 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363683 }
364684
365685 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
368688 billboardItem = menu.add(new MenuItem("Billboard"));
369689 billboardItem.addActionListener(this);
370690 csgItem = menu.add(new MenuItem("CSG"));
371691 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373693 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375695 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
378701 if (Globals.ADVANCED)
379702 {
380703 menu.add("-");
381704 linkerItem = menu.add(new MenuItem("Linker"));
382705 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385706 templateItem = menu.add(new MenuItem("Template"));
386707 templateItem.addActionListener(this);
387708 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +731,7 @@
410731 genNormalsMESHItem.addActionListener(this);
411732 if (Globals.ADVANCED)
412733 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414735 genNormalsMINEItem.addActionListener(this);
415736 }
416737 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -503,10 +824,15 @@
503824 attachBumpItem.addActionListener(this);
504825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
505826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
506828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
507829 detachPigmentItem.addActionListener(this);
508830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
509831 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);
510836 menu.add("-");
511837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
512838 sortbysizeItem.addActionListener(this);
....@@ -533,8 +859,21 @@
533859 buildToolsMenu(menu);
534860 }
535861
862
+
536863 void SetupUI2(ObjEditor oe)
537864 {
865
+ // June 2019
866
+ if (oe == null)
867
+ {
868
+ //super.SetupUI2(this);
869
+ //return;
870
+ }
871
+
872
+ if (copy != group)
873
+ {
874
+ //super.SetupUI2(this);
875
+ }
876
+
538877 //new Exception().printStackTrace();
539878
540879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -563,39 +902,79 @@
563902 oe.radioPanel.add(dummyButton);
564903 oe.buttonGroup.add(dummyButton);
565904 */
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
908
+
566909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
567910
568
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- undoButton.setToolTipText("Undo changes");
570
- undoButton.addActionListener(this);
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
571914
572
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
- redoButton.setToolTipText("Redo changes");
574
- redoButton.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
+ }
575921
576
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
- saveButton.setToolTipText("Save changes");
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
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);
933
+
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("Duplicate current version");
578936 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);
579942
580
- 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("Undo (restore current version)");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Save (replace current version)");
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);
581962 liveCB.setToolTipText("Enable animation");
582963 liveCB.addItemListener(this);
583964
584
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
965
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585966 oneStepButton.setToolTipText("Animate one step forward");
586967 oneStepButton.addActionListener(this);
587968
588
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
969
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
589970 fastCB.setToolTipText("Fast mode");
590971 fastCB.addItemListener(this);
591972
592
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
593
- trackCB.setToolTipText("Enable tracking");
594
- trackCB.addItemListener(this);
595
-
596
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- screenfitButton.setToolTipText("Screen fit");
598
- 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);
599978
600979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
601980 // screenfitpointButton.addActionListener(this);
....@@ -605,67 +984,156 @@
605984 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606985 snapobjectButton.addActionListener(this);
607986 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");
608991 }
609992
610
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- flashSelectionButton.setToolTipText("Show selection");
612
- flashSelectionButton.addActionListener(this);
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
613994
614
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
615
-
616
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
- 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");
618997 twoButton.addActionListener(this);
619
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- fourButton.addActionListener(this);
621
- fourButton.setToolTipText("Show left panel only");
622
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
- sixButton.setToolTipText("2-column layout left");
624
- sixButton.addActionListener(this);
625
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- 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");
6271002 threeButton.addActionListener(this);
628
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- sevenButton.setToolTipText("3-column layout");
630
- 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);
6311009 //
6321010
633
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- 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");
6351013 rootButton.addActionListener(this);
6361014
637
- 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);
6381016 closeButton.setToolTipText("Close tab");
6391017 closeButton.addActionListener(this);
6401018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6411019 //clearButton.addActionListener(this);
642
-
643
- cGridBag commandsPanel = new cGridBag();
1020
+
1021
+ cGridBag row1 = new cGridBag();
6441022
645
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- editButton.setToolTipText("Edit selection");
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");
6471110 editButton.addActionListener(this);
6481111
649
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- uneditButton.setToolTipText("Unedit selection");
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Unpin and remove selection controls");
6511114 uneditButton.addActionListener(this);
6521115
653
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
654
- allParamsButton.setToolTipText("Edit all params");
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
6551118 allParamsButton.addActionListener(this);
6561119
657
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6581121 clearPanelButton.setToolTipText("Clear edit panel");
6591122 clearPanelButton.addActionListener(this);
6601123
661
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6621125 unselectButton.setToolTipText("Unselect");
6631126 unselectButton.addActionListener(this);
6641127
665
- commandsPanel.preferredHeight = 1;
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
6661131
667
- oe.treePanel.add(commandsPanel);
668
- oe.treePanel.Return();
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
6691137
6701138 // oe.aConstraints.gridx += 1;
6711139 // oe.aConstraints.weighty = 0;
....@@ -682,32 +1150,20 @@
6821150
6831151 JScrollPane jSP;
6841152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
685
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6861154 ResetModel();
6871155
6881156 oe.treePanel.add(jSPPanel);
6891157 oe.treePanel.Return();
6901158
691
- cGridBag copyOptionsPanel = new cGridBag();
692
-
693
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
694
- colorCB.setToolTipText("Copy color when dropped");
695
- colorCB.addItemListener(this);
696
-
697
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
698
- materialCB.setToolTipText("Copy material when dropped");
699
- materialCB.addItemListener(this);
700
-
701
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
702
- textureCB.setToolTipText("Copy texture when dropped");
703
- textureCB.addItemListener(this);
704
-
705
- copyOptionsPanel.preferredHeight = 1;
7061159 oe.treePanel.add(copyOptionsPanel);
7071160 oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
7081164
709
-// mainPanel.setDividerLocation(0.5); //1.0);
710
-// mainPanel.setResizeWeight(0.5);
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
7111167
7121168 //jList.addListSelectionListener(this);
7131169 oe.jTree.addTreeSelectionListener(this);
....@@ -715,7 +1171,7 @@
7151171 //jTree.setEditable(true);
7161172 oe.jTree.setDragEnabled(true);
7171173 //jTree.setPreferredSize(new Dimension(10,10));
718
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
7191175
7201176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7211177
....@@ -727,29 +1183,49 @@
7271183 dgr.addDragGestureListener(this);
7281184 }catch(Exception e) {}
7291185 */
730
- radio.layout = sevenButton;
1186
+ radio.layout = threeButton; // sixButton;
7311187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7321188 }
7331189
7341190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7351191 {
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
+
7361206 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7371207 boxCB.setToolTipText("Display bounding boxes");
7381208 boxCB.addItemListener(this);
7391209
7401210 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
741
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
7421212 zoomBoxCB.addItemListener(this);
7431213
7441214 if (true) // Globals.ADVANCED)
7451215 {
746
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
747
- supportCB.setToolTipText("Enable rigging");
748
- 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);
7491223
7501224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7511225 // localCB.addItemListener(this);
7521226
1227
+ panel.Return();
1228
+
7531229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7541230 crowdCB.setToolTipText("Used for crowds");
7551231 crowdCB.addItemListener(this);
....@@ -758,14 +1234,19 @@
7581234 smoothCB.setToolTipText("Snapping delay");
7591235 smoothCB.addItemListener(this);
7601236
761
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
762
- slowCB.setToolTipText("Smooth interpolation");
763
- 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);
7641243
7651244 // constraints.gridy += 1;
7661245 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7671246 // speakerMocapCB.addItemListener(this);
7681247
1248
+ panel.Return();
1249
+
7691250 if (false)
7701251 {
7711252 // handled in scripts
....@@ -780,34 +1261,74 @@
7801261 //constraints.gridy += 1;
7811262 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7821263 smoothfocusCB.addItemListener(this);
1264
+ panel.Return();
7831265 }
7841266
7851267 //constraints.gridx += 1;
7861268 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7871269 // debugCB.addItemListener(this);
7881270
1271
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1272
+ trackCB.setToolTipText("Enable tracking target");
1273
+ trackCB.addItemListener(this);
1274
+
7891275 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1276
+ oeilCB.setToolTipText("Move camera when tracking");
7901277 oeilCB.addItemListener(this);
7911278
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
+ {
7921299 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7931300 lookAtCB.setToolTipText("Look-at target");
7941301 lookAtCB.addItemListener(this);
1302
+ }
7951303
7961304 }
7971305
7981306 cGridBag fill = new cGridBag();
799
-
8001307 fill.preferredHeight = 200;
1308
+ cGridBag fill2 = new cGridBag();
1309
+ fill2.preferredHeight = 200;
1310
+ cGridBag fill3 = new cGridBag();
1311
+ fill3.preferredHeight = 200;
8011312
8021313 panel.add(fill);
1314
+ panel.add(fill2);
1315
+ panel.add(fill3);
8031316
8041317 }
8051318
8061319 void EditObject(Object3D obj)
8071320 {
8081321 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
+
8091330 radioButton.SetObject(obj);
810
- radioButton.layout = sevenButton;
1331
+ radioButton.layout = threeButton; // sixButton;
8111332 radioButton.SetCamera(cameraView.renderCamera, false);
8121333 radioButton.addActionListener(this);
8131334 radioPanel.add(radioButton);
....@@ -817,6 +1338,8 @@
8171338
8181339 void SetupViews(ObjEditor oe)
8191340 {
1341
+ theFrame = this;
1342
+
8201343 oe.SetupViews();
8211344
8221345 System.out.println("SetupViews");
....@@ -825,23 +1348,30 @@
8251348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8261349 }
8271350
828
- JCheckBox liveCB;
829
- JCheckBox supportCB;
830
- JCheckBox localCB;
831
- JCheckBox crowdCB;
832
- JCheckBox smoothCB;
833
- JCheckBox fastCB;
834
- JCheckBox slowCB;
835
- JCheckBox boxCB;
836
- JCheckBox zoomBoxCB;
837
- JCheckBox trackCB;
838
- 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;
8391366 // JCheckBox speakerMocapCB;
840
- JCheckBox speakerCameraCB;
841
- JCheckBox speakerFocusCB;
842
- JCheckBox debugCB;
843
- JCheckBox oeilCB;
844
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
8451375
8461376 // static int COLOR = 1;
8471377 // static int MATERIAL = 2;
....@@ -849,9 +1379,9 @@
8491379
8501380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8511381
852
- JCheckBox colorCB;
853
- JCheckBox materialCB;
854
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
8551385
8561386 public void itemStateChanged(ItemEvent e)
8571387 {
....@@ -895,6 +1425,12 @@
8951425 {
8961426 cameraView.ToggleInertia();
8971427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
8981434 }
8991435 else if(e.getSource() == localCB)
9001436 {
....@@ -944,6 +1480,18 @@
9441480 {
9451481 cameraView.ToggleOeil();
9461482 }
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
+ }
9471495 else if(e.getSource() == lookAtCB)
9481496 {
9491497 cameraView.ToggleLookAt();
....@@ -960,7 +1508,8 @@
9601508
9611509 /**/
9621510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
963
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
9641513 if ((path == null) || (path.getPathCount() <= 1)) {
9651514 // We can't move the root node or an empty selection
9661515 return;
....@@ -1023,8 +1572,6 @@
10231572 }
10241573 }
10251574
1026
- String string = (String) object;
1027
-
10281575 System.out.println("Transfer = " + object + "; drop : " + target);
10291576 // if( object instanceof java.io.File[])
10301577 // {
....@@ -1032,6 +1579,8 @@
10321579 // objEditor.DropFile((java.io.File[]) object, true);
10331580 // return;
10341581 // }
1582
+
1583
+ String string = object.toString();
10351584
10361585 // File path for Mac and Windows
10371586 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1077,23 +1626,33 @@
10771626
10781627 assert target == objEditor.jTree;
10791628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
10801630 try {
1081
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10821632 } catch (Exception e) {
10831633 System.out.println("destinationPath : " + destinationPath);
10841634 return;
10851635 }
10861636
1087
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
10881638 {
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
+// {
10891648 loadClipboard(true);
10901649 objEditor.jTree.setSelectionPath(destinationPath);
10911650 pasteInto(false, false);
1092
- } else {
1093
- loadClipboard(false);
1094
- objEditor.jTree.setSelectionPath(destinationPath);
1095
- pasteInto(false, false); // true); // ???
1096
- }
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
10971656 }
10981657 public void dropActionChanged(DropTargetDragEvent dtde)
10991658 // Called if the user has modified the current drop gesture
....@@ -1198,22 +1757,30 @@
11981757 {
11991758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12001759 //heightFieldItem.addActionListener(this);
1201
- gridItem = menu.add(new MenuItem("Grid"));
1202
- gridItem.addActionListener(this);
1203
- rectoidItem = menu.add(new MenuItem("Box"));
1204
- rectoidItem.addActionListener(this);
1205
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1206
- ellipsoidItem.addActionListener(this);
1207
- coneItem = menu.add(new MenuItem("Cone"));
1208
- coneItem.addActionListener(this);
1209
- torusItem = menu.add(new MenuItem("Torus"));
1210
- torusItem.addActionListener(this);
1211
- superItem = menu.add(new MenuItem("Superellipsoid"));
1212
- 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
+ {
12131778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12141779 kleinItem.addActionListener(this);
1215
- particleItem = menu.add(new MenuItem("Particle system"));
1216
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
12171784 if (Globals.ADVANCED)
12181785 {
12191786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1239,15 +1806,15 @@
12391806 }
12401807 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12411808 bezierItem.addActionListener(this);
1242
- overlayItem = menu.add(new MenuItem("Overlay"));
1243
- overlayItem.addActionListener(this);
1244
- lightItem = menu.add(new MenuItem("Light"));
1245
- 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);
12461813 menu.add("-");
12471814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12481815 //superLoopItem.addActionListener(this);
1249
- loopItem = menu.add(new MenuItem("Loop"));
1250
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
12511818 doubleItem = menu.add(new MenuItem("Fork"));
12521819 doubleItem.addActionListener(this);
12531820 if (Globals.ADVANCED)
....@@ -1263,6 +1830,9 @@
12631830 animationItem.addItemListener(this);
12641831 animationItem.setState(Globals.ANIMATION);
12651832
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
1835
+
12661836 menu.add("-");
12671837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12681838 parseverticesItem.addActionListener(this);
....@@ -1275,6 +1845,8 @@
12751845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12761846 reduce34MorphItem.addActionListener(this);
12771847 menu.add("-");
1848
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1849
+ memoryItem.addActionListener(this);
12781850 menu.add(computeAOItem = new MenuItem("Compute AO"));
12791851 computeAOItem.addActionListener(this);
12801852
....@@ -1283,8 +1855,6 @@
12831855 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12841856 mirrorItem.addActionListener(this);
12851857 menu.add("-");
1286
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1287
- memoryItem.addActionListener(this);
12881858 menu.add(analyzeItem = new MenuItem("Analyze"));
12891859 analyzeItem.addActionListener(this);
12901860 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1428,9 +1998,34 @@
14281998 shadow.material = new cMaterial(obj.material);
14291999 shadow.material.diffuse = 0.0001f;
14302000 shadow.material.specular = 0.0001f;
2001
+ //shadow.projectedVertices[1].x = 300;
14312002
14322003 makeSomething(shadow);
14332004 }
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
+ }
14342029
14352030 /**
14362031 * applyExample
....@@ -1675,7 +2270,7 @@
16752270 {
16762271 ScreenFit();
16772272 } else
1678
- if (source == switchItem)
2273
+ if (source == switchViewItem)
16792274 {
16802275 cVector v1 = new cVector();
16812276 cVector v2 = new cVector();
....@@ -1684,11 +2279,11 @@
16842279 objEditor.cameraView.renderCamera.setAim(v2, v1);
16852280 objEditor.cameraView.repaint();
16862281 } else
1687
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
16882283 {
16892284 makeSomething(new Box());
16902285 } else
1691
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
16922287 {
16932288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16942289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1767,27 +2362,27 @@
17672362
17682363 makeSomething(obj);
17692364 } else
1770
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
17712366 {
17722367 makeSomething(new Grid());
17732368 } else
1774
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
17752370 {
17762371 makeSomething(new Sphere());
17772372 } else
1778
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
17792374 {
17802375 makeSomething(new Cone());
17812376 } else
1782
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
17832378 {
17842379 makeSomething(new Torus());
17852380 } else
1786
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
17872382 {
17882383 makeSomething(new Superellipsoid());
17892384 } else
1790
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
17912386 {
17922387 makeSomething(new Klein());
17932388 } else
....@@ -1807,7 +2402,7 @@
18072402 {
18082403 makeSomething(new BezierSurface());
18092404 } else
1810
- if (source == overlayItem)
2405
+ if (source == overlayItem || source == overlayButton)
18112406 {
18122407 /*
18132408 Object3D obj = new BezierSurface(5,8);
....@@ -1855,10 +2450,27 @@
18552450 s.setup();
18562451 makeSomething(s);
18572452 } else
1858
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
18592454 {
18602455 makeSomething(new Light());
18612456 } 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
18622474 if (source == csgItem)
18632475 {
18642476 group(new CSG());
....@@ -1905,30 +2517,30 @@
19052517
19062518 group(g);
19072519 } else
1908
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
19092521 {
19102522 Composite csg = new GroupLeaf();
19112523 csg.count = 5;
19122524 group(csg);
1913
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
19142526 csg.addChild(child);
19152527 child.addChild(csg);
19162528 } else
19172529 if (source == doubleItem)
19182530 {
1919
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
19202532 csg.count = 5;
19212533 group(csg);
1922
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
19232535 csg.addChild(child);
19242536 child.addChild(csg);
1925
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
19262538 csg.addChild(child);
19272539 child.addChild(csg);
19282540 } else
19292541 if (source == tripleItem)
19302542 {
1931
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
19322544 csg.count = 4;
19332545 group(csg);
19342546 Composite child = new cGroup();
....@@ -1944,7 +2556,7 @@
19442556 if (source == computeAOItem)
19452557 {
19462558 Globals.drawMode = CameraPane.OCCLUSION;
1947
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
19482560 } else
19492561 if (source == recompileItem)
19502562 {
....@@ -1978,17 +2590,47 @@
19782590 {
19792591 DumpObject();
19802592 } else
2593
+ if (source == minButton)
2594
+ {
2595
+ Minimize();
2596
+ } else
2597
+ if (source == maxButton)
2598
+ {
2599
+ Maximize();
2600
+ } else
2601
+ if (source == fullButton)
2602
+ {
2603
+ ToggleFullScreen();
2604
+ } else
19812605 if (source == undoButton)
19822606 {
2607
+ // Go to previous version
2608
+ //if (!Undo())
2609
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19832610 Undo();
2611
+ } else
2612
+ if (source == restoreButton)
2613
+ {
2614
+ // Restore current version
2615
+ Restore();
2616
+ restoreButton.setEnabled(false);
2617
+ } else
2618
+ if (source == replaceButton)
2619
+ {
2620
+ // Overwrite current version
2621
+ Replace();
2622
+ replaceButton.setEnabled(false);
19842623 } else
19852624 if (source == redoButton)
19862625 {
2626
+ // Go to next version
19872627 Redo();
19882628 } else
19892629 if (source == saveButton)
19902630 {
1991
- Save();
2631
+ // Save a new version
2632
+ if (!Save(true))
2633
+ java.awt.Toolkit.getDefaultToolkit().beep();
19922634 } else
19932635 if (source == oneStepButton)
19942636 {
....@@ -1997,17 +2639,14 @@
19972639 } else
19982640 if (source == screenfitButton)
19992641 {
2000
- //Reload(lastConverter, lastFilename, true);
20012642 ScreenFit();
20022643 } else
20032644 if (source == screenfitpointButton)
20042645 {
2005
- //Reload(lastConverter, lastFilename, true);
20062646 ScreenFitPoint();
20072647 } else
20082648 if (source == snapobjectButton)
20092649 {
2010
- //Reload(lastConverter, lastFilename, true);
20112650 SnapObject();
20122651 } else
20132652 // if (event.getSource() == recompileButton)
....@@ -2371,7 +3010,7 @@
23713010 {
23723011 StepAll();
23733012 } else
2374
- if (source == clearItem) // || event.getSource() == clearButton)
3013
+ if (source == deleteItem) // || event.getSource() == clearButton)
23753014 {
23763015 //int indices[] = jList.getSelectedIndices();
23773016 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2383,9 +3022,9 @@
23833022 {
23843023 ClearSelection(true);
23853024 } else
2386
- if (source == grabItem)
3025
+ if (source == grabItem || source == groupButton)
23873026 {
2388
- group(new cGroup(), true);
3027
+ group(new cGroup(), false); // true);
23893028 } else
23903029 if (source == hideItem)
23913030 {
....@@ -2403,11 +3042,11 @@
24033042 {
24043043 makeSomething(new Camera());
24053044 } else
2406
- if (source == compositeItem)
3045
+ if (source == compositeItem || source == compositeButton)
24073046 {
24083047 group(new Composite());
24093048 } else
2410
- if (source == randomItem)
3049
+ if (source == switchItem || source == switchButton)
24113050 {
24123051 RandomNode random = new RandomNode();
24133052 group(random);
....@@ -2509,7 +3148,7 @@
25093148 {
25103149 group(new cLinker());
25113150 } else
2512
- if (source == textureItem)
3151
+ if (source == textureItem || source == textureButton)
25133152 {
25143153 group(new TextureNode());
25153154 } else
....@@ -2529,17 +3168,30 @@
25293168 {
25303169 CastShadow(2);
25313170 } else
2532
- if (source == ungroupItem)
3171
+ if (source == ungroupItem || source == ungroupButton)
25333172 {
2534
- //ungroup();
3173
+ boolean hasRoot = false;
3174
+
25353175 for (int i=0; i<group.selection.size(); i++)
25363176 {
2537
- Ungroup(group.selection.get(i));
3177
+ if (group.selection.get(i) == group)
3178
+ {
3179
+ hasRoot = true;
3180
+ break;
3181
+ }
25383182 }
25393183
2540
- ClearSelection(false);
2541
-
2542
- refreshContents();
3184
+ if (!hasRoot)
3185
+ {
3186
+ for (int i=0; i<group.selection.size(); i++)
3187
+ {
3188
+ Ungroup(group.selection.get(i));
3189
+ }
3190
+
3191
+ ClearSelection(false);
3192
+
3193
+ refreshContents();
3194
+ }
25433195 } else
25443196 if (source == genUVItem)
25453197 {
....@@ -2840,7 +3492,7 @@
28403492 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28413493 {
28423494 obj = (Object3D)e.nextElement();
2843
- obj.SetBumpTexture(null);
3495
+ obj.ResetBumpTexture();
28443496 }
28453497
28463498 refreshContents();
....@@ -2856,6 +3508,31 @@
28563508
28573509 refreshContents();
28583510 } else
3511
+ if (source == embedTexturesItem)
3512
+ {
3513
+ Object3D obj;
3514
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3515
+ {
3516
+ obj = (Object3D)e.nextElement();
3517
+ obj.EmbedTextures(true);
3518
+ }
3519
+
3520
+ refreshContents();
3521
+ } else
3522
+ if (source == deEmbedTexturesItem)
3523
+ {
3524
+ Object3D obj;
3525
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3526
+ {
3527
+ obj = (Object3D)e.nextElement();
3528
+ obj.EmbedTextures(false);
3529
+ }
3530
+
3531
+ CameraPane.texturepigment.clear();
3532
+ CameraPane.texturebump.clear();
3533
+
3534
+ refreshContents();
3535
+ } else
28593536 if (source == flashSelectionButton)
28603537 {
28613538 CameraPane.flash = true;
....@@ -2867,6 +3544,10 @@
28673544 if (source == twoButton)
28683545 {
28693546 radio.layout = twoButton;
3547
+
3548
+ if (CameraPane.FULLSCREEN)
3549
+ fullscreenLayout = radio.layout;
3550
+
28703551 // bug
28713552 //gridPanel.setDividerLocation(1.0);
28723553 //bigPanel.setDividerLocation(0.0);
....@@ -2899,10 +3580,31 @@
28993580 bigThree.ClearUI();
29003581 bigThree.add(centralPanel);
29013582 bigThree.FlushUI();
3583
+
3584
+ cameraView.requestFocusInWindow();
3585
+
3586
+// refreshContents(true);
3587
+//
3588
+// try
3589
+// {
3590
+// java.awt.Robot bot = new java.awt.Robot();
3591
+// int mask = InputEvent.BUTTON1_MASK;
3592
+// bot.mouseMove(100, 100);
3593
+// bot.mousePress(mask);
3594
+// bot.mouseRelease(mask);
3595
+// }
3596
+// catch (Exception e)
3597
+// {
3598
+//
3599
+// }
3600
+
29023601 } else
29033602 if (source == threeButton)
29043603 {
29053604 radio.layout = threeButton;
3605
+
3606
+ if (CameraPane.FULLSCREEN)
3607
+ fullscreenLayout = radio.layout;
29063608
29073609 // bigThree.remove(scenePanel);
29083610 // bigThree.remove(centralPanel);
....@@ -2932,13 +3634,18 @@
29323634 // centralPanel.setVisible(true);
29333635 // XYZPanel.setVisible(true);
29343636 bigThree.ClearUI();
3637
+ bigThree.add(scenePanel);
29353638 bigThree.add(centralPanel);
2936
- bigThree.add(XYZPanel);
29373639 bigThree.FlushUI();
3640
+
3641
+ cameraView.requestFocusInWindow();
29383642 } else
29393643 if (source == fourButton)
29403644 {
29413645 radio.layout = fourButton;
3646
+
3647
+ if (CameraPane.FULLSCREEN)
3648
+ fullscreenLayout = radio.layout;
29423649
29433650 // bigThree.remove(scenePanel);
29443651 // bigThree.remove(centralPanel);
....@@ -2970,10 +3677,15 @@
29703677 bigThree.ClearUI();
29713678 bigThree.add(scenePanel);
29723679 bigThree.FlushUI();
3680
+
3681
+ cameraView.requestFocusInWindow();
29733682 } else
29743683 if (source == sixButton)
29753684 {
29763685 radio.layout = sixButton;
3686
+
3687
+ if (CameraPane.FULLSCREEN)
3688
+ fullscreenLayout = radio.layout;
29773689
29783690 // bigThree.remove(scenePanel);
29793691 // bigThree.remove(centralPanel);
....@@ -3003,13 +3715,18 @@
30033715 // centralPanel.setVisible(true);
30043716 // XYZPanel.setVisible(false);
30053717 bigThree.ClearUI();
3006
- bigThree.add(scenePanel);
30073718 bigThree.add(centralPanel);
3719
+ bigThree.add(scenePanel);
30083720 bigThree.FlushUI();
3721
+
3722
+ cameraView.requestFocusInWindow();
30093723 } else
30103724 if (source == sevenButton)
30113725 {
30123726 radio.layout = sevenButton;
3727
+
3728
+ if (CameraPane.FULLSCREEN)
3729
+ fullscreenLayout = radio.layout;
30133730
30143731 // bigThree.remove(scenePanel);
30153732 // bigThree.remove(centralPanel);
....@@ -3043,6 +3760,8 @@
30433760 bigThree.add(centralPanel);
30443761 bigThree.add(XYZPanel);
30453762 bigThree.FlushUI();
3763
+
3764
+ cameraView.requestFocusInWindow();
30463765 } else
30473766 if (source == rootButton)
30483767 {
....@@ -3054,6 +3773,7 @@
30543773 EditObject(obj);
30553774 }
30563775
3776
+ cameraView.requestFocusInWindow();
30573777 refreshContents(true);
30583778 } else
30593779 if (source == closeButton)
....@@ -3063,22 +3783,37 @@
30633783 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30643784 {
30653785 ab = (cRadio)e.nextElement();
3066
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3786
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30673787 {
3788
+ // Patch to avoid bug with transparency.
3789
+ if (!ab.hadMaterial)
3790
+ {
3791
+ ab.object.material = null;
3792
+ }
3793
+
30683794 buttonGroup.remove(ab);
30693795 radioPanel.remove(ab);
30703796
3071
- ab.GetObject().editWindow = null;
3797
+ //ab.GetObject().editWindow = null;
3798
+ ab.GetObject().manipWindow = null;
30723799 // ab.GetObject().objectUI = null; // ?????????
30733800
30743801 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30753802 break;
30763803 }
30773804 }
3805
+
3806
+ cameraView.requestFocusInWindow();
30783807 refreshContents(true);
30793808 } else
30803809 if (source == editItem || source == editButton)
30813810 {
3811
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3812
+ {
3813
+ Object3D child = (Object3D)e.nextElement();
3814
+ child.pinned = true;
3815
+ }
3816
+
30823817 EditSelection(false);
30833818 } else
30843819 if (source == uneditButton)
....@@ -3087,9 +3822,10 @@
30873822 {
30883823 Object3D child = (Object3D)e.nextElement();
30893824 if(child.editWindow != null)
3090
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3825
+ child.pinned = false;
30913826 child.CloseUI();
30923827 listUI.remove(child);
3828
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30933829
30943830 //child.editWindow = null; // ???????????
30953831 }
....@@ -3104,16 +3840,18 @@
31043840 //copy.ClearUI();
31053841 for (Object3D obj : listUI)
31063842 {
3843
+ obj.pinned = false;
31073844 obj.CloseUI();
31083845 }
31093846 listUI.clear();
3847
+ SetPinStates(group.selection.size() > 0);
31103848 refreshContents(true);
31113849 } else
31123850 if (source == allParamsButton)
31133851 {
31143852 assert(copy == group);
31153853
3116
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3854
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31173855
31183856 for (Object3D obj : listUI)
31193857 {
....@@ -3162,6 +3900,9 @@
31623900 }
31633901
31643902 copy = group;
3903
+
3904
+ SetUndoStates();
3905
+
31653906 //Globals.theRenderer.object = group;
31663907 if(!useclient)
31673908 {
....@@ -3179,7 +3920,8 @@
31793920 }
31803921
31813922 // fix "+" issue
3182
- group.editWindow = this;
3923
+ //group.editWindow = this;
3924
+ group.manipWindow = this;
31833925
31843926 /*
31853927 currentLayout = radio.layout;
....@@ -3187,20 +3929,32 @@
31873929 currentLayout = sevenButton;
31883930 */
31893931 radio.layout.doClick();
3932
+
3933
+ ClearUnpinned();
3934
+
3935
+ //Grafreed.Assert(group != null);
3936
+ //Grafreed.Assert(group.selection != null);
3937
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3938
+ if (group.selection == null || group.selection.size() == 1)
3939
+ EditSelection(false);
31903940 keepparent = group.parent;
31913941 // PARENT = NULL or not???
31923942 //group.parent = null; // ROOT
31933943 //group.attributes = -1;
31943944 ResetModel();
3945
+
3946
+ cameraView.requestFocusInWindow();
31953947 refreshContents(true);
31963948 } else if (event.getSource() == editCameraItem)
31973949 {
31983950 cameraView.ProtectCamera();
3951
+ cameraView.requestFocusInWindow();
31993952 cameraView.repaint();
32003953 return;
3201
- } else if (event.getSource() == revertCameraItem)
3954
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32023955 {
32033956 cameraView.RevertCamera();
3957
+ cameraView.requestFocusInWindow();
32043958 cameraView.repaint();
32053959 return;
32063960 // } else if (event.getSource() == textureButton)
....@@ -3215,7 +3969,6 @@
32153969 }
32163970
32173971 boolean useclient = false;
3218
- cRadio radio;
32193972
32203973 void ToggleRoot()
32213974 {
....@@ -3778,7 +4531,7 @@
37784531
37794532 try
37804533 {
3781
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4534
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37824535 }
37834536 catch (Exception e)
37844537 {
....@@ -4253,28 +5006,25 @@
42535006 // }
42545007 // }
42555008
4256
- static boolean allparams = true;
4257
-
4258
- static Vector<Object3D> listUI = new Vector<Object3D>();
4259
-
42605009 void EditSelection(boolean newWindow)
42615010 {
5011
+ if (group.selection == null)
5012
+ {
5013
+ EditElement(group, newWindow); // ? new
5014
+ return;
5015
+ }
5016
+
42625017 // aConstraints.gridy = 0;
42635018 for (int i=0; i<group.selection.size(); i++)
42645019 {
42655020 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42665021 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4267
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5022
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42685023
42695024 Object3D elem = (Object3D)group.selection.elementAt(i);
42705025 if(elem != group || !newWindow)
42715026 {
4272
- // if (!(elem instanceof Composite))
4273
- // newWindow = false;
4274
- listUI.add(elem);
4275
- elem.openEditWindow(this, newWindow); //, false);
4276
- System.out.println("edit : " + elem);
4277
- elem.editWindow.refreshContents(true); // ? new
5027
+ EditElement(elem, newWindow); // ? new
42785028 }
42795029 }
42805030 }
....@@ -4337,9 +5087,7 @@
43375087
43385088 freezemodel = false;
43395089 }
4340
-
4341
- boolean flashIt = true;
4342
-
5090
+
43435091 public void valueChanged(TreeSelectionEvent e)
43445092 //public boolean handleEvent(Event event)
43455093 {
....@@ -4349,7 +5097,8 @@
43495097 //new Exception().printStackTrace();
43505098
43515099 freezemodel = true;
4352
-
5100
+ ClearUnpinned();
5101
+
43535102 /**/
43545103 //switch (event.id)
43555104 {
....@@ -4382,7 +5131,7 @@
43825131 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43835132 // a camera
43845133 {
4385
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5134
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43865135 {
43875136 CameraPane.camerachangeframe = 0; // don't refuse it
43885137 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4391,6 +5140,13 @@
43915140 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43925141 }
43935142
5143
+ if (tps != null && tps.length == 1)
5144
+ {
5145
+ EditSelection(false);
5146
+ }
5147
+
5148
+ SetPinStates(tps != null && tps.length > 0);
5149
+
43945150 refreshContents();
43955151 //return true;
43965152 }
....@@ -4400,9 +5156,20 @@
44005156 freezemodel = false;
44015157 }
44025158
5159
+ void SetPinStates(boolean enabled)
5160
+ {
5161
+ editButton.setEnabled(enabled);
5162
+ uneditButton.setEnabled(enabled);
5163
+ unselectButton.setEnabled(enabled);
5164
+ flashSelectionButton.setEnabled(enabled);
5165
+
5166
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5167
+ }
5168
+
44035169 void refreshContents(boolean cp)
44045170 {
4405
- if (!Globals.MOUSEDRAGGED)
5171
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5172
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44065173 {
44075174 objEditor.ClearInfo(); // .GetMaterial());
44085175
....@@ -4501,7 +5268,8 @@
45015268
45025269 if (cut)
45035270 {
4504
- Save();
5271
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5272
+// Save();
45055273 //int indices[] = jList.getSelectedIndices();
45065274 //for (int i = indices.length - 1; i >= 0; i--)
45075275 //jList.remove(indices[i]);
....@@ -4604,6 +5372,10 @@
46045372
46055373 void paste(boolean expand)
46065374 {
5375
+ if (Globals.REPLACEONMAKE)
5376
+ Save();
5377
+ boolean keep = Globals.REPLACEONMAKE;
5378
+ Globals.REPLACEONMAKE = false;
46075379 // if (GrafreeD.clipboard == null)
46085380 // return;
46095381 boolean first = true;
....@@ -4663,6 +5435,7 @@
46635435 Grafreed.clipboard.get(0).parent = keepparent;
46645436 }
46655437
5438
+ Globals.REPLACEONMAKE = keep;
46665439 ResetModel();
46675440 refreshContents();
46685441 }
....@@ -4798,6 +5571,10 @@
47985571
47995572 void group(Object3D csg, boolean grab)
48005573 {
5574
+ if (Globals.REPLACEONMAKE)
5575
+ Save();
5576
+ boolean keep = Globals.REPLACEONMAKE;
5577
+ Globals.REPLACEONMAKE = false;
48015578 if (//false) // why??
48025579 !group.selection.isEmpty())
48035580 {
....@@ -4911,10 +5688,15 @@
49115688 //node.add(csg);
49125689 //makeSomething(node);
49135690 makeSomething(csg);
5691
+ Globals.REPLACEONMAKE = keep;
49145692 }
49155693
49165694 void Ungroup(Object3D g)
49175695 {
5696
+ if (Globals.REPLACEONMAKE)
5697
+ Save();
5698
+ boolean keep = Globals.REPLACEONMAKE;
5699
+ Globals.REPLACEONMAKE = false;
49185700 if (g instanceof HiddenObject)
49195701 {
49205702 HiddenObject h = (HiddenObject) g;
....@@ -4931,6 +5713,7 @@
49315713 objEditor.makeSomething(g.get(i), false);
49325714 }
49335715 }
5716
+ Globals.REPLACEONMAKE = keep;
49345717 }
49355718
49365719 void ungroup()
....@@ -5219,10 +6002,44 @@
52196002 cButton clearpanelButton;
52206003 cButton unselectButton;
52216004
6005
+ cButton restoreCameraButton;
6006
+
52226007 cButton saveButton;
5223
- cButton undoButton;
5224
- cButton redoButton;
52256008 cButton oneStepButton;
6009
+
6010
+ cButton groupButton;
6011
+ cButton ungroupButton;
6012
+ cButton compositeButton;
6013
+ cButton switchButton;
6014
+ cButton loopButton;
6015
+ cButton textureButton;
6016
+
6017
+ cButton skybox1Button;
6018
+ cButton skybox2Button;
6019
+ cButton skybox3Button;
6020
+ cButton skybox4Button;
6021
+ cButton skybox5Button;
6022
+ cButton skybox6Button;
6023
+ cButton skybox7Button;
6024
+
6025
+ cButton skybox11Button;
6026
+ cButton skybox12Button;
6027
+ cButton skybox13Button;
6028
+ cButton skybox14Button;
6029
+ cButton skybox15Button;
6030
+ cButton skybox16Button;
6031
+ cButton skybox17Button;
6032
+
6033
+ cButton gridButton;
6034
+ cButton boxButton;
6035
+ cButton sphereButton;
6036
+ cButton coneButton;
6037
+ cButton torusButton;
6038
+ cButton superButton;
6039
+ cButton kleinButton;
6040
+ cButton particlesButton;
6041
+ cButton overlayButton;
6042
+ cButton lightButton;
52266043
52276044 cButton screenfitButton;
52286045 cButton screenfitpointButton;
....@@ -5235,14 +6052,6 @@
52356052
52366053 cButton setsupportButton;
52376054
5238
- cButton twoButton;
5239
- cButton sixButton;
5240
- cButton threeButton;
5241
- cButton sevenButton;
5242
- cButton fourButton; // full panel
5243
- cButton oneButton; // full XYZ
5244
- //cButton currentLayout;
5245
-
52466055 //
52476056 //Composite
52486057 Object3D // to do !!
....@@ -5252,11 +6061,11 @@
52526061 //JTree jTree;
52536062 private MenuItem lookAtItem;
52546063 private MenuItem lookFromItem;
5255
- private MenuItem switchItem;
6064
+ private MenuItem switchViewItem;
52566065 private MenuItem cutItem;
52576066 private MenuItem undoItem;
52586067 private MenuItem redoItem;
5259
- private MenuItem duplicateItem;
6068
+ private JMenuItem duplicateItem;
52606069 private MenuItem cloneItem;
52616070 private MenuItem cloneSupportItem;
52626071 private MenuItem overwriteGeoItem;
....@@ -5284,7 +6093,7 @@
52846093 private MenuItem pasteLinkItem;
52856094 private MenuItem pasteCloneItem;
52866095 private MenuItem pasteExpandItem;
5287
- private MenuItem clearItem;
6096
+ private MenuItem deleteItem;
52886097 private MenuItem clearAllItem;
52896098 private MenuItem genUVItem;
52906099 private MenuItem genNormalsMESHItem;
....@@ -5344,7 +6153,7 @@
53446153 private MenuItem frontItem;
53456154 private MenuItem cameraItem;
53466155 private MenuItem compositeItem;
5347
- private MenuItem randomItem;
6156
+ private MenuItem switchItem;
53486157 private MenuItem physicsItem;
53496158 private MenuItem frameselectorItem;
53506159 private MenuItem scriptNodeItem;
....@@ -5368,6 +6177,8 @@
53686177 private MenuItem attachBumpItem;
53696178 private MenuItem detachBumpItem;
53706179 private MenuItem pigmentBumpItem;
6180
+ private MenuItem embedTexturesItem;
6181
+ private MenuItem deEmbedTexturesItem;
53716182
53726183 private MenuItem particleItem;
53736184 private MenuItem ragdollItem;
....@@ -5418,5 +6229,5 @@
54186229
54196230 Menu cameraMenu;
54206231 MenuItem editCameraItem;
5421
- MenuItem revertCameraItem;
6232
+ MenuItem restoreCameraItem;
54226233 }