Normand Briere
2019-08-14 0c1f740dd6ddd6432dc29266e42ef851e26027bb
GroupEditor.java
....@@ -12,9 +12,11 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1820 ObjectUI,
1921 Runnable,
2022 ActionListener,
....@@ -22,6 +24,360 @@
2224 DragGestureListener, DragSourceListener, DropTargetListener,
2325 ItemListener // ListSelectionListener
2426 {
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.equals("") ? "No background" : 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 AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
346
+ }
347
+
348
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
349
+ {
350
+ JTabbedPane skyboxpane = new JTabbedPane();
351
+
352
+ AddSkyboxTab0(skyboxpane);
353
+ AddSkyboxTab1(skyboxpane);
354
+ AddSkyboxTab2(skyboxpane);
355
+ AddSkyboxTab3(skyboxpane);
356
+
357
+ skyboxPanel.add(skyboxpane);
358
+ }
359
+
360
+ public void ChangeTexture(String texture)
361
+ {
362
+ for (int i=0; i<group.selection.size(); i++)
363
+ {
364
+ Object3D obj = group.selection.get(i);
365
+ obj.SetPigmentTexture("@" + texture);
366
+ }
367
+
368
+ refreshContents();
369
+ }
370
+
371
+ public void Show3DView()
372
+ {
373
+ // bug
374
+ //gridPanel.setDividerLocation(1.0);
375
+ //bigPanel.setDividerLocation(0.0);
376
+ bigThree.ClearUI();
377
+ bigThree.add(centralPanel);
378
+ bigThree.FlushUI();
379
+ }
380
+
25381 //ObjEditor objEditor;
26382 public void closeUI2()
27383 {
....@@ -59,6 +415,14 @@
59415 this.copy = this.group = group;
60416 //selectees = this.group.selectees;
61417
418
+ if (copy.versionlist == null)
419
+ {
420
+ copy.versionlist = new Object3D[100];
421
+ copy.versionindex = -1;
422
+
423
+ Save(true);
424
+ }
425
+
62426 if(ui)
63427 SetupUI(objEditor);
64428 }
....@@ -73,16 +437,28 @@
73437 this.copy = this.group = copy;
74438 //selectees = this.group.selectees;
75439
76
- SetupMenu2(objEditor);
440
+ SetupMenu2(this); //objEditor);
77441 SetupUI2(objEditor);
78442 objEditor.SetupUI(true);
79443 SetupViews(objEditor);
80444
81445 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
446
+
447
+ if (copy.versionlist == null)
448
+ {
449
+ copy.versionlist = new Object3D[100];
450
+ copy.versionindex = -1;
451
+
452
+ Save(true);
453
+ }
82454 }
83455
84456 void CloneSelection(boolean supports)
85457 {
458
+ if (Globals.REPLACEONMAKE)
459
+ Save();
460
+ boolean keep = Globals.REPLACEONMAKE;
461
+ Globals.REPLACEONMAKE = false;
86462 // Object3D keep = GrafreeD.clipboard;
87463 //Object3D obj;
88464 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +469,19 @@
93469
94470 makeSomething(clone, i==group.selection.size()-1);
95471 }
472
+ Globals.REPLACEONMAKE = keep;
96473 }
97474
98475 void CloneClipboard(boolean supports)
99476 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
477
+ assert(Grafreed.clipboard.parent == null);
478
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
479
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
480
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
481
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105482 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
483
+ makeSomething(CloneObject(Grafreed.clipboard, false));
484
+ Grafreed.clipboard.get(0).parent = keepparent;
108485 }
109486
110487 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +495,7 @@
118495 // obj.support = null;
119496 if (!supports)
120497 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
498
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122499 obj.parent = parent;
123500 // obj.support = support;
124501 // clone.support = support; // aout 2013
....@@ -147,30 +524,29 @@
147524
148525 //JTextField nameField;
149526
150
- void SetupMenu2(ObjEditor oe)
527
+ void SetupMenu2(GroupEditor oe)
151528 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
529
+ oe.jTree = new cTree();
530
+
163531 Menu menu;
164532 oe.menuBar.add(menu = new Menu("Edit"));
165533 //editItem = menu.add(new MenuItem("Edit"));
166534 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
535
+
536
+// undoItem = menu.add(new MenuItem("Undo"));
537
+// undoItem.addActionListener(this);
538
+// redoItem = menu.add(new MenuItem("Redo"));
539
+// redoItem.addActionListener(this);
540
+// menu.add("-");
541
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168542 duplicateItem.addActionListener(this);
169
- menu.add("-");
170543 cloneItem = menu.add(new MenuItem("Clone"));
171544 cloneItem.addActionListener(this);
545
+ if (Globals.ADVANCED)
546
+ {
172547 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173548 cloneSupportItem.addActionListener(this);
549
+ }
174550 menu.add("-");
175551 cutItem = menu.add(new MenuItem("Cut"));
176552 cutItem.addActionListener(this);
....@@ -178,27 +554,121 @@
178554 copyItem.addActionListener(this);
179555 pasteItem = menu.add(new MenuItem("Paste"));
180556 pasteItem.addActionListener(this);
557
+
558
+ menu.add("-");
559
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
560
+ pasteIntoItem.addActionListener(this);
181561 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182562 pasteLinkItem.addActionListener(this);
183563 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184564 pasteCloneItem.addActionListener(this);
185565 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186566 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
567
+ menu.add("-");
568
+ deleteItem = menu.add(new MenuItem("Delete"));
569
+ deleteItem.addActionListener(this);
570
+
571
+ if (Globals.ADVANCED)
572
+ {
573
+ // Deletes the cameras...
189574 clearAllItem = menu.add(new MenuItem("Clear All"));
190575 clearAllItem.addActionListener(this);
576
+ }
577
+
578
+ menuBar.add(cameraMenu = new Menu("View"));
579
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
580
+ //zBufferItem.addActionListener(this);
581
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
582
+ //normalLensItem.addActionListener(this);
583
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
584
+ restoreCameraItem.addActionListener(this);
585
+
586
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
587
+// toggleFullScreenItem.addItemListener(this);
588
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
589
+// cameraMenu.add("-");
590
+//
591
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
592
+// toggleTextureItem.addItemListener(this);
593
+// toggleTextureItem.setState(CameraPane.textureon);
594
+//
595
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
596
+// toggleSwitchItem.addItemListener(this);
597
+// toggleSwitchItem.setState(CameraPane.SWITCH);
598
+
599
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
600
+ toggleHandleItem.addItemListener(this);
601
+ toggleHandleItem.setState(CameraPane.HANDLES);
602
+
603
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
604
+ togglePaintItem.addItemListener(this);
605
+ togglePaintItem.setState(CameraPane.PAINTMODE);
606
+
607
+ if (Globals.ADVANCED)
608
+ {
609
+ cameraMenu.add("-");
610
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
611
+ toggleLiveItem.addItemListener(this);
612
+ toggleLiveItem.setState(Globals.isLIVE());
191613
614
+ cameraMenu.add(stepItem = new MenuItem("Step"));
615
+ stepItem.addActionListener(this);
616
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
617
+ // toggleDLItem.addItemListener(this);
618
+ // toggleDLItem.setState(false);
619
+
620
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
621
+ toggleRenderItem.addItemListener(this);
622
+ toggleRenderItem.setState(!CameraPane.frozen);
623
+
624
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
625
+ toggleDebugItem.addItemListener(this);
626
+ toggleDebugItem.setState(Globals.DEBUG);
627
+
628
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
629
+ toggleFrustumItem.addItemListener(this);
630
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
631
+
632
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
633
+ toggleFootContactItem.addItemListener(this);
634
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
635
+
636
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
637
+ toggleTimelineItem.addItemListener(this);
638
+ }
639
+
640
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
641
+// toggleRootItem.addItemListener(this);
642
+// toggleRootItem.setState(false);
643
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
644
+// animationItem.addItemListener(this);
645
+// animationItem.setState(CameraPane.ANIMATION);
646
+ cameraMenu.add("-");
647
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
648
+ editCameraItem.addActionListener(this);
649
+
650
+ if (Globals.ADVANCED)
651
+ {
652
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
653
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
654
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
655
+ oe.cameraMenu.add("-");
656
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
657
+ openWindowItem.addActionListener(this);
658
+ lookAtItem.addActionListener(this);
659
+ //lookFromItem.addActinoListener(this);
660
+ //switchViewItem.addActionListener(this);
661
+ }
662
+
192663 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
664
+ if (Globals.ADVANCED)
665
+ {
197666 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198667 revertMeshItem.addActionListener(this);
199668 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200669 resetreferencesItem.addActionListener(this);
201670 menu.add("-");
671
+ }
202672 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203673 overwriteGeoItem.addActionListener(this);
204674 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +680,104 @@
210680 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211681 overwriteUVItem.addActionListener(this);
212682 menu.add("-");
683
+ if (Globals.ADVANCED)
684
+ {
213685 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214686 generateMeshItem.addActionListener(this);
215687 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216688 poseMeshItem.addActionListener(this);
217689 menu.add("-");
690
+ }
218691 resetsupportItem = menu.add(new MenuItem("Reset support"));
219692 resetsupportItem.addActionListener(this);
220693 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221694 linkverticesItem.addActionListener(this);
222695 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223696 relinkverticesItem.addActionListener(this);
697
+
698
+ if (Globals.ADVANCED)
699
+ {
224700 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225701 setMasterItem.addActionListener(this);
702
+ }
226703
227704 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
705
+// grabItem = menu.add(new MenuItem("Grab"));
706
+// grabItem.addActionListener(this);
230707 backItem = menu.add(new MenuItem("Back"));
231708 backItem.addActionListener(this);
232709 frontItem = menu.add(new MenuItem("Front"));
233710 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
711
+// compositeItem = menu.add(new MenuItem("Composite"));
712
+// compositeItem.addActionListener(this);
713
+
714
+ if (Globals.ADVANCED)
715
+ {
716
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237717 hideItem.addActionListener(this);
718
+ }
238719 ungroupItem = menu.add(new MenuItem("Ungroup"));
239720 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
721
+
722
+// menu.add("-");
723
+//
724
+// switchItem = menu.add(new MenuItem("Switch node"));
725
+// switchItem.addActionListener(this);
726
+ if (Globals.ADVANCED)
727
+ {
247728 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248729 switchGeoItem.addActionListener(this);
249730 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250731 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
732
+ morphItem = menu.add(new MenuItem("Morph Group"));
252733 morphItem.addActionListener(this);
734
+
735
+ menu.add("-");
736
+ physicsItem = menu.add(new MenuItem("Physics"));
737
+ physicsItem.addActionListener(this);
738
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
739
+ frameselectorItem.addActionListener(this);
253740 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254741 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
742
+ }
257743
258744 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
745
+// textureItem = menu.add(new MenuItem("Texture"));
746
+// textureItem.addActionListener(this);
261747 billboardItem = menu.add(new MenuItem("Billboard"));
262748 billboardItem.addActionListener(this);
263749 csgItem = menu.add(new MenuItem("CSG"));
264750 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
751
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266752 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
753
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268754 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
755
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270756 shadowZItem.addActionListener(this);
757
+ attributeItem = menu.add(new MenuItem("Attribute"));
758
+ attributeItem.addActionListener(this);
759
+
760
+ if (Globals.ADVANCED)
761
+ {
762
+ menu.add("-");
271763 linkerItem = menu.add(new MenuItem("Linker"));
272764 linkerItem.addActionListener(this);
273765 templateItem = menu.add(new MenuItem("Template"));
274766 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277767 pointflowItem = menu.add(new MenuItem("Point Flow"));
278768 pointflowItem.addActionListener(this);
769
+ }
279770 menu.add("-");
280771 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281772 resetTransformItem.addActionListener(this);
282773 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283774 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
775
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
776
+ resetCentroidXZItem.addActionListener(this);
777
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
778
+ transformGeometryItem.addActionListener(this);
779
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
780
+ transformChildrenItem.addActionListener(this);
286781
287782 oe.menuBar.add(menu = new Menu("Geometry"));
288783 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +788,11 @@
293788 genNormalsCADItem.addActionListener(this);
294789 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295790 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
791
+ if (Globals.ADVANCED)
792
+ {
793
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297794 genNormalsMINEItem.addActionListener(this);
795
+ }
298796 stripifyItem = menu.add(new MenuItem("Stripify"));
299797 stripifyItem.addActionListener(this);
300798 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +814,34 @@
316814 reduce34MeshItem.addActionListener(this);
317815 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318816 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321817 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322818 clipMeshItem.addActionListener(this);
819
+
820
+ if (Globals.ADVANCED)
821
+ {
822
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
823
+ smoothMeshItem.addActionListener(this);
824
+ }
323825
324826 oe.menuBar.add(menu = new Menu("Attributes"));
325827 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326828 clearMaterialsItem.addActionListener(this);
829
+ resetAllItem = menu.add(new MenuItem("Reset All"));
830
+ resetAllItem.addActionListener(this);
831
+ stepAllItem = menu.add(new MenuItem("Step All"));
832
+ stepAllItem.addActionListener(this);
327833 menu.add("-");
328834 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329835 liveleavesItem.addActionListener(this);
330836 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331837 unliveleavesItem.addActionListener(this);
838
+ if (Globals.ADVANCED)
839
+ {
332840 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333841 supportleavesItem.addActionListener(this);
334842 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335843 unsupportleavesItem.addActionListener(this);
844
+ }
336845 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337846 hideleavesItem.addActionListener(this);
338847 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +850,14 @@
341850 markleavesItem.addActionListener(this);
342851 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343852 unmarkleavesItem.addActionListener(this);
853
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
854
+ rewindleavesItem.addActionListener(this);
855
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
856
+ unrewindleavesItem.addActionListener(this);
857
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
858
+ randomleavesItem.addActionListener(this);
859
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
860
+ unrandomleavesItem.addActionListener(this);
344861 menu.add("-");
345862 flipVItem = menu.add(new MenuItem("Flip V"));
346863 flipVItem.addActionListener(this);
....@@ -366,53 +883,129 @@
366883 attachBumpItem.addActionListener(this);
367884 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
368885 pigmentBumpItem.addActionListener(this);
886
+ //embedTexturesItem
369887 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
370888 detachPigmentItem.addActionListener(this);
371889 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
372890 detachBumpItem.addActionListener(this);
891
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
892
+ embedTexturesItem.addActionListener(this);
893
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
894
+ deEmbedTexturesItem.addActionListener(this);
373895 menu.add("-");
374896 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
375897 sortbysizeItem.addActionListener(this);
376898 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377899 sortbynameItem.addActionListener(this);
378900 menu.add("-");
901
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
902
+ shareGeometriesItem.addActionListener(this);
903
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
904
+ mergeGeometriesItem.addActionListener(this);
905
+ menu.add("-");
906
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
907
+ editLeafItem.addActionListener(this);
908
+ if (Globals.ADVANCED)
909
+ {
910
+ // Pretty much the same as duplicate and clone.
379911 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380912 extractGeometriesItem.addActionListener(this);
381913 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382914 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
915
+ }
387916
388917 oe.menuBar.add(menu = new Menu("Insert"));
389918 buildCreateMenu(menu);
390919
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402920 oe.menuBar.add(menu = new Menu("Tools"));
403921 buildToolsMenu(menu);
404922 }
405923
924
+ JTabbedPane resourcecontainer;
925
+ cGridBag currenttab;
926
+ boolean added; // patch for jar
927
+
928
+ int tabcount = 0;
929
+ int colcount = 0;
930
+ int rowcount = 0;
931
+ int texturecount = 0;
932
+
933
+ int columns = 5;
934
+ int rows = 7;
935
+
936
+ public void ResourceCallBack(String[] path)
937
+ {
938
+// for (int i = 0; i < path.length; i++)
939
+// System.out.print(path[i] + "/");
940
+// System.out.println();
941
+
942
+ if (//rowcount == 0 ||
943
+ path.length == 1)
944
+ {
945
+ currenttab = new cGridBag();
946
+ added = false;
947
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
948
+ currenttab.setName(tabname);
949
+ rowcount = 1;
950
+ colcount = 0;
951
+ texturecount = 0;
952
+ }
953
+
954
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
955
+ {
956
+ if (!added)
957
+ {
958
+ added = true;
959
+ resourcecontainer.add(currenttab);
960
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
961
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
962
+ }
963
+
964
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
965
+
966
+ if (++colcount >= columns)
967
+ {
968
+ colcount = 0;
969
+ currenttab.Return();
970
+
971
+ if (rowcount++ >= rows)
972
+ {
973
+ rowcount = 0;
974
+ }
975
+ }
976
+ }
977
+ else
978
+ {
979
+// if (!path[path.length-1].equals("icons"))
980
+// resourcecontainer.Return();
981
+ }
982
+ }
983
+
984
+ void CreateTexturePanel(cGridBag container)
985
+ {
986
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
987
+ container.add(resourcecontainer);
988
+
989
+ Grafreed.ParseResources("textures", this);
990
+ }
991
+
406992 void SetupUI2(ObjEditor oe)
407993 {
994
+ // June 2019
995
+ if (oe == null)
996
+ {
997
+ //super.SetupUI2(this);
998
+ //return;
999
+ }
1000
+
1001
+ if (copy != group)
1002
+ {
1003
+ //super.SetupUI2(this);
1004
+ }
1005
+
4081006 //new Exception().printStackTrace();
4091007
4101008 oe.radioPanel = new JPanel(new GridBagLayout());
411
- oe.aConstraints.weightx = 1;
412
- oe.aConstraints.weighty = 0;
413
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
414
- oe.aConstraints.gridwidth = 100;
415
- oe.aConstraints.gridheight = 1;
4161009 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
4171010
4181011 oe.buttonGroup = new ButtonGroup();
....@@ -433,176 +1026,263 @@
4331026 oe.radioPanel.add(dummyButton);
4341027 oe.buttonGroup.add(dummyButton);
4351028 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
1029
+ cGridBag copyOptionsPanel = new cGridBag();
1030
+
1031
+ copyOptionsPanel.preferredHeight = 2;
4391032
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
441
- liveCB.setToolTipText("Enabled animation");
442
- liveCB.addItemListener(this);
443
-
444
- oe.aConstraints.gridx += 1;
445
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
446
- fastCB.setToolTipText("Fast mode");
447
- fastCB.addItemListener(this);
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
450
- supportCB.setToolTipText("Enabled rigging");
451
- supportCB.addItemListener(this);
452
-
453
- // oe.aConstraints.gridx += 1;
454
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
455
- // localCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints);
459
- crowdCB.setToolTipText("Used for crowds");
460
- crowdCB.addItemListener(this);
461
-
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
464
- smoothCB.setToolTipText("Snapping delay");
465
- smoothCB.addItemListener(this);
466
-
467
- oe.aConstraints.gridx += 1;
468
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
469
- slowCB.setToolTipText("Smooth interpolation");
470
- slowCB.addItemListener(this);
471
- oe.aConstraints.gridx += 1;
472
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), oe.aConstraints);
473
- boxCB.setToolTipText("Display bounding boxes");
474
- boxCB.addItemListener(this);
475
- oe.aConstraints.gridx += 1;
476
- oe.toolbarPanel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), oe.aConstraints);
477
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
478
- zoomBoxCB.addItemListener(this);
479
-
480
-// oe.aConstraints.gridx += 1;
481
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
482
-// speakerMocapCB.addItemListener(this);
483
-
484
- if (false)
485
- {
486
- // handled in scripts
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
489
- speakerCameraCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
493
- speakerFocusCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
497
- smoothfocusCB.addItemListener(this);
498
- }
499
-
500
-//oe.aConstraints.gridx += 1;
501
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
502
-// debugCB.addItemListener(this);
503
-
504
- oe.aConstraints.gridx += 1;
505
- oe.toolbarPanel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), oe.aConstraints);
506
- oeilCB.addItemListener(this);
507
-
508
- oe.aConstraints.gridx += 1;
509
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), oe.aConstraints);
510
- lookAtCB.setToolTipText("Look-at target");
511
- lookAtCB.addItemListener(this);
512
-
513
- oe.aConstraints.gridx += 1;
514
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
515
- trackCB.setToolTipText("Enable tracking");
516
- trackCB.addItemListener(this);
517
-
518
- oe.aConstraints.gridx += 1;
519
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
1033
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1034
+
1035
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1036
+ //minButton.setToolTipText("Minimize window");
1037
+ //minButton.addActionListener(this);
1038
+
1039
+ if (Globals.ADVANCED)
1040
+ {
1041
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+// maxButton.setToolTipText("Maximize window");
1043
+// maxButton.addActionListener(this);
1044
+ }
1045
+
1046
+ cButton gcButton;
1047
+
1048
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+// gcButton.setToolTipText("Garbage collect");
1050
+// gcButton.addActionListener(new ActionListener()
1051
+// {
1052
+// public void actionPerformed(ActionEvent e)
1053
+// {
1054
+// System.gc();
1055
+// }
1056
+// });
1057
+
1058
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
+ collapseButton.setToolTipText("Collapse toolbar");
1060
+ collapseButton.addActionListener(this);
1061
+
1062
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ maximize3DButton.setToolTipText("Maximize 3D view");
1064
+ maximize3DButton.addActionListener(this);
1065
+
1066
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1067
+ twoButton.setToolTipText("Show 3D view only");
1068
+ twoButton.addActionListener(this);
1069
+ this.fullscreenLayout = twoButton;
1070
+
1071
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ threeButton.setToolTipText("Show controls and 3D view");
1073
+ threeButton.addActionListener(this);
1074
+ if (Globals.ADVANCED)
1075
+ {
1076
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ sixButton.setToolTipText("Show 3D view and controls");
1078
+ sixButton.addActionListener(this);
1079
+ }
1080
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+// sevenButton.setToolTipText("3-column layout");
1082
+// sevenButton.addActionListener(this);
1083
+ //
1084
+
1085
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+ fullButton.setToolTipText("Full-screen window");
1087
+ fullButton.addActionListener(this);
1088
+
1089
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5201090 screenfitButton.setToolTipText("Screen fit");
5211091 screenfitButton.addActionListener(this);
522
- oe.aConstraints.gridx += 1;
1092
+
1093
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1094
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1095
+ restoreCameraButton.addActionListener(this);
1096
+
1097
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1098
+ saveVersionButton.setToolTipText("Duplicate current version");
1099
+ saveVersionButton.addActionListener(this);
1100
+
1101
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1102
+ deleteVersionButton.setToolTipText("Delete current version");
1103
+ deleteVersionButton.addActionListener(this);
1104
+
1105
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+ previousVersionButton.setToolTipText("Previous version");
1107
+ previousVersionButton.addActionListener(this);
1108
+ previousVersionButton.setEnabled(false);
1109
+
1110
+ cGridBag updown = new cGridBag().setVertical(true);
1111
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ restoreButton.setToolTipText("Undo (restore current version)");
1113
+ restoreButton.addActionListener(this);
1114
+ //restoreButton.setEnabled(false);
1115
+
1116
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ replaceButton.setToolTipText("Save (replace current version)");
1118
+ replaceButton.addActionListener(this);
1119
+ //replaceButton.setEnabled(false);
1120
+
1121
+ copyOptionsPanel.add(updown);
1122
+
1123
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ nextVersionButton.setToolTipText("Next version");
1125
+ nextVersionButton.addActionListener(this);
1126
+ nextVersionButton.setEnabled(false);
1127
+
1128
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ oneStepButton.setToolTipText("Animate one step forward");
1130
+ oneStepButton.addActionListener(this);
1131
+
1132
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1133
+ liveCB.setToolTipText("Enable animation");
1134
+ liveCB.addItemListener(this);
1135
+
1136
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1137
+ fastCB.setToolTipText("Fast mode");
1138
+ fastCB.addItemListener(this);
1139
+
1140
+ //oe.toolboxPanel.Return();
1141
+
1142
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1143
+// trackCB.setToolTipText("Enable tracking");
1144
+// trackCB.addItemListener(this);
1145
+
5231146 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5241147 // screenfitpointButton.addActionListener(this);
525
-// oe.aConstraints.gridx += 1;
526
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
527
- snapobjectButton.addActionListener(this);
528
- snapobjectButton.setToolTipText("Snap Object");
529
- oe.aConstraints.gridx += 1;
5301148
531
- //aConstraints.gridx = 0;
532
- //aConstraints.gridy += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
537
- flashSelectionButton.setToolTipText("Show selection");
538
- flashSelectionButton.addActionListener(this);
539
-
540
- oe.toolbarPanel.add(new cButton(" ", false));
541
-
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545
-
546
- //
547
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
548
- twoButton.setToolTipText("Show center view only");
549
- twoButton.addActionListener(this);
550
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
1149
+ if (Globals.ADVANCED)
1150
+ {
1151
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ snapobjectButton.addActionListener(this);
1153
+ snapobjectButton.setToolTipText("Snap Object");
1154
+
1155
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5511156 fourButton.addActionListener(this);
552
- fourButton.setToolTipText("Show left panel only");
553
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
554
- sixButton.setToolTipText("2-column layout left");
555
- sixButton.addActionListener(this);
556
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
557
- threeButton.setToolTipText("2-column layout right");
558
- threeButton.addActionListener(this);
559
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
560
- sevenButton.setToolTipText("3-column layout");
561
- sevenButton.addActionListener(this);
562
- //
1157
+ fourButton.setToolTipText("Show control panel only");
1158
+ }
5631159
564
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
565
- rootButton.setToolTipText("Edit object in new tab");
1160
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1161
+
1162
+
1163
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1164
+ rootButton.setToolTipText("Open selection in new tab");
5661165 rootButton.addActionListener(this);
567
- oe.aConstraints.gridx += 1;
568
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1166
+
1167
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5691168 closeButton.setToolTipText("Close tab");
5701169 closeButton.addActionListener(this);
5711170 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5721171 //clearButton.addActionListener(this);
573
- oe.aConstraints.gridx += 1;
574
-
575
- oe.aConstraints.gridx = 1; //
576
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
577
- editButton.addActionListener(this);
578
- oe.aConstraints.gridx += 1;
579
- oe.aConstraints.weighty = 0;
580
- oe.aConstraints.gridwidth = 1;
5811172
582
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1173
+ cGridBag row1 = new cGridBag();
1174
+
1175
+ // INSERT
1176
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1177
+ gridButton.setToolTipText("Create ground");
1178
+ gridButton.addActionListener(this);
1179
+
1180
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1181
+ boxButton.setToolTipText("Create box");
1182
+ boxButton.addActionListener(this);
1183
+
1184
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1185
+ sphereButton.setToolTipText("Create sphere");
1186
+ sphereButton.addActionListener(this);
1187
+
1188
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1189
+ coneButton.setToolTipText("Create cone");
1190
+ coneButton.addActionListener(this);
1191
+
1192
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1193
+ torusButton.setToolTipText("Create torus");
1194
+ torusButton.addActionListener(this);
1195
+
1196
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1197
+ superButton.setToolTipText("Create superellipsoid");
1198
+ superButton.addActionListener(this);
1199
+
1200
+ if (Globals.ADVANCED)
1201
+ {
1202
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1203
+ kleinButton.setToolTipText("Create Klein bottle");
1204
+ kleinButton.addActionListener(this);
1205
+ }
1206
+
1207
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ particlesButton.setToolTipText("Create particle system");
1209
+ particlesButton.addActionListener(this);
1210
+
1211
+ oe.toolboxPanel.add(row1);
1212
+
1213
+ cGridBag row2 = new cGridBag();
1214
+
1215
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ groupButton.setToolTipText("Create group");
1217
+ groupButton.addActionListener(this);
1218
+
1219
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ compositeButton.setToolTipText("Create composite");
1221
+ compositeButton.addActionListener(this);
1222
+
1223
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ switchButton.setToolTipText("Create item switcher");
1225
+ switchButton.addActionListener(this);
1226
+
1227
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ loopButton.setToolTipText("Create loop");
1229
+ loopButton.addActionListener(this);
1230
+
1231
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ textureButton.setToolTipText("Create texture");
1233
+ textureButton.addActionListener(this);
1234
+
1235
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ overlayButton.setToolTipText("Create overlay");
1237
+ overlayButton.addActionListener(this);
1238
+
1239
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1240
+ lightButton.setToolTipText("Create light");
1241
+ lightButton.addActionListener(this);
1242
+
1243
+ oe.toolboxPanel.add(row2);
1244
+
1245
+ cGridBag textures = new cGridBag();
1246
+
1247
+ CreateTexturePanel(textures);
1248
+
1249
+ oe.toolboxPanel.add(textures);
1250
+
1251
+ textures.preferredHeight = 100;
1252
+
1253
+ CreateSkyboxPanel(oe.skyboxPanel);
1254
+
1255
+ // EDIT panel
1256
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1257
+ editButton.setToolTipText("Pin selection controls");
1258
+ editButton.addActionListener(this);
1259
+
1260
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1261
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5831262 uneditButton.addActionListener(this);
5841263
585
- oe.aConstraints.gridx += 1;
586
- oe.aConstraints.weighty = 0;
587
- oe.aConstraints.gridwidth = 1;
588
-
589
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
590
- clearPanelButton.addActionListener(this);
591
-
592
- oe.aConstraints.gridx += 1;
593
- oe.aConstraints.weighty = 0;
594
- oe.aConstraints.gridwidth = 1;
595
-
596
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1264
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1265
+ allParamsButton.setToolTipText("Show all controls");
5971266 allParamsButton.addActionListener(this);
5981267
599
- oe.aConstraints.gridx += 1;
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 1;
602
-
603
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
604
- unselectButton.addActionListener(this);
1268
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1269
+ clearPanelButton.setToolTipText("Clear all controls");
1270
+ clearPanelButton.addActionListener(this);
6051271
1272
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1273
+ //unselectButton.setToolTipText("Unselect");
1274
+ //unselectButton.addActionListener(this);
1275
+
1276
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1277
+ flashSelectionButton.setToolTipText("Highlight selection");
1278
+ flashSelectionButton.addActionListener(this);
1279
+
1280
+ editCommandsPanel.preferredHeight = 1;
1281
+
1282
+ SetPinStates(false);
1283
+// oe.treePanel.add(commandsPanel);
1284
+// oe.treePanel.Return();
1285
+
6061286 // oe.aConstraints.gridx += 1;
6071287 // oe.aConstraints.weighty = 0;
6081288 // oe.aConstraints.gridwidth = 1;
....@@ -614,47 +1294,32 @@
6141294 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
6151295 // gcButton.addActionListener(this);
6161296
617
- oe.aConstraints.gridx = 0;
618
- oe.aConstraints.gridy += 1;
619
-
620
- //ctrlPanel.add(objList = new List(5, true));
621
- oe.aConstraints.gridwidth = 100;
622
- // oe.aConstraints.gridheight = 100;
623
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
624
- oe.aConstraints.gridheight = 1;
625
- oe.aConstraints.weighty = 0.5;
626
- oe.aConstraints.gridx = 0;
627
- JScrollPane jSP;
1297
+ cGridBag jSPPanel = new cGridBag();
1298
+
1299
+ JScrollPane jSP;
6281300 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
629
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1301
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6301302 ResetModel();
631
- oe.aConstraints.weighty = 0.5;
632
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
633
- oe.aConstraints.gridy += 1;
634
- oe.aConstraints.gridwidth = 1;
635
-
636
- oe.aConstraints.weighty = 0;
637
- oe.aConstraints.gridwidth = 2;
638
-
639
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
640
- colorCB.addItemListener(this);
641
- oe.aConstraints.gridx += 2;
642
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
643
- materialCB.addItemListener(this);
644
- oe.aConstraints.gridx += 2;
645
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
646
- textureCB.addItemListener(this);
647
-
648
- oe.aConstraints.gridx = 0;
649
- oe.aConstraints.gridy += 1;
6501303
1304
+ oe.treePanel.add(jSPPanel);
1305
+ oe.treePanel.Return();
1306
+
1307
+ oe.treePanel.add(copyOptionsPanel);
1308
+ oe.treePanel.Return();
1309
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1310
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1311
+ sliderPane.preferredHeight = 1;
1312
+
1313
+// mainPanel.setDividerLocation(0.1); //1.0);
1314
+ mainPanel.setResizeWeight(0.4);
1315
+
6511316 //jList.addListSelectionListener(this);
6521317 oe.jTree.addTreeSelectionListener(this);
6531318 //jTree.setRootVisible(false);
6541319 //jTree.setEditable(true);
6551320 oe.jTree.setDragEnabled(true);
6561321 //jTree.setPreferredSize(new Dimension(10,10));
657
- jSP.setPreferredSize(new Dimension(100,200));
1322
+ //jSP.setPreferredSize(new Dimension(100,200));
6581323
6591324 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6601325
....@@ -666,23 +1331,171 @@
6661331 dgr.addDragGestureListener(this);
6671332 }catch(Exception e) {}
6681333 */
669
- radio.layout = sevenButton;
1334
+ radio.layout = threeButton; // sixButton;
6701335 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6711336 }
1337
+
1338
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1339
+ {
1340
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1341
+ colorCB.setToolTipText("Copy color when dropped");
1342
+ colorCB.addItemListener(this);
1343
+
1344
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1345
+ materialCB.setToolTipText("Copy material when dropped");
1346
+ materialCB.addItemListener(this);
1347
+
1348
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1349
+ textureCB.setToolTipText("Copy texture when dropped");
1350
+ textureCB.addItemListener(this);
1351
+
1352
+ panel.Return();
1353
+
1354
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1355
+ boxCB.setToolTipText("Display bounding boxes");
1356
+ boxCB.addItemListener(this);
1357
+
1358
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1359
+ zoomBoxCB.setToolTipText("Display only for wheel");
1360
+ zoomBoxCB.addItemListener(this);
1361
+
1362
+ if (true) // Globals.ADVANCED)
1363
+ {
1364
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1365
+// supportCB.setToolTipText("Enable rigging");
1366
+// supportCB.addItemListener(this);
1367
+
1368
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1369
+ freezeCB.setToolTipText("Fast moving camera");
1370
+ freezeCB.addItemListener(this);
1371
+
1372
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1373
+ // localCB.addItemListener(this);
1374
+
1375
+ panel.Return();
1376
+
1377
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1378
+ crowdCB.setToolTipText("Used for crowds");
1379
+ crowdCB.addItemListener(this);
1380
+
1381
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1382
+ smoothCB.setToolTipText("Snapping delay");
1383
+ smoothCB.addItemListener(this);
1384
+
1385
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1386
+// slowCB.setToolTipText("Smooth interpolation");
1387
+// slowCB.addItemListener(this);
1388
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1389
+ minshaderCB.setToolTipText("Minimal fast shader");
1390
+ minshaderCB.addItemListener(this);
1391
+
1392
+// constraints.gridy += 1;
1393
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1394
+// speakerMocapCB.addItemListener(this);
1395
+
1396
+ panel.Return();
1397
+
1398
+ if (false)
1399
+ {
1400
+ // handled in scripts
1401
+ //constraints.gridy += 1;
1402
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1403
+ speakerCameraCB.addItemListener(this);
1404
+
1405
+ //constraints.gridy += 1;
1406
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1407
+ speakerFocusCB.addItemListener(this);
1408
+
1409
+ //constraints.gridy += 1;
1410
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1411
+ smoothfocusCB.addItemListener(this);
1412
+ panel.Return();
1413
+ }
1414
+
1415
+//constraints.gridx += 1;
1416
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1417
+// debugCB.addItemListener(this);
1418
+
1419
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1420
+ trackCB.setToolTipText("Enable tracking target");
1421
+ trackCB.addItemListener(this);
1422
+
1423
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1424
+ oeilCB.setToolTipText("Move camera when tracking");
1425
+ oeilCB.addItemListener(this);
1426
+
1427
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1428
+ shadowCB.setToolTipText("When live compute shadows");
1429
+ shadowCB.addItemListener(this);
1430
+
1431
+ panel.Return();
1432
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1433
+ toggleTextureCB.setToolTipText("Load textures");
1434
+ toggleTextureCB.addItemListener(this);
1435
+
1436
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1437
+ toggleSwitchCB.setToolTipText("Choose a single item");
1438
+ toggleSwitchCB.addItemListener(this);
1439
+
1440
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1441
+ autokeepCB.setToolTipText("On structure change");
1442
+ autokeepCB.addItemListener(this);
1443
+
1444
+ panel.Return();
1445
+ if (Globals.ADVANCED)
1446
+ {
1447
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1448
+ lookAtCB.setToolTipText("Look-at target");
1449
+ lookAtCB.addItemListener(this);
1450
+ }
1451
+
1452
+ }
1453
+
1454
+ cGridBag fill = new cGridBag();
1455
+ fill.preferredHeight = 200;
1456
+ cGridBag fill2 = new cGridBag();
1457
+ fill2.preferredHeight = 200;
1458
+ cGridBag fill3 = new cGridBag();
1459
+ fill3.preferredHeight = 200;
1460
+
1461
+ panel.add(fill);
1462
+ panel.add(fill2);
1463
+ panel.add(fill3);
1464
+
1465
+ }
6721466
6731467 void EditObject(Object3D obj)
6741468 {
1469
+ assert(obj instanceof Composite);
1470
+
1471
+// if (obj.versionlist == null)
1472
+// {
1473
+// obj.versionlist = new Object3D[100];
1474
+// obj.versionindex = -1;
1475
+// }
1476
+
6751477 cRadio radioButton = new cRadio(obj.name);
1478
+
1479
+ // June 2019. Patch to avoid bug with transparency.
1480
+ radioButton.hadMaterial = obj.material != null;
1481
+ if (!radioButton.hadMaterial)
1482
+ {
1483
+ obj.material = new cMaterial();
1484
+ }
1485
+
6761486 radioButton.SetObject(obj);
677
- radioButton.layout = sevenButton;
1487
+ radioButton.layout = threeButton; // sixButton;
6781488 radioButton.SetCamera(cameraView.renderCamera, false);
6791489 radioButton.addActionListener(this);
6801490 radioPanel.add(radioButton);
6811491 buttonGroup.add(radioButton);
6821492 radioButton.doClick();
6831493 }
1494
+
6841495 void SetupViews(ObjEditor oe)
6851496 {
1497
+ theFrame = this;
1498
+
6861499 oe.SetupViews();
6871500
6881501 System.out.println("SetupViews");
....@@ -691,23 +1504,30 @@
6911504 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6921505 }
6931506
694
- JCheckBox liveCB;
695
- JCheckBox supportCB;
696
- JCheckBox localCB;
697
- JCheckBox crowdCB;
698
- JCheckBox smoothCB;
699
- JCheckBox fastCB;
700
- JCheckBox slowCB;
701
- JCheckBox boxCB;
702
- JCheckBox zoomBoxCB;
703
- JCheckBox trackCB;
704
- JCheckBox smoothfocusCB;
1507
+ cToggleButton liveCB;
1508
+ cCheckBox supportCB;
1509
+ cCheckBox localCB;
1510
+ cCheckBox crowdCB;
1511
+ cCheckBox smoothCB;
1512
+ cCheckBox minshaderCB;
1513
+
1514
+ cToggleButton fastCB;
1515
+ cCheckBox slowCB;
1516
+ cCheckBox boxCB;
1517
+ cCheckBox zoomBoxCB;
1518
+ cCheckBox freezeCB;
1519
+ //cToggleButton trackCB;
1520
+ cCheckBox trackCB;
1521
+ cCheckBox smoothfocusCB;
7051522 // JCheckBox speakerMocapCB;
706
- JCheckBox speakerCameraCB;
707
- JCheckBox speakerFocusCB;
708
- JCheckBox debugCB;
709
- JCheckBox oeilCB;
710
- JCheckBox lookAtCB;
1523
+ cCheckBox speakerCameraCB;
1524
+ cCheckBox speakerFocusCB;
1525
+ cCheckBox debugCB;
1526
+
1527
+ cCheckBox oeilCB;
1528
+ cCheckBox shadowCB;
1529
+ cCheckBox autokeepCB;
1530
+ cCheckBox lookAtCB;
7111531
7121532 // static int COLOR = 1;
7131533 // static int MATERIAL = 2;
....@@ -715,9 +1535,9 @@
7151535
7161536 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7171537
718
- JCheckBox colorCB;
719
- JCheckBox materialCB;
720
- JCheckBox textureCB;
1538
+ cCheckBox colorCB;
1539
+ cCheckBox materialCB;
1540
+ cCheckBox textureCB;
7211541
7221542 public void itemStateChanged(ItemEvent e)
7231543 {
....@@ -745,6 +1565,7 @@
7451565 } else if(e.getSource() == liveCB)
7461566 {
7471567 cameraView.ToggleLive();
1568
+ refreshContents(false);
7481569 }
7491570 else if(e.getSource() == supportCB)
7501571 {
....@@ -760,6 +1581,12 @@
7601581 {
7611582 cameraView.ToggleInertia();
7621583 cameraView.repaint();
1584
+ }
1585
+ else if(e.getSource() == minshaderCB)
1586
+ {
1587
+ Globals.MINSHADER ^= true;
1588
+ cameraView.programInitialized = false;
1589
+ cameraView.repaint();
7631590 }
7641591 else if(e.getSource() == localCB)
7651592 {
....@@ -809,6 +1636,18 @@
8091636 {
8101637 cameraView.ToggleOeil();
8111638 }
1639
+ else if(e.getSource() == shadowCB)
1640
+ {
1641
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1642
+ }
1643
+ else if(e.getSource() == freezeCB)
1644
+ {
1645
+ Globals.FREEZEONMOVE ^= true;
1646
+ }
1647
+ else if(e.getSource() == autokeepCB)
1648
+ {
1649
+ Globals.REPLACEONMAKE ^= true;
1650
+ }
8121651 else if(e.getSource() == lookAtCB)
8131652 {
8141653 cameraView.ToggleLookAt();
....@@ -825,7 +1664,8 @@
8251664
8261665 /**/
8271666 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
828
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1667
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1668
+ TreePath path = objEditor.jTree.getSelectionPath();
8291669 if ((path == null) || (path.getPathCount() <= 1)) {
8301670 // We can't move the root node or an empty selection
8311671 return;
....@@ -888,8 +1728,6 @@
8881728 }
8891729 }
8901730
891
- String string = (String) object;
892
-
8931731 System.out.println("Transfer = " + object + "; drop : " + target);
8941732 // if( object instanceof java.io.File[])
8951733 // {
....@@ -897,7 +1735,11 @@
8971735 // objEditor.DropFile((java.io.File[]) object, true);
8981736 // return;
8991737 // }
900
- if (string.charAt(0) == '/')
1738
+
1739
+ String string = object.toString();
1740
+
1741
+ // File path for Mac and Windows
1742
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9011743 {
9021744 // file(s)
9031745 String[] names = string.split("\n");
....@@ -924,7 +1766,7 @@
9241766
9251767 flashIt = false;
9261768 CameraPane pane = (CameraPane) target;
927
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1769
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9281770 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9291771
9301772 if (group.selection.size() == 1)
....@@ -940,23 +1782,33 @@
9401782
9411783 assert target == objEditor.jTree;
9421784 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1785
+ Object3D destinationLeaf;
9431786 try {
944
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1787
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9451788 } catch (Exception e) {
9461789 System.out.println("destinationPath : " + destinationPath);
9471790 return;
9481791 }
9491792
950
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1793
+ for (int i=group.selection.size(); --i>=0;)
9511794 {
1795
+ Object3D child = (Object3D)group.selection.elementAt(i);
1796
+
1797
+ // Cannot move into itself
1798
+ if (child == destinationLeaf)
1799
+ return;
1800
+ }
1801
+
1802
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1803
+// {
9521804 loadClipboard(true);
9531805 objEditor.jTree.setSelectionPath(destinationPath);
954
- pasteInto(false);
955
- } else {
956
- loadClipboard(false);
957
- objEditor.jTree.setSelectionPath(destinationPath);
958
- pasteInto(false); // true); // ???
959
- }
1806
+ pasteInto(false, false);
1807
+// } else {
1808
+// loadClipboard(false);
1809
+// objEditor.jTree.setSelectionPath(destinationPath);
1810
+// pasteInto(false, false); // true); // ???
1811
+// }
9601812 }
9611813 public void dropActionChanged(DropTargetDragEvent dtde)
9621814 // Called if the user has modified the current drop gesture
....@@ -1012,7 +1864,12 @@
10121864 TreePath path;
10131865
10141866 public TransferableTreePath(TreePath tp) {
1015
- path = tp;
1867
+ Object[] objs = new Object[tp.getPathCount()];
1868
+ for (int i=0; i<objs.length; i++)
1869
+ {
1870
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1871
+ }
1872
+ path = new TreePath(objs);
10161873 }
10171874
10181875 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1061,85 +1918,107 @@
10611918 {
10621919 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10631920 //heightFieldItem.addActionListener(this);
1064
- gridItem = menu.add(new MenuItem("Grid"));
1065
- gridItem.addActionListener(this);
1066
- rectoidItem = menu.add(new MenuItem("Box"));
1067
- rectoidItem.addActionListener(this);
1068
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1069
- ellipsoidItem.addActionListener(this);
1070
- coneItem = menu.add(new MenuItem("Cone"));
1071
- coneItem.addActionListener(this);
1072
- torusItem = menu.add(new MenuItem("Torus"));
1073
- torusItem.addActionListener(this);
1074
- superItem = menu.add(new MenuItem("Superellipsoid"));
1075
- superItem.addActionListener(this);
1921
+// gridItem = menu.add(new MenuItem("Grid"));
1922
+// gridItem.addActionListener(this);
1923
+// rectoidItem = menu.add(new MenuItem("Box"));
1924
+// rectoidItem.addActionListener(this);
1925
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1926
+// ellipsoidItem.addActionListener(this);
1927
+// coneItem = menu.add(new MenuItem("Cone"));
1928
+// coneItem.addActionListener(this);
1929
+// torusItem = menu.add(new MenuItem("Torus"));
1930
+// torusItem.addActionListener(this);
1931
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1932
+// superItem.addActionListener(this);
1933
+
1934
+ cameraItem = menu.add(new MenuItem("Camera"));
1935
+ cameraItem.addActionListener(this);
1936
+
1937
+ if (!Globals.ADVANCED)
1938
+ {
10761939 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10771940 kleinItem.addActionListener(this);
1078
- particleItem = menu.add(new MenuItem("Particle system"));
1079
- particleItem.addActionListener(this);
1941
+ }
1942
+
1943
+// particleItem = menu.add(new MenuItem("Particle system"));
1944
+// particleItem.addActionListener(this);
1945
+ if (Globals.ADVANCED)
1946
+ {
10801947 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10811948 ragdollItem.addActionListener(this);
10821949 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10831950 ragdoll2Item.addActionListener(this);
1951
+ }
10841952 menu.add("-");
1085
- meshItem = menu.add(new MenuItem("Mesh"));
1953
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10861954 meshItem.addActionListener(this);
10871955 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10881956 // meshGroupItem.addActionListener(this);
1957
+ if (Globals.ADVANCED)
1958
+ {
10891959 springItem = menu.add(new MenuItem("Spring"));
10901960 springItem.addActionListener(this);
10911961 flagItem = menu.add(new MenuItem("Flag"));
10921962 flagItem.addActionListener(this);
1093
- bezierItem = menu.add(new MenuItem("Patch"));
1094
- bezierItem.addActionListener(this);
1095
- checkerItem = menu.add(new MenuItem("Checker"));
1096
- checkerItem.addActionListener(this);
10971963 blobItem = menu.add(new MenuItem("Blob"));
10981964 blobItem.addActionListener(this);
10991965 latheItem = menu.add(new MenuItem("Lathe"));
11001966 latheItem.addActionListener(this);
1101
- lightItem = menu.add(new MenuItem("Light"));
1102
- lightItem.addActionListener(this);
1967
+ }
1968
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1969
+ bezierItem.addActionListener(this);
1970
+// overlayItem = menu.add(new MenuItem("Overlay"));
1971
+// overlayItem.addActionListener(this);
1972
+// lightItem = menu.add(new MenuItem("Light"));
1973
+// lightItem.addActionListener(this);
11031974 menu.add("-");
11041975 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11051976 //superLoopItem.addActionListener(this);
1106
- loopItem = menu.add(new MenuItem("Loop"));
1107
- loopItem.addActionListener(this);
1977
+// loopItem = menu.add(new MenuItem("Loop"));
1978
+// loopItem.addActionListener(this);
11081979 doubleItem = menu.add(new MenuItem("Fork"));
11091980 doubleItem.addActionListener(this);
1981
+ if (Globals.ADVANCED)
1982
+ {
11101983 tripleItem = menu.add(new MenuItem("Trident"));
11111984 tripleItem.addActionListener(this);
1985
+ }
11121986 }
11131987
11141988 void buildToolsMenu(Menu menu)
11151989 {
11161990 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11171991 animationItem.addItemListener(this);
1118
- animationItem.setState(CameraPane.ANIMATION);
1992
+ animationItem.setState(Globals.ANIMATION);
1993
+
1994
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1995
+ archiveItem.addActionListener(this);
11191996
11201997 menu.add("-");
11211998 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11221999 parseverticesItem.addActionListener(this);
11232000 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11242001 textureFieldItem.addActionListener(this);
1125
- alignItem = menu.add(new MenuItem("Align"));
2002
+ alignItem = menu.add(new MenuItem("Align Objects"));
11262003 alignItem.addActionListener(this);
1127
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1128
- mirrorItem.addActionListener(this);
11292004 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11302005 reduceMorphItem.addActionListener(this);
11312006 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11322007 reduce34MorphItem.addActionListener(this);
1133
-
1134
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1135
- computeAOItem.addActionListener(this);
11362008 menu.add("-");
1137
-
11382009 menu.add(memoryItem = new MenuItem("Memory Usage"));
11392010 memoryItem.addActionListener(this);
2011
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
2012
+ computeAOItem.addActionListener(this);
2013
+
2014
+ if (Globals.ADVANCED)
2015
+ {
2016
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
2017
+ mirrorItem.addActionListener(this);
2018
+ menu.add("-");
11402019 menu.add(analyzeItem = new MenuItem("Analyze"));
11412020 analyzeItem.addActionListener(this);
1142
- menu.add(dumpItem = new MenuItem("Dump"));
2021
+ menu.add(dumpItem = new MenuItem("Print"));
11432022 dumpItem.addActionListener(this);
11442023 // menu.add(pathItem = new MenuItem("From-to path"));
11452024 // pathItem.addActionListener(this);
....@@ -1157,6 +2036,7 @@
11572036 menu.add("-");
11582037 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11592038 editScriptItem.addActionListener(this);
2039
+ }
11602040 }
11612041
11622042 void ScreenFit()
....@@ -1279,9 +2159,34 @@
12792159 shadow.material = new cMaterial(obj.material);
12802160 shadow.material.diffuse = 0.0001f;
12812161 shadow.material.specular = 0.0001f;
2162
+ //shadow.projectedVertices[1].x = 300;
12822163
12832164 makeSomething(shadow);
12842165 }
2166
+
2167
+ private void ClearUnpinned()
2168
+ {
2169
+ //for (Object3D obj : listUI)
2170
+ for (int i=listUI.size(); --i>=0;)
2171
+ {
2172
+ Object3D obj = listUI.elementAt(i);
2173
+ if (!obj.pinned)
2174
+ {
2175
+ obj.CloseUI();
2176
+ listUI.remove(i);
2177
+ }
2178
+ }
2179
+ }
2180
+
2181
+ private void EditElement(Object3D elem, boolean newWindow)
2182
+ {
2183
+ // if (!(elem instanceof Composite))
2184
+ // newWindow = false;
2185
+ listUI.add(elem);
2186
+ elem.openEditWindow(this, newWindow); //, false);
2187
+ System.out.println("edit : " + elem);
2188
+ elem.editWindow.refreshContents(true); // ? new
2189
+ }
12852190
12862191 /**
12872192 * applyExample
....@@ -1485,9 +2390,9 @@
14852390
14862391 void Overwrite(int mask)
14872392 {
1488
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2393
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14892394 {
1490
- Object3D content = GrafreeD.clipboard.get(0);
2395
+ Object3D content = Grafreed.clipboard.get(0);
14912396
14922397 if (content instanceof cGroup && ((cGroup)content).transientlink )
14932398 content = ((cGroup)content).get(0);
....@@ -1510,6 +2415,7 @@
15102415 //
15112416 public void actionPerformed(ActionEvent event) // , Object arg)
15122417 {
2418
+ Object source = event.getSource();
15132419 /*
15142420 if (event.getSource() == nameField)
15152421 {
....@@ -1521,11 +2427,11 @@
15212427 }
15222428 else
15232429 */
1524
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2430
+ if (source == lookAtItem || source == lookFromItem)
15252431 {
15262432 ScreenFit();
15272433 } else
1528
- if (event.getSource() == switchItem)
2434
+ if (source == switchViewItem)
15292435 {
15302436 cVector v1 = new cVector();
15312437 cVector v2 = new cVector();
....@@ -1534,11 +2440,11 @@
15342440 objEditor.cameraView.renderCamera.setAim(v2, v1);
15352441 objEditor.cameraView.repaint();
15362442 } else
1537
- if (event.getSource() == rectoidItem)
2443
+ if (source == rectoidItem || source == boxButton)
15382444 {
15392445 makeSomething(new Box());
15402446 } else
1541
- if (event.getSource() == particleItem)
2447
+ if (source == particleItem || source == particlesButton)
15422448 {
15432449 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15442450 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1559,9 +2465,9 @@
15592465 applyExample(particleGeom, "SMOKE");
15602466 makeSomething(particleGeom);
15612467 } else
1562
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2468
+ if (source == ragdollItem || source == ragdoll2Item)
15632469 {
1564
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2470
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15652471
15662472 ragdoll.toParent = LA.newMatrix();
15672473 ragdoll.fromParent = LA.newMatrix();
....@@ -1579,7 +2485,7 @@
15792485 } else
15802486 /*
15812487 */
1582
- if (event.getSource() == heightFieldItem)
2488
+ if (source == heightFieldItem)
15832489 {
15842490 Object3D obj = new Object3D();
15852491
....@@ -1617,31 +2523,31 @@
16172523
16182524 makeSomething(obj);
16192525 } else
1620
- if (event.getSource() == gridItem)
2526
+ if (source == gridItem || source == gridButton)
16212527 {
16222528 makeSomething(new Grid());
16232529 } else
1624
- if (event.getSource() == ellipsoidItem)
2530
+ if (source == ellipsoidItem || source == sphereButton)
16252531 {
16262532 makeSomething(new Sphere());
16272533 } else
1628
- if (event.getSource() == coneItem)
2534
+ if (source == coneItem || source == coneButton)
16292535 {
16302536 makeSomething(new Cone());
16312537 } else
1632
- if (event.getSource() == torusItem)
2538
+ if (source == torusItem || source == torusButton)
16332539 {
16342540 makeSomething(new Torus());
16352541 } else
1636
- if (event.getSource() == superItem)
2542
+ if (source == superItem || source == superButton)
16372543 {
16382544 makeSomething(new Superellipsoid());
16392545 } else
1640
- if (event.getSource() == kleinItem)
2546
+ if (source == kleinItem || source == kleinButton)
16412547 {
16422548 makeSomething(new Klein());
16432549 } else
1644
- if (event.getSource() == blobItem)
2550
+ if (source == blobItem)
16452551 {
16462552 Blob blob = new Blob();
16472553 BlobComponent comp = new BlobComponent();
....@@ -1649,15 +2555,15 @@
16492555 //blob.retile();
16502556 makeSomething(blob);
16512557 } else
1652
- if (event.getSource() == latheItem)
2558
+ if (source == latheItem)
16532559 {
16542560 makeSomething(new Lathe());
16552561 } else
1656
- if (event.getSource() == bezierItem)
2562
+ if (source == bezierItem)
16572563 {
16582564 makeSomething(new BezierSurface());
16592565 } else
1660
- if (event.getSource() == checkerItem)
2566
+ if (source == overlayItem || source == overlayButton)
16612567 {
16622568 /*
16632569 Object3D obj = new BezierSurface(5,8);
....@@ -1672,7 +2578,7 @@
16722578 */
16732579 makeSomething(new Checker());
16742580 } else
1675
- if (event.getSource() == meshItem)
2581
+ if (source == meshItem)
16762582 {
16772583 Object3D itemtomake = new Object3D();
16782584 Object3D child;
....@@ -1693,35 +2599,52 @@
16932599 makeSomething(child);
16942600 }
16952601 } else
1696
- if (event.getSource() == springItem)
2602
+ if (source == springItem)
16972603 {
16982604 cSpring s = new cSpring();
16992605 s.setup();
17002606 makeSomething(s);
17012607 } else
1702
- if (event.getSource() == flagItem)
2608
+ if (source == flagItem)
17032609 {
17042610 cSpring s = new cFlag();
17052611 s.setup();
17062612 makeSomething(s);
17072613 } else
1708
- if (event.getSource() == lightItem)
2614
+ if (source == lightItem || source == lightButton)
17092615 {
17102616 makeSomething(new Light());
17112617 } else
1712
- if (event.getSource() == csgItem)
2618
+// if (source == skybox1Button ||
2619
+// source == skybox2Button ||
2620
+// source == skybox3Button ||
2621
+// source == skybox4Button ||
2622
+// source == skybox5Button ||
2623
+// source == skybox6Button ||
2624
+// source == skybox7Button ||
2625
+// source == skybox11Button ||
2626
+// source == skybox12Button ||
2627
+// source == skybox13Button ||
2628
+// source == skybox14Button ||
2629
+// source == skybox15Button ||
2630
+// source == skybox16Button ||
2631
+// source == skybox17Button)
2632
+// {
2633
+// ChangeSkybox(source);
2634
+// } else
2635
+ if (source == csgItem)
17132636 {
17142637 group(new CSG());
17152638 } else
1716
- if (event.getSource() == templateItem)
2639
+ if (source == templateItem)
17172640 {
17182641 group(new cTemplate());
17192642 } else
1720
- if (event.getSource() == attributeItem)
2643
+ if (source == attributeItem)
17212644 {
17222645 makeSomething(new Attribute());
17232646 } else
1724
- if (event.getSource() == pointflowItem)
2647
+ if (source == pointflowItem)
17252648 {
17262649 makeSomething(new PointFlow());
17272650 } else
....@@ -1733,7 +2656,7 @@
17332656 } else
17342657 */
17352658
1736
- if (event.getSource() == superLoopItem)
2659
+ if (source == superLoopItem)
17372660 {
17382661 Composite g = new cGroup();
17392662 for (int i=0; i<15; i++)
....@@ -1755,30 +2678,30 @@
17552678
17562679 group(g);
17572680 } else
1758
- if (event.getSource() == loopItem)
2681
+ if (source == loopItem || source == loopButton)
17592682 {
17602683 Composite csg = new GroupLeaf();
17612684 csg.count = 5;
17622685 group(csg);
1763
- Composite child = new cGroup();
2686
+ Composite child = new cGroup("Branch");
17642687 csg.addChild(child);
17652688 child.addChild(csg);
17662689 } else
1767
- if (event.getSource() == doubleItem)
2690
+ if (source == doubleItem)
17682691 {
1769
- Composite csg = new GroupLeaf();
2692
+ Composite csg = new GroupLeaf("Fork");
17702693 csg.count = 5;
17712694 group(csg);
1772
- Composite child = new cGroup();
2695
+ Composite child = new cGroup("Branch A");
17732696 csg.addChild(child);
17742697 child.addChild(csg);
1775
- child = new cGroup();
2698
+ child = new cGroup("Branch B");
17762699 csg.addChild(child);
17772700 child.addChild(csg);
17782701 } else
1779
- if (event.getSource() == tripleItem)
2702
+ if (source == tripleItem)
17802703 {
1781
- Composite csg = new GroupLeaf();
2704
+ Composite csg = new GroupLeaf("Trident");
17822705 csg.count = 4;
17832706 group(csg);
17842707 Composite child = new cGroup();
....@@ -1791,73 +2714,117 @@
17912714 csg.addChild(child);
17922715 child.addChild(csg);
17932716 } else
1794
-
1795
- if (event.getSource() == importGFDItem)
1796
- {
1797
- ImportGFD();
1798
- } else
1799
- if (event.getSource() == importVRMLX3DItem)
1800
- {
1801
- ImportVRMLX3D();
1802
- } else
1803
- if (event.getSource() == import3DSItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1806
- } else
1807
- if (event.getSource() == importOBJItem)
1808
- {
1809
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1810
- } else
1811
- if (event.getSource() == computeAOItem)
2717
+ if (source == computeAOItem)
18122718 {
18132719 Globals.drawMode = CameraPane.OCCLUSION;
1814
- Globals.theRenderer.repaint();
2720
+ cameraView.repaint();
18152721 } else
1816
- if (event.getSource() == recompileItem)
2722
+ if (source == recompileItem)
18172723 {
18182724 Recompile();
18192725 refreshContents();
18202726 } else
1821
- if (event.getSource() == editScriptItem)
2727
+ if (source == editScriptItem)
18222728 {
18232729 OpenDialog();
18242730 refreshContents();
18252731 } else
1826
- if (event.getSource() == invariantsItem)
2732
+ if (source == invariantsItem)
18272733 {
18282734 System.out.println("Invariants:");
1829
- GrafreeD.grafreeD.universe.invariants();
2735
+ Grafreed.grafreed.universe.invariants();
18302736 } else
1831
- if (event.getSource() == memoryItem)
2737
+ if (source == memoryItem)
18322738 {
18332739 //System.out.println("Invariants:");
18342740 PrintMemory();
18352741 } else
1836
- if (event.getSource() == pathItem)
2742
+ if (source == pathItem)
18372743 {
18382744 PrintPath();
18392745 } else
1840
- if (event.getSource() == analyzeItem)
2746
+ if (source == analyzeItem)
18412747 {
18422748 AnalyzeObject();
18432749 } else
1844
- if (event.getSource() == dumpItem)
2750
+ if (source == dumpItem)
18452751 {
18462752 DumpObject();
18472753 } else
1848
- if (event.getSource() == screenfitButton)
2754
+ if (source == minButton)
18492755 {
1850
- //Reload(lastConverter, lastFilename, true);
2756
+ Minimize();
2757
+ } else
2758
+ if (source == maxButton)
2759
+ {
2760
+ Maximize();
2761
+ } else
2762
+ if (source == fullButton)
2763
+ {
2764
+ ToggleFullScreen();
2765
+ } else
2766
+ if (source == collapseButton)
2767
+ {
2768
+ this.expandedLayout = radio.layout;
2769
+ CollapseToolbar();
2770
+ } else
2771
+ if (source == maximize3DButton)
2772
+ {
2773
+ this.expandedLayout = radio.layout;
2774
+ radio.layout = twoButton;
2775
+ Show3DView();
2776
+ CollapseToolbar();
2777
+ } else
2778
+ if (source == previousVersionButton)
2779
+ {
2780
+ // Go to previous version
2781
+ //if (!Undo())
2782
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2783
+ PreviousVersion();
2784
+ } else
2785
+ if (source == restoreButton)
2786
+ {
2787
+ // Restore current version
2788
+ Restore();
2789
+ //restoreButton.setEnabled(false);
2790
+ } else
2791
+ if (source == replaceButton)
2792
+ {
2793
+ // Overwrite current version
2794
+ Replace();
2795
+ //replaceButton.setEnabled(false);
2796
+ } else
2797
+ if (source == nextVersionButton)
2798
+ {
2799
+ // Go to next version
2800
+ NextVersion();
2801
+ } else
2802
+ if (source == saveVersionButton)
2803
+ {
2804
+ // Save a new version
2805
+ if (!Save(true))
2806
+ java.awt.Toolkit.getDefaultToolkit().beep();
2807
+ } else
2808
+ if (source == deleteVersionButton)
2809
+ {
2810
+ // Delete a new version
2811
+ DeleteVersion();
2812
+ } else
2813
+ if (source == oneStepButton)
2814
+ {
2815
+ Globals.ONESTEP = true;
2816
+ cameraView.repaint();
2817
+ } else
2818
+ if (source == screenfitButton)
2819
+ {
18512820 ScreenFit();
18522821 } else
1853
- if (event.getSource() == screenfitpointButton)
2822
+ if (source == screenfitpointButton)
18542823 {
1855
- //Reload(lastConverter, lastFilename, true);
18562824 ScreenFitPoint();
18572825 } else
1858
- if (event.getSource() == snapobjectButton)
2826
+ if (source == snapobjectButton)
18592827 {
1860
- //Reload(lastConverter, lastFilename, true);
18612828 SnapObject();
18622829 } else
18632830 // if (event.getSource() == recompileButton)
....@@ -1866,13 +2833,13 @@
18662833 // Recompile();
18672834 // refreshContents();
18682835 // } else
1869
- if (event.getSource() == gcButton)
2836
+ if (source == gcButton)
18702837 {
18712838 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18722839 System.gc();
18732840 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18742841 } else
1875
- if (event.getSource() == editLeafItem)
2842
+ if (source == editLeafItem)
18762843 {
18772844 Object3D obj;
18782845 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1886,62 +2853,74 @@
18862853 }
18872854 refreshContents(true);
18882855 } else
1889
- if (event.getSource() == openWindowItem)
2856
+ if (source == openWindowItem)
18902857 {
18912858 EditSelection(true);
18922859 } else
1893
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2860
+ if (source == cutItem || source == clearButton)
18942861 {
18952862 loadClipboard(true);
18962863 } else
1897
- if (event.getSource() == duplicateItem)
2864
+ if (source == undoItem)
18982865 {
1899
- Object3D keep = GrafreeD.clipboard;
2866
+ PreviousVersion();
2867
+ } else
2868
+ if (source == redoItem)
2869
+ {
2870
+ NextVersion();
2871
+ } else
2872
+ if (source == duplicateItem)
2873
+ {
2874
+ Object3D keep = Grafreed.clipboard;
19002875 loadClipboard(false);
19012876 paste(false);
1902
- GrafreeD.clipboard = keep;
2877
+ Grafreed.clipboard = keep;
19032878 } else
1904
- if (event.getSource() == cloneItem)
2879
+ if (source == cloneItem)
19052880 {
19062881 CloneSelection(false);
19072882 } else
1908
- if (event.getSource() == cloneSupportItem)
2883
+ if (source == cloneSupportItem)
19092884 {
19102885 CloneSelection(true);
19112886 } else
1912
- if (event.getSource() == copyItem)
2887
+ if (source == copyItem)
19132888 {
19142889 loadClipboard(false);
19152890 } else
1916
- if (event.getSource() == pasteItem)
2891
+ if (source == pasteItem)
19172892 {
19182893 paste(false);
19192894 } else
1920
- if (event.getSource() == pasteLinkItem)
2895
+ if (source == pasteIntoItem)
19212896 {
1922
- pasteInto(false);
2897
+ pasteInto(true, false);
19232898 } else
1924
- if (event.getSource() == pasteCloneItem)
2899
+ if (source == pasteLinkItem)
19252900 {
1926
- pasteInto(true);
2901
+ pasteInto(false, false);
19272902 } else
1928
- if (event.getSource() == pasteExpandItem)
2903
+ if (source == pasteCloneItem)
2904
+ {
2905
+ pasteInto(true, true);
2906
+ } else
2907
+ if (source == pasteExpandItem)
19292908 {
19302909 paste(true);
19312910 } else
1932
- if (event.getSource() == synchronizeItem)
2911
+ if (source == synchronizeItem)
19332912 {
19342913 Overwrite(Object3D.TRANSFORM);
19352914 } else
1936
- if (event.getSource() == overwriteNameItem)
2915
+ if (source == overwriteNameItem)
19372916 {
19382917 Overwrite(Object3D.NAME);
19392918 } else
1940
- if (event.getSource() == overwriteUVItem)
2919
+ if (source == overwriteUVItem)
19412920 {
19422921 Overwrite(Object3D.UV);
19432922 } else
1944
- if (event.getSource() == overwriteMatItem)
2923
+ if (source == overwriteMatItem)
19452924 {
19462925 /* july 2015
19472926 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1961,7 +2940,7 @@
19612940
19622941 Overwrite(dropAttributes);
19632942 }
1964
- if (event.getSource() == overwriteGeoItem)
2943
+ if (source == overwriteGeoItem)
19652944 {
19662945 Overwrite(Object3D.GEOMETRY);
19672946 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1978,7 +2957,7 @@
19782957 // refreshContents();
19792958 // }
19802959 } else
1981
- if (event.getSource() == generateMeshItem)
2960
+ if (source == generateMeshItem)
19822961 {
19832962 //if (group.selection.size() == 1)
19842963 // for (int i=0; i<group.selection.size(); i++)
....@@ -1989,7 +2968,7 @@
19892968 ResetModel();
19902969 refreshContents();
19912970 } else
1992
- if (event.getSource() == extractGeometriesItem)
2971
+ if (source == extractGeometriesItem)
19932972 {
19942973 boolean one = false;
19952974
....@@ -2016,7 +2995,7 @@
20162995 ResetModel();
20172996 refreshContents();
20182997 } else
2019
- if (event.getSource() == cloneGeometriesItem)
2998
+ if (source == cloneGeometriesItem)
20202999 {
20213000 boolean one = false;
20223001
....@@ -2042,7 +3021,7 @@
20423021 ResetModel();
20433022 refreshContents();
20443023 } else
2045
- if (event.getSource() == shareGeometriesItem)
3024
+ if (source == shareGeometriesItem)
20463025 {
20473026 boolean one = false;
20483027
....@@ -2072,7 +3051,7 @@
20723051 refreshContents();
20733052 }
20743053 } else
2075
- if (event.getSource() == mergeGeometriesItem)
3054
+ if (source == mergeGeometriesItem)
20763055 {
20773056 boolean one = false;
20783057
....@@ -2102,7 +3081,7 @@
21023081 ResetModel();
21033082 refreshContents();
21043083 } else
2105
- if (event.getSource() == linkverticesItem)
3084
+ if (source == linkverticesItem)
21063085 {
21073086 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21083087 // {
....@@ -2115,9 +3094,9 @@
21153094 // group.selection.get(0).setMasterThis(content); // should be identity
21163095 // refreshContents();
21173096 // }
2118
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3097
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21193098 {
2120
- Object3D content = GrafreeD.clipboard.get(0);
3099
+ Object3D content = Grafreed.clipboard.get(0);
21213100
21223101 if (content instanceof cGroup && ((cGroup)content).transientlink )
21233102 content = ((cGroup)content).get(0);
....@@ -2125,38 +3104,38 @@
21253104 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21263105 for (int i=0; i<group.selection.size(); i++)
21273106 {
2128
- boolean random = CameraPane.RANDOM;
2129
- CameraPane.RANDOM = false; // parse all random nodes
3107
+ boolean random = CameraPane.SWITCH;
3108
+ CameraPane.SWITCH = false; // parse all random nodes
21303109 group.selection.get(i).linkVerticesThis(content);
21313110 // group.selection.get(i).setMasterThis(content); // should be identity
2132
- CameraPane.RANDOM = random;
3111
+ CameraPane.SWITCH = random;
21333112 }
21343113 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21353114 refreshContents();
21363115 }
21373116 } else
2138
- if (event.getSource() == resetsupportItem)
3117
+ if (source == resetsupportItem)
21393118 {
21403119 for (int i=0; i<group.selection.size(); i++)
21413120 {
2142
- boolean random = CameraPane.RANDOM;
2143
- CameraPane.RANDOM = false; // parse all random nodes
3121
+ boolean random = CameraPane.SWITCH;
3122
+ CameraPane.SWITCH = false; // parse all random nodes
21443123 group.selection.get(i).linkVerticesThis(null);
2145
- CameraPane.RANDOM = random;
3124
+ CameraPane.SWITCH = random;
21463125 }
21473126
21483127 refreshContents();
21493128 } else
2150
- if (event.getSource() == relinkverticesItem)
3129
+ if (source == relinkverticesItem)
21513130 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
3131
+ boolean random = CameraPane.SWITCH;
3132
+ CameraPane.SWITCH = false; // parse all random nodes
21543133 group.selection.RelinkToSupport();
2155
- CameraPane.RANDOM = random;
3134
+ CameraPane.SWITCH = random;
21563135
21573136 refreshContents();
21583137 } else
2159
- if (event.getSource() == resetreferencesItem)
3138
+ if (source == resetreferencesItem)
21603139 {
21613140 for (int i=0; i<group.selection.size(); i++)
21623141 {
....@@ -2165,11 +3144,11 @@
21653144
21663145 refreshContents();
21673146 } else
2168
- if (event.getSource() == setMasterItem)
3147
+ if (source == setMasterItem)
21693148 {
2170
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3149
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21713150 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
3151
+ Object3D content = Grafreed.clipboard.get(0);
21733152
21743153 if (content instanceof cGroup && ((cGroup)content).transientlink )
21753154 content = ((cGroup)content).get(0);
....@@ -2178,13 +3157,13 @@
21783157 refreshContents();
21793158 }
21803159 } else
2181
- if (event.getSource() == poseMeshItem)
3160
+ if (source == poseMeshItem)
21823161 {
21833162 if (group.selection.size() == 1)
21843163 {
2185
- if (GrafreeD.clipboard.size() == 1)
3164
+ if (Grafreed.clipboard.size() == 1)
21863165 {
2187
- Object3D content = GrafreeD.clipboard.get(0);
3166
+ Object3D content = Grafreed.clipboard.get(0);
21883167
21893168 if (content instanceof cGroup && ((cGroup)content).transientlink )
21903169 content = ((cGroup)content).get(0);
....@@ -2197,19 +3176,19 @@
21973176 }
21983177
21993178 } else
2200
- if (event.getSource() == revertMeshItem)
3179
+ if (source == revertMeshItem)
22013180 {
22023181 RevertMeshes();
22033182 } else
2204
- if (event.getSource() == resetMeshItem)
3183
+ if (source == resetAllItem)
22053184 {
22063185 ResetAll();
22073186 } else
2208
- if (event.getSource() == stepAllItem)
3187
+ if (source == stepAllItem)
22093188 {
22103189 StepAll();
22113190 } else
2212
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3191
+ if (source == deleteItem) // || event.getSource() == clearButton)
22133192 {
22143193 //int indices[] = jList.getSelectedIndices();
22153194 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2217,46 +3196,46 @@
22173196
22183197 ClearSelection(false);
22193198 } else
2220
- if (event.getSource() == clearAllItem)
3199
+ if (source == clearAllItem)
22213200 {
22223201 ClearSelection(true);
22233202 } else
2224
- if (event.getSource() == grabItem)
3203
+ if (source == grabItem || source == groupButton)
22253204 {
2226
- group(new cGroup(), true);
3205
+ group(new cGroup(), false); // true);
22273206 } else
2228
- if (event.getSource() == hideItem)
3207
+ if (source == hideItem)
22293208 {
22303209 group(new HiddenObject());
22313210 } else
2232
- if (event.getSource() == frontItem)
3211
+ if (source == frontItem)
22333212 {
22343213 front();
22353214 } else
2236
- if (event.getSource() == backItem)
3215
+ if (source == backItem)
22373216 {
22383217 back();
22393218 } else
2240
- if (event.getSource() == cameraItem)
3219
+ if (source == cameraItem)
22413220 {
22423221 makeSomething(new Camera());
22433222 } else
2244
- if (event.getSource() == compositeItem)
3223
+ if (source == compositeItem || source == compositeButton)
22453224 {
22463225 group(new Composite());
22473226 } else
2248
- if (event.getSource() == randomItem)
3227
+ if (source == switchItem || source == switchButton)
22493228 {
22503229 RandomNode random = new RandomNode();
22513230 group(random);
22523231 if (random.size() > 0)
2253
- random.name = random.get(0).name + "Rnd";
3232
+ random.name = random.get(0).name + "Switch";
22543233 } else
2255
- if (event.getSource() == physicsItem)
3234
+ if (source == physicsItem)
22563235 {
22573236 group(new PhysicsNode());
22583237 } else
2259
- if (event.getSource() == frameselectorItem)
3238
+ if (source == frameselectorItem)
22603239 {
22613240 for (int i=0; i<group.selection.size(); i++)
22623241 {
....@@ -2268,7 +3247,7 @@
22683247 ResetModel();
22693248 refreshContents();
22703249 } else
2271
- if (event.getSource() == switchGeoItem)
3250
+ if (source == switchGeoItem)
22723251 {
22733252 for (int i=0; i<group.selection.size(); i++)
22743253 {
....@@ -2280,7 +3259,7 @@
22803259 ResetModel();
22813260 refreshContents();
22823261 } else
2283
- if (event.getSource() == switchTransfoItem)
3262
+ if (source == switchTransfoItem)
22843263 {
22853264 for (int i=0; i<group.selection.size(); i++)
22863265 {
....@@ -2292,7 +3271,7 @@
22923271 ResetModel();
22933272 refreshContents();
22943273 } else
2295
- if (event.getSource() == morphItem)
3274
+ if (source == morphItem)
22963275 {
22973276 for (int i=0; i<group.selection.size(); i++)
22983277 {
....@@ -2304,7 +3283,7 @@
23043283 ResetModel();
23053284 refreshContents();
23063285 } else
2307
- if (event.getSource() == scriptNodeItem)
3286
+ if (source == scriptNodeItem)
23083287 {
23093288 boolean atleastone = false;
23103289
....@@ -2343,215 +3322,252 @@
23433322 }
23443323 }
23453324 } else
2346
- if (event.getSource() == linkerItem)
3325
+ if (source == linkerItem)
23473326 {
23483327 group(new cLinker());
23493328 } else
2350
- if (event.getSource() == textureItem)
3329
+ if (source == textureItem || source == textureButton)
23513330 {
23523331 group(new TextureNode());
23533332 } else
2354
- if (event.getSource() == billboardItem)
3333
+ if (source == billboardItem)
23553334 {
23563335 group(new BillboardNode());
23573336 } else
2358
- if (event.getSource() == shadowXItem)
3337
+ if (source == shadowXItem)
23593338 {
23603339 CastShadow(0);
23613340 } else
2362
- if (event.getSource() == shadowYItem)
3341
+ if (source == shadowYItem)
23633342 {
23643343 CastShadow(1);
23653344 } else
2366
- if (event.getSource() == shadowZItem)
3345
+ if (source == shadowZItem)
23673346 {
23683347 CastShadow(2);
23693348 } else
2370
- if (event.getSource() == ungroupItem)
3349
+ if (source == ungroupItem || source == ungroupButton)
23713350 {
2372
- //ungroup();
3351
+ boolean hasRoot = false;
3352
+
23733353 for (int i=0; i<group.selection.size(); i++)
23743354 {
2375
- Ungroup(group.selection.get(i));
3355
+ if (group.selection.get(i) == group)
3356
+ {
3357
+ hasRoot = true;
3358
+ break;
3359
+ }
23763360 }
23773361
2378
- ClearSelection(false);
2379
-
2380
- refreshContents();
3362
+ if (!hasRoot)
3363
+ {
3364
+ for (int i=0; i<group.selection.size(); i++)
3365
+ {
3366
+ Ungroup(group.selection.get(i));
3367
+ }
3368
+
3369
+ ClearSelection(false);
3370
+
3371
+ refreshContents();
3372
+ }
23813373 } else
2382
- if (event.getSource() == genUVItem)
3374
+ if (source == genUVItem)
23833375 {
23843376 GenUV();
23853377 } else
2386
- if (event.getSource() == genNormalsCADItem)
3378
+ if (source == genNormalsCADItem)
23873379 {
23883380 GenNormals(true);
23893381 } else
2390
- if (event.getSource() == genNormalsMESHItem)
3382
+ if (source == genNormalsMESHItem)
23913383 {
2392
- GenNormals(true); // TODO
3384
+ GenNormalsMESH();
23933385 } else
2394
- if (event.getSource() == genNormalsORGANItem)
3386
+ if (source == genNormalsORGANItem)
23953387 {
23963388 GenNormals(false);
23973389 } else
2398
- if (event.getSource() == genNormalsMINEItem)
3390
+ if (source == genNormalsMINEItem)
23993391 {
24003392 GenNormalsMINE();
24013393 } else
2402
- if (event.getSource() == stripifyItem)
3394
+ if (source == stripifyItem)
24033395 {
24043396 Stripify();
24053397 } else
2406
- if (event.getSource() == unstripifyItem)
3398
+ if (source == unstripifyItem)
24073399 {
24083400 Unstripify();
24093401 } else
2410
- if (event.getSource() == trimItem)
3402
+ if (source == trimItem)
24113403 {
24123404 Trim();
24133405 } else
2414
- if (event.getSource() == untrimItem)
3406
+ if (source == untrimItem)
24153407 {
24163408 Untrim();
24173409 } else
2418
- if (event.getSource() == clearColorsItem)
3410
+ if (source == clearColorsItem)
24193411 {
24203412 ClearColors();
24213413 } else
2422
- if (event.getSource() == clearMaterialsItem)
3414
+ if (source == clearMaterialsItem)
24233415 {
24243416 ClearMaterials();
24253417 } else
2426
- if (event.getSource() == liveleavesItem)
3418
+ if (source == liveleavesItem)
24273419 {
24283420 LiveLeaves(true);
24293421 } else
2430
- if (event.getSource() == unliveleavesItem)
3422
+ if (source == unliveleavesItem)
24313423 {
24323424 LiveLeaves(false);
24333425 } else
2434
- if (event.getSource() == supportleavesItem)
3426
+ if (source == supportleavesItem)
24353427 {
24363428 SupportLeaves(true);
24373429 } else
2438
- if (event.getSource() == unsupportleavesItem)
3430
+ if (source == unsupportleavesItem)
24393431 {
24403432 SupportLeaves(false);
24413433 } else
2442
- if (event.getSource() == hideleavesItem)
3434
+ if (source == hideleavesItem)
24433435 {
24443436 HideLeaves(true);
24453437 } else
2446
- if (event.getSource() == showleavesItem)
3438
+ if (source == showleavesItem)
24473439 {
24483440 HideLeaves(false);
24493441 } else
2450
- if (event.getSource() == markleavesItem)
3442
+ if (source == markleavesItem)
24513443 {
24523444 MarkLeaves(true);
24533445 } else
2454
- if (event.getSource() == unmarkleavesItem)
3446
+ if (source == unmarkleavesItem)
24553447 {
24563448 MarkLeaves(false);
24573449 } else
2458
- if (event.getSource() == flipVItem)
3450
+ if (source == rewindleavesItem)
3451
+ {
3452
+ RewindLeaves(true);
3453
+ } else
3454
+ if (source == unrewindleavesItem)
3455
+ {
3456
+ RewindLeaves(false);
3457
+ } else
3458
+ if (source == randomleavesItem)
3459
+ {
3460
+ RandomLeaves(true);
3461
+ } else
3462
+ if (source == unrandomleavesItem)
3463
+ {
3464
+ RandomLeaves(false);
3465
+ } else
3466
+ if (source == flipVItem)
24593467 {
24603468 FlipV(true);
24613469 } else
2462
- if (event.getSource() == unflipVItem)
3470
+ if (source == unflipVItem)
24633471 {
24643472 FlipV(false);
24653473 } else
2466
- if (event.getSource() == lowTexturesItem)
3474
+ if (source == lowTexturesItem)
24673475 {
24683476 SetTexRes(0);
24693477 } else
2470
- if (event.getSource() == normalTexturesItem)
3478
+ if (source == normalTexturesItem)
24713479 {
24723480 SetTexRes(1);
24733481 } else
2474
- if (event.getSource() == highTexturesItem)
3482
+ if (source == highTexturesItem)
24753483 {
24763484 SetTexRes(2);
24773485 } else
2478
- if (event.getSource() == veryhighTexturesItem)
3486
+ if (source == veryhighTexturesItem)
24793487 {
24803488 SetTexRes(3);
24813489 } else
2482
- if (event.getSource() == maxTexturesItem)
3490
+ if (source == maxTexturesItem)
24833491 {
24843492 SetTexRes(4);
24853493 } else
2486
- if (event.getSource() == panoTexturesItem)
3494
+ if (source == panoTexturesItem)
24873495 {
24883496 SetTexRes(5);
24893497 } else
2490
- if (event.getSource() == reverseNormalsItem)
3498
+ if (source == reverseNormalsItem)
24913499 {
24923500 ReverseNormals();
24933501 } else
2494
- if (event.getSource() == parseverticesItem)
3502
+ if (source == parseverticesItem)
24953503 {
24963504 ParseVertices();
24973505 } else
2498
- if (event.getSource() == textureFieldItem)
3506
+ if (source == textureFieldItem)
24993507 {
25003508 TextureVertices();
25013509 } else
2502
- if (event.getSource() == alignItem)
3510
+ if (source == alignItem)
25033511 {
25043512 Align();
25053513 } else
2506
- if (event.getSource() == mirrorItem)
3514
+ if (source == mirrorItem)
25073515 {
25083516 MirrorPoses();
25093517 } else
2510
- if (event.getSource() == reduceMorphItem)
3518
+ if (source == reduceMorphItem)
25113519 {
25123520 MeshReduction(false);
25133521 } else
2514
- if (event.getSource() == reduce34MorphItem)
3522
+ if (source == reduce34MorphItem)
25153523 {
25163524 MeshReduction(true);
25173525 } else
2518
- if (event.getSource() == reverseTrianglesItem)
3526
+ if (source == reverseTrianglesItem)
25193527 {
25203528 ReverseTriangles();
25213529 } else
2522
- if (event.getSource() == reduceMeshItem)
3530
+ if (source == reduceMeshItem)
25233531 {
25243532 ReduceMesh(false);
25253533 } else
2526
- if (event.getSource() == reduce34MeshItem)
3534
+ if (source == reduce34MeshItem)
25273535 {
25283536 ReduceMesh(true);
25293537 } else
2530
- if (event.getSource() == increaseMeshItem)
3538
+ if (source == increaseMeshItem)
25313539 {
25323540 IncreaseMesh();
25333541 } else
2534
- if (event.getSource() == clipMeshItem)
3542
+ if (source == clipMeshItem)
25353543 {
25363544 ClipMesh();
25373545 } else
2538
- if (event.getSource() == smoothMeshItem)
3546
+ if (source == smoothMeshItem)
25393547 {
25403548 SmoothMesh();
25413549 } else
2542
- if (event.getSource() == transformgeometryItem)
3550
+ if (source == transformGeometryItem)
25433551 {
25443552 TransformGeometry();
25453553 } else
2546
- if (event.getSource() == resetTransformItem)
3554
+ if (source == transformChildrenItem)
3555
+ {
3556
+ TransformChildren();
3557
+ } else
3558
+ if (source == resetTransformItem)
25473559 {
25483560 ResetTransform();
25493561 } else
2550
- if (event.getSource() == resetCentroidItem)
3562
+ if (source == resetCentroidItem)
25513563 {
2552
- ResetCentroid();
3564
+ ResetCentroid(true);
25533565 } else
2554
- if (event.getSource() == resetParentItem)
3566
+ if (source == resetCentroidXZItem)
3567
+ {
3568
+ ResetCentroid(false);
3569
+ } else
3570
+ if (source == resetParentItem)
25553571 {
25563572 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25573573 {
....@@ -2561,7 +3577,7 @@
25613577
25623578 refreshContents();
25633579 } else
2564
- if (event.getSource() == repairParentItem)
3580
+ if (source == repairParentItem)
25653581 {
25663582 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673583 {
....@@ -2575,7 +3591,7 @@
25753591
25763592 refreshContents();
25773593 } else
2578
- if (event.getSource() == repairShadowItem)
3594
+ if (source == repairShadowItem)
25793595 {
25803596 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25813597 {
....@@ -2589,7 +3605,7 @@
25893605
25903606 refreshContents();
25913607 } else
2592
- if (event.getSource() == sortbysizeItem)
3608
+ if (source == sortbysizeItem)
25933609 {
25943610 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25953611 {
....@@ -2601,7 +3617,7 @@
26013617 ResetModel();
26023618 refreshContents();
26033619 } else
2604
- if (event.getSource() == sortbynameItem)
3620
+ if (source == sortbynameItem)
26053621 {
26063622 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26073623 {
....@@ -2613,7 +3629,7 @@
26133629 ResetModel();
26143630 refreshContents();
26153631 } else
2616
- if (event.getSource() == attachPigmentItem)
3632
+ if (source == attachPigmentItem)
26173633 {
26183634 String texture = GetFile("Attach pigment");
26193635 Object3D obj;
....@@ -2625,7 +3641,7 @@
26253641
26263642 refreshContents();
26273643 } else
2628
- if (event.getSource() == detachPigmentItem)
3644
+ if (source == detachPigmentItem)
26293645 {
26303646 Object3D obj;
26313647 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2636,7 +3652,7 @@
26363652
26373653 refreshContents();
26383654 } else
2639
- if (event.getSource() == attachBumpItem)
3655
+ if (source == attachBumpItem)
26403656 {
26413657 String texture = GetFile("Attach bump");
26423658 Object3D obj;
....@@ -2648,18 +3664,18 @@
26483664
26493665 refreshContents();
26503666 } else
2651
- if (event.getSource() == detachBumpItem)
3667
+ if (source == detachBumpItem)
26523668 {
26533669 Object3D obj;
26543670 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26553671 {
26563672 obj = (Object3D)e.nextElement();
2657
- obj.SetBumpTexture(null);
3673
+ obj.ResetBumpTexture();
26583674 }
26593675
26603676 refreshContents();
26613677 } else
2662
- if (event.getSource() == pigmentBumpItem)
3678
+ if (source == pigmentBumpItem)
26633679 {
26643680 Object3D obj;
26653681 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2670,159 +3686,233 @@
26703686
26713687 refreshContents();
26723688 } else
2673
- if (event.getSource() == flashSelectionButton)
3689
+ if (source == embedTexturesItem)
3690
+ {
3691
+ Object3D obj;
3692
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3693
+ {
3694
+ obj = (Object3D)e.nextElement();
3695
+ obj.EmbedTextures(true);
3696
+ }
3697
+
3698
+ refreshContents();
3699
+ } else
3700
+ if (source == deEmbedTexturesItem)
3701
+ {
3702
+ Object3D obj;
3703
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3704
+ {
3705
+ obj = (Object3D)e.nextElement();
3706
+ obj.EmbedTextures(false);
3707
+ }
3708
+
3709
+ CameraPane.texturepigment.clear();
3710
+ CameraPane.texturebump.clear();
3711
+
3712
+ refreshContents();
3713
+ } else
3714
+ if (source == flashSelectionButton)
26743715 {
26753716 CameraPane.flash = true;
26763717 refreshContents();
26773718 } else
2678
- if (event.getSource() == oneButton)
3719
+ if (source == oneButton)
26793720 {
26803721 } else
2681
- if (event.getSource() == twoButton)
3722
+ if (source == twoButton)
26823723 {
26833724 radio.layout = twoButton;
2684
- // bug
2685
- //gridPanel.setDividerLocation(1.0);
2686
- //bigPanel.setDividerLocation(0.0);
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2709
- //bigThree.add(XYZPanel, aWindowConstraints);
2710
- bigThree.revalidate();
3725
+
3726
+ if (CameraPane.FULLSCREEN)
3727
+ fullscreenLayout = radio.layout;
3728
+
3729
+ Show3DView();
3730
+
3731
+ cameraView.requestFocusInWindow();
3732
+
3733
+// refreshContents(true);
3734
+//
3735
+// try
3736
+// {
3737
+// java.awt.Robot bot = new java.awt.Robot();
3738
+// int mask = InputEvent.BUTTON1_MASK;
3739
+// bot.mouseMove(100, 100);
3740
+// bot.mousePress(mask);
3741
+// bot.mouseRelease(mask);
3742
+// }
3743
+// catch (Exception e)
3744
+// {
3745
+//
3746
+// }
3747
+
27113748 } else
2712
- if (event.getSource() == threeButton)
3749
+ if (source == threeButton)
27133750 {
27143751 radio.layout = threeButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2723
- aWindowConstraints.weightx = 0;
2724
- aWindowConstraints.weighty = 1;
2725
- //bigThree.add(jtp, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- bigThree.add(centralPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aConstraints.gridheight = 3;
2736
- aConstraints.fill = GridBagConstraints.VERTICAL;
2737
- bigThree.add(XYZPanel, aWindowConstraints);
2738
- bigThree.revalidate();
3752
+
3753
+ if (CameraPane.FULLSCREEN)
3754
+ fullscreenLayout = radio.layout;
3755
+
3756
+// bigThree.remove(scenePanel);
3757
+// bigThree.remove(centralPanel);
3758
+// bigThree.remove(XYZPanel);
3759
+// aWindowConstraints.gridx = 0;
3760
+// aWindowConstraints.gridy = 0;
3761
+// aWindowConstraints.gridwidth = 1;
3762
+// // aConstraints.gridheight = 3;
3763
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3764
+// aWindowConstraints.weightx = 0;
3765
+// aWindowConstraints.weighty = 1;
3766
+// //bigThree.add(jtp, aWindowConstraints);
3767
+// aWindowConstraints.weightx = 1;
3768
+// aWindowConstraints.gridwidth = 3;
3769
+// // aConstraints.gridheight = 3;
3770
+// aWindowConstraints.gridx = 1;
3771
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3772
+// bigThree.add(centralPanel, aWindowConstraints);
3773
+// aWindowConstraints.weightx = 0;
3774
+// aWindowConstraints.gridx = 4;
3775
+// aWindowConstraints.gridwidth = 1;
3776
+// // aConstraints.gridheight = 3;
3777
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3778
+// bigThree.add(XYZPanel, aWindowConstraints);
3779
+// bigThree.validate();
3780
+// scenePanel.setVisible(false);
3781
+// centralPanel.setVisible(true);
3782
+// XYZPanel.setVisible(true);
3783
+ bigThree.ClearUI();
3784
+ bigThree.add(scenePanel);
3785
+ bigThree.add(centralPanel);
3786
+ bigThree.FlushUI();
3787
+
3788
+ cameraView.requestFocusInWindow();
27393789 } else
2740
- if (event.getSource() == fourButton)
3790
+ if (source == fourButton)
27413791 {
27423792 radio.layout = fourButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aWindowConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2751
- aWindowConstraints.weightx = 1;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- //bigThree.add(cameraPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aWindowConstraints);
2766
- bigThree.revalidate();
3793
+
3794
+ if (CameraPane.FULLSCREEN)
3795
+ fullscreenLayout = radio.layout;
3796
+
3797
+// bigThree.remove(scenePanel);
3798
+// bigThree.remove(centralPanel);
3799
+// bigThree.remove(XYZPanel);
3800
+// aWindowConstraints.gridx = 0;
3801
+// aWindowConstraints.gridy = 0;
3802
+// aWindowConstraints.gridwidth = 1;
3803
+// // aWindowConstraints.gridheight = 3;
3804
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3805
+// aWindowConstraints.weightx = 1;
3806
+// aWindowConstraints.weighty = 1;
3807
+// bigThree.add(scenePanel, aWindowConstraints);
3808
+// aWindowConstraints.weightx = 1;
3809
+// aWindowConstraints.gridwidth = 3;
3810
+// // aConstraints.gridheight = 3;
3811
+// aWindowConstraints.gridx = 1;
3812
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3813
+// //bigThree.add(cameraPanel, aWindowConstraints);
3814
+// aWindowConstraints.weightx = 0;
3815
+// aWindowConstraints.gridx = 4;
3816
+// aWindowConstraints.gridwidth = 1;
3817
+// // aWindowConstraints.gridheight = 3;
3818
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3819
+// //bigThree.add(XYZPanel, aWindowConstraints);
3820
+// bigThree.validate();
3821
+// scenePanel.setVisible(true);
3822
+// centralPanel.setVisible(false);
3823
+// XYZPanel.setVisible(false);
3824
+ bigThree.ClearUI();
3825
+ bigThree.add(scenePanel);
3826
+ bigThree.FlushUI();
3827
+
3828
+ cameraView.requestFocusInWindow();
27673829 } else
2768
- if (event.getSource() == sixButton)
3830
+ if (source == sixButton)
27693831 {
27703832 radio.layout = sixButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aWindowConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- //bigThree.add(XYZPanel, aConstraints);
2794
- bigThree.revalidate();
3833
+
3834
+ if (CameraPane.FULLSCREEN)
3835
+ fullscreenLayout = radio.layout;
3836
+
3837
+// bigThree.remove(scenePanel);
3838
+// bigThree.remove(centralPanel);
3839
+// bigThree.remove(XYZPanel);
3840
+// aWindowConstraints.gridx = 0;
3841
+// aWindowConstraints.gridy = 0;
3842
+// aWindowConstraints.gridwidth = 1;
3843
+// // aConstraints.gridheight = 3;
3844
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3845
+// aWindowConstraints.weightx = 0;
3846
+// aWindowConstraints.weighty = 1;
3847
+// bigThree.add(scenePanel, aWindowConstraints);
3848
+// aWindowConstraints.weightx = 1;
3849
+// aWindowConstraints.gridwidth = 3;
3850
+// // aWindowConstraints.gridheight = 3;
3851
+// aWindowConstraints.gridx = 1;
3852
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3853
+// bigThree.add(centralPanel, aWindowConstraints);
3854
+// aWindowConstraints.weightx = 0;
3855
+// aWindowConstraints.gridx = 4;
3856
+// aWindowConstraints.gridwidth = 1;
3857
+// // aWindowConstraints.gridheight = 3;
3858
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3859
+// //bigThree.add(XYZPanel, aConstraints);
3860
+// bigThree.validate();
3861
+// scenePanel.setVisible(true);
3862
+// centralPanel.setVisible(true);
3863
+// XYZPanel.setVisible(false);
3864
+ bigThree.ClearUI();
3865
+ bigThree.add(centralPanel);
3866
+ bigThree.add(scenePanel);
3867
+ bigThree.FlushUI();
3868
+
3869
+ cameraView.requestFocusInWindow();
27953870 } else
2796
- if (event.getSource() == sevenButton)
3871
+ if (source == sevenButton)
27973872 {
27983873 radio.layout = sevenButton;
2799
- bigThree.remove(scenePanel);
2800
- bigThree.remove(centralPanel);
2801
- bigThree.remove(XYZPanel);
2802
- aWindowConstraints.gridx = 0;
2803
- aWindowConstraints.gridy = 0;
2804
- aWindowConstraints.gridwidth = 1;
2805
- // aWindowConstraints.gridheight = 3;
2806
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2807
- aWindowConstraints.weightx = 0;
2808
- aWindowConstraints.weighty = 1;
2809
- bigThree.add(scenePanel, aWindowConstraints);
2810
- aWindowConstraints.weightx = 1;
2811
- aWindowConstraints.gridwidth = 3;
2812
- // aWindowConstraints.gridheight = 3;
2813
- aWindowConstraints.gridx = 1;
2814
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2815
- bigThree.add(centralPanel, aWindowConstraints);
2816
- aWindowConstraints.weightx = 0;
2817
- aWindowConstraints.gridx = 4;
2818
- aWindowConstraints.gridwidth = 1;
2819
- // aConstraints.gridheight = 3;
2820
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2821
- bigThree.add(XYZPanel, aWindowConstraints);
2822
- bigThree.revalidate();
3874
+
3875
+ if (CameraPane.FULLSCREEN)
3876
+ fullscreenLayout = radio.layout;
3877
+
3878
+// bigThree.remove(scenePanel);
3879
+// bigThree.remove(centralPanel);
3880
+// bigThree.remove(XYZPanel);
3881
+// aWindowConstraints.gridx = 0;
3882
+// aWindowConstraints.gridy = 0;
3883
+// aWindowConstraints.gridwidth = 1;
3884
+// // aWindowConstraints.gridheight = 3;
3885
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3886
+// aWindowConstraints.weightx = 0;
3887
+// aWindowConstraints.weighty = 1;
3888
+// bigThree.add(scenePanel, aWindowConstraints);
3889
+// aWindowConstraints.weightx = 1;
3890
+// aWindowConstraints.gridwidth = 3;
3891
+// // aWindowConstraints.gridheight = 3;
3892
+// aWindowConstraints.gridx = 1;
3893
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3894
+// bigThree.add(centralPanel, aWindowConstraints);
3895
+// aWindowConstraints.weightx = 0;
3896
+// aWindowConstraints.gridx = 4;
3897
+// aWindowConstraints.gridwidth = 1;
3898
+// // aConstraints.gridheight = 3;
3899
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3900
+// bigThree.add(XYZPanel, aWindowConstraints);
3901
+// bigThree.validate();
3902
+// scenePanel.setVisible(true);
3903
+// centralPanel.setVisible(true);
3904
+// XYZPanel.setVisible(true);
3905
+ bigThree.ClearUI();
3906
+ bigThree.add(scenePanel);
3907
+ bigThree.add(centralPanel);
3908
+ bigThree.add(XYZPanel);
3909
+ bigThree.FlushUI();
3910
+
3911
+ cameraView.requestFocusInWindow();
28233912 } else
2824
- if (event.getSource() == rootButton)
3913
+ if (source == rootButton)
28253914 {
3915
+ Replace();
28263916 Object3D obj;
28273917 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28283918 {
....@@ -2831,66 +3921,85 @@
28313921 EditObject(obj);
28323922 }
28333923
3924
+ cameraView.requestFocusInWindow();
28343925 refreshContents(true);
28353926 } else
2836
- if (event.getSource() == closeButton)
3927
+ if (source == closeButton)
28373928 {
28383929 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28393930 cRadio ab;
28403931 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28413932 {
28423933 ab = (cRadio)e.nextElement();
2843
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3934
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28443935 {
3936
+ // Patch to avoid bug with transparency.
3937
+ if (!ab.hadMaterial)
3938
+ {
3939
+ ab.object.material = null;
3940
+ }
3941
+
28453942 buttonGroup.remove(ab);
28463943 radioPanel.remove(ab);
28473944
2848
- ab.GetObject().editWindow = null;
3945
+ //ab.GetObject().editWindow = null;
3946
+ ab.GetObject().manipWindow = null;
28493947 // ab.GetObject().objectUI = null; // ?????????
28503948
28513949 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28523950 break;
28533951 }
28543952 }
3953
+
3954
+ cameraView.requestFocusInWindow();
28553955 refreshContents(true);
28563956 } else
2857
- if (event.getSource() == editItem || event.getSource() == editButton)
3957
+ if (source == editItem || source == editButton)
28583958 {
3959
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3960
+ {
3961
+ Object3D child = (Object3D)e.nextElement();
3962
+ child.pinned = true;
3963
+ }
3964
+
28593965 EditSelection(false);
28603966 } else
2861
- if (event.getSource() == uneditButton)
3967
+ if (source == uneditButton)
28623968 {
28633969 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28643970 {
28653971 Object3D child = (Object3D)e.nextElement();
28663972 if(child.editWindow != null)
2867
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3973
+ child.pinned = false;
28683974 child.CloseUI();
28693975 listUI.remove(child);
3976
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28703977
2871
- child.editWindow = null; // ???????????
3978
+ //child.editWindow = null; // ???????????
28723979 }
2873
- objEditor.ctrlPanel.revalidate();
3980
+ objEditor.ctrlPanel.FlushUI();
28743981 //objEditor.jTree.clearSelection();
28753982 //objEditor.ResetSliders();
28763983 refreshContents(true);
28773984 } else
2878
- if (event.getSource() == clearPanelButton)
3985
+ if (source == clearPanelButton)
28793986 {
28803987 assert(copy == group);
28813988 //copy.ClearUI();
28823989 for (Object3D obj : listUI)
28833990 {
3991
+ obj.pinned = false;
28843992 obj.CloseUI();
28853993 }
28863994 listUI.clear();
3995
+ SetPinStates(group.selection.size() > 0);
28873996 refreshContents(true);
28883997 } else
2889
- if (event.getSource() == allParamsButton)
3998
+ if (source == allParamsButton)
28903999 {
28914000 assert(copy == group);
28924001
2893
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4002
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28944003
28954004 for (Object3D obj : listUI)
28964005 {
....@@ -2907,19 +4016,19 @@
29074016
29084017 refreshContents(true);
29094018 } else
2910
- if (event.getSource() == unselectButton)
4019
+ if (source == unselectButton)
29114020 {
29124021 objEditor.jTree.clearSelection();
29134022 // ?? oct 2012 GrafreeD.clipboard.clear();
29144023 objEditor.ResetSliders();
29154024 refreshContents(true);
29164025 } else
2917
- if(event.getSource() instanceof cRadio)
4026
+ if(source instanceof cRadio)
29184027 {
29194028 group.parent = keepparent;
29204029 group.attributes = 0;
29214030 //group.editWindow = null;
2922
- /*cRadio*/ radio = (cRadio)event.getSource();
4031
+ /*cRadio*/ radio = (cRadio)source;
29234032 Object3D obj = radio.GetObject();
29244033 System.out.println("Edit " + obj);
29254034 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2939,6 +4048,7 @@
29394048 }
29404049
29414050 copy = group;
4051
+
29424052 //Globals.theRenderer.object = group;
29434053 if(!useclient)
29444054 {
....@@ -2954,20 +4064,61 @@
29544064 frontView.object = group;
29554065 sideView.object = group;
29564066 }
2957
- group.editWindow = this;
4067
+
4068
+// fix "+" issue
4069
+ //group.editWindow = this;
4070
+ group.manipWindow = this;
4071
+
29584072 /*
29594073 currentLayout = radio.layout;
29604074 if (currentLayout == null)
29614075 currentLayout = sevenButton;
29624076 */
29634077 radio.layout.doClick();
4078
+
4079
+ assert(copy instanceof Composite);
4080
+
4081
+ if (copy.versionlist == null)
4082
+ {
4083
+ copy.versionlist = new Object3D[100];
4084
+ copy.versionindex = -1;
4085
+
4086
+ Save(true);
4087
+ }
4088
+
4089
+ SetVersionStates();
4090
+
4091
+ ClearUnpinned();
4092
+
4093
+ //Grafreed.Assert(group != null);
4094
+ //Grafreed.Assert(group.selection != null);
4095
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4096
+ if (group.selection == null || group.selection.size() == 1)
4097
+ EditSelection(false);
29644098 keepparent = group.parent;
29654099 // PARENT = NULL or not???
29664100 //group.parent = null; // ROOT
29674101 //group.attributes = -1;
29684102 ResetModel();
4103
+
4104
+ cameraView.requestFocusInWindow();
29694105 refreshContents(true);
2970
- }
4106
+ } else if (event.getSource() == editCameraItem)
4107
+ {
4108
+ cameraView.ProtectCamera();
4109
+ cameraView.requestFocusInWindow();
4110
+ cameraView.repaint();
4111
+ return;
4112
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4113
+ {
4114
+ cameraView.RevertCamera();
4115
+ cameraView.requestFocusInWindow();
4116
+ cameraView.repaint();
4117
+ return;
4118
+ // } else if (event.getSource() == textureButton)
4119
+ // {
4120
+ // return; // true;
4121
+ }
29714122 else
29724123 {
29734124 //return super.action(event, arg);
....@@ -2976,7 +4127,6 @@
29764127 }
29774128
29784129 boolean useclient = false;
2979
- cRadio radio;
29804130
29814131 void ToggleRoot()
29824132 {
....@@ -3028,6 +4178,28 @@
30284178 refreshContents();
30294179 }
30304180
4181
+ void TransformChildren()
4182
+ {
4183
+ Object3D obj;
4184
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4185
+ {
4186
+ obj = (Object3D)e.nextElement();
4187
+ obj.KeepTextureMatrices();
4188
+ obj.TransformChildren();
4189
+ obj.RestoreTextureMatrices();
4190
+
4191
+// if (obj.parent == null)
4192
+// {
4193
+// System.out.println("NULL PARENT!");
4194
+// new Exception().printStackTrace();
4195
+// }
4196
+// else
4197
+// TouchTransform(obj);
4198
+// //obj.parent.Touch();
4199
+ }
4200
+
4201
+ refreshContents();
4202
+ }
30314203
30324204 void ResetTransform()
30334205 {
....@@ -3140,7 +4312,7 @@
31404312 refreshContents();
31414313 }
31424314
3143
- void ResetCentroid()
4315
+ void ResetCentroid(boolean full)
31444316 {
31454317 Object3D obj;
31464318 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3155,12 +4327,16 @@
31554327 LA.matIdentity(Object3D.mat);
31564328 obj.getBounds(minima, maxima, false);
31574329 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3158
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4330
+ if (full)
4331
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31594332 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31604333 obj.TransformMesh(Object3D.mat);
4334
+
31614335 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3162
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4336
+ if (full)
4337
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31634338 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4339
+
31644340 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31654341 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31664342 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3189,7 +4365,8 @@
31894365
31904366 int size = obj.MemorySize();
31914367
3192
- System.err.println((size/1024) + " KB is the size of " + obj);
4368
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4369
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31934370 }
31944371 }
31954372 catch (Exception e)
....@@ -3226,9 +4403,9 @@
32264403 obj = (Object3D)e.nextElement();
32274404
32284405 System.out.println("Object is: " + obj);
3229
- GrafreeD.AnalyzeObject(obj);
4406
+ Grafreed.AnalyzeObject(obj);
32304407 System.out.println("Boundary rep: " + obj.bRep);
3231
- GrafreeD.AnalyzeObject(obj.bRep);
4408
+ Grafreed.AnalyzeObject(obj.bRep);
32324409
32334410 // System.err.println((size/1024) + " KB is the size of " + obj);
32344411 }
....@@ -3270,6 +4447,13 @@
32704447 void GenNormals(boolean crease)
32714448 {
32724449 group.GenNormalsS(crease);
4450
+
4451
+ refreshContents();
4452
+ }
4453
+
4454
+ void GenNormalsMESH()
4455
+ {
4456
+ group.GenNormalsMeshS();
32734457
32744458 refreshContents();
32754459 }
....@@ -3442,8 +4626,8 @@
34424626
34434627 void ParseVertices()
34444628 {
3445
- boolean epsequal = GrafreeD.epsequal;
3446
- GrafreeD.epsequal = true;
4629
+ boolean epsequal = Grafreed.epsequal;
4630
+ Grafreed.epsequal = true;
34474631
34484632 for (int i=0; i<group.selection.size(); i++)
34494633 {
....@@ -3468,7 +4652,7 @@
34684652 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34694653 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34704654
3471
- g.add(GrafreeD.clipboard);
4655
+ g.add(Grafreed.clipboard);
34724656
34734657 buffer.add(g);
34744658 }
....@@ -3483,7 +4667,7 @@
34834667 makeSomething(buffer, i==group.selection.size()-1);
34844668 }
34854669
3486
- GrafreeD.epsequal = epsequal;
4670
+ Grafreed.epsequal = epsequal;
34874671
34884672 refreshContents();
34894673 }
....@@ -3501,7 +4685,16 @@
35014685 String pigment = Object3D.GetPigment(tex);
35024686 //String bump = Object3D.GetBump(tex);
35034687
3504
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4688
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4689
+
4690
+ try
4691
+ {
4692
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4693
+ }
4694
+ catch (Exception e)
4695
+ {
4696
+ System.err.println("FAIL: " + node);
4697
+ }
35054698
35064699 double s = v.s;
35074700
....@@ -3589,11 +4782,11 @@
35894782
35904783 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35914784
3592
- boolean random = CameraPane.RANDOM;
3593
- CameraPane.RANDOM = false; // parse all random nodes
4785
+ boolean random = CameraPane.SWITCH;
4786
+ CameraPane.SWITCH = false; // parse all random nodes
35944787 lowres.linkVerticesThis(null);
35954788 lowres.linkVerticesThis(sn);
3596
- CameraPane.RANDOM = random;
4789
+ CameraPane.SWITCH = random;
35974790
35984791 System.err.flush();
35994792
....@@ -3633,7 +4826,7 @@
36334826 return;
36344827
36354828 Object3D poses = group.selection.get(0);
3636
- Object3D ref = GrafreeD.clipboard.get(0);
4829
+ Object3D ref = Grafreed.clipboard.get(0);
36374830
36384831 Object3D newgroup = new Object3D("Po:" + poses.name);
36394832
....@@ -3827,9 +5020,9 @@
38275020
38285021 void ClipMesh()
38295022 {
3830
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
5023
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38315024 {
3832
- Object3D content = GrafreeD.clipboard.get(0);
5025
+ Object3D content = Grafreed.clipboard.get(0);
38335026
38345027 if (content instanceof cGroup && ((cGroup)content).transientlink )
38355028 content = ((cGroup)content).get(0);
....@@ -3838,7 +5031,7 @@
38385031 // {
38395032 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38405033 // }
3841
- group.selection.ClipMesh(GrafreeD.clipboard);
5034
+ group.selection.ClipMesh(Grafreed.clipboard);
38425035 }
38435036 // group.selection.ClipMesh(GrafreeD.clipboard);
38445037 System.out.println("DONE.");
....@@ -3885,6 +5078,18 @@
38855078 void MarkLeaves(boolean hide)
38865079 {
38875080 group.selection.MarkLeaves(hide);
5081
+ refreshContents();
5082
+ }
5083
+
5084
+ void RewindLeaves(boolean hide)
5085
+ {
5086
+ group.selection.RewindLeaves(hide);
5087
+ refreshContents();
5088
+ }
5089
+
5090
+ void RandomLeaves(boolean hide)
5091
+ {
5092
+ group.selection.RandomLeaves(hide);
38885093 refreshContents();
38895094 }
38905095
....@@ -3959,28 +5164,25 @@
39595164 // }
39605165 // }
39615166
3962
- static boolean allparams = true;
3963
-
3964
- static Vector<Object3D> listUI = new Vector<Object3D>();
3965
-
39665167 void EditSelection(boolean newWindow)
39675168 {
5169
+ if (group.selection == null)
5170
+ {
5171
+ EditElement(group, newWindow); // ? new
5172
+ return;
5173
+ }
5174
+
39685175 // aConstraints.gridy = 0;
39695176 for (int i=0; i<group.selection.size(); i++)
39705177 {
39715178 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39725179 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3973
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5180
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39745181
39755182 Object3D elem = (Object3D)group.selection.elementAt(i);
3976
- if(elem != group)
5183
+ if(elem != group || !newWindow)
39775184 {
3978
- // if (!(elem instanceof Composite))
3979
- // newWindow = false;
3980
- listUI.add(elem);
3981
- elem.openEditWindow(this, newWindow); //, false);
3982
- System.out.println("edit : " + elem);
3983
- elem.editWindow.refreshContents(true); // ? new
5185
+ EditElement(elem, newWindow); // ? new
39845186 }
39855187 }
39865188 }
....@@ -4043,9 +5245,7 @@
40435245
40445246 freezemodel = false;
40455247 }
4046
-
4047
- boolean flashIt = true;
4048
-
5248
+
40495249 public void valueChanged(TreeSelectionEvent e)
40505250 //public boolean handleEvent(Event event)
40515251 {
....@@ -4055,7 +5255,8 @@
40555255 //new Exception().printStackTrace();
40565256
40575257 freezemodel = true;
4058
-
5258
+ ClearUnpinned();
5259
+
40595260 /**/
40605261 //switch (event.id)
40615262 {
....@@ -4063,7 +5264,6 @@
40635264 //case 702: // Event.LIST_DESELECT
40645265 group.deselectAll();
40655266 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4066
- objEditor.ClearInfo(); // .GetMaterial());
40675267 if (tps != null)
40685268 {
40695269 for (int i=0; i < tps.length; i++)
....@@ -4072,33 +5272,39 @@
40725272
40735273 //if (child.parent != null)
40745274 //child.parent.addSelectee(child);
5275
+ objEditor.SetMaterial(child);
40755276 group.addSelectee(child);
4076
- objEditor.SetMaterial(child); // .GetMaterial());
4077
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4078
- System.err.println("info : " + child.GetPath());
40795277 }
40805278 }
4081
- else
4082
- {
4083
- objEditor.SetMaterial(group); // .GetMaterial());
4084
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4085
- System.err.println("info : " + group.GetPath());
4086
- }
5279
+// else
5280
+// {
5281
+// objEditor.SetMaterial(group); // .GetMaterial());
5282
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5283
+// System.err.println("info : " + group.GetPath());
5284
+// }
40875285
4088
- objEditor.SetText(); // jan 2014
4089
-
4090
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5286
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40915287 CameraPane.flash = true;
40925288
4093
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5289
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40945290 // a camera
40955291 {
4096
- CameraPane.camerachangeframe = 0; // don't refuse it
4097
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5292
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5293
+ {
5294
+ CameraPane.camerachangeframe = 0; // don't refuse it
5295
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5296
+ }
40985297 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
40995298 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41005299 }
41015300
5301
+ if (tps != null && tps.length == 1)
5302
+ {
5303
+ EditSelection(false);
5304
+ }
5305
+
5306
+ SetPinStates(tps != null && tps.length > 0);
5307
+
41025308 refreshContents();
41035309 //return true;
41045310 }
....@@ -4107,6 +5313,51 @@
41075313
41085314 freezemodel = false;
41095315 }
5316
+
5317
+ void SetPinStates(boolean enabled)
5318
+ {
5319
+ editButton.setEnabled(enabled);
5320
+ uneditButton.setEnabled(enabled);
5321
+ //unselectButton.setEnabled(enabled);
5322
+ flashSelectionButton.setEnabled(enabled);
5323
+
5324
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5325
+
5326
+ boolean allComposites = true;
5327
+
5328
+ if (group.selection != null)
5329
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5330
+ {
5331
+ if (!(e.nextElement() instanceof Composite))
5332
+ {
5333
+ allComposites = false;
5334
+ break;
5335
+ }
5336
+ }
5337
+
5338
+ rootButton.setEnabled(allComposites);
5339
+ }
5340
+
5341
+ void refreshContents(boolean cp)
5342
+ {
5343
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5344
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5345
+ {
5346
+ objEditor.ClearInfo(); // .GetMaterial());
5347
+
5348
+ for (int i=0; i < group.selection.Size(); i++)
5349
+ {
5350
+ Object3D child = (Object3D) group.selection.get(i);
5351
+
5352
+ objEditor.AddInfo(child, this, true);
5353
+// System.err.println("info : " + child.GetPath());
5354
+ }
5355
+
5356
+ objEditor.SetText(); // jan 2014
5357
+ }
5358
+
5359
+ super.refreshContents(cp);
5360
+ }
41105361
41115362 void linkSomething(Object3D thing)
41125363 {
....@@ -4178,16 +5429,19 @@
41785429 {
41795430 if (group.selection.isEmpty())
41805431 return;
4181
- GrafreeD.clipboardIsTempGroup = false;
5432
+
5433
+ Grafreed.clipboardIsTempGroup = false;
41825434 Composite tGroup = null;
41835435 if (group.selection.size() > 0) // 1)
41845436 {
41855437 tGroup = new cGroup();
4186
- GrafreeD.clipboardIsTempGroup = true;
5438
+ Grafreed.clipboardIsTempGroup = true;
41875439 }
41885440
41895441 if (cut)
41905442 {
5443
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5444
+// Save();
41915445 //int indices[] = jList.getSelectedIndices();
41925446 //for (int i = indices.length - 1; i >= 0; i--)
41935447 //jList.remove(indices[i]);
....@@ -4223,16 +5477,16 @@
42235477 //System.out.println("cut " + child);
42245478 //System.out.println("parent = " + child.parent);
42255479 // tmp.addChild(child);
4226
- if (GrafreeD.clipboardIsTempGroup)
5480
+ if (Grafreed.clipboardIsTempGroup)
42275481 tGroup.add/*Child*/(tmp);
42285482 else
4229
- GrafreeD.clipboard = tmp;
5483
+ Grafreed.clipboard = tmp;
42305484 }
42315485 else
4232
- if (GrafreeD.clipboardIsTempGroup)
5486
+ if (Grafreed.clipboardIsTempGroup)
42335487 tGroup.add/*Child*/(child);
42345488 else
4235
- GrafreeD.clipboard = child;
5489
+ Grafreed.clipboard = child;
42365490 }
42375491
42385492 //ResetModel();
....@@ -4264,21 +5518,23 @@
42645518 //System.out.println("cut " + elem);
42655519 //System.out.println("parent = " + elem.parent);
42665520 // tmp.addChild(elem);
4267
- if (GrafreeD.clipboardIsTempGroup)
5521
+ if (Grafreed.clipboardIsTempGroup)
42685522 tGroup.add/*Child*/(tmp);
42695523 else
4270
- GrafreeD.clipboard = tmp;
5524
+ Grafreed.clipboard = tmp;
42715525 }
42725526 else
4273
- if (GrafreeD.clipboardIsTempGroup)
5527
+ if (Grafreed.clipboardIsTempGroup)
42745528 tGroup.add/*Child*/(child);
42755529 else
4276
- GrafreeD.clipboard = child;
5530
+ Grafreed.clipboard = child;
42775531 }
42785532
42795533 }
4280
- if (GrafreeD.clipboardIsTempGroup)
4281
- GrafreeD.clipboard = tGroup;
5534
+
5535
+ if (Grafreed.clipboardIsTempGroup)
5536
+ Grafreed.clipboard = tGroup;
5537
+
42825538 if (cut)
42835539 {
42845540 ResetModel();
....@@ -4288,11 +5544,15 @@
42885544
42895545 void paste(boolean expand)
42905546 {
5547
+ if (Globals.REPLACEONMAKE)
5548
+ Save();
5549
+ boolean keep = Globals.REPLACEONMAKE;
5550
+ Globals.REPLACEONMAKE = false;
42915551 // if (GrafreeD.clipboard == null)
42925552 // return;
42935553 boolean first = true;
42945554
4295
- if (GrafreeD.clipboardIsTempGroup)
5555
+ if (Grafreed.clipboardIsTempGroup)
42965556 {
42975557 Composite temp;
42985558
....@@ -4303,7 +5563,7 @@
43035563 temp = (Composite)Applet3D.clipboard.deepCopy();
43045564 */
43055565 Object3D elem;
4306
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5566
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43075567 {
43085568 Object3D child = (Object3D)e.nextElement();
43095569
....@@ -4337,21 +5597,22 @@
43375597 //Object3D cb = Applet3D.clipboard;
43385598 //temp.addChild(cb);
43395599 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4340
- assert(GrafreeD.clipboard.parent == null);
4341
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4342
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4343
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4344
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5600
+ assert(Grafreed.clipboard.parent == null);
5601
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5602
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5603
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5604
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43455605 else
4346
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4347
- GrafreeD.clipboard.get(0).parent = keepparent;
5606
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5607
+ Grafreed.clipboard.get(0).parent = keepparent;
43485608 }
43495609
5610
+ Globals.REPLACEONMAKE = keep;
43505611 ResetModel();
43515612 refreshContents();
43525613 }
43535614
4354
- void pasteInto(boolean copyit)
5615
+ void pasteInto(boolean copyit, boolean clone)
43555616 {
43565617 // if (GrafreeD.clipboard == null)
43575618 // return;
....@@ -4380,15 +5641,22 @@
43805641 if (copyit)
43815642 {
43825643 // paste(false);
4383
- CloneClipboard(false); // sept 2014
5644
+ if (clone)
5645
+ {
5646
+ CloneClipboard(false); // sept 2014
5647
+ }
5648
+ else
5649
+ {
5650
+ paste(false);
5651
+ }
43845652 }
43855653 else
43865654 {
43875655 boolean first = true;
43885656
4389
- if (GrafreeD.clipboardIsTempGroup)
5657
+ if (Grafreed.clipboardIsTempGroup)
43905658 {
4391
- Composite temp = (Composite)GrafreeD.clipboard;
5659
+ Composite temp = (Composite)Grafreed.clipboard;
43925660 Object3D copy;
43935661 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43945662 {
....@@ -4398,7 +5666,7 @@
43985666 }
43995667 } else
44005668 {
4401
- linkSomething(GrafreeD.clipboard); //.get(0));
5669
+ linkSomething(Grafreed.clipboard); //.get(0));
44025670 }
44035671 }
44045672 }
....@@ -4475,6 +5743,10 @@
44755743
44765744 void group(Object3D csg, boolean grab)
44775745 {
5746
+ if (Globals.REPLACEONMAKE)
5747
+ Save();
5748
+ boolean keep = Globals.REPLACEONMAKE;
5749
+ Globals.REPLACEONMAKE = false;
44785750 if (//false) // why??
44795751 !group.selection.isEmpty())
44805752 {
....@@ -4588,10 +5860,15 @@
45885860 //node.add(csg);
45895861 //makeSomething(node);
45905862 makeSomething(csg);
5863
+ Globals.REPLACEONMAKE = keep;
45915864 }
45925865
45935866 void Ungroup(Object3D g)
45945867 {
5868
+ if (Globals.REPLACEONMAKE)
5869
+ Save();
5870
+ boolean keep = Globals.REPLACEONMAKE;
5871
+ Globals.REPLACEONMAKE = false;
45955872 if (g instanceof HiddenObject)
45965873 {
45975874 HiddenObject h = (HiddenObject) g;
....@@ -4608,6 +5885,7 @@
46085885 objEditor.makeSomething(g.get(i), false);
46095886 }
46105887 }
5888
+ Globals.REPLACEONMAKE = keep;
46115889 }
46125890
46135891 void ungroup()
....@@ -4803,21 +6081,6 @@
48036081 }
48046082 */
48056083
4806
- void ImportGFD()
4807
- {
4808
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4809
- browser.show();
4810
- String filename = browser.getFile();
4811
- if (filename != null && filename.length() > 0)
4812
- {
4813
- String fullname = browser.getDirectory() + filename;
4814
-
4815
- //Object3D readobj =
4816
- objEditor.ReadGFD(fullname, objEditor);
4817
- //makeSomething(readobj);
4818
- }
4819
- }
4820
-
48216084 /*
48226085 public void Callback(Object obj)
48236086 {
....@@ -4841,26 +6104,9 @@
48416104 }
48426105 */
48436106
4844
- void ImportVRMLX3D()
4845
- {
4846
- if (GrafreeD.standAlone)
4847
- {
4848
- /**/
4849
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4850
- browser.show();
4851
- String filename = browser.getFile();
4852
- if (filename != null && filename.length() > 0)
4853
- {
4854
- String fullname = browser.getDirectory() + filename;
4855
- LoadVRMLX3D(fullname);
4856
- }
4857
- /**/
4858
- }
4859
- }
4860
-
48616107 String GetFile(String dialogName)
48626108 {
4863
- if (GrafreeD.standAlone)
6109
+ if (Grafreed.standAlone)
48646110 {
48656111 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48666112 browser.show();
....@@ -4924,10 +6170,48 @@
49246170 cButton flashSelectionButton;
49256171 cButton editButton;
49266172 cButton uneditButton;
6173
+ JCheckBox allParamsButton;
49276174 cButton clearpanelButton;
4928
- cButton allParamsButton;
49296175 cButton unselectButton;
49306176
6177
+ cButton restoreCameraButton;
6178
+
6179
+ cButton oneStepButton;
6180
+
6181
+ cButton groupButton;
6182
+ cButton ungroupButton;
6183
+ cButton compositeButton;
6184
+ cButton switchButton;
6185
+ cButton loopButton;
6186
+ cButton textureButton;
6187
+
6188
+ cButton skybox1Button;
6189
+ cButton skybox2Button;
6190
+ cButton skybox3Button;
6191
+ cButton skybox4Button;
6192
+ cButton skybox5Button;
6193
+ cButton skybox6Button;
6194
+ cButton skybox7Button;
6195
+
6196
+ cButton skybox11Button;
6197
+ cButton skybox12Button;
6198
+ cButton skybox13Button;
6199
+ cButton skybox14Button;
6200
+ cButton skybox15Button;
6201
+ cButton skybox16Button;
6202
+ cButton skybox17Button;
6203
+
6204
+ cButton gridButton;
6205
+ cButton boxButton;
6206
+ cButton sphereButton;
6207
+ cButton coneButton;
6208
+ cButton torusButton;
6209
+ cButton superButton;
6210
+ cButton kleinButton;
6211
+ cButton particlesButton;
6212
+ cButton overlayButton;
6213
+ cButton lightButton;
6214
+
49316215 cButton screenfitButton;
49326216 cButton screenfitpointButton;
49336217 cButton snapobjectButton;
....@@ -4939,14 +6223,6 @@
49396223
49406224 cButton setsupportButton;
49416225
4942
- cButton twoButton;
4943
- cButton sixButton;
4944
- cButton threeButton;
4945
- cButton sevenButton;
4946
- cButton fourButton; // full panel
4947
- cButton oneButton; // full XYZ
4948
- //cButton currentLayout;
4949
-
49506226 //
49516227 //Composite
49526228 Object3D // to do !!
....@@ -4956,9 +6232,11 @@
49566232 //JTree jTree;
49576233 private MenuItem lookAtItem;
49586234 private MenuItem lookFromItem;
4959
- private MenuItem switchItem;
6235
+ private MenuItem switchViewItem;
49606236 private MenuItem cutItem;
4961
- private MenuItem duplicateItem;
6237
+ private MenuItem undoItem;
6238
+ private MenuItem redoItem;
6239
+ private JMenuItem duplicateItem;
49626240 private MenuItem cloneItem;
49636241 private MenuItem cloneSupportItem;
49646242 private MenuItem overwriteGeoItem;
....@@ -4971,7 +6249,7 @@
49716249 private MenuItem linkverticesItem;
49726250 private MenuItem relinkverticesItem;
49736251 private MenuItem setMasterItem;
4974
- private MenuItem resetMeshItem;
6252
+ private MenuItem resetAllItem;
49756253 private MenuItem stepAllItem;
49766254 private MenuItem revertMeshItem;
49776255 private MenuItem poseMeshItem;
....@@ -4982,10 +6260,11 @@
49826260 private MenuItem mergeGeometriesItem;
49836261 private MenuItem copyItem;
49846262 private MenuItem pasteItem;
6263
+ private MenuItem pasteIntoItem;
49856264 private MenuItem pasteLinkItem;
49866265 private MenuItem pasteCloneItem;
49876266 private MenuItem pasteExpandItem;
4988
- private MenuItem clearItem;
6267
+ private MenuItem deleteItem;
49896268 private MenuItem clearAllItem;
49906269 private MenuItem genUVItem;
49916270 private MenuItem genNormalsMESHItem;
....@@ -5020,6 +6299,10 @@
50206299 private MenuItem showleavesItem;
50216300 private MenuItem markleavesItem;
50226301 private MenuItem unmarkleavesItem;
6302
+ private MenuItem rewindleavesItem;
6303
+ private MenuItem unrewindleavesItem;
6304
+ private MenuItem randomleavesItem;
6305
+ private MenuItem unrandomleavesItem;
50236306
50246307 private MenuItem flipVItem;
50256308 private MenuItem unflipVItem;
....@@ -5031,15 +6314,17 @@
50316314 private MenuItem panoTexturesItem;
50326315
50336316 private MenuItem resetCentroidItem;
5034
- private MenuItem transformgeometryItem;
6317
+ private MenuItem resetCentroidXZItem;
50356318 private MenuItem resetTransformItem;
6319
+ private MenuItem transformGeometryItem;
6320
+ private MenuItem transformChildrenItem;
50366321 private MenuItem hideItem;
50376322 private MenuItem grabItem;
50386323 private MenuItem backItem;
50396324 private MenuItem frontItem;
50406325 private MenuItem cameraItem;
50416326 private MenuItem compositeItem;
5042
- private MenuItem randomItem;
6327
+ private MenuItem switchItem;
50436328 private MenuItem physicsItem;
50446329 private MenuItem frameselectorItem;
50456330 private MenuItem scriptNodeItem;
....@@ -5063,6 +6348,8 @@
50636348 private MenuItem attachBumpItem;
50646349 private MenuItem detachBumpItem;
50656350 private MenuItem pigmentBumpItem;
6351
+ private MenuItem embedTexturesItem;
6352
+ private MenuItem deEmbedTexturesItem;
50666353
50676354 private MenuItem particleItem;
50686355 private MenuItem ragdollItem;
....@@ -5079,7 +6366,7 @@
50796366 private MenuItem blobItem;
50806367 private MenuItem latheItem;
50816368 private MenuItem bezierItem;
5082
- private MenuItem checkerItem;
6369
+ private MenuItem overlayItem;
50836370 private MenuItem meshItem;
50846371 // private MenuItem meshGroupItem;
50856372 private MenuItem springItem;
....@@ -5101,11 +6388,6 @@
51016388 private MenuItem doubleItem;
51026389 private MenuItem tripleItem;
51036390
5104
- private MenuItem importGFDItem;
5105
- private MenuItem importVRMLX3DItem;
5106
- private MenuItem import3DSItem;
5107
- private MenuItem importOBJItem;
5108
-
51096391 private MenuItem computeAOItem;
51106392 private MenuItem recompileItem;
51116393 private MenuItem editScriptItem;
....@@ -5115,4 +6397,8 @@
51156397 private MenuItem analyzeItem;
51166398 private MenuItem dumpItem;
51176399 //boolean freezemodel = false;
6400
+
6401
+ Menu cameraMenu;
6402
+ MenuItem editCameraItem;
6403
+ MenuItem restoreCameraItem;
51186404 }