Normand Briere
2019-08-07 59de607850161a26863f92961d53caae7a2dabc8
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -23,6 +24,314 @@
2324 DragGestureListener, DragSourceListener, DropTargetListener,
2425 ItemListener // ListSelectionListener
2526 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(s);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
45
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
46
+ {
47
+ cGridBag tab0 = new cGridBag().setVertical(true);
48
+
49
+ tab0.setName("Urban");
50
+ skyboxpanel.add(tab0);
51
+
52
+ cGridBag row0 = new cGridBag();
53
+ cGridBag row1 = new cGridBag();
54
+ cGridBag row2 = new cGridBag();
55
+ cGridBag row3 = new cGridBag();
56
+ cGridBag row4 = new cGridBag();
57
+ cGridBag row5 = new cGridBag();
58
+ cGridBag row6 = new cGridBag();
59
+
60
+ AddSkyboxButton("default", "rgb", row0);
61
+ //AddSkyboxButton("default", "cornell", row0);
62
+ AddSkyboxButton("penguins", "dust", row0);
63
+ AddSkyboxButton("penguins", "tropic", row0);
64
+ AddSkyboxButton("penguins", "yonder", row0);
65
+
66
+ AddSkyboxButton("default", "uffizi", row1);
67
+ AddSkyboxButton("bridge", "Bridge", row1);
68
+ AddSkyboxButton("bridge", "Bridge2", row1);
69
+ AddSkyboxButton("urban", "GamlaStan2", row1);
70
+
71
+ AddSkyboxButton("urban", "Parliament", row2);
72
+ AddSkyboxButton("urban", "Roundabout", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
74
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
75
+
76
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
77
+ AddSkyboxButton("urban", "UnionSquare", row3);
78
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
79
+ AddSkyboxButton("park", "BerzeliiPark", row3);
80
+
81
+ AddSkyboxButton("park", "Buddha", row4);
82
+ AddSkyboxButton("park", "CNTower2", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
84
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
85
+
86
+ AddSkyboxButton("park", "Park", row5);
87
+ AddSkyboxButton("park", "Pond", row5);
88
+ AddSkyboxButton("park", "Skansen", row5);
89
+ AddSkyboxButton("park", "Skansen2", row5);
90
+
91
+ AddSkyboxButton("park", "Skansen3", row6);
92
+ AddSkyboxButton("park", "Skansen4", row6);
93
+ AddSkyboxButton("park", "Skansen5", row6);
94
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
95
+
96
+ tab0.add(row0);
97
+ tab0.add(row1);
98
+ tab0.add(row2);
99
+ tab0.add(row3);
100
+ tab0.add(row4);
101
+ tab0.add(row5);
102
+ tab0.add(row6);
103
+
104
+ for (int i=5; --i>=0;)
105
+ {
106
+ //oe.toolboxPanel.Return();
107
+ //tab0.add(new cGridBag());
108
+ }
109
+ }
110
+
111
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
112
+ {
113
+ cGridBag tab0 = new cGridBag().setVertical(true);
114
+
115
+ tab0.setName("Nature");
116
+ skyboxpanel.add(tab0);
117
+
118
+ cGridBag row0 = new cGridBag();
119
+ cGridBag row1 = new cGridBag();
120
+ cGridBag row2 = new cGridBag();
121
+ cGridBag row3 = new cGridBag();
122
+ cGridBag row4 = new cGridBag();
123
+ cGridBag row5 = new cGridBag();
124
+ cGridBag row6 = new cGridBag();
125
+
126
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
127
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
128
+ AddSkyboxButton("beach", "PalmTrees", row0);
129
+ AddSkyboxButton("beach", "Tenerife", row0);
130
+
131
+ AddSkyboxButton("beach", "Tenerife2", row1);
132
+ AddSkyboxButton("beach", "Tenerife3", row1);
133
+ AddSkyboxButton("field", "FishPond", row1);
134
+ AddSkyboxButton("field", "Footballfield", row1);
135
+
136
+ AddSkyboxButton("field", "Meadow", row2);
137
+ AddSkyboxButton("field", "Sorsele", row2);
138
+ AddSkyboxButton("field", "Sorsele2", row2);
139
+ AddSkyboxButton("field", "Sorsele3", row2);
140
+
141
+ AddSkyboxButton("forest", "Brudslojan", row3);
142
+ AddSkyboxButton("forest", "Langholmen2", row3);
143
+ AddSkyboxButton("forest", "Plants", row3);
144
+ AddSkyboxButton("mountain", "Maskonaive", row3);
145
+
146
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
147
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("park", "Stairs", row5);
152
+ AddSkyboxButton("default", "skycube", row6);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+
156
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "MountainTrail", row6);
160
+ /*
161
+Autumn
162
+Greenlands
163
+MountainTrail
164
+Oasis
165
+TheRock
166
+TopOfTheWorld
167
+Winter
168
+ */
169
+
170
+ tab0.add(row0);
171
+ tab0.add(row1);
172
+ tab0.add(row2);
173
+ tab0.add(row3);
174
+ tab0.add(row4);
175
+ tab0.add(row5);
176
+ tab0.add(row6);
177
+
178
+ for (int i=5; --i>=0;)
179
+ {
180
+ //oe.toolboxPanel.Return();
181
+ //tab0.add(new cGridBag());
182
+ }
183
+ }
184
+
185
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
186
+ {
187
+ cGridBag tab0 = new cGridBag().setVertical(true);
188
+
189
+ tab0.setName("Night");
190
+ skyboxpanel.add(tab0);
191
+
192
+ cGridBag row0 = new cGridBag();
193
+ cGridBag row1 = new cGridBag();
194
+ cGridBag row2 = new cGridBag();
195
+ cGridBag row3 = new cGridBag();
196
+ cGridBag row4 = new cGridBag();
197
+ cGridBag row5 = new cGridBag();
198
+ cGridBag row6 = new cGridBag();
199
+
200
+ AddSkyboxButton("night", "NightPath", row0);
201
+ AddSkyboxButton("night", "PondNight", row0);
202
+ AddSkyboxButton("night", "Powerlines", row0);
203
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
204
+
205
+ AddSkyboxButton("urban", "CNTower", row1);
206
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
207
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
208
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
209
+
210
+ AddSkyboxButton("penguins", "kenon_star", row2);
211
+ AddSkyboxButton("persson", "corona", row2);
212
+ AddSkyboxButton("persson", "spaceskybox", row2);
213
+ AddSkyboxButton("indoors", "Vasa", row2);
214
+
215
+ AddSkyboxButton("winter", "Backyard", row3);
216
+ AddSkyboxButton("winter", "Creek", row3);
217
+ AddSkyboxButton("winter", "FootballField3", row3);
218
+ AddSkyboxButton("winter", "Forest", row3);
219
+
220
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
221
+ AddSkyboxButton("winter", "House", row4);
222
+ AddSkyboxButton("winter", "IceLake", row4);
223
+ AddSkyboxButton("winter", "IceRiver", row4);
224
+
225
+ AddSkyboxButton("winter", "Park3", row5);
226
+ AddSkyboxButton("winter", "PondWinter", row5);
227
+ AddSkyboxButton("winter", "Tantolunden5", row5);
228
+ AddSkyboxButton("winter", "Vindelalven", row5);
229
+
230
+ AddSkyboxButton("daz", "TheRock", row6);
231
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
232
+ AddSkyboxButton("daz", "Winter", row6);
233
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
234
+
235
+ tab0.add(row0);
236
+ tab0.add(row1);
237
+ tab0.add(row2);
238
+ tab0.add(row3);
239
+ tab0.add(row4);
240
+ tab0.add(row5);
241
+ tab0.add(row6);
242
+
243
+ for (int i=5; --i>=0;)
244
+ {
245
+ //oe.toolboxPanel.Return();
246
+ //tab0.add(new cGridBag());
247
+ }
248
+ }
249
+
250
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
251
+ {
252
+ cGridBag tab0 = new cGridBag().setVertical(true);
253
+
254
+ tab0.setName("Others");
255
+ skyboxpanel.add(tab0);
256
+
257
+ cGridBag row0 = new cGridBag();
258
+ cGridBag row1 = new cGridBag();
259
+ cGridBag row2 = new cGridBag();
260
+ cGridBag row3 = new cGridBag();
261
+ cGridBag row4 = new cGridBag();
262
+ cGridBag row5 = new cGridBag();
263
+ cGridBag row6 = new cGridBag();
264
+
265
+ AddSkyboxButton("mayhem", "afterrain", row0);
266
+ AddSkyboxButton("mayhem", "aqua4", row0);
267
+ AddSkyboxButton("mayhem", "aqua9", row0);
268
+ AddSkyboxButton("mayhem", "flame", row0);
269
+
270
+ AddSkyboxButton("mayhem", "h2s", row1);
271
+ AddSkyboxButton("mayhem", "prehistoric", row1);
272
+ AddSkyboxButton("mayhem", "scorched", row1);
273
+ AddSkyboxButton("penguins", "desertdawn", row1);
274
+
275
+ AddSkyboxButton("persson", "Citadella", row2);
276
+ AddSkyboxButton("persson", "Citadella2", row2);
277
+ AddSkyboxButton("persson", "clouds1", row2);
278
+ AddSkyboxButton("penguins", "wrath", row2);
279
+
280
+ AddSkyboxButton("persson", "FishermansBastion", row3);
281
+ AddSkyboxButton("persson", "HeroesSquare", row3);
282
+ AddSkyboxButton("indoors", "DallasW", row3);
283
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
284
+
285
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
286
+ AddSkyboxButton("persson", "PereaBeach1", row4);
287
+ AddSkyboxButton("persson", "PereaBeach2", row4);
288
+ AddSkyboxButton("persson", "redeclipse", row4);
289
+
290
+ AddSkyboxButton("daz", "Greenlands", row5);
291
+ AddSkyboxButton("daz", "Oasis", row5);
292
+ AddSkyboxButton("elyvisions", "arch3", row5);
293
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
294
+
295
+ AddSkyboxButton("elyvisions", "rainbow", row6);
296
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
297
+ AddSkyboxButton("elyvisions", "heaven", row6);
298
+ AddSkyboxButton("elyvisions", "hot", row6);
299
+
300
+ tab0.add(row0);
301
+ tab0.add(row1);
302
+ tab0.add(row2);
303
+ tab0.add(row3);
304
+ tab0.add(row4);
305
+ tab0.add(row5);
306
+ tab0.add(row6);
307
+
308
+ for (int i=5; --i>=0;)
309
+ {
310
+ //oe.toolboxPanel.Return();
311
+ //tab0.add(new cGridBag());
312
+ }
313
+ }
314
+
315
+ public void CallBack(String[] path)
316
+ {
317
+ for (int i = 0; i < path.length; i++)
318
+ {
319
+ System.out.print(path[i] + "/");
320
+ }
321
+
322
+ System.out.println();
323
+ }
324
+
325
+ public void ChangeSkybox(String skybox)
326
+ {
327
+ //cameraView.envyoff = false;
328
+ group.skyboxname = skybox;
329
+ group.skyboxext = "jpg";
330
+ cameraView.repaint();
331
+
332
+ Grafreed.ParseResources("textures", this);
333
+ }
334
+
26335 //ObjEditor objEditor;
27336 public void closeUI2()
28337 {
....@@ -60,6 +369,12 @@
60369 this.copy = this.group = group;
61370 //selectees = this.group.selectees;
62371
372
+ if (copy.versionlist == null)
373
+ {
374
+ copy.versionlist = new Object3D[100];
375
+ copy.versionindex = -1;
376
+ }
377
+
63378 if(ui)
64379 SetupUI(objEditor);
65380 }
....@@ -80,10 +395,22 @@
80395 SetupViews(objEditor);
81396
82397 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
398
+
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+
404
+ Save(true);
405
+ }
83406 }
84407
85408 void CloneSelection(boolean supports)
86409 {
410
+ if (Globals.REPLACEONMAKE)
411
+ Save();
412
+ boolean keep = Globals.REPLACEONMAKE;
413
+ Globals.REPLACEONMAKE = false;
87414 // Object3D keep = GrafreeD.clipboard;
88415 //Object3D obj;
89416 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +421,7 @@
94421
95422 makeSomething(clone, i==group.selection.size()-1);
96423 }
424
+ Globals.REPLACEONMAKE = keep;
97425 }
98426
99427 void CloneClipboard(boolean supports)
....@@ -189,8 +517,8 @@
189517 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190518 // pasteExpandItem.addActionListener(this);
191519 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
520
+ deleteItem = menu.add(new MenuItem("Delete"));
521
+ deleteItem.addActionListener(this);
194522
195523 if (Globals.ADVANCED)
196524 {
....@@ -220,7 +548,7 @@
220548 // toggleSwitchItem.addItemListener(this);
221549 // toggleSwitchItem.setState(CameraPane.SWITCH);
222550
223
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
551
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224552 toggleHandleItem.addItemListener(this);
225553 toggleHandleItem.setState(CameraPane.HANDLES);
226554
....@@ -380,13 +708,14 @@
380708 shadowYItem.addActionListener(this);
381709 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382710 shadowZItem.addActionListener(this);
711
+ attributeItem = menu.add(new MenuItem("Attribute"));
712
+ attributeItem.addActionListener(this);
713
+
383714 if (Globals.ADVANCED)
384715 {
385716 menu.add("-");
386717 linkerItem = menu.add(new MenuItem("Linker"));
387718 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390719 templateItem = menu.add(new MenuItem("Template"));
391720 templateItem.addActionListener(this);
392721 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -415,7 +744,7 @@
415744 genNormalsMESHItem.addActionListener(this);
416745 if (Globals.ADVANCED)
417746 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
747
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419748 genNormalsMINEItem.addActionListener(this);
420749 }
421750 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -508,10 +837,15 @@
508837 attachBumpItem.addActionListener(this);
509838 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
510839 pigmentBumpItem.addActionListener(this);
840
+ //embedTexturesItem
511841 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
512842 detachPigmentItem.addActionListener(this);
513843 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
514844 detachBumpItem.addActionListener(this);
845
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
846
+ embedTexturesItem.addActionListener(this);
847
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
848
+ deEmbedTexturesItem.addActionListener(this);
515849 menu.add("-");
516850 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
517851 sortbysizeItem.addActionListener(this);
....@@ -538,6 +872,7 @@
538872 buildToolsMenu(menu);
539873 }
540874
875
+
541876 void SetupUI2(ObjEditor oe)
542877 {
543878 // June 2019
....@@ -590,48 +925,70 @@
590925 //minButton.setToolTipText("Minimize window");
591926 //minButton.addActionListener(this);
592927
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
928
+ if (Globals.ADVANCED)
929
+ {
930
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ maxButton.setToolTipText("Maximize window");
932
+ maxButton.addActionListener(this);
933
+ }
596934
597935 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598936 fullButton.setToolTipText("Full-screen window");
599937 fullButton.addActionListener(this);
600938
939
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
940
+ screenfitButton.setToolTipText("Screen fit");
941
+ screenfitButton.addActionListener(this);
942
+
601943 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602944 restoreCameraButton.setToolTipText("Restore viewpoint");
603945 restoreCameraButton.addActionListener(this);
604946
605
- copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606
- undoButton.setToolTipText("Undo changes");
607
- undoButton.addActionListener(this);
947
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
948
+ saveVersionButton.setToolTipText("Duplicate current version");
949
+ saveVersionButton.addActionListener(this);
950
+
951
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
952
+ deleteVersionButton.setToolTipText("Delete current version");
953
+ deleteVersionButton.addActionListener(this);
954
+
955
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
956
+ previousVersionButton.setToolTipText("Previous version");
957
+ previousVersionButton.addActionListener(this);
958
+ previousVersionButton.setEnabled(false);
608959
609
- copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
610
- redoButton.setToolTipText("Redo changes");
611
- redoButton.addActionListener(this);
960
+ cGridBag updown = new cGridBag().setVertical(true);
961
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
962
+ restoreButton.setToolTipText("Undo (restore current version)");
963
+ restoreButton.addActionListener(this);
964
+ //restoreButton.setEnabled(false);
612965
613
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
- saveButton.setToolTipText("Save changes");
615
- saveButton.addActionListener(this);
966
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ replaceButton.setToolTipText("Save (replace current version)");
968
+ replaceButton.addActionListener(this);
969
+ //replaceButton.setEnabled(false);
616970
617
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
971
+ copyOptionsPanel.add(updown);
972
+
973
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
974
+ nextVersionButton.setToolTipText("Next version");
975
+ nextVersionButton.addActionListener(this);
976
+ nextVersionButton.setEnabled(false);
977
+
978
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
618979 liveCB.setToolTipText("Enable animation");
619980 liveCB.addItemListener(this);
620981
621
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
982
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
622983 oneStepButton.setToolTipText("Animate one step forward");
623984 oneStepButton.addActionListener(this);
624985
625
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
986
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
626987 fastCB.setToolTipText("Fast mode");
627988 fastCB.addItemListener(this);
628989
629990 //oe.toolboxPanel.Return();
630991
631
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
- screenfitButton.setToolTipText("Screen fit");
633
- screenfitButton.addActionListener(this);
634
-
635992 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
636993 // trackCB.setToolTipText("Enable tracking");
637994 // trackCB.addItemListener(this);
....@@ -644,31 +1001,32 @@
6441001 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6451002 snapobjectButton.addActionListener(this);
6461003 snapobjectButton.setToolTipText("Snap Object");
1004
+
1005
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ fourButton.addActionListener(this);
1007
+ fourButton.setToolTipText("Show control panel only");
6471008 }
6481009
6491010 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
6501011
651
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
- twoButton.setToolTipText("Show center view only");
1012
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ twoButton.setToolTipText("Show 3D view only");
6531014 twoButton.addActionListener(this);
6541015 this.fullscreenLayout = twoButton;
6551016
656
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- fourButton.addActionListener(this);
658
- fourButton.setToolTipText("Show left panel only");
659
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
- sixButton.setToolTipText("2-column layout left");
661
- sixButton.addActionListener(this);
662
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
- threeButton.setToolTipText("2-column layout right");
1017
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ threeButton.setToolTipText("Show controls and 3D view");
6641019 threeButton.addActionListener(this);
665
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
666
- sevenButton.setToolTipText("3-column layout");
667
- sevenButton.addActionListener(this);
1020
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
+ sixButton.setToolTipText("Show 3D view and controls");
1022
+ sixButton.addActionListener(this);
1023
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
+// sevenButton.setToolTipText("3-column layout");
1025
+// sevenButton.addActionListener(this);
6681026 //
6691027
670
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- rootButton.setToolTipText("Edit selection in new tab");
1028
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ rootButton.setToolTipText("Open selection in new tab");
6721030 rootButton.addActionListener(this);
6731031
6741032 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -677,28 +1035,30 @@
6771035 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6781036 //clearButton.addActionListener(this);
6791037
1038
+ cGridBag row1 = new cGridBag();
1039
+
6801040 // INSERT
681
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6821042 gridButton.setToolTipText("Create grid");
6831043 gridButton.addActionListener(this);
6841044
685
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6861046 boxButton.setToolTipText("Create box");
6871047 boxButton.addActionListener(this);
6881048
689
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6901050 sphereButton.setToolTipText("Create sphere");
6911051 sphereButton.addActionListener(this);
6921052
693
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1053
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6941054 coneButton.setToolTipText("Create cone");
6951055 coneButton.addActionListener(this);
6961056
697
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1057
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6981058 torusButton.setToolTipText("Create torus");
6991059 torusButton.addActionListener(this);
7001060
701
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7021062 superButton.setToolTipText("Create superellipsoid");
7031063 superButton.addActionListener(this);
7041064
....@@ -709,60 +1069,78 @@
7091069 kleinButton.addActionListener(this);
7101070 }
7111071
712
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7131073 particlesButton.setToolTipText("Create particle system");
7141074 particlesButton.addActionListener(this);
7151075
716
- oe.toolboxPanel.Return();
1076
+ oe.toolboxPanel.add(row1);
7171077
718
- oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1078
+ cGridBag row2 = new cGridBag();
1079
+
1080
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7191081 groupButton.setToolTipText("Create group");
7201082 groupButton.addActionListener(this);
7211083
722
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7231085 compositeButton.setToolTipText("Create composite");
7241086 compositeButton.addActionListener(this);
7251087
726
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
- switchButton.setToolTipText("Create switch");
1088
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ switchButton.setToolTipText("Create item switcher");
7281090 switchButton.addActionListener(this);
7291091
730
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7311093 loopButton.setToolTipText("Create loop");
7321094 loopButton.addActionListener(this);
7331095
734
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7351097 textureButton.setToolTipText("Create texture");
7361098 textureButton.addActionListener(this);
7371099
738
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7391101 overlayButton.setToolTipText("Create overlay");
7401102 overlayButton.addActionListener(this);
7411103
742
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1104
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7431105 lightButton.setToolTipText("Create light");
7441106 lightButton.addActionListener(this);
7451107
1108
+ oe.toolboxPanel.add(row2);
1109
+
1110
+ // ENVYMAPS
1111
+ cGridBag skyboxpane = new cGridBag();
1112
+ skyboxpane.preferredHeight = 100;
1113
+
1114
+ oe.skyboxPanel.add(skyboxpane);
1115
+
1116
+ JTabbedPane skyboxpanel = new JTabbedPane();
1117
+ skyboxpane.add(skyboxpanel);
1118
+
1119
+ AddSkyboxTab0(skyboxpanel);
1120
+ AddSkyboxTab1(skyboxpanel);
1121
+ AddSkyboxTab2(skyboxpanel);
1122
+ AddSkyboxTab3(skyboxpanel);
1123
+
7461124 // EDIT panel
747
- editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
- editButton.setToolTipText("Edit selection");
1125
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1126
+ editButton.setToolTipText("Pin selection controls");
7491127 editButton.addActionListener(this);
7501128
751
- editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
752
- uneditButton.setToolTipText("Unedit selection");
1129
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1130
+ uneditButton.setToolTipText("Unpin and remove selection controls");
7531131 uneditButton.addActionListener(this);
7541132
7551133 editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
756
- allParamsButton.setToolTipText("Edit all params");
1134
+ allParamsButton.setToolTipText("Show all controle");
7571135 allParamsButton.addActionListener(this);
7581136
759
- editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1137
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7601138 clearPanelButton.setToolTipText("Clear edit panel");
7611139 clearPanelButton.addActionListener(this);
7621140
763
- editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
- unselectButton.setToolTipText("Unselect");
765
- unselectButton.addActionListener(this);
1141
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1142
+ //unselectButton.setToolTipText("Unselect");
1143
+ //unselectButton.addActionListener(this);
7661144
7671145 editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7681146 flashSelectionButton.setToolTipText("Highlight selection");
....@@ -770,6 +1148,7 @@
7701148
7711149 editCommandsPanel.preferredHeight = 1;
7721150
1151
+ SetPinStates(false);
7731152 // oe.treePanel.add(commandsPanel);
7741153 // oe.treePanel.Return();
7751154
....@@ -796,9 +1175,12 @@
7961175
7971176 oe.treePanel.add(copyOptionsPanel);
7981177 oe.treePanel.Return();
1178
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1179
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1180
+ sliderPane.preferredHeight = 1;
7991181
800
-// mainPanel.setDividerLocation(0.5); //1.0);
801
-// mainPanel.setResizeWeight(0.5);
1182
+// mainPanel.setDividerLocation(0.1); //1.0);
1183
+ mainPanel.setResizeWeight(0.4);
8021184
8031185 //jList.addListSelectionListener(this);
8041186 oe.jTree.addTreeSelectionListener(this);
....@@ -806,7 +1188,7 @@
8061188 //jTree.setEditable(true);
8071189 oe.jTree.setDragEnabled(true);
8081190 //jTree.setPreferredSize(new Dimension(10,10));
809
- jSP.setPreferredSize(new Dimension(100,200));
1191
+ //jSP.setPreferredSize(new Dimension(100,200));
8101192
8111193 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
8121194
....@@ -818,7 +1200,7 @@
8181200 dgr.addDragGestureListener(this);
8191201 }catch(Exception e) {}
8201202 */
821
- radio.layout = sevenButton;
1203
+ radio.layout = threeButton; // sixButton;
8221204 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8231205 }
8241206
....@@ -843,14 +1225,18 @@
8431225 boxCB.addItemListener(this);
8441226
8451227 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
846
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1228
+ zoomBoxCB.setToolTipText("Display only for wheel");
8471229 zoomBoxCB.addItemListener(this);
8481230
8491231 if (true) // Globals.ADVANCED)
8501232 {
851
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
852
- supportCB.setToolTipText("Enable rigging");
853
- supportCB.addItemListener(this);
1233
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1234
+// supportCB.setToolTipText("Enable rigging");
1235
+// supportCB.addItemListener(this);
1236
+
1237
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1238
+ freezeCB.setToolTipText("Fast moving camera");
1239
+ freezeCB.addItemListener(this);
8541240
8551241 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
8561242 // localCB.addItemListener(this);
....@@ -865,9 +1251,12 @@
8651251 smoothCB.setToolTipText("Snapping delay");
8661252 smoothCB.addItemListener(this);
8671253
868
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
869
- slowCB.setToolTipText("Smooth interpolation");
870
- slowCB.addItemListener(this);
1254
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1255
+// slowCB.setToolTipText("Smooth interpolation");
1256
+// slowCB.addItemListener(this);
1257
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1258
+ minshaderCB.setToolTipText("Minimal fast shader");
1259
+ minshaderCB.addItemListener(this);
8711260
8721261 // constraints.gridy += 1;
8731262 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
....@@ -905,7 +1294,7 @@
9051294 oeilCB.addItemListener(this);
9061295
9071296 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
908
- shadowCB.setToolTipText("Compute shadows when live");
1297
+ shadowCB.setToolTipText("When live compute shadows");
9091298 shadowCB.addItemListener(this);
9101299
9111300 panel.Return();
....@@ -914,12 +1303,12 @@
9141303 toggleTextureCB.addItemListener(this);
9151304
9161305 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
917
- toggleSwitchCB.setToolTipText("Use switch");
1306
+ toggleSwitchCB.setToolTipText("Choose a single item");
9181307 toggleSwitchCB.addItemListener(this);
9191308
920
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
921
- autosaveCB.setToolTipText("Auto-save on structure change");
922
- autosaveCB.addItemListener(this);
1309
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1310
+ autokeepCB.setToolTipText("On structure change");
1311
+ autokeepCB.addItemListener(this);
9231312
9241313 panel.Return();
9251314 if (Globals.ADVANCED)
....@@ -948,7 +1337,7 @@
9481337 {
9491338 cRadio radioButton = new cRadio(obj.name);
9501339
951
- // Patch to avoid bug with transparency.
1340
+ // June 2019. Patch to avoid bug with transparency.
9521341 radioButton.hadMaterial = obj.material != null;
9531342 if (!radioButton.hadMaterial)
9541343 {
....@@ -956,7 +1345,7 @@
9561345 }
9571346
9581347 radioButton.SetObject(obj);
959
- radioButton.layout = sevenButton;
1348
+ radioButton.layout = threeButton; // sixButton;
9601349 radioButton.SetCamera(cameraView.renderCamera, false);
9611350 radioButton.addActionListener(this);
9621351 radioPanel.add(radioButton);
....@@ -981,10 +1370,13 @@
9811370 cCheckBox localCB;
9821371 cCheckBox crowdCB;
9831372 cCheckBox smoothCB;
1373
+ cCheckBox minshaderCB;
1374
+
9841375 cToggleButton fastCB;
9851376 cCheckBox slowCB;
9861377 cCheckBox boxCB;
9871378 cCheckBox zoomBoxCB;
1379
+ cCheckBox freezeCB;
9881380 //cToggleButton trackCB;
9891381 cCheckBox trackCB;
9901382 cCheckBox smoothfocusCB;
....@@ -995,7 +1387,7 @@
9951387
9961388 cCheckBox oeilCB;
9971389 cCheckBox shadowCB;
998
- cCheckBox autosaveCB;
1390
+ cCheckBox autokeepCB;
9991391 cCheckBox lookAtCB;
10001392
10011393 // static int COLOR = 1;
....@@ -1051,6 +1443,12 @@
10511443 cameraView.ToggleInertia();
10521444 cameraView.repaint();
10531445 }
1446
+ else if(e.getSource() == minshaderCB)
1447
+ {
1448
+ Globals.MINSHADER ^= true;
1449
+ cameraView.programInitialized = false;
1450
+ cameraView.repaint();
1451
+ }
10541452 else if(e.getSource() == localCB)
10551453 {
10561454 cameraView.ToggleLocal();
....@@ -1103,9 +1501,13 @@
11031501 {
11041502 Globals.COMPUTESHADOWWHENLIVE ^= true;
11051503 }
1106
- else if(e.getSource() == autosaveCB)
1504
+ else if(e.getSource() == freezeCB)
11071505 {
1108
- Globals.SAVEONMAKE ^= true;
1506
+ Globals.FREEZEONMOVE ^= true;
1507
+ }
1508
+ else if(e.getSource() == autokeepCB)
1509
+ {
1510
+ Globals.REPLACEONMAKE ^= true;
11091511 }
11101512 else if(e.getSource() == lookAtCB)
11111513 {
....@@ -1187,8 +1589,6 @@
11871589 }
11881590 }
11891591
1190
- String string = (String) object;
1191
-
11921592 System.out.println("Transfer = " + object + "; drop : " + target);
11931593 // if( object instanceof java.io.File[])
11941594 // {
....@@ -1196,6 +1596,8 @@
11961596 // objEditor.DropFile((java.io.File[]) object, true);
11971597 // return;
11981598 // }
1599
+
1600
+ String string = object.toString();
11991601
12001602 // File path for Mac and Windows
12011603 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1445,6 +1847,9 @@
14451847 animationItem.addItemListener(this);
14461848 animationItem.setState(Globals.ANIMATION);
14471849
1850
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1851
+ archiveItem.addActionListener(this);
1852
+
14481853 menu.add("-");
14491854 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14501855 parseverticesItem.addActionListener(this);
....@@ -1457,6 +1862,8 @@
14571862 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14581863 reduce34MorphItem.addActionListener(this);
14591864 menu.add("-");
1865
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1866
+ memoryItem.addActionListener(this);
14601867 menu.add(computeAOItem = new MenuItem("Compute AO"));
14611868 computeAOItem.addActionListener(this);
14621869
....@@ -1465,8 +1872,6 @@
14651872 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14661873 mirrorItem.addActionListener(this);
14671874 menu.add("-");
1468
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1469
- memoryItem.addActionListener(this);
14701875 menu.add(analyzeItem = new MenuItem("Analyze"));
14711876 analyzeItem.addActionListener(this);
14721877 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1614,6 +2019,30 @@
16142019
16152020 makeSomething(shadow);
16162021 }
2022
+
2023
+ private void ClearUnpinned()
2024
+ {
2025
+ //for (Object3D obj : listUI)
2026
+ for (int i=listUI.size(); --i>=0;)
2027
+ {
2028
+ Object3D obj = listUI.elementAt(i);
2029
+ if (!obj.pinned)
2030
+ {
2031
+ obj.CloseUI();
2032
+ listUI.remove(i);
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ private void EditElement(Object3D elem, boolean newWindow)
2038
+ {
2039
+ // if (!(elem instanceof Composite))
2040
+ // newWindow = false;
2041
+ listUI.add(elem);
2042
+ elem.openEditWindow(this, newWindow); //, false);
2043
+ System.out.println("edit : " + elem);
2044
+ elem.editWindow.refreshContents(true); // ? new
2045
+ }
16172046
16182047 /**
16192048 * applyExample
....@@ -2042,6 +2471,23 @@
20422471 {
20432472 makeSomething(new Light());
20442473 } else
2474
+// if (source == skybox1Button ||
2475
+// source == skybox2Button ||
2476
+// source == skybox3Button ||
2477
+// source == skybox4Button ||
2478
+// source == skybox5Button ||
2479
+// source == skybox6Button ||
2480
+// source == skybox7Button ||
2481
+// source == skybox11Button ||
2482
+// source == skybox12Button ||
2483
+// source == skybox13Button ||
2484
+// source == skybox14Button ||
2485
+// source == skybox15Button ||
2486
+// source == skybox16Button ||
2487
+// source == skybox17Button)
2488
+// {
2489
+// ChangeSkybox(source);
2490
+// } else
20452491 if (source == csgItem)
20462492 {
20472493 group(new CSG());
....@@ -2093,25 +2539,25 @@
20932539 Composite csg = new GroupLeaf();
20942540 csg.count = 5;
20952541 group(csg);
2096
- Composite child = new cGroup();
2542
+ Composite child = new cGroup("Branch");
20972543 csg.addChild(child);
20982544 child.addChild(csg);
20992545 } else
21002546 if (source == doubleItem)
21012547 {
2102
- Composite csg = new GroupLeaf();
2548
+ Composite csg = new GroupLeaf("Fork");
21032549 csg.count = 5;
21042550 group(csg);
2105
- Composite child = new cGroup();
2551
+ Composite child = new cGroup("Branch A");
21062552 csg.addChild(child);
21072553 child.addChild(csg);
2108
- child = new cGroup();
2554
+ child = new cGroup("Branch B");
21092555 csg.addChild(child);
21102556 child.addChild(csg);
21112557 } else
21122558 if (source == tripleItem)
21132559 {
2114
- Composite csg = new GroupLeaf();
2560
+ Composite csg = new GroupLeaf("Trident");
21152561 csg.count = 4;
21162562 group(csg);
21172563 Composite child = new cGroup();
....@@ -2127,7 +2573,7 @@
21272573 if (source == computeAOItem)
21282574 {
21292575 Globals.drawMode = CameraPane.OCCLUSION;
2130
- Globals.theRenderer.repaint();
2576
+ cameraView.repaint();
21312577 } else
21322578 if (source == recompileItem)
21332579 {
....@@ -2142,7 +2588,7 @@
21422588 if (source == invariantsItem)
21432589 {
21442590 System.out.println("Invariants:");
2145
- Grafreed.grafreeD.universe.invariants();
2591
+ Grafreed.grafreed.universe.invariants();
21462592 } else
21472593 if (source == memoryItem)
21482594 {
....@@ -2173,17 +2619,40 @@
21732619 {
21742620 ToggleFullScreen();
21752621 } else
2176
- if (source == undoButton)
2622
+ if (source == previousVersionButton)
21772623 {
2178
- Undo();
2624
+ // Go to previous version
2625
+ //if (!Undo())
2626
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2627
+ PreviousVersion();
21792628 } else
2180
- if (source == redoButton)
2629
+ if (source == restoreButton)
21812630 {
2182
- Redo();
2631
+ // Restore current version
2632
+ Restore();
2633
+ //restoreButton.setEnabled(false);
21832634 } else
2184
- if (source == saveButton)
2635
+ if (source == replaceButton)
21852636 {
2186
- Save();
2637
+ // Overwrite current version
2638
+ Replace();
2639
+ //replaceButton.setEnabled(false);
2640
+ } else
2641
+ if (source == nextVersionButton)
2642
+ {
2643
+ // Go to next version
2644
+ NextVersion();
2645
+ } else
2646
+ if (source == saveVersionButton)
2647
+ {
2648
+ // Save a new version
2649
+ if (!Save(true))
2650
+ java.awt.Toolkit.getDefaultToolkit().beep();
2651
+ } else
2652
+ if (source == deleteVersionButton)
2653
+ {
2654
+ // Delete a new version
2655
+ DeleteVersion();
21872656 } else
21882657 if (source == oneStepButton)
21892658 {
....@@ -2192,17 +2661,14 @@
21922661 } else
21932662 if (source == screenfitButton)
21942663 {
2195
- //Reload(lastConverter, lastFilename, true);
21962664 ScreenFit();
21972665 } else
21982666 if (source == screenfitpointButton)
21992667 {
2200
- //Reload(lastConverter, lastFilename, true);
22012668 ScreenFitPoint();
22022669 } else
22032670 if (source == snapobjectButton)
22042671 {
2205
- //Reload(lastConverter, lastFilename, true);
22062672 SnapObject();
22072673 } else
22082674 // if (event.getSource() == recompileButton)
....@@ -2241,11 +2707,11 @@
22412707 } else
22422708 if (source == undoItem)
22432709 {
2244
- Undo();
2710
+ PreviousVersion();
22452711 } else
22462712 if (source == redoItem)
22472713 {
2248
- Redo();
2714
+ NextVersion();
22492715 } else
22502716 if (source == duplicateItem)
22512717 {
....@@ -2566,7 +3032,7 @@
25663032 {
25673033 StepAll();
25683034 } else
2569
- if (source == clearItem) // || event.getSource() == clearButton)
3035
+ if (source == deleteItem) // || event.getSource() == clearButton)
25703036 {
25713037 //int indices[] = jList.getSelectedIndices();
25723038 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2726,15 +3192,28 @@
27263192 } else
27273193 if (source == ungroupItem || source == ungroupButton)
27283194 {
2729
- //ungroup();
3195
+ boolean hasRoot = false;
3196
+
27303197 for (int i=0; i<group.selection.size(); i++)
27313198 {
2732
- Ungroup(group.selection.get(i));
3199
+ if (group.selection.get(i) == group)
3200
+ {
3201
+ hasRoot = true;
3202
+ break;
3203
+ }
27333204 }
27343205
2735
- ClearSelection(false);
2736
-
2737
- refreshContents();
3206
+ if (!hasRoot)
3207
+ {
3208
+ for (int i=0; i<group.selection.size(); i++)
3209
+ {
3210
+ Ungroup(group.selection.get(i));
3211
+ }
3212
+
3213
+ ClearSelection(false);
3214
+
3215
+ refreshContents();
3216
+ }
27383217 } else
27393218 if (source == genUVItem)
27403219 {
....@@ -3035,7 +3514,7 @@
30353514 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30363515 {
30373516 obj = (Object3D)e.nextElement();
3038
- obj.SetBumpTexture(null);
3517
+ obj.ResetBumpTexture();
30393518 }
30403519
30413520 refreshContents();
....@@ -3049,6 +3528,31 @@
30493528 obj.SetBumpTexture(obj.GetPigmentTexture());
30503529 }
30513530
3531
+ refreshContents();
3532
+ } else
3533
+ if (source == embedTexturesItem)
3534
+ {
3535
+ Object3D obj;
3536
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3537
+ {
3538
+ obj = (Object3D)e.nextElement();
3539
+ obj.EmbedTextures(true);
3540
+ }
3541
+
3542
+ refreshContents();
3543
+ } else
3544
+ if (source == deEmbedTexturesItem)
3545
+ {
3546
+ Object3D obj;
3547
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3548
+ {
3549
+ obj = (Object3D)e.nextElement();
3550
+ obj.EmbedTextures(false);
3551
+ }
3552
+
3553
+ CameraPane.texturepigment.clear();
3554
+ CameraPane.texturebump.clear();
3555
+
30523556 refreshContents();
30533557 } else
30543558 if (source == flashSelectionButton)
....@@ -3152,8 +3656,8 @@
31523656 // centralPanel.setVisible(true);
31533657 // XYZPanel.setVisible(true);
31543658 bigThree.ClearUI();
3659
+ bigThree.add(scenePanel);
31553660 bigThree.add(centralPanel);
3156
- bigThree.add(XYZPanel);
31573661 bigThree.FlushUI();
31583662
31593663 cameraView.requestFocusInWindow();
....@@ -3233,8 +3737,8 @@
32333737 // centralPanel.setVisible(true);
32343738 // XYZPanel.setVisible(false);
32353739 bigThree.ClearUI();
3236
- bigThree.add(scenePanel);
32373740 bigThree.add(centralPanel);
3741
+ bigThree.add(scenePanel);
32383742 bigThree.FlushUI();
32393743
32403744 cameraView.requestFocusInWindow();
....@@ -3326,6 +3830,12 @@
33263830 } else
33273831 if (source == editItem || source == editButton)
33283832 {
3833
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3834
+ {
3835
+ Object3D child = (Object3D)e.nextElement();
3836
+ child.pinned = true;
3837
+ }
3838
+
33293839 EditSelection(false);
33303840 } else
33313841 if (source == uneditButton)
....@@ -3334,9 +3844,10 @@
33343844 {
33353845 Object3D child = (Object3D)e.nextElement();
33363846 if(child.editWindow != null)
3337
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3847
+ child.pinned = false;
33383848 child.CloseUI();
33393849 listUI.remove(child);
3850
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33403851
33413852 //child.editWindow = null; // ???????????
33423853 }
....@@ -3351,16 +3862,18 @@
33513862 //copy.ClearUI();
33523863 for (Object3D obj : listUI)
33533864 {
3865
+ obj.pinned = false;
33543866 obj.CloseUI();
33553867 }
33563868 listUI.clear();
3869
+ SetPinStates(group.selection.size() > 0);
33573870 refreshContents(true);
33583871 } else
33593872 if (source == allParamsButton)
33603873 {
33613874 assert(copy == group);
33623875
3363
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3876
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
33643877
33653878 for (Object3D obj : listUI)
33663879 {
....@@ -3409,6 +3922,9 @@
34093922 }
34103923
34113924 copy = group;
3925
+
3926
+ SetUndoStates();
3927
+
34123928 //Globals.theRenderer.object = group;
34133929 if(!useclient)
34143930 {
....@@ -3435,6 +3951,14 @@
34353951 currentLayout = sevenButton;
34363952 */
34373953 radio.layout.doClick();
3954
+
3955
+ ClearUnpinned();
3956
+
3957
+ //Grafreed.Assert(group != null);
3958
+ //Grafreed.Assert(group.selection != null);
3959
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3960
+ if (group.selection == null || group.selection.size() == 1)
3961
+ EditSelection(false);
34383962 keepparent = group.parent;
34393963 // PARENT = NULL or not???
34403964 //group.parent = null; // ROOT
....@@ -3446,11 +3970,13 @@
34463970 } else if (event.getSource() == editCameraItem)
34473971 {
34483972 cameraView.ProtectCamera();
3973
+ cameraView.requestFocusInWindow();
34493974 cameraView.repaint();
34503975 return;
34513976 } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
34523977 {
34533978 cameraView.RevertCamera();
3979
+ cameraView.requestFocusInWindow();
34543980 cameraView.repaint();
34553981 return;
34563982 // } else if (event.getSource() == textureButton)
....@@ -4027,7 +4553,7 @@
40274553
40284554 try
40294555 {
4030
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4556
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
40314557 }
40324558 catch (Exception e)
40334559 {
....@@ -4502,12 +5028,14 @@
45025028 // }
45035029 // }
45045030
4505
- static boolean allparams = true;
4506
-
4507
- static Vector<Object3D> listUI = new Vector<Object3D>();
4508
-
45095031 void EditSelection(boolean newWindow)
45105032 {
5033
+ if (group.selection == null)
5034
+ {
5035
+ EditElement(group, newWindow); // ? new
5036
+ return;
5037
+ }
5038
+
45115039 // aConstraints.gridy = 0;
45125040 for (int i=0; i<group.selection.size(); i++)
45135041 {
....@@ -4518,12 +5046,7 @@
45185046 Object3D elem = (Object3D)group.selection.elementAt(i);
45195047 if(elem != group || !newWindow)
45205048 {
4521
- // if (!(elem instanceof Composite))
4522
- // newWindow = false;
4523
- listUI.add(elem);
4524
- elem.openEditWindow(this, newWindow); //, false);
4525
- System.out.println("edit : " + elem);
4526
- elem.editWindow.refreshContents(true); // ? new
5049
+ EditElement(elem, newWindow); // ? new
45275050 }
45285051 }
45295052 }
....@@ -4586,9 +5109,7 @@
45865109
45875110 freezemodel = false;
45885111 }
4589
-
4590
- boolean flashIt = true;
4591
-
5112
+
45925113 public void valueChanged(TreeSelectionEvent e)
45935114 //public boolean handleEvent(Event event)
45945115 {
....@@ -4598,7 +5119,8 @@
45985119 //new Exception().printStackTrace();
45995120
46005121 freezemodel = true;
4601
-
5122
+ ClearUnpinned();
5123
+
46025124 /**/
46035125 //switch (event.id)
46045126 {
....@@ -4631,7 +5153,7 @@
46315153 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
46325154 // a camera
46335155 {
4634
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5156
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
46355157 {
46365158 CameraPane.camerachangeframe = 0; // don't refuse it
46375159 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4640,6 +5162,13 @@
46405162 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
46415163 }
46425164
5165
+ if (tps != null && tps.length == 1)
5166
+ {
5167
+ EditSelection(false);
5168
+ }
5169
+
5170
+ SetPinStates(tps != null && tps.length > 0);
5171
+
46435172 refreshContents();
46445173 //return true;
46455174 }
....@@ -4649,10 +5178,20 @@
46495178 freezemodel = false;
46505179 }
46515180
5181
+ void SetPinStates(boolean enabled)
5182
+ {
5183
+ editButton.setEnabled(enabled);
5184
+ uneditButton.setEnabled(enabled);
5185
+ //unselectButton.setEnabled(enabled);
5186
+ flashSelectionButton.setEnabled(enabled);
5187
+
5188
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5189
+ }
5190
+
46525191 void refreshContents(boolean cp)
46535192 {
4654
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4655
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
5193
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5194
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
46565195 {
46575196 objEditor.ClearInfo(); // .GetMaterial());
46585197
....@@ -4751,8 +5290,8 @@
47515290
47525291 if (cut)
47535292 {
4754
- if (Globals.SAVEONMAKE)
4755
- Save();
5293
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5294
+// Save();
47565295 //int indices[] = jList.getSelectedIndices();
47575296 //for (int i = indices.length - 1; i >= 0; i--)
47585297 //jList.remove(indices[i]);
....@@ -4855,6 +5394,10 @@
48555394
48565395 void paste(boolean expand)
48575396 {
5397
+ if (Globals.REPLACEONMAKE)
5398
+ Save();
5399
+ boolean keep = Globals.REPLACEONMAKE;
5400
+ Globals.REPLACEONMAKE = false;
48585401 // if (GrafreeD.clipboard == null)
48595402 // return;
48605403 boolean first = true;
....@@ -4914,6 +5457,7 @@
49145457 Grafreed.clipboard.get(0).parent = keepparent;
49155458 }
49165459
5460
+ Globals.REPLACEONMAKE = keep;
49175461 ResetModel();
49185462 refreshContents();
49195463 }
....@@ -5049,6 +5593,10 @@
50495593
50505594 void group(Object3D csg, boolean grab)
50515595 {
5596
+ if (Globals.REPLACEONMAKE)
5597
+ Save();
5598
+ boolean keep = Globals.REPLACEONMAKE;
5599
+ Globals.REPLACEONMAKE = false;
50525600 if (//false) // why??
50535601 !group.selection.isEmpty())
50545602 {
....@@ -5162,10 +5710,15 @@
51625710 //node.add(csg);
51635711 //makeSomething(node);
51645712 makeSomething(csg);
5713
+ Globals.REPLACEONMAKE = keep;
51655714 }
51665715
51675716 void Ungroup(Object3D g)
51685717 {
5718
+ if (Globals.REPLACEONMAKE)
5719
+ Save();
5720
+ boolean keep = Globals.REPLACEONMAKE;
5721
+ Globals.REPLACEONMAKE = false;
51695722 if (g instanceof HiddenObject)
51705723 {
51715724 HiddenObject h = (HiddenObject) g;
....@@ -5182,6 +5735,7 @@
51825735 objEditor.makeSomething(g.get(i), false);
51835736 }
51845737 }
5738
+ Globals.REPLACEONMAKE = keep;
51855739 }
51865740
51875741 void ungroup()
....@@ -5472,12 +6026,6 @@
54726026
54736027 cButton restoreCameraButton;
54746028
5475
- cButton minButton;
5476
- cButton maxButton;
5477
- cButton fullButton;
5478
- cButton undoButton;
5479
- cButton redoButton;
5480
- cButton saveButton;
54816029 cButton oneStepButton;
54826030
54836031 cButton groupButton;
....@@ -5486,6 +6034,22 @@
54866034 cButton switchButton;
54876035 cButton loopButton;
54886036 cButton textureButton;
6037
+
6038
+ cButton skybox1Button;
6039
+ cButton skybox2Button;
6040
+ cButton skybox3Button;
6041
+ cButton skybox4Button;
6042
+ cButton skybox5Button;
6043
+ cButton skybox6Button;
6044
+ cButton skybox7Button;
6045
+
6046
+ cButton skybox11Button;
6047
+ cButton skybox12Button;
6048
+ cButton skybox13Button;
6049
+ cButton skybox14Button;
6050
+ cButton skybox15Button;
6051
+ cButton skybox16Button;
6052
+ cButton skybox17Button;
54896053
54906054 cButton gridButton;
54916055 cButton boxButton;
....@@ -5550,7 +6114,7 @@
55506114 private MenuItem pasteLinkItem;
55516115 private MenuItem pasteCloneItem;
55526116 private MenuItem pasteExpandItem;
5553
- private MenuItem clearItem;
6117
+ private MenuItem deleteItem;
55546118 private MenuItem clearAllItem;
55556119 private MenuItem genUVItem;
55566120 private MenuItem genNormalsMESHItem;
....@@ -5634,6 +6198,8 @@
56346198 private MenuItem attachBumpItem;
56356199 private MenuItem detachBumpItem;
56366200 private MenuItem pigmentBumpItem;
6201
+ private MenuItem embedTexturesItem;
6202
+ private MenuItem deEmbedTexturesItem;
56376203
56386204 private MenuItem particleItem;
56396205 private MenuItem ragdollItem;