Normand Briere
2019-07-30 7a77e39423398b7ad8bf7e80cf45fac6817000c2
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);
....@@ -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
....@@ -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,6 +859,7 @@
533859 buildToolsMenu(menu);
534860 }
535861
862
+
536863 void SetupUI2(ObjEditor oe)
537864 {
538865 // June 2019
....@@ -575,51 +902,79 @@
575902 oe.radioPanel.add(dummyButton);
576903 oe.buttonGroup.add(dummyButton);
577904 */
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
908
+
578909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
579910
580911 //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581912 //minButton.setToolTipText("Minimize window");
582913 //minButton.addActionListener(this);
583914
584
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- maxButton.setToolTipText("Maximize window");
586
- 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
+ }
587921
588
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589923 fullButton.setToolTipText("Full-screen window");
590924 fullButton.addActionListener(this);
591925
592
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
593
- undoButton.setToolTipText("Undo changes");
594
- 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);
595933
596
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- redoButton.setToolTipText("Redo changes");
598
- redoButton.addActionListener(this);
599
-
600
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
- saveButton.setToolTipText("Save changes");
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("New version");
602936 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);
603942
604
- 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");
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");
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);
605962 liveCB.setToolTipText("Enable animation");
606963 liveCB.addItemListener(this);
607964
608
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
965
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609966 oneStepButton.setToolTipText("Animate one step forward");
610967 oneStepButton.addActionListener(this);
611968
612
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
969
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
613970 fastCB.setToolTipText("Fast mode");
614971 fastCB.addItemListener(this);
615972
616
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
617
- trackCB.setToolTipText("Enable tracking");
618
- trackCB.addItemListener(this);
619
-
620
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- screenfitButton.setToolTipText("Screen fit");
622
- 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);
623978
624979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
625980 // screenfitpointButton.addActionListener(this);
....@@ -629,67 +984,156 @@
629984 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630985 snapobjectButton.addActionListener(this);
631986 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");
632991 }
633992
634
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
- flashSelectionButton.setToolTipText("Show selection");
636
- flashSelectionButton.addActionListener(this);
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
637994
638
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
639
-
640
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
641
- 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");
642997 twoButton.addActionListener(this);
643
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
- fourButton.addActionListener(this);
645
- fourButton.setToolTipText("Show left panel only");
646
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
- sixButton.setToolTipText("2-column layout left");
648
- sixButton.addActionListener(this);
649
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- 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");
6511002 threeButton.addActionListener(this);
652
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
653
- sevenButton.setToolTipText("3-column layout");
654
- 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);
6551009 //
6561010
657
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658
- 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");
6591013 rootButton.addActionListener(this);
6601014
661
- 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);
6621016 closeButton.setToolTipText("Close tab");
6631017 closeButton.addActionListener(this);
6641018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6651019 //clearButton.addActionListener(this);
666
-
667
- cGridBag commandsPanel = new cGridBag();
1020
+
1021
+ cGridBag row1 = new cGridBag();
6681022
669
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
670
- 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");
6711110 editButton.addActionListener(this);
6721111
673
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- uneditButton.setToolTipText("Unedit selection");
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
6751114 uneditButton.addActionListener(this);
6761115
677
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
678
- allParamsButton.setToolTipText("Edit all params");
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
6791118 allParamsButton.addActionListener(this);
6801119
681
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6821121 clearPanelButton.setToolTipText("Clear edit panel");
6831122 clearPanelButton.addActionListener(this);
6841123
685
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6861125 unselectButton.setToolTipText("Unselect");
6871126 unselectButton.addActionListener(this);
6881127
689
- 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);
6901131
691
- oe.treePanel.add(commandsPanel);
692
- oe.treePanel.Return();
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
6931137
6941138 // oe.aConstraints.gridx += 1;
6951139 // oe.aConstraints.weighty = 0;
....@@ -706,32 +1150,20 @@
7061150
7071151 JScrollPane jSP;
7081152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
709
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
7101154 ResetModel();
7111155
7121156 oe.treePanel.add(jSPPanel);
7131157 oe.treePanel.Return();
7141158
715
- cGridBag copyOptionsPanel = new cGridBag();
716
-
717
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
718
- colorCB.setToolTipText("Copy color when dropped");
719
- colorCB.addItemListener(this);
720
-
721
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
722
- materialCB.setToolTipText("Copy material when dropped");
723
- materialCB.addItemListener(this);
724
-
725
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
726
- textureCB.setToolTipText("Copy texture when dropped");
727
- textureCB.addItemListener(this);
728
-
729
- copyOptionsPanel.preferredHeight = 1;
7301159 oe.treePanel.add(copyOptionsPanel);
7311160 oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
7321164
733
-// mainPanel.setDividerLocation(0.5); //1.0);
734
-// mainPanel.setResizeWeight(0.5);
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
7351167
7361168 //jList.addListSelectionListener(this);
7371169 oe.jTree.addTreeSelectionListener(this);
....@@ -739,7 +1171,7 @@
7391171 //jTree.setEditable(true);
7401172 oe.jTree.setDragEnabled(true);
7411173 //jTree.setPreferredSize(new Dimension(10,10));
742
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
7431175
7441176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7451177
....@@ -751,29 +1183,49 @@
7511183 dgr.addDragGestureListener(this);
7521184 }catch(Exception e) {}
7531185 */
754
- radio.layout = sevenButton;
1186
+ radio.layout = sixButton; // sevenButton;
7551187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7561188 }
7571189
7581190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7591191 {
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
+
7601206 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7611207 boxCB.setToolTipText("Display bounding boxes");
7621208 boxCB.addItemListener(this);
7631209
7641210 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
765
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
7661212 zoomBoxCB.addItemListener(this);
7671213
7681214 if (true) // Globals.ADVANCED)
7691215 {
770
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
771
- supportCB.setToolTipText("Enable rigging");
772
- 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);
7731223
7741224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7751225 // localCB.addItemListener(this);
7761226
1227
+ panel.Return();
1228
+
7771229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7781230 crowdCB.setToolTipText("Used for crowds");
7791231 crowdCB.addItemListener(this);
....@@ -790,6 +1242,8 @@
7901242 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7911243 // speakerMocapCB.addItemListener(this);
7921244
1245
+ panel.Return();
1246
+
7931247 if (false)
7941248 {
7951249 // handled in scripts
....@@ -804,34 +1258,74 @@
8041258 //constraints.gridy += 1;
8051259 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
8061260 smoothfocusCB.addItemListener(this);
1261
+ panel.Return();
8071262 }
8081263
8091264 //constraints.gridx += 1;
8101265 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
8111266 // debugCB.addItemListener(this);
8121267
1268
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1269
+ trackCB.setToolTipText("Enable tracking target");
1270
+ trackCB.addItemListener(this);
1271
+
8131272 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1273
+ oeilCB.setToolTipText("Move camera when tracking");
8141274 oeilCB.addItemListener(this);
8151275
1276
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1277
+ shadowCB.setToolTipText("When live compute shadows");
1278
+ shadowCB.addItemListener(this);
1279
+
1280
+ panel.Return();
1281
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1282
+ toggleTextureCB.setToolTipText("Load textures");
1283
+ toggleTextureCB.addItemListener(this);
1284
+
1285
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1286
+ toggleSwitchCB.setToolTipText("Choose a single item");
1287
+ toggleSwitchCB.addItemListener(this);
1288
+
1289
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1290
+ autokeepCB.setToolTipText("On structure change");
1291
+ autokeepCB.addItemListener(this);
1292
+
1293
+ panel.Return();
1294
+ if (Globals.ADVANCED)
1295
+ {
8161296 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
8171297 lookAtCB.setToolTipText("Look-at target");
8181298 lookAtCB.addItemListener(this);
1299
+ }
8191300
8201301 }
8211302
8221303 cGridBag fill = new cGridBag();
823
-
8241304 fill.preferredHeight = 200;
1305
+ cGridBag fill2 = new cGridBag();
1306
+ fill2.preferredHeight = 200;
1307
+ cGridBag fill3 = new cGridBag();
1308
+ fill3.preferredHeight = 200;
8251309
8261310 panel.add(fill);
1311
+ panel.add(fill2);
1312
+ panel.add(fill3);
8271313
8281314 }
8291315
8301316 void EditObject(Object3D obj)
8311317 {
8321318 cRadio radioButton = new cRadio(obj.name);
1319
+
1320
+ // June 2019. Patch to avoid bug with transparency.
1321
+ radioButton.hadMaterial = obj.material != null;
1322
+ if (!radioButton.hadMaterial)
1323
+ {
1324
+ obj.material = new cMaterial();
1325
+ }
1326
+
8331327 radioButton.SetObject(obj);
834
- radioButton.layout = sevenButton;
1328
+ radioButton.layout = sixButton; // sevenButton;
8351329 radioButton.SetCamera(cameraView.renderCamera, false);
8361330 radioButton.addActionListener(this);
8371331 radioPanel.add(radioButton);
....@@ -851,23 +1345,28 @@
8511345 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8521346 }
8531347
854
- JCheckBox liveCB;
855
- JCheckBox supportCB;
856
- JCheckBox localCB;
857
- JCheckBox crowdCB;
858
- JCheckBox smoothCB;
859
- JCheckBox fastCB;
860
- JCheckBox slowCB;
861
- JCheckBox boxCB;
862
- JCheckBox zoomBoxCB;
863
- JCheckBox trackCB;
864
- JCheckBox smoothfocusCB;
1348
+ cToggleButton liveCB;
1349
+ cCheckBox supportCB;
1350
+ cCheckBox localCB;
1351
+ cCheckBox crowdCB;
1352
+ cCheckBox smoothCB;
1353
+ cToggleButton fastCB;
1354
+ cCheckBox slowCB;
1355
+ cCheckBox boxCB;
1356
+ cCheckBox zoomBoxCB;
1357
+ cCheckBox freezeCB;
1358
+ //cToggleButton trackCB;
1359
+ cCheckBox trackCB;
1360
+ cCheckBox smoothfocusCB;
8651361 // JCheckBox speakerMocapCB;
866
- JCheckBox speakerCameraCB;
867
- JCheckBox speakerFocusCB;
868
- JCheckBox debugCB;
869
- JCheckBox oeilCB;
870
- JCheckBox lookAtCB;
1362
+ cCheckBox speakerCameraCB;
1363
+ cCheckBox speakerFocusCB;
1364
+ cCheckBox debugCB;
1365
+
1366
+ cCheckBox oeilCB;
1367
+ cCheckBox shadowCB;
1368
+ cCheckBox autokeepCB;
1369
+ cCheckBox lookAtCB;
8711370
8721371 // static int COLOR = 1;
8731372 // static int MATERIAL = 2;
....@@ -875,9 +1374,9 @@
8751374
8761375 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8771376
878
- JCheckBox colorCB;
879
- JCheckBox materialCB;
880
- JCheckBox textureCB;
1377
+ cCheckBox colorCB;
1378
+ cCheckBox materialCB;
1379
+ cCheckBox textureCB;
8811380
8821381 public void itemStateChanged(ItemEvent e)
8831382 {
....@@ -970,6 +1469,18 @@
9701469 {
9711470 cameraView.ToggleOeil();
9721471 }
1472
+ else if(e.getSource() == shadowCB)
1473
+ {
1474
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1475
+ }
1476
+ else if(e.getSource() == freezeCB)
1477
+ {
1478
+ Globals.FREEZEONMOVE ^= true;
1479
+ }
1480
+ else if(e.getSource() == autokeepCB)
1481
+ {
1482
+ Globals.REPLACEONMAKE ^= true;
1483
+ }
9731484 else if(e.getSource() == lookAtCB)
9741485 {
9751486 cameraView.ToggleLookAt();
....@@ -986,7 +1497,8 @@
9861497
9871498 /**/
9881499 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
989
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1500
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1501
+ TreePath path = objEditor.jTree.getSelectionPath();
9901502 if ((path == null) || (path.getPathCount() <= 1)) {
9911503 // We can't move the root node or an empty selection
9921504 return;
....@@ -1049,8 +1561,6 @@
10491561 }
10501562 }
10511563
1052
- String string = (String) object;
1053
-
10541564 System.out.println("Transfer = " + object + "; drop : " + target);
10551565 // if( object instanceof java.io.File[])
10561566 // {
....@@ -1058,6 +1568,8 @@
10581568 // objEditor.DropFile((java.io.File[]) object, true);
10591569 // return;
10601570 // }
1571
+
1572
+ String string = object.toString();
10611573
10621574 // File path for Mac and Windows
10631575 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1103,23 +1615,33 @@
11031615
11041616 assert target == objEditor.jTree;
11051617 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1618
+ Object3D destinationLeaf;
11061619 try {
1107
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1620
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
11081621 } catch (Exception e) {
11091622 System.out.println("destinationPath : " + destinationPath);
11101623 return;
11111624 }
11121625
1113
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1626
+ for (int i=group.selection.size(); --i>=0;)
11141627 {
1628
+ Object3D child = (Object3D)group.selection.elementAt(i);
1629
+
1630
+ // Cannot move into itself
1631
+ if (child == destinationLeaf)
1632
+ return;
1633
+ }
1634
+
1635
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1636
+// {
11151637 loadClipboard(true);
11161638 objEditor.jTree.setSelectionPath(destinationPath);
11171639 pasteInto(false, false);
1118
- } else {
1119
- loadClipboard(false);
1120
- objEditor.jTree.setSelectionPath(destinationPath);
1121
- pasteInto(false, false); // true); // ???
1122
- }
1640
+// } else {
1641
+// loadClipboard(false);
1642
+// objEditor.jTree.setSelectionPath(destinationPath);
1643
+// pasteInto(false, false); // true); // ???
1644
+// }
11231645 }
11241646 public void dropActionChanged(DropTargetDragEvent dtde)
11251647 // Called if the user has modified the current drop gesture
....@@ -1224,22 +1746,30 @@
12241746 {
12251747 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12261748 //heightFieldItem.addActionListener(this);
1227
- gridItem = menu.add(new MenuItem("Grid"));
1228
- gridItem.addActionListener(this);
1229
- rectoidItem = menu.add(new MenuItem("Box"));
1230
- rectoidItem.addActionListener(this);
1231
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1232
- ellipsoidItem.addActionListener(this);
1233
- coneItem = menu.add(new MenuItem("Cone"));
1234
- coneItem.addActionListener(this);
1235
- torusItem = menu.add(new MenuItem("Torus"));
1236
- torusItem.addActionListener(this);
1237
- superItem = menu.add(new MenuItem("Superellipsoid"));
1238
- superItem.addActionListener(this);
1749
+// gridItem = menu.add(new MenuItem("Grid"));
1750
+// gridItem.addActionListener(this);
1751
+// rectoidItem = menu.add(new MenuItem("Box"));
1752
+// rectoidItem.addActionListener(this);
1753
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1754
+// ellipsoidItem.addActionListener(this);
1755
+// coneItem = menu.add(new MenuItem("Cone"));
1756
+// coneItem.addActionListener(this);
1757
+// torusItem = menu.add(new MenuItem("Torus"));
1758
+// torusItem.addActionListener(this);
1759
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1760
+// superItem.addActionListener(this);
1761
+
1762
+ cameraItem = menu.add(new MenuItem("Camera"));
1763
+ cameraItem.addActionListener(this);
1764
+
1765
+ if (!Globals.ADVANCED)
1766
+ {
12391767 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12401768 kleinItem.addActionListener(this);
1241
- particleItem = menu.add(new MenuItem("Particle system"));
1242
- particleItem.addActionListener(this);
1769
+ }
1770
+
1771
+// particleItem = menu.add(new MenuItem("Particle system"));
1772
+// particleItem.addActionListener(this);
12431773 if (Globals.ADVANCED)
12441774 {
12451775 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1265,15 +1795,15 @@
12651795 }
12661796 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12671797 bezierItem.addActionListener(this);
1268
- overlayItem = menu.add(new MenuItem("Overlay"));
1269
- overlayItem.addActionListener(this);
1270
- lightItem = menu.add(new MenuItem("Light"));
1271
- lightItem.addActionListener(this);
1798
+// overlayItem = menu.add(new MenuItem("Overlay"));
1799
+// overlayItem.addActionListener(this);
1800
+// lightItem = menu.add(new MenuItem("Light"));
1801
+// lightItem.addActionListener(this);
12721802 menu.add("-");
12731803 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12741804 //superLoopItem.addActionListener(this);
1275
- loopItem = menu.add(new MenuItem("Loop"));
1276
- loopItem.addActionListener(this);
1805
+// loopItem = menu.add(new MenuItem("Loop"));
1806
+// loopItem.addActionListener(this);
12771807 doubleItem = menu.add(new MenuItem("Fork"));
12781808 doubleItem.addActionListener(this);
12791809 if (Globals.ADVANCED)
....@@ -1289,6 +1819,9 @@
12891819 animationItem.addItemListener(this);
12901820 animationItem.setState(Globals.ANIMATION);
12911821
1822
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1823
+ archiveItem.addActionListener(this);
1824
+
12921825 menu.add("-");
12931826 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12941827 parseverticesItem.addActionListener(this);
....@@ -1301,6 +1834,8 @@
13011834 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
13021835 reduce34MorphItem.addActionListener(this);
13031836 menu.add("-");
1837
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1838
+ memoryItem.addActionListener(this);
13041839 menu.add(computeAOItem = new MenuItem("Compute AO"));
13051840 computeAOItem.addActionListener(this);
13061841
....@@ -1309,8 +1844,6 @@
13091844 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
13101845 mirrorItem.addActionListener(this);
13111846 menu.add("-");
1312
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1313
- memoryItem.addActionListener(this);
13141847 menu.add(analyzeItem = new MenuItem("Analyze"));
13151848 analyzeItem.addActionListener(this);
13161849 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1454,9 +1987,34 @@
14541987 shadow.material = new cMaterial(obj.material);
14551988 shadow.material.diffuse = 0.0001f;
14561989 shadow.material.specular = 0.0001f;
1990
+ //shadow.projectedVertices[1].x = 300;
14571991
14581992 makeSomething(shadow);
14591993 }
1994
+
1995
+ private void ClearUnpinned()
1996
+ {
1997
+ //for (Object3D obj : listUI)
1998
+ for (int i=listUI.size(); --i>=0;)
1999
+ {
2000
+ Object3D obj = listUI.elementAt(i);
2001
+ if (!obj.pinned)
2002
+ {
2003
+ obj.CloseUI();
2004
+ listUI.remove(i);
2005
+ }
2006
+ }
2007
+ }
2008
+
2009
+ private void EditElement(Object3D elem, boolean newWindow)
2010
+ {
2011
+ // if (!(elem instanceof Composite))
2012
+ // newWindow = false;
2013
+ listUI.add(elem);
2014
+ elem.openEditWindow(this, newWindow); //, false);
2015
+ System.out.println("edit : " + elem);
2016
+ elem.editWindow.refreshContents(true); // ? new
2017
+ }
14602018
14612019 /**
14622020 * applyExample
....@@ -1701,7 +2259,7 @@
17012259 {
17022260 ScreenFit();
17032261 } else
1704
- if (source == switchItem)
2262
+ if (source == switchViewItem)
17052263 {
17062264 cVector v1 = new cVector();
17072265 cVector v2 = new cVector();
....@@ -1710,11 +2268,11 @@
17102268 objEditor.cameraView.renderCamera.setAim(v2, v1);
17112269 objEditor.cameraView.repaint();
17122270 } else
1713
- if (source == rectoidItem)
2271
+ if (source == rectoidItem || source == boxButton)
17142272 {
17152273 makeSomething(new Box());
17162274 } else
1717
- if (source == particleItem)
2275
+ if (source == particleItem || source == particlesButton)
17182276 {
17192277 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17202278 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1793,27 +2351,27 @@
17932351
17942352 makeSomething(obj);
17952353 } else
1796
- if (source == gridItem)
2354
+ if (source == gridItem || source == gridButton)
17972355 {
17982356 makeSomething(new Grid());
17992357 } else
1800
- if (source == ellipsoidItem)
2358
+ if (source == ellipsoidItem || source == sphereButton)
18012359 {
18022360 makeSomething(new Sphere());
18032361 } else
1804
- if (source == coneItem)
2362
+ if (source == coneItem || source == coneButton)
18052363 {
18062364 makeSomething(new Cone());
18072365 } else
1808
- if (source == torusItem)
2366
+ if (source == torusItem || source == torusButton)
18092367 {
18102368 makeSomething(new Torus());
18112369 } else
1812
- if (source == superItem)
2370
+ if (source == superItem || source == superButton)
18132371 {
18142372 makeSomething(new Superellipsoid());
18152373 } else
1816
- if (source == kleinItem)
2374
+ if (source == kleinItem || source == kleinButton)
18172375 {
18182376 makeSomething(new Klein());
18192377 } else
....@@ -1833,7 +2391,7 @@
18332391 {
18342392 makeSomething(new BezierSurface());
18352393 } else
1836
- if (source == overlayItem)
2394
+ if (source == overlayItem || source == overlayButton)
18372395 {
18382396 /*
18392397 Object3D obj = new BezierSurface(5,8);
....@@ -1881,10 +2439,27 @@
18812439 s.setup();
18822440 makeSomething(s);
18832441 } else
1884
- if (source == lightItem)
2442
+ if (source == lightItem || source == lightButton)
18852443 {
18862444 makeSomething(new Light());
18872445 } else
2446
+// if (source == skybox1Button ||
2447
+// source == skybox2Button ||
2448
+// source == skybox3Button ||
2449
+// source == skybox4Button ||
2450
+// source == skybox5Button ||
2451
+// source == skybox6Button ||
2452
+// source == skybox7Button ||
2453
+// source == skybox11Button ||
2454
+// source == skybox12Button ||
2455
+// source == skybox13Button ||
2456
+// source == skybox14Button ||
2457
+// source == skybox15Button ||
2458
+// source == skybox16Button ||
2459
+// source == skybox17Button)
2460
+// {
2461
+// ChangeSkybox(source);
2462
+// } else
18882463 if (source == csgItem)
18892464 {
18902465 group(new CSG());
....@@ -1931,30 +2506,30 @@
19312506
19322507 group(g);
19332508 } else
1934
- if (source == loopItem)
2509
+ if (source == loopItem || source == loopButton)
19352510 {
19362511 Composite csg = new GroupLeaf();
19372512 csg.count = 5;
19382513 group(csg);
1939
- Composite child = new cGroup();
2514
+ Composite child = new cGroup("Branch");
19402515 csg.addChild(child);
19412516 child.addChild(csg);
19422517 } else
19432518 if (source == doubleItem)
19442519 {
1945
- Composite csg = new GroupLeaf();
2520
+ Composite csg = new GroupLeaf("Fork");
19462521 csg.count = 5;
19472522 group(csg);
1948
- Composite child = new cGroup();
2523
+ Composite child = new cGroup("Branch A");
19492524 csg.addChild(child);
19502525 child.addChild(csg);
1951
- child = new cGroup();
2526
+ child = new cGroup("Branch B");
19522527 csg.addChild(child);
19532528 child.addChild(csg);
19542529 } else
19552530 if (source == tripleItem)
19562531 {
1957
- Composite csg = new GroupLeaf();
2532
+ Composite csg = new GroupLeaf("Trident");
19582533 csg.count = 4;
19592534 group(csg);
19602535 Composite child = new cGroup();
....@@ -1970,7 +2545,7 @@
19702545 if (source == computeAOItem)
19712546 {
19722547 Globals.drawMode = CameraPane.OCCLUSION;
1973
- Globals.theRenderer.repaint();
2548
+ cameraView.repaint();
19742549 } else
19752550 if (source == recompileItem)
19762551 {
....@@ -2018,15 +2593,31 @@
20182593 } else
20192594 if (source == undoButton)
20202595 {
2596
+ // Go to previous version
2597
+ //if (!Undo())
2598
+ //java.awt.Toolkit.getDefaultToolkit().beep();
20212599 Undo();
2600
+ } else
2601
+ if (source == restoreButton)
2602
+ {
2603
+ // Restore current version
2604
+ Restore();
2605
+ } else
2606
+ if (source == replaceButton)
2607
+ {
2608
+ // Overwrite current version
2609
+ Replace();
20222610 } else
20232611 if (source == redoButton)
20242612 {
2613
+ // Go to next version
20252614 Redo();
20262615 } else
20272616 if (source == saveButton)
20282617 {
2029
- Save();
2618
+ // Save a new version
2619
+ if (!Save(true))
2620
+ java.awt.Toolkit.getDefaultToolkit().beep();
20302621 } else
20312622 if (source == oneStepButton)
20322623 {
....@@ -2035,17 +2626,14 @@
20352626 } else
20362627 if (source == screenfitButton)
20372628 {
2038
- //Reload(lastConverter, lastFilename, true);
20392629 ScreenFit();
20402630 } else
20412631 if (source == screenfitpointButton)
20422632 {
2043
- //Reload(lastConverter, lastFilename, true);
20442633 ScreenFitPoint();
20452634 } else
20462635 if (source == snapobjectButton)
20472636 {
2048
- //Reload(lastConverter, lastFilename, true);
20492637 SnapObject();
20502638 } else
20512639 // if (event.getSource() == recompileButton)
....@@ -2409,7 +2997,7 @@
24092997 {
24102998 StepAll();
24112999 } else
2412
- if (source == clearItem) // || event.getSource() == clearButton)
3000
+ if (source == deleteItem) // || event.getSource() == clearButton)
24133001 {
24143002 //int indices[] = jList.getSelectedIndices();
24153003 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2421,9 +3009,9 @@
24213009 {
24223010 ClearSelection(true);
24233011 } else
2424
- if (source == grabItem)
3012
+ if (source == grabItem || source == groupButton)
24253013 {
2426
- group(new cGroup(), true);
3014
+ group(new cGroup(), false); // true);
24273015 } else
24283016 if (source == hideItem)
24293017 {
....@@ -2441,11 +3029,11 @@
24413029 {
24423030 makeSomething(new Camera());
24433031 } else
2444
- if (source == compositeItem)
3032
+ if (source == compositeItem || source == compositeButton)
24453033 {
24463034 group(new Composite());
24473035 } else
2448
- if (source == randomItem)
3036
+ if (source == switchItem || source == switchButton)
24493037 {
24503038 RandomNode random = new RandomNode();
24513039 group(random);
....@@ -2547,7 +3135,7 @@
25473135 {
25483136 group(new cLinker());
25493137 } else
2550
- if (source == textureItem)
3138
+ if (source == textureItem || source == textureButton)
25513139 {
25523140 group(new TextureNode());
25533141 } else
....@@ -2567,17 +3155,30 @@
25673155 {
25683156 CastShadow(2);
25693157 } else
2570
- if (source == ungroupItem)
3158
+ if (source == ungroupItem || source == ungroupButton)
25713159 {
2572
- //ungroup();
3160
+ boolean hasRoot = false;
3161
+
25733162 for (int i=0; i<group.selection.size(); i++)
25743163 {
2575
- Ungroup(group.selection.get(i));
3164
+ if (group.selection.get(i) == group)
3165
+ {
3166
+ hasRoot = true;
3167
+ break;
3168
+ }
25763169 }
25773170
2578
- ClearSelection(false);
2579
-
2580
- refreshContents();
3171
+ if (!hasRoot)
3172
+ {
3173
+ for (int i=0; i<group.selection.size(); i++)
3174
+ {
3175
+ Ungroup(group.selection.get(i));
3176
+ }
3177
+
3178
+ ClearSelection(false);
3179
+
3180
+ refreshContents();
3181
+ }
25813182 } else
25823183 if (source == genUVItem)
25833184 {
....@@ -2878,7 +3479,7 @@
28783479 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28793480 {
28803481 obj = (Object3D)e.nextElement();
2881
- obj.SetBumpTexture(null);
3482
+ obj.ResetBumpTexture();
28823483 }
28833484
28843485 refreshContents();
....@@ -2894,6 +3495,31 @@
28943495
28953496 refreshContents();
28963497 } else
3498
+ if (source == embedTexturesItem)
3499
+ {
3500
+ Object3D obj;
3501
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3502
+ {
3503
+ obj = (Object3D)e.nextElement();
3504
+ obj.EmbedTextures(true);
3505
+ }
3506
+
3507
+ refreshContents();
3508
+ } else
3509
+ if (source == deEmbedTexturesItem)
3510
+ {
3511
+ Object3D obj;
3512
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3513
+ {
3514
+ obj = (Object3D)e.nextElement();
3515
+ obj.EmbedTextures(false);
3516
+ }
3517
+
3518
+ CameraPane.texturepigment.clear();
3519
+ CameraPane.texturebump.clear();
3520
+
3521
+ refreshContents();
3522
+ } else
28973523 if (source == flashSelectionButton)
28983524 {
28993525 CameraPane.flash = true;
....@@ -2905,6 +3531,10 @@
29053531 if (source == twoButton)
29063532 {
29073533 radio.layout = twoButton;
3534
+
3535
+ if (CameraPane.FULLSCREEN)
3536
+ fullscreenLayout = radio.layout;
3537
+
29083538 // bug
29093539 //gridPanel.setDividerLocation(1.0);
29103540 //bigPanel.setDividerLocation(0.0);
....@@ -2960,6 +3590,9 @@
29603590 {
29613591 radio.layout = threeButton;
29623592
3593
+ if (CameraPane.FULLSCREEN)
3594
+ fullscreenLayout = radio.layout;
3595
+
29633596 // bigThree.remove(scenePanel);
29643597 // bigThree.remove(centralPanel);
29653598 // bigThree.remove(XYZPanel);
....@@ -2988,8 +3621,8 @@
29883621 // centralPanel.setVisible(true);
29893622 // XYZPanel.setVisible(true);
29903623 bigThree.ClearUI();
3624
+ bigThree.add(scenePanel);
29913625 bigThree.add(centralPanel);
2992
- bigThree.add(XYZPanel);
29933626 bigThree.FlushUI();
29943627
29953628 cameraView.requestFocusInWindow();
....@@ -2997,6 +3630,9 @@
29973630 if (source == fourButton)
29983631 {
29993632 radio.layout = fourButton;
3633
+
3634
+ if (CameraPane.FULLSCREEN)
3635
+ fullscreenLayout = radio.layout;
30003636
30013637 // bigThree.remove(scenePanel);
30023638 // bigThree.remove(centralPanel);
....@@ -3035,6 +3671,9 @@
30353671 {
30363672 radio.layout = sixButton;
30373673
3674
+ if (CameraPane.FULLSCREEN)
3675
+ fullscreenLayout = radio.layout;
3676
+
30383677 // bigThree.remove(scenePanel);
30393678 // bigThree.remove(centralPanel);
30403679 // bigThree.remove(XYZPanel);
....@@ -3063,8 +3702,8 @@
30633702 // centralPanel.setVisible(true);
30643703 // XYZPanel.setVisible(false);
30653704 bigThree.ClearUI();
3066
- bigThree.add(scenePanel);
30673705 bigThree.add(centralPanel);
3706
+ bigThree.add(scenePanel);
30683707 bigThree.FlushUI();
30693708
30703709 cameraView.requestFocusInWindow();
....@@ -3072,6 +3711,9 @@
30723711 if (source == sevenButton)
30733712 {
30743713 radio.layout = sevenButton;
3714
+
3715
+ if (CameraPane.FULLSCREEN)
3716
+ fullscreenLayout = radio.layout;
30753717
30763718 // bigThree.remove(scenePanel);
30773719 // bigThree.remove(centralPanel);
....@@ -3128,12 +3770,19 @@
31283770 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
31293771 {
31303772 ab = (cRadio)e.nextElement();
3131
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3773
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
31323774 {
3775
+ // Patch to avoid bug with transparency.
3776
+ if (!ab.hadMaterial)
3777
+ {
3778
+ ab.object.material = null;
3779
+ }
3780
+
31333781 buttonGroup.remove(ab);
31343782 radioPanel.remove(ab);
31353783
3136
- ab.GetObject().editWindow = null;
3784
+ //ab.GetObject().editWindow = null;
3785
+ ab.GetObject().manipWindow = null;
31373786 // ab.GetObject().objectUI = null; // ?????????
31383787
31393788 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3146,6 +3795,12 @@
31463795 } else
31473796 if (source == editItem || source == editButton)
31483797 {
3798
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3799
+ {
3800
+ Object3D child = (Object3D)e.nextElement();
3801
+ child.pinned = true;
3802
+ }
3803
+
31493804 EditSelection(false);
31503805 } else
31513806 if (source == uneditButton)
....@@ -3155,6 +3810,7 @@
31553810 Object3D child = (Object3D)e.nextElement();
31563811 if(child.editWindow != null)
31573812 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3813
+ child.pinned = false;
31583814 child.CloseUI();
31593815 listUI.remove(child);
31603816
....@@ -3171,6 +3827,7 @@
31713827 //copy.ClearUI();
31723828 for (Object3D obj : listUI)
31733829 {
3830
+ obj.pinned = false;
31743831 obj.CloseUI();
31753832 }
31763833 listUI.clear();
....@@ -3180,7 +3837,7 @@
31803837 {
31813838 assert(copy == group);
31823839
3183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3840
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31843841
31853842 for (Object3D obj : listUI)
31863843 {
....@@ -3229,6 +3886,9 @@
32293886 }
32303887
32313888 copy = group;
3889
+
3890
+ SetUndoStates();
3891
+
32323892 //Globals.theRenderer.object = group;
32333893 if(!useclient)
32343894 {
....@@ -3247,6 +3907,7 @@
32473907
32483908 // fix "+" issue
32493909 //group.editWindow = this;
3910
+ group.manipWindow = this;
32503911
32513912 /*
32523913 currentLayout = radio.layout;
....@@ -3254,6 +3915,13 @@
32543915 currentLayout = sevenButton;
32553916 */
32563917 radio.layout.doClick();
3918
+
3919
+ ClearUnpinned();
3920
+ //Grafreed.Assert(group != null);
3921
+ //Grafreed.Assert(group.selection != null);
3922
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3923
+ if (group.selection == null || group.selection.size() == 1)
3924
+ EditSelection(false);
32573925 keepparent = group.parent;
32583926 // PARENT = NULL or not???
32593927 //group.parent = null; // ROOT
....@@ -3267,7 +3935,7 @@
32673935 cameraView.ProtectCamera();
32683936 cameraView.repaint();
32693937 return;
3270
- } else if (event.getSource() == revertCameraItem)
3938
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32713939 {
32723940 cameraView.RevertCamera();
32733941 cameraView.repaint();
....@@ -3846,7 +4514,7 @@
38464514
38474515 try
38484516 {
3849
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4517
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
38504518 }
38514519 catch (Exception e)
38524520 {
....@@ -4321,28 +4989,25 @@
43214989 // }
43224990 // }
43234991
4324
- static boolean allparams = true;
4325
-
4326
- static Vector<Object3D> listUI = new Vector<Object3D>();
4327
-
43284992 void EditSelection(boolean newWindow)
43294993 {
4994
+ if (group.selection == null)
4995
+ {
4996
+ EditElement(group, newWindow); // ? new
4997
+ return;
4998
+ }
4999
+
43305000 // aConstraints.gridy = 0;
43315001 for (int i=0; i<group.selection.size(); i++)
43325002 {
43335003 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43345004 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4335
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5005
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43365006
43375007 Object3D elem = (Object3D)group.selection.elementAt(i);
43385008 if(elem != group || !newWindow)
43395009 {
4340
- // if (!(elem instanceof Composite))
4341
- // newWindow = false;
4342
- listUI.add(elem);
4343
- elem.openEditWindow(this, newWindow); //, false);
4344
- System.out.println("edit : " + elem);
4345
- elem.editWindow.refreshContents(true); // ? new
5010
+ EditElement(elem, newWindow); // ? new
43465011 }
43475012 }
43485013 }
....@@ -4417,7 +5082,8 @@
44175082 //new Exception().printStackTrace();
44185083
44195084 freezemodel = true;
4420
-
5085
+ ClearUnpinned();
5086
+
44215087 /**/
44225088 //switch (event.id)
44235089 {
....@@ -4450,7 +5116,7 @@
44505116 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
44515117 // a camera
44525118 {
4453
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5119
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
44545120 {
44555121 CameraPane.camerachangeframe = 0; // don't refuse it
44565122 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4459,6 +5125,13 @@
44595125 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
44605126 }
44615127
5128
+ if (tps != null && tps.length == 1)
5129
+ {
5130
+ EditSelection(false);
5131
+ }
5132
+
5133
+ SetPinStates(tps != null && tps.length > 0);
5134
+
44625135 refreshContents();
44635136 //return true;
44645137 }
....@@ -4468,9 +5141,18 @@
44685141 freezemodel = false;
44695142 }
44705143
5144
+ void SetPinStates(boolean enabled)
5145
+ {
5146
+ editButton.setEnabled(enabled);
5147
+ uneditButton.setEnabled(enabled);
5148
+ unselectButton.setEnabled(enabled);
5149
+ flashSelectionButton.setEnabled(enabled);
5150
+ }
5151
+
44715152 void refreshContents(boolean cp)
44725153 {
4473
- if (!Globals.MOUSEDRAGGED)
5154
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5155
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44745156 {
44755157 objEditor.ClearInfo(); // .GetMaterial());
44765158
....@@ -4569,7 +5251,8 @@
45695251
45705252 if (cut)
45715253 {
4572
- Save();
5254
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5255
+// Save();
45735256 //int indices[] = jList.getSelectedIndices();
45745257 //for (int i = indices.length - 1; i >= 0; i--)
45755258 //jList.remove(indices[i]);
....@@ -4672,6 +5355,10 @@
46725355
46735356 void paste(boolean expand)
46745357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
46755362 // if (GrafreeD.clipboard == null)
46765363 // return;
46775364 boolean first = true;
....@@ -4731,6 +5418,7 @@
47315418 Grafreed.clipboard.get(0).parent = keepparent;
47325419 }
47335420
5421
+ Globals.REPLACEONMAKE = keep;
47345422 ResetModel();
47355423 refreshContents();
47365424 }
....@@ -4866,6 +5554,10 @@
48665554
48675555 void group(Object3D csg, boolean grab)
48685556 {
5557
+ if (Globals.REPLACEONMAKE)
5558
+ Save();
5559
+ boolean keep = Globals.REPLACEONMAKE;
5560
+ Globals.REPLACEONMAKE = false;
48695561 if (//false) // why??
48705562 !group.selection.isEmpty())
48715563 {
....@@ -4979,10 +5671,15 @@
49795671 //node.add(csg);
49805672 //makeSomething(node);
49815673 makeSomething(csg);
5674
+ Globals.REPLACEONMAKE = keep;
49825675 }
49835676
49845677 void Ungroup(Object3D g)
49855678 {
5679
+ if (Globals.REPLACEONMAKE)
5680
+ Save();
5681
+ boolean keep = Globals.REPLACEONMAKE;
5682
+ Globals.REPLACEONMAKE = false;
49865683 if (g instanceof HiddenObject)
49875684 {
49885685 HiddenObject h = (HiddenObject) g;
....@@ -4999,6 +5696,7 @@
49995696 objEditor.makeSomething(g.get(i), false);
50005697 }
50015698 }
5699
+ Globals.REPLACEONMAKE = keep;
50025700 }
50035701
50045702 void ungroup()
....@@ -5287,13 +5985,44 @@
52875985 cButton clearpanelButton;
52885986 cButton unselectButton;
52895987
5290
- cButton minButton;
5291
- cButton maxButton;
5292
- cButton fullButton;
5293
- cButton undoButton;
5294
- cButton redoButton;
5988
+ cButton restoreCameraButton;
5989
+
52955990 cButton saveButton;
52965991 cButton oneStepButton;
5992
+
5993
+ cButton groupButton;
5994
+ cButton ungroupButton;
5995
+ cButton compositeButton;
5996
+ cButton switchButton;
5997
+ cButton loopButton;
5998
+ cButton textureButton;
5999
+
6000
+ cButton skybox1Button;
6001
+ cButton skybox2Button;
6002
+ cButton skybox3Button;
6003
+ cButton skybox4Button;
6004
+ cButton skybox5Button;
6005
+ cButton skybox6Button;
6006
+ cButton skybox7Button;
6007
+
6008
+ cButton skybox11Button;
6009
+ cButton skybox12Button;
6010
+ cButton skybox13Button;
6011
+ cButton skybox14Button;
6012
+ cButton skybox15Button;
6013
+ cButton skybox16Button;
6014
+ cButton skybox17Button;
6015
+
6016
+ cButton gridButton;
6017
+ cButton boxButton;
6018
+ cButton sphereButton;
6019
+ cButton coneButton;
6020
+ cButton torusButton;
6021
+ cButton superButton;
6022
+ cButton kleinButton;
6023
+ cButton particlesButton;
6024
+ cButton overlayButton;
6025
+ cButton lightButton;
52976026
52986027 cButton screenfitButton;
52996028 cButton screenfitpointButton;
....@@ -5315,11 +6044,11 @@
53156044 //JTree jTree;
53166045 private MenuItem lookAtItem;
53176046 private MenuItem lookFromItem;
5318
- private MenuItem switchItem;
6047
+ private MenuItem switchViewItem;
53196048 private MenuItem cutItem;
53206049 private MenuItem undoItem;
53216050 private MenuItem redoItem;
5322
- private MenuItem duplicateItem;
6051
+ private JMenuItem duplicateItem;
53236052 private MenuItem cloneItem;
53246053 private MenuItem cloneSupportItem;
53256054 private MenuItem overwriteGeoItem;
....@@ -5347,7 +6076,7 @@
53476076 private MenuItem pasteLinkItem;
53486077 private MenuItem pasteCloneItem;
53496078 private MenuItem pasteExpandItem;
5350
- private MenuItem clearItem;
6079
+ private MenuItem deleteItem;
53516080 private MenuItem clearAllItem;
53526081 private MenuItem genUVItem;
53536082 private MenuItem genNormalsMESHItem;
....@@ -5407,7 +6136,7 @@
54076136 private MenuItem frontItem;
54086137 private MenuItem cameraItem;
54096138 private MenuItem compositeItem;
5410
- private MenuItem randomItem;
6139
+ private MenuItem switchItem;
54116140 private MenuItem physicsItem;
54126141 private MenuItem frameselectorItem;
54136142 private MenuItem scriptNodeItem;
....@@ -5431,6 +6160,8 @@
54316160 private MenuItem attachBumpItem;
54326161 private MenuItem detachBumpItem;
54336162 private MenuItem pigmentBumpItem;
6163
+ private MenuItem embedTexturesItem;
6164
+ private MenuItem deEmbedTexturesItem;
54346165
54356166 private MenuItem particleItem;
54366167 private MenuItem ragdollItem;
....@@ -5481,5 +6212,5 @@
54816212
54826213 Menu cameraMenu;
54836214 MenuItem editCameraItem;
5484
- MenuItem revertCameraItem;
6215
+ MenuItem restoreCameraItem;
54856216 }