Normand Briere
2019-08-15 7f97054d681518416a4ee1c1548ad42cfb489a8f
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
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+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,17 +437,29 @@
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 {
86
- // Object3D keep = GraphreeD.clipboard;
458
+ if (Globals.REPLACEONMAKE)
459
+ Save();
460
+ boolean keep = Globals.REPLACEONMAKE;
461
+ Globals.REPLACEONMAKE = false;
462
+ // Object3D keep = GrafreeD.clipboard;
87463 //Object3D obj;
88464 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89465 {
....@@ -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(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.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(GraphreeD.clipboard, false));
107
- GraphreeD.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)GraphreeD.clone(obj);
498
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122499 obj.parent = parent;
123500 // obj.support = support;
124501 // clone.support = support; // aout 2013
....@@ -147,57 +524,156 @@
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("-");
170
- cloneItem = menu.add(new MenuItem("Clone"));
543
+
544
+ cloneItem = oe.jTree.popup.add(new JMenuItem("Clone"));
171545 cloneItem.addActionListener(this);
546
+ //if (Globals.ADVANCED)
547
+ {
172548 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173549 cloneSupportItem.addActionListener(this);
550
+ }
551
+ oe.jTree.popup.addSeparator();
174552 menu.add("-");
175
- cutItem = menu.add(new MenuItem("Cut"));
553
+ cutItem = oe.jTree.popup.add(new JMenuItem("Cut"));
176554 cutItem.addActionListener(this);
177
- copyItem = menu.add(new MenuItem("Copy"));
555
+ copyItem = oe.jTree.popup.add(new JMenuItem("Copy"));
178556 copyItem.addActionListener(this);
179557 pasteItem = menu.add(new MenuItem("Paste"));
180558 pasteItem.addActionListener(this);
181
- pasteLinkItem = menu.add(new MenuItem("Paste link"));
559
+
560
+ oe.jTree.popup.addSeparator();
561
+ //menu.add("-");
562
+ pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into"));
563
+ pasteIntoItem.addActionListener(this);
564
+ pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link"));
182565 pasteLinkItem.addActionListener(this);
183
- pasteCloneItem = menu.add(new MenuItem("Paste clone"));
566
+ pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone"));
184567 pasteCloneItem.addActionListener(this);
185
-// pasteExpandItem = menu.add(new MenuItem("Paste expand"));
568
+// CRASH pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand"));
186569 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
570
+ //menu.add("-");
571
+ oe.jTree.popup.addSeparator();
572
+
573
+ deleteItem = oe.jTree.popup.add(new JMenuItem("Delete"));
574
+ deleteItem.addActionListener(this);
575
+
576
+ if (Globals.ADVANCED)
577
+ {
578
+ // Deletes the cameras...
189579 clearAllItem = menu.add(new MenuItem("Clear All"));
190580 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
193
- resetMeshItem.addActionListener(this);
194
- stepAllItem = menu.add(new MenuItem("Step All"));
195
- stepAllItem.addActionListener(this);
581
+ }
582
+
583
+ menuBar.add(cameraMenu = new Menu("View"));
584
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
585
+ //zBufferItem.addActionListener(this);
586
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
587
+ //normalLensItem.addActionListener(this);
588
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
589
+ restoreCameraItem.addActionListener(this);
590
+
591
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
592
+// toggleFullScreenItem.addItemListener(this);
593
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
594
+// cameraMenu.add("-");
595
+//
596
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
597
+// toggleTextureItem.addItemListener(this);
598
+// toggleTextureItem.setState(CameraPane.textureon);
599
+//
600
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
601
+// toggleSwitchItem.addItemListener(this);
602
+// toggleSwitchItem.setState(CameraPane.SWITCH);
603
+
604
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
605
+ toggleHandleItem.addItemListener(this);
606
+ toggleHandleItem.setState(CameraPane.HANDLES);
607
+
608
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
609
+ togglePaintItem.addItemListener(this);
610
+ togglePaintItem.setState(CameraPane.PAINTMODE);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ cameraMenu.add("-");
615
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
616
+ toggleLiveItem.addItemListener(this);
617
+ toggleLiveItem.setState(Globals.isLIVE());
618
+
619
+ cameraMenu.add(stepItem = new MenuItem("Step"));
620
+ stepItem.addActionListener(this);
621
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
622
+ // toggleDLItem.addItemListener(this);
623
+ // toggleDLItem.setState(false);
624
+
625
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
626
+ toggleRenderItem.addItemListener(this);
627
+ toggleRenderItem.setState(!CameraPane.frozen);
628
+
629
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
630
+ toggleDebugItem.addItemListener(this);
631
+ toggleDebugItem.setState(Globals.DEBUG);
632
+
633
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
634
+ toggleFrustumItem.addItemListener(this);
635
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
636
+
637
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
638
+ toggleFootContactItem.addItemListener(this);
639
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
640
+
641
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
642
+ toggleTimelineItem.addItemListener(this);
643
+ }
644
+
645
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
646
+// toggleRootItem.addItemListener(this);
647
+// toggleRootItem.setState(false);
648
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
649
+// animationItem.addItemListener(this);
650
+// animationItem.setState(CameraPane.ANIMATION);
651
+ cameraMenu.add("-");
652
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
653
+ editCameraItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
657
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
658
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
659
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
660
+ oe.cameraMenu.add("-");
661
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
662
+ openWindowItem.addActionListener(this);
663
+ lookAtItem.addActionListener(this);
664
+ //lookFromItem.addActinoListener(this);
665
+ //switchViewItem.addActionListener(this);
666
+ }
667
+
668
+ oe.menuBar.add(menu = new Menu("Setting"));
669
+ if (Globals.ADVANCED)
670
+ {
196671 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197672 revertMeshItem.addActionListener(this);
198673 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199674 resetreferencesItem.addActionListener(this);
200675 menu.add("-");
676
+ }
201677 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202678 overwriteGeoItem.addActionListener(this);
203679 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +685,104 @@
209685 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210686 overwriteUVItem.addActionListener(this);
211687 menu.add("-");
688
+ if (Globals.ADVANCED)
689
+ {
212690 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213691 generateMeshItem.addActionListener(this);
214692 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215693 poseMeshItem.addActionListener(this);
216694 menu.add("-");
695
+ }
217696 resetsupportItem = menu.add(new MenuItem("Reset support"));
218697 resetsupportItem.addActionListener(this);
219698 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220699 linkverticesItem.addActionListener(this);
700
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
701
+ relinkverticesItem.addActionListener(this);
702
+
703
+ if (Globals.ADVANCED)
704
+ {
221705 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222706 setMasterItem.addActionListener(this);
707
+ }
223708
224
- oe.menuBar.add(menu = new Menu("Object"));
225
- grabItem = menu.add(new MenuItem("Grab"));
226
- grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
709
+ oe.menuBar.add(menu = new Menu("Group"));
710
+// grabItem = menu.add(new MenuItem("Grab"));
711
+// grabItem.addActionListener(this);
229712 backItem = menu.add(new MenuItem("Back"));
230713 backItem.addActionListener(this);
231
- compositeItem = menu.add(new MenuItem("Composite"));
232
- compositeItem.addActionListener(this);
233
- menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
235
- randomItem.addActionListener(this);
236
- physicsItem = menu.add(new MenuItem("Physics"));
237
- physicsItem.addActionListener(this);
238
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
239
- frameselectorItem.addActionListener(this);
714
+ frontItem = menu.add(new MenuItem("Front"));
715
+ frontItem.addActionListener(this);
716
+// compositeItem = menu.add(new MenuItem("Composite"));
717
+// compositeItem.addActionListener(this);
718
+
719
+ if (Globals.ADVANCED)
720
+ {
721
+ hideItem = menu.add(new MenuItem("Hidden Group"));
722
+ hideItem.addActionListener(this);
723
+ }
724
+ ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup"));
725
+ ungroupItem.addActionListener(this);
726
+
727
+// menu.add("-");
728
+//
729
+// switchItem = menu.add(new MenuItem("Switch node"));
730
+// switchItem.addActionListener(this);
731
+ if (Globals.ADVANCED)
732
+ {
240733 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241734 switchGeoItem.addActionListener(this);
242735 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243736 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
737
+ morphItem = menu.add(new MenuItem("Morph Group"));
245738 morphItem.addActionListener(this);
739
+
740
+ menu.add("-");
741
+ physicsItem = menu.add(new MenuItem("Physics"));
742
+ physicsItem.addActionListener(this);
743
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
744
+ frameselectorItem.addActionListener(this);
246745 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247746 scriptNodeItem.addActionListener(this);
248
- cameraItem = menu.add(new MenuItem("Camera"));
249
- cameraItem.addActionListener(this);
250
- menu.add("-");
251
- textureItem = menu.add(new MenuItem("Texture"));
252
- textureItem.addActionListener(this);
747
+ }
748
+
749
+ oe.menuBar.add(menu = new Menu("Object"));
750
+// textureItem = menu.add(new MenuItem("Texture"));
751
+// textureItem.addActionListener(this);
752
+ billboardItem = menu.add(new MenuItem("Billboard"));
753
+ billboardItem.addActionListener(this);
253754 csgItem = menu.add(new MenuItem("CSG"));
254755 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
756
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256757 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
758
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258759 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
760
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260761 shadowZItem.addActionListener(this);
762
+ attributeItem = menu.add(new MenuItem("Attribute"));
763
+ attributeItem.addActionListener(this);
764
+
765
+ if (Globals.ADVANCED)
766
+ {
767
+ menu.add("-");
261768 linkerItem = menu.add(new MenuItem("Linker"));
262769 linkerItem.addActionListener(this);
263770 templateItem = menu.add(new MenuItem("Template"));
264771 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267772 pointflowItem = menu.add(new MenuItem("Point Flow"));
268773 pointflowItem.addActionListener(this);
774
+ }
269775 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272776 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273777 resetTransformItem.addActionListener(this);
274778 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275779 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
780
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
781
+ resetCentroidXZItem.addActionListener(this);
782
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
783
+ transformGeometryItem.addActionListener(this);
784
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
785
+ transformChildrenItem.addActionListener(this);
278786
279787 oe.menuBar.add(menu = new Menu("Geometry"));
280788 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +791,13 @@
283791 genNormalsORGANItem.addActionListener(this);
284792 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285793 genNormalsCADItem.addActionListener(this);
794
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
795
+ genNormalsMESHItem.addActionListener(this);
796
+ if (Globals.ADVANCED)
797
+ {
798
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
799
+ genNormalsMINEItem.addActionListener(this);
800
+ }
286801 stripifyItem = menu.add(new MenuItem("Stripify"));
287802 stripifyItem.addActionListener(this);
288803 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +807,6 @@
292807 untrimItem = menu.add(new MenuItem("Untrim"));
293808 untrimItem.addActionListener(this);
294809 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297810 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298811 clearColorsItem.addActionListener(this);
299812 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +819,34 @@
306819 reduce34MeshItem.addActionListener(this);
307820 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308821 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311822 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312823 clipMeshItem.addActionListener(this);
824
+
825
+ if (Globals.ADVANCED)
826
+ {
827
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
828
+ smoothMeshItem.addActionListener(this);
829
+ }
830
+
831
+ oe.menuBar.add(menu = new Menu("Attributes"));
832
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
833
+ clearMaterialsItem.addActionListener(this);
834
+ resetAllItem = menu.add(new MenuItem("Reset All"));
835
+ resetAllItem.addActionListener(this);
836
+ stepAllItem = menu.add(new MenuItem("Step All"));
837
+ stepAllItem.addActionListener(this);
313838 menu.add("-");
314839 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315840 liveleavesItem.addActionListener(this);
316841 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317842 unliveleavesItem.addActionListener(this);
843
+ if (Globals.ADVANCED)
844
+ {
318845 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319846 supportleavesItem.addActionListener(this);
320847 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321848 unsupportleavesItem.addActionListener(this);
849
+ }
322850 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323851 hideleavesItem.addActionListener(this);
324852 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +855,31 @@
327855 markleavesItem.addActionListener(this);
328856 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329857 unmarkleavesItem.addActionListener(this);
858
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
859
+ rewindleavesItem.addActionListener(this);
860
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
861
+ unrewindleavesItem.addActionListener(this);
862
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
863
+ randomleavesItem.addActionListener(this);
864
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
865
+ unrandomleavesItem.addActionListener(this);
330866 menu.add("-");
331867 flipVItem = menu.add(new MenuItem("Flip V"));
332868 flipVItem.addActionListener(this);
333869 unflipVItem = menu.add(new MenuItem("Unflip V"));
334870 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
871
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336872 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
873
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338874 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
875
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340876 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
877
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342878 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
879
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344880 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
881
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346882 panoTexturesItem.addActionListener(this);
347
- menu.add("-");
348
- extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
349
- extractGeometriesItem.addActionListener(this);
350
- cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
351
- cloneGeometriesItem.addActionListener(this);
352
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
353
- shareGeometriesItem.addActionListener(this);
354
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
355
- mergeGeometriesItem.addActionListener(this);
356883
357884 oe.menuBar.add(menu = new Menu("Selection"));
358885 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -361,31 +888,129 @@
361888 attachBumpItem.addActionListener(this);
362889 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
363890 pigmentBumpItem.addActionListener(this);
891
+ //embedTexturesItem
364892 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
365893 detachPigmentItem.addActionListener(this);
366894 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
367895 detachBumpItem.addActionListener(this);
896
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
897
+ embedTexturesItem.addActionListener(this);
898
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
899
+ deEmbedTexturesItem.addActionListener(this);
368900 menu.add("-");
369901 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
370902 sortbysizeItem.addActionListener(this);
371903 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372904 sortbynameItem.addActionListener(this);
905
+ menu.add("-");
906
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
907
+ shareGeometriesItem.addActionListener(this);
908
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
909
+ mergeGeometriesItem.addActionListener(this);
910
+ menu.add("-");
911
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
912
+ editLeafItem.addActionListener(this);
913
+ if (Globals.ADVANCED)
914
+ {
915
+ // Pretty much the same as duplicate and clone.
916
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
917
+ extractGeometriesItem.addActionListener(this);
918
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
919
+ cloneGeometriesItem.addActionListener(this);
920
+ }
921
+
373922 oe.menuBar.add(menu = new Menu("Insert"));
374923 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
924
+
925
+ oe.menuBar.add(menu = new Menu("Tools"));
376926 buildToolsMenu(menu);
377927 }
378928
929
+ JTabbedPane resourcecontainer;
930
+ cGridBag currenttab;
931
+ boolean added; // patch for jar
932
+
933
+ int tabcount = 0;
934
+ int colcount = 0;
935
+ int rowcount = 0;
936
+ int texturecount = 0;
937
+
938
+ int columns = 5;
939
+ int rows = 7;
940
+
941
+ public void ResourceCallBack(String[] path)
942
+ {
943
+ for (int i = 0; i < path.length; i++)
944
+ System.out.print(path[i] + "/");
945
+ System.out.println();
946
+
947
+ if (//rowcount == 0 ||
948
+ path.length == 1)
949
+ {
950
+ currenttab = new cGridBag();
951
+ added = false;
952
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
953
+ currenttab.setName(tabname);
954
+ rowcount = 1;
955
+ colcount = 0;
956
+ texturecount = 0;
957
+ }
958
+
959
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
960
+ {
961
+ if (!added)
962
+ {
963
+ added = true;
964
+ resourcecontainer.add(currenttab);
965
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
966
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
967
+ }
968
+
969
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
970
+
971
+ if (++colcount >= columns)
972
+ {
973
+ colcount = 0;
974
+ currenttab.Return();
975
+
976
+ if (rowcount++ >= rows)
977
+ {
978
+ rowcount = 0;
979
+ }
980
+ }
981
+ }
982
+ else
983
+ {
984
+// if (!path[path.length-1].equals("icons"))
985
+// resourcecontainer.Return();
986
+ }
987
+ }
988
+
989
+ void CreateTexturePanel(cGridBag container)
990
+ {
991
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
992
+ container.add(resourcecontainer);
993
+
994
+ Grafreed.ParseResources("textures", this);
995
+ }
996
+
379997 void SetupUI2(ObjEditor oe)
380998 {
999
+ // June 2019
1000
+ if (oe == null)
1001
+ {
1002
+ //super.SetupUI2(this);
1003
+ //return;
1004
+ }
1005
+
1006
+ if (copy != group)
1007
+ {
1008
+ //super.SetupUI2(this);
1009
+ }
1010
+
3811011 //new Exception().printStackTrace();
3821012
3831013 oe.radioPanel = new JPanel(new GridBagLayout());
384
- oe.aConstraints.weightx = 1;
385
- oe.aConstraints.weighty = 0;
386
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
387
- oe.aConstraints.gridwidth = 100;
388
- oe.aConstraints.gridheight = 1;
3891014 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
3901015
3911016 oe.buttonGroup = new ButtonGroup();
....@@ -406,150 +1031,263 @@
4061031 oe.radioPanel.add(dummyButton);
4071032 oe.buttonGroup.add(dummyButton);
4081033 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
1034
+ cGridBag copyOptionsPanel = new cGridBag();
1035
+
1036
+ copyOptionsPanel.preferredHeight = 2;
4121037
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
1038
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1039
+
1040
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ //minButton.setToolTipText("Minimize window");
1042
+ //minButton.addActionListener(this);
1043
+
1044
+ if (Globals.ADVANCED)
1045
+ {
1046
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
+// maxButton.setToolTipText("Maximize window");
1048
+// maxButton.addActionListener(this);
1049
+ }
1050
+
1051
+ cButton gcButton;
1052
+
1053
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+// gcButton.setToolTipText("Garbage collect");
1055
+// gcButton.addActionListener(new ActionListener()
1056
+// {
1057
+// public void actionPerformed(ActionEvent e)
1058
+// {
1059
+// System.gc();
1060
+// }
1061
+// });
1062
+
1063
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ collapseButton.setToolTipText("Collapse toolbar");
1065
+ collapseButton.addActionListener(this);
1066
+
1067
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ maximize3DButton.setToolTipText("Maximize 3D view");
1069
+ maximize3DButton.addActionListener(this);
1070
+
1071
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ twoButton.setToolTipText("Show 3D view only");
1073
+ twoButton.addActionListener(this);
1074
+ this.fullscreenLayout = twoButton;
1075
+
1076
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ threeButton.setToolTipText("Show controls and 3D view");
1078
+ threeButton.addActionListener(this);
1079
+ if (Globals.ADVANCED)
1080
+ {
1081
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1082
+ sixButton.setToolTipText("Show 3D view and controls");
1083
+ sixButton.addActionListener(this);
1084
+ }
1085
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1086
+// sevenButton.setToolTipText("3-column layout");
1087
+// sevenButton.addActionListener(this);
1088
+ //
1089
+
1090
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1091
+ fullButton.setToolTipText("Full-screen window");
1092
+ fullButton.addActionListener(this);
1093
+
1094
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ screenfitButton.setToolTipText("Screen fit");
1096
+ screenfitButton.addActionListener(this);
1097
+
1098
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1099
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1100
+ restoreCameraButton.addActionListener(this);
1101
+
1102
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ saveVersionButton.setToolTipText("Duplicate current version");
1104
+ saveVersionButton.addActionListener(this);
1105
+
1106
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
+ deleteVersionButton.setToolTipText("Delete current version");
1108
+ deleteVersionButton.addActionListener(this);
1109
+
1110
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ previousVersionButton.setToolTipText("Previous version");
1112
+ previousVersionButton.addActionListener(this);
1113
+ previousVersionButton.setEnabled(false);
1114
+
1115
+ cGridBag updown = new cGridBag().setVertical(true);
1116
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ restoreButton.setToolTipText("Undo (restore current version)");
1118
+ restoreButton.addActionListener(this);
1119
+ //restoreButton.setEnabled(false);
1120
+
1121
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1122
+ replaceButton.setToolTipText("Save (replace current version)");
1123
+ replaceButton.addActionListener(this);
1124
+ //replaceButton.setEnabled(false);
1125
+
1126
+ copyOptionsPanel.add(updown);
1127
+
1128
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ nextVersionButton.setToolTipText("Next version");
1130
+ nextVersionButton.addActionListener(this);
1131
+ nextVersionButton.setEnabled(false);
1132
+
1133
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1134
+ oneStepButton.setToolTipText("Animate one step forward");
1135
+ oneStepButton.addActionListener(this);
1136
+
1137
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1138
+ liveCB.setToolTipText("Enable animation");
4141139 liveCB.addItemListener(this);
4151140
416
- oe.aConstraints.gridx += 1;
417
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
418
- supportCB.addItemListener(this);
419
-
420
- // oe.aConstraints.gridx += 1;
421
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
422
- // localCB.addItemListener(this);
423
-
424
- oe.aConstraints.gridx += 1;
425
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
426
- crowdCB.addItemListener(this);
427
-
428
- oe.aConstraints.gridx += 1;
429
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
430
- smoothCB.addItemListener(this);
431
-
432
- oe.aConstraints.gridx += 1;
433
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
1141
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1142
+ fastCB.setToolTipText("Fast mode");
4341143 fastCB.addItemListener(this);
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
437
- slowCB.addItemListener(this);
438
- oe.aConstraints.gridx += 1;
439
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
440
- boxCB.addItemListener(this);
1144
+
1145
+ //oe.toolboxPanel.Return();
1146
+
1147
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1148
+// trackCB.setToolTipText("Enable tracking");
1149
+// trackCB.addItemListener(this);
4411150
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
476
- trackCB.addItemListener(this);
477
-
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
480
- screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
4821151 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
4831152 // screenfitpointButton.addActionListener(this);
484
-// oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486
- snapobjectButton.addActionListener(this);
487
- oe.aConstraints.gridx += 1;
4881153
489
- //aConstraints.gridx = 0;
490
- //aConstraints.gridy += 1;
491
- oe.aConstraints.weighty = 0;
492
- oe.aConstraints.gridwidth = 1;
493
-
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
495
- flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499
-
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
502
- twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
1154
+ if (Globals.ADVANCED)
1155
+ {
1156
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1157
+ snapobjectButton.addActionListener(this);
1158
+ snapobjectButton.setToolTipText("Snap Object");
1159
+
1160
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5041161 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
506
- sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
508
- threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
511
- //
1162
+ fourButton.setToolTipText("Show control panel only");
1163
+ }
5121164
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1165
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1166
+
1167
+
1168
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1169
+ rootButton.setToolTipText("Open selection in new tab");
5141170 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1171
+
1172
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1173
+ closeButton.setToolTipText("Close tab");
5171174 closeButton.addActionListener(this);
5181175 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5191176 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521
-
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
524
- editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
5281177
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1178
+ cGridBag row1 = new cGridBag();
1179
+
1180
+ // INSERT
1181
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1182
+ gridButton.setToolTipText("Create ground");
1183
+ gridButton.addActionListener(this);
1184
+
1185
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1186
+ boxButton.setToolTipText("Create box");
1187
+ boxButton.addActionListener(this);
1188
+
1189
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1190
+ sphereButton.setToolTipText("Create sphere");
1191
+ sphereButton.addActionListener(this);
1192
+
1193
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ coneButton.setToolTipText("Create cone");
1195
+ coneButton.addActionListener(this);
1196
+
1197
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1198
+ torusButton.setToolTipText("Create torus");
1199
+ torusButton.addActionListener(this);
1200
+
1201
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1202
+ superButton.setToolTipText("Create superellipsoid");
1203
+ superButton.addActionListener(this);
1204
+
1205
+ if (Globals.ADVANCED)
1206
+ {
1207
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ kleinButton.setToolTipText("Create Klein bottle");
1209
+ kleinButton.addActionListener(this);
1210
+ }
1211
+
1212
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1213
+ particlesButton.setToolTipText("Create particle system");
1214
+ particlesButton.addActionListener(this);
1215
+
1216
+ oe.toolboxPanel.add(row1);
1217
+
1218
+ cGridBag row2 = new cGridBag();
1219
+
1220
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1221
+ groupButton.setToolTipText("Create group");
1222
+ groupButton.addActionListener(this);
1223
+
1224
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1225
+ compositeButton.setToolTipText("Create composite");
1226
+ compositeButton.addActionListener(this);
1227
+
1228
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1229
+ switchButton.setToolTipText("Create item switcher");
1230
+ switchButton.addActionListener(this);
1231
+
1232
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1233
+ loopButton.setToolTipText("Create loop");
1234
+ loopButton.addActionListener(this);
1235
+
1236
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1237
+ textureButton.setToolTipText("Create texture");
1238
+ textureButton.addActionListener(this);
1239
+
1240
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1241
+ overlayButton.setToolTipText("Create overlay");
1242
+ overlayButton.addActionListener(this);
1243
+
1244
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1245
+ lightButton.setToolTipText("Create light");
1246
+ lightButton.addActionListener(this);
1247
+
1248
+ oe.toolboxPanel.add(row2);
1249
+
1250
+ cGridBag textures = new cGridBag();
1251
+
1252
+ CreateTexturePanel(textures);
1253
+
1254
+ oe.toolboxPanel.add(textures);
1255
+
1256
+ textures.preferredHeight = 100;
1257
+
1258
+ CreateSkyboxPanel(oe.skyboxPanel);
1259
+
1260
+ // EDIT panel
1261
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1262
+ editButton.setToolTipText("Pin selection controls");
1263
+ editButton.addActionListener(this);
1264
+
1265
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1266
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5301267 uneditButton.addActionListener(this);
5311268
532
- oe.aConstraints.gridx += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
537
- clearPanelButton.addActionListener(this);
538
-
539
- oe.aConstraints.gridx += 1;
540
- oe.aConstraints.weighty = 0;
541
- oe.aConstraints.gridwidth = 1;
542
-
543
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1269
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1270
+ allParamsButton.setToolTipText("Show all controls");
5441271 allParamsButton.addActionListener(this);
5451272
546
- oe.aConstraints.gridx += 1;
547
- oe.aConstraints.weighty = 0;
548
- oe.aConstraints.gridwidth = 1;
549
-
550
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
551
- unselectButton.addActionListener(this);
1273
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1274
+ clearPanelButton.setToolTipText("Clear all controls");
1275
+ clearPanelButton.addActionListener(this);
5521276
1277
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1278
+ //unselectButton.setToolTipText("Unselect");
1279
+ //unselectButton.addActionListener(this);
1280
+
1281
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1282
+ flashSelectionButton.setToolTipText("Highlight selection");
1283
+ flashSelectionButton.addActionListener(this);
1284
+
1285
+ editCommandsPanel.preferredHeight = 1;
1286
+
1287
+ SetPinStates(false);
1288
+// oe.treePanel.add(commandsPanel);
1289
+// oe.treePanel.Return();
1290
+
5531291 // oe.aConstraints.gridx += 1;
5541292 // oe.aConstraints.weighty = 0;
5551293 // oe.aConstraints.gridwidth = 1;
....@@ -561,47 +1299,32 @@
5611299 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5621300 // gcButton.addActionListener(this);
5631301
564
- oe.aConstraints.gridx = 0;
565
- oe.aConstraints.gridy += 1;
566
-
567
- //ctrlPanel.add(objList = new List(5, true));
568
- oe.aConstraints.gridwidth = 100;
569
- // oe.aConstraints.gridheight = 100;
570
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
571
- oe.aConstraints.gridheight = 1;
572
- oe.aConstraints.weighty = 0.5;
573
- oe.aConstraints.gridx = 0;
574
- JScrollPane jSP;
1302
+ cGridBag jSPPanel = new cGridBag();
1303
+
1304
+ JScrollPane jSP;
5751305 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
576
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1306
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5771307 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
582
-
583
- oe.aConstraints.weighty = 0;
584
- oe.aConstraints.gridwidth = 2;
585
-
586
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
587
- colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
590
- materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
593
- textureCB.addItemListener(this);
594
-
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
5971308
1309
+ oe.treePanel.add(jSPPanel);
1310
+ oe.treePanel.Return();
1311
+
1312
+ oe.treePanel.add(copyOptionsPanel);
1313
+ oe.treePanel.Return();
1314
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1315
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1316
+ sliderPane.preferredHeight = 1;
1317
+
1318
+// mainPanel.setDividerLocation(0.1); //1.0);
1319
+ mainPanel.setResizeWeight(0.4);
1320
+
5981321 //jList.addListSelectionListener(this);
5991322 oe.jTree.addTreeSelectionListener(this);
6001323 //jTree.setRootVisible(false);
6011324 //jTree.setEditable(true);
6021325 oe.jTree.setDragEnabled(true);
6031326 //jTree.setPreferredSize(new Dimension(10,10));
604
- jSP.setPreferredSize(new Dimension(100,200));
1327
+ //jSP.setPreferredSize(new Dimension(100,200));
6051328
6061329 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6071330
....@@ -613,23 +1336,171 @@
6131336 dgr.addDragGestureListener(this);
6141337 }catch(Exception e) {}
6151338 */
616
- radio.layout = sevenButton;
1339
+ radio.layout = threeButton; // sixButton;
6171340 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6181341 }
1342
+
1343
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1344
+ {
1345
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1346
+ colorCB.setToolTipText("Copy color when dropped");
1347
+ colorCB.addItemListener(this);
1348
+
1349
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1350
+ materialCB.setToolTipText("Copy material when dropped");
1351
+ materialCB.addItemListener(this);
1352
+
1353
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1354
+ textureCB.setToolTipText("Copy texture when dropped");
1355
+ textureCB.addItemListener(this);
1356
+
1357
+ panel.Return();
1358
+
1359
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1360
+ boxCB.setToolTipText("Display bounding boxes");
1361
+ boxCB.addItemListener(this);
1362
+
1363
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1364
+ zoomBoxCB.setToolTipText("Display only for wheel");
1365
+ zoomBoxCB.addItemListener(this);
1366
+
1367
+ if (true) // Globals.ADVANCED)
1368
+ {
1369
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1370
+// supportCB.setToolTipText("Enable rigging");
1371
+// supportCB.addItemListener(this);
1372
+
1373
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1374
+ freezeCB.setToolTipText("Fast moving camera");
1375
+ freezeCB.addItemListener(this);
1376
+
1377
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1378
+ // localCB.addItemListener(this);
1379
+
1380
+ panel.Return();
1381
+
1382
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1383
+ crowdCB.setToolTipText("Used for crowds");
1384
+ crowdCB.addItemListener(this);
1385
+
1386
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1387
+ smoothCB.setToolTipText("Snapping delay");
1388
+ smoothCB.addItemListener(this);
1389
+
1390
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1391
+// slowCB.setToolTipText("Smooth interpolation");
1392
+// slowCB.addItemListener(this);
1393
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1394
+ minshaderCB.setToolTipText("Minimal fast shader");
1395
+ minshaderCB.addItemListener(this);
1396
+
1397
+// constraints.gridy += 1;
1398
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1399
+// speakerMocapCB.addItemListener(this);
1400
+
1401
+ panel.Return();
1402
+
1403
+ if (false)
1404
+ {
1405
+ // handled in scripts
1406
+ //constraints.gridy += 1;
1407
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1408
+ speakerCameraCB.addItemListener(this);
1409
+
1410
+ //constraints.gridy += 1;
1411
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1412
+ speakerFocusCB.addItemListener(this);
1413
+
1414
+ //constraints.gridy += 1;
1415
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1416
+ smoothfocusCB.addItemListener(this);
1417
+ panel.Return();
1418
+ }
1419
+
1420
+//constraints.gridx += 1;
1421
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1422
+// debugCB.addItemListener(this);
1423
+
1424
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1425
+ trackCB.setToolTipText("Enable tracking target");
1426
+ trackCB.addItemListener(this);
1427
+
1428
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1429
+ oeilCB.setToolTipText("Move camera when tracking");
1430
+ oeilCB.addItemListener(this);
1431
+
1432
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1433
+ shadowCB.setToolTipText("When live compute shadows");
1434
+ shadowCB.addItemListener(this);
1435
+
1436
+ panel.Return();
1437
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1438
+ toggleTextureCB.setToolTipText("Load textures");
1439
+ toggleTextureCB.addItemListener(this);
1440
+
1441
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1442
+ toggleSwitchCB.setToolTipText("Choose a single item");
1443
+ toggleSwitchCB.addItemListener(this);
1444
+
1445
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1446
+ autokeepCB.setToolTipText("On structure change");
1447
+ autokeepCB.addItemListener(this);
1448
+
1449
+ panel.Return();
1450
+ if (Globals.ADVANCED)
1451
+ {
1452
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1453
+ lookAtCB.setToolTipText("Look-at target");
1454
+ lookAtCB.addItemListener(this);
1455
+ }
1456
+
1457
+ }
1458
+
1459
+ cGridBag fill = new cGridBag();
1460
+ fill.preferredHeight = 200;
1461
+ cGridBag fill2 = new cGridBag();
1462
+ fill2.preferredHeight = 200;
1463
+ cGridBag fill3 = new cGridBag();
1464
+ fill3.preferredHeight = 200;
1465
+
1466
+ panel.add(fill);
1467
+ panel.add(fill2);
1468
+ panel.add(fill3);
1469
+
1470
+ }
6191471
6201472 void EditObject(Object3D obj)
6211473 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
1474
+ assert(obj instanceof Composite);
1475
+
1476
+// if (obj.versionlist == null)
1477
+// {
1478
+// obj.versionlist = new Object3D[100];
1479
+// obj.versionindex = -1;
1480
+// }
1481
+
1482
+ cRadio radioButton = new cRadio(obj.name);
1483
+
1484
+ // June 2019. Patch to avoid bug with transparency.
1485
+ radioButton.hadMaterial = obj.material != null;
1486
+ if (!radioButton.hadMaterial)
1487
+ {
1488
+ obj.material = new cMaterial();
1489
+ }
1490
+
1491
+ radioButton.SetObject(obj);
1492
+ radioButton.layout = threeButton; // sixButton;
1493
+ radioButton.SetCamera(cameraView.renderCamera, false);
1494
+ radioButton.addActionListener(this);
1495
+ radioPanel.add(radioButton);
1496
+ buttonGroup.add(radioButton);
1497
+ radioButton.doClick();
6301498 }
1499
+
6311500 void SetupViews(ObjEditor oe)
6321501 {
1502
+ theFrame = this;
1503
+
6331504 oe.SetupViews();
6341505
6351506 System.out.println("SetupViews");
....@@ -638,22 +1509,30 @@
6381509 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391510 }
6401511
641
- JCheckBox liveCB;
642
- JCheckBox supportCB;
643
- JCheckBox localCB;
644
- JCheckBox crowdCB;
645
- JCheckBox smoothCB;
646
- JCheckBox fastCB;
647
- JCheckBox slowCB;
648
- JCheckBox boxCB;
649
- JCheckBox trackCB;
650
- JCheckBox smoothfocusCB;
1512
+ cToggleButton liveCB;
1513
+ cCheckBox supportCB;
1514
+ cCheckBox localCB;
1515
+ cCheckBox crowdCB;
1516
+ cCheckBox smoothCB;
1517
+ cCheckBox minshaderCB;
1518
+
1519
+ cToggleButton fastCB;
1520
+ cCheckBox slowCB;
1521
+ cCheckBox boxCB;
1522
+ cCheckBox zoomBoxCB;
1523
+ cCheckBox freezeCB;
1524
+ //cToggleButton trackCB;
1525
+ cCheckBox trackCB;
1526
+ cCheckBox smoothfocusCB;
6511527 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1528
+ cCheckBox speakerCameraCB;
1529
+ cCheckBox speakerFocusCB;
1530
+ cCheckBox debugCB;
1531
+
1532
+ cCheckBox oeilCB;
1533
+ cCheckBox shadowCB;
1534
+ cCheckBox autokeepCB;
1535
+ cCheckBox lookAtCB;
6571536
6581537 // static int COLOR = 1;
6591538 // static int MATERIAL = 2;
....@@ -661,9 +1540,9 @@
6611540
6621541 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631542
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1543
+ cCheckBox colorCB;
1544
+ cCheckBox materialCB;
1545
+ cCheckBox textureCB;
6671546
6681547 public void itemStateChanged(ItemEvent e)
6691548 {
....@@ -688,10 +1567,10 @@
6881567 dropAttributes |= Object3D.TEXTURE;
6891568 else
6901569 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1570
+ } else if(e.getSource() == liveCB)
6931571 {
6941572 cameraView.ToggleLive();
1573
+ refreshContents(false);
6951574 }
6961575 else if(e.getSource() == supportCB)
6971576 {
....@@ -707,6 +1586,12 @@
7071586 {
7081587 cameraView.ToggleInertia();
7091588 cameraView.repaint();
1589
+ }
1590
+ else if(e.getSource() == minshaderCB)
1591
+ {
1592
+ Globals.MINSHADER ^= true;
1593
+ cameraView.programInitialized = false;
1594
+ cameraView.repaint();
7101595 }
7111596 else if(e.getSource() == localCB)
7121597 {
....@@ -726,6 +1611,10 @@
7261611 Recompile();
7271612 cameraView.repaint();
7281613 // refreshContents();
1614
+ }
1615
+ else if(e.getSource() == zoomBoxCB)
1616
+ {
1617
+ cameraView.ToggleZoomBoxMode();
7291618 }
7301619 else if(e.getSource() == smoothfocusCB)
7311620 {
....@@ -752,6 +1641,18 @@
7521641 {
7531642 cameraView.ToggleOeil();
7541643 }
1644
+ else if(e.getSource() == shadowCB)
1645
+ {
1646
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1647
+ }
1648
+ else if(e.getSource() == freezeCB)
1649
+ {
1650
+ Globals.FREEZEONMOVE ^= true;
1651
+ }
1652
+ else if(e.getSource() == autokeepCB)
1653
+ {
1654
+ Globals.REPLACEONMAKE ^= true;
1655
+ }
7551656 else if(e.getSource() == lookAtCB)
7561657 {
7571658 cameraView.ToggleLookAt();
....@@ -768,7 +1669,8 @@
7681669
7691670 /**/
7701671 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1672
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1673
+ TreePath path = objEditor.jTree.getSelectionPath();
7721674 if ((path == null) || (path.getPathCount() <= 1)) {
7731675 // We can't move the root node or an empty selection
7741676 return;
....@@ -831,8 +1733,6 @@
8311733 }
8321734 }
8331735
834
- String string = (String) object;
835
-
8361736 System.out.println("Transfer = " + object + "; drop : " + target);
8371737 // if( object instanceof java.io.File[])
8381738 // {
....@@ -840,7 +1740,11 @@
8401740 // objEditor.DropFile((java.io.File[]) object, true);
8411741 // return;
8421742 // }
843
- if (string.charAt(0) == '/')
1743
+
1744
+ String string = object.toString();
1745
+
1746
+ // File path for Mac and Windows
1747
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441748 {
8451749 // file(s)
8461750 String[] names = string.split("\n");
....@@ -867,7 +1771,7 @@
8671771
8681772 flashIt = false;
8691773 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1774
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711775 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721776
8731777 if (group.selection.size() == 1)
....@@ -883,23 +1787,33 @@
8831787
8841788 assert target == objEditor.jTree;
8851789 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1790
+ Object3D destinationLeaf;
8861791 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1792
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881793 } catch (Exception e) {
8891794 System.out.println("destinationPath : " + destinationPath);
8901795 return;
8911796 }
8921797
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1798
+ for (int i=group.selection.size(); --i>=0;)
8941799 {
1800
+ Object3D child = (Object3D)group.selection.elementAt(i);
1801
+
1802
+ // Cannot move into itself
1803
+ if (child == destinationLeaf)
1804
+ return;
1805
+ }
1806
+
1807
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1808
+// {
8951809 loadClipboard(true);
8961810 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1811
+ pasteInto(false, false);
1812
+// } else {
1813
+// loadClipboard(false);
1814
+// objEditor.jTree.setSelectionPath(destinationPath);
1815
+// pasteInto(false, false); // true); // ???
1816
+// }
9031817 }
9041818 public void dropActionChanged(DropTargetDragEvent dtde)
9051819 // Called if the user has modified the current drop gesture
....@@ -955,7 +1869,12 @@
9551869 TreePath path;
9561870
9571871 public TransferableTreePath(TreePath tp) {
958
- path = tp;
1872
+ Object[] objs = new Object[tp.getPathCount()];
1873
+ for (int i=0; i<objs.length; i++)
1874
+ {
1875
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1876
+ }
1877
+ path = new TreePath(objs);
9591878 }
9601879
9611880 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1002,90 +1921,109 @@
10021921
10031922 void buildCreateMenu(Menu menu)
10041923 {
1005
- gridItem = menu.add(new MenuItem("Grid"));
1006
- gridItem.addActionListener(this);
1007
- rectoidItem = menu.add(new MenuItem("Box"));
1008
- rectoidItem.addActionListener(this);
1009
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1010
- ellipsoidItem.addActionListener(this);
1011
- coneItem = menu.add(new MenuItem("Cone"));
1012
- coneItem.addActionListener(this);
1013
- torusItem = menu.add(new MenuItem("Torus"));
1014
- torusItem.addActionListener(this);
1015
- superItem = menu.add(new MenuItem("Superellipsoid"));
1016
- superItem.addActionListener(this);
1017
- particleItem = menu.add(new MenuItem("Particle system"));
1018
- particleItem.addActionListener(this);
1924
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1925
+ //heightFieldItem.addActionListener(this);
1926
+// gridItem = menu.add(new MenuItem("Grid"));
1927
+// gridItem.addActionListener(this);
1928
+// rectoidItem = menu.add(new MenuItem("Box"));
1929
+// rectoidItem.addActionListener(this);
1930
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1931
+// ellipsoidItem.addActionListener(this);
1932
+// coneItem = menu.add(new MenuItem("Cone"));
1933
+// coneItem.addActionListener(this);
1934
+// torusItem = menu.add(new MenuItem("Torus"));
1935
+// torusItem.addActionListener(this);
1936
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1937
+// superItem.addActionListener(this);
1938
+
1939
+ cameraItem = menu.add(new MenuItem("Camera"));
1940
+ cameraItem.addActionListener(this);
1941
+
1942
+ if (!Globals.ADVANCED)
1943
+ {
1944
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1945
+ kleinItem.addActionListener(this);
1946
+ }
1947
+
1948
+// particleItem = menu.add(new MenuItem("Particle system"));
1949
+// particleItem.addActionListener(this);
1950
+ if (Globals.ADVANCED)
1951
+ {
10191952 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201953 ragdollItem.addActionListener(this);
10211954 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221955 ragdoll2Item.addActionListener(this);
1956
+ }
10231957 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1958
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251959 meshItem.addActionListener(this);
10261960 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271961 // meshGroupItem.addActionListener(this);
1962
+ if (Globals.ADVANCED)
1963
+ {
10281964 springItem = menu.add(new MenuItem("Spring"));
10291965 springItem.addActionListener(this);
10301966 flagItem = menu.add(new MenuItem("Flag"));
10311967 flagItem.addActionListener(this);
1032
- bezierItem = menu.add(new MenuItem("Patch"));
1033
- bezierItem.addActionListener(this);
1034
- checkerItem = menu.add(new MenuItem("Checker"));
1035
- checkerItem.addActionListener(this);
10361968 blobItem = menu.add(new MenuItem("Blob"));
10371969 blobItem.addActionListener(this);
10381970 latheItem = menu.add(new MenuItem("Lathe"));
10391971 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1972
+ }
1973
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1974
+ bezierItem.addActionListener(this);
1975
+// overlayItem = menu.add(new MenuItem("Overlay"));
1976
+// overlayItem.addActionListener(this);
1977
+// lightItem = menu.add(new MenuItem("Light"));
1978
+// lightItem.addActionListener(this);
10421979 menu.add("-");
10431980 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441981 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1982
+// loopItem = menu.add(new MenuItem("Loop"));
1983
+// loopItem.addActionListener(this);
10471984 doubleItem = menu.add(new MenuItem("Fork"));
10481985 doubleItem.addActionListener(this);
1986
+ if (Globals.ADVANCED)
1987
+ {
10491988 tripleItem = menu.add(new MenuItem("Trident"));
10501989 tripleItem.addActionListener(this);
1051
- menu.add("-");
1052
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
1053
- importGFDItem.addActionListener(this);
1054
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
1055
- importVRMLX3DItem.addActionListener(this);
1056
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
1057
- importOBJItem.addActionListener(this);
1058
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
1059
- import3DSItem.addActionListener(this);
1990
+ }
10601991 }
10611992
10621993 void buildToolsMenu(Menu menu)
10631994 {
10641995 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651996 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1997
+ animationItem.setState(Globals.ANIMATION);
1998
+
1999
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
2000
+ archiveItem.addActionListener(this);
10672001
10682002 menu.add("-");
10692003 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10702004 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
2005
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
2006
+ textureFieldItem.addActionListener(this);
2007
+ alignItem = menu.add(new MenuItem("Align Objects"));
10722008 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10752009 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10762010 reduceMorphItem.addActionListener(this);
10772011 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10782012 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10822013 menu.add("-");
1083
-
10842014 menu.add(memoryItem = new MenuItem("Memory Usage"));
10852015 memoryItem.addActionListener(this);
2016
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
2017
+ computeAOItem.addActionListener(this);
2018
+
2019
+ if (Globals.ADVANCED)
2020
+ {
2021
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
2022
+ mirrorItem.addActionListener(this);
2023
+ menu.add("-");
10862024 menu.add(analyzeItem = new MenuItem("Analyze"));
10872025 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
2026
+ menu.add(dumpItem = new MenuItem("Print"));
10892027 dumpItem.addActionListener(this);
10902028 // menu.add(pathItem = new MenuItem("From-to path"));
10912029 // pathItem.addActionListener(this);
....@@ -1094,6 +2032,8 @@
10942032 resetParentItem.addActionListener(this);
10952033 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10962034 repairParentItem.addActionListener(this);
2035
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
2036
+ repairShadowItem.addActionListener(this);
10972037 menu.add(invariantsItem = new MenuItem("Invariants"));
10982038 invariantsItem.addActionListener(this);
10992039 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +2041,7 @@
11012041 menu.add("-");
11022042 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11032043 editScriptItem.addActionListener(this);
2044
+ }
11042045 }
11052046
11062047 void ScreenFit()
....@@ -1223,9 +2164,34 @@
12232164 shadow.material = new cMaterial(obj.material);
12242165 shadow.material.diffuse = 0.0001f;
12252166 shadow.material.specular = 0.0001f;
2167
+ //shadow.projectedVertices[1].x = 300;
12262168
12272169 makeSomething(shadow);
12282170 }
2171
+
2172
+ private void ClearUnpinned()
2173
+ {
2174
+ //for (Object3D obj : listUI)
2175
+ for (int i=listUI.size(); --i>=0;)
2176
+ {
2177
+ Object3D obj = listUI.elementAt(i);
2178
+ if (!obj.pinned)
2179
+ {
2180
+ obj.CloseUI();
2181
+ listUI.remove(i);
2182
+ }
2183
+ }
2184
+ }
2185
+
2186
+ private void EditElement(Object3D elem, boolean newWindow)
2187
+ {
2188
+ // if (!(elem instanceof Composite))
2189
+ // newWindow = false;
2190
+ listUI.add(elem);
2191
+ elem.openEditWindow(this, newWindow); //, false);
2192
+ System.out.println("edit : " + elem);
2193
+ elem.editWindow.refreshContents(true); // ? new
2194
+ }
12292195
12302196 /**
12312197 * applyExample
....@@ -1429,9 +2395,9 @@
14292395
14302396 void Overwrite(int mask)
14312397 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2398
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332399 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2400
+ Object3D content = Grafreed.clipboard.get(0);
14352401
14362402 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372403 content = ((cGroup)content).get(0);
....@@ -1454,6 +2420,7 @@
14542420 //
14552421 public void actionPerformed(ActionEvent event) // , Object arg)
14562422 {
2423
+ Object source = event.getSource();
14572424 /*
14582425 if (event.getSource() == nameField)
14592426 {
....@@ -1465,11 +2432,11 @@
14652432 }
14662433 else
14672434 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2435
+ if (source == lookAtItem || source == lookFromItem)
14692436 {
14702437 ScreenFit();
14712438 } else
1472
- if (event.getSource() == switchItem)
2439
+ if (source == switchViewItem)
14732440 {
14742441 cVector v1 = new cVector();
14752442 cVector v2 = new cVector();
....@@ -1478,11 +2445,11 @@
14782445 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792446 objEditor.cameraView.repaint();
14802447 } else
1481
- if (event.getSource() == rectoidItem)
2448
+ if (source == rectoidItem || source == boxButton)
14822449 {
14832450 makeSomething(new Box());
14842451 } else
1485
- if (event.getSource() == particleItem)
2452
+ if (source == particleItem || source == particlesButton)
14862453 {
14872454 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882455 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2470,9 @@
15032470 applyExample(particleGeom, "SMOKE");
15042471 makeSomething(particleGeom);
15052472 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2473
+ if (source == ragdollItem || source == ragdoll2Item)
15072474 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2475
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092476
15102477 ragdoll.toParent = LA.newMatrix();
15112478 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2488,71 @@
15212488 makeSomething(ragdoll);
15222489 //makeSomething(new VehicleDemo());
15232490 } else
1524
- if (event.getSource() == gridItem)
2491
+ /*
2492
+ */
2493
+ if (source == heightFieldItem)
2494
+ {
2495
+ Object3D obj = new Object3D();
2496
+
2497
+ obj.CreateMaterial();
2498
+ obj.bRep = new BoundaryRep();
2499
+
2500
+ obj.bRep.CreateMesh(new iHeightField()
2501
+ {
2502
+ public double f(double x, double y)
2503
+ {
2504
+ // The Mandelbrot set is represented by coloring
2505
+ // each point (x,y) according to the number of
2506
+ // iterations it takes before the while loop in
2507
+ // this method ends. For points that are actually
2508
+ // in the Mandelbrot set, or very close to it, the
2509
+ // count will reach the maximum value, 80. These
2510
+ // points will be colored purple. All other colors
2511
+ // represent points that are definitely NOT in the set.
2512
+ x -= 600;
2513
+ y -= 500;
2514
+ x /= 200;
2515
+ y /= 200;
2516
+ int count = 0;
2517
+ double zx = x;
2518
+ double zy = y;
2519
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2520
+ double new_zx = zx*zx - zy*zy + x;
2521
+ zy = 2*zx*zy + y;
2522
+ zx = new_zx;
2523
+ count++;
2524
+ }
2525
+ return count; // Math.sqrt(count);
2526
+ }
2527
+ }, 1000,1000);
2528
+
2529
+ makeSomething(obj);
2530
+ } else
2531
+ if (source == gridItem || source == gridButton)
15252532 {
15262533 makeSomething(new Grid());
15272534 } else
1528
- if (event.getSource() == ellipsoidItem)
2535
+ if (source == ellipsoidItem || source == sphereButton)
15292536 {
15302537 makeSomething(new Sphere());
15312538 } else
1532
- if (event.getSource() == coneItem)
2539
+ if (source == coneItem || source == coneButton)
15332540 {
15342541 makeSomething(new Cone());
15352542 } else
1536
- if (event.getSource() == torusItem)
2543
+ if (source == torusItem || source == torusButton)
15372544 {
15382545 makeSomething(new Torus());
15392546 } else
1540
- if (event.getSource() == superItem)
2547
+ if (source == superItem || source == superButton)
15412548 {
15422549 makeSomething(new Superellipsoid());
15432550 } else
1544
- if (event.getSource() == blobItem)
2551
+ if (source == kleinItem || source == kleinButton)
2552
+ {
2553
+ makeSomething(new Klein());
2554
+ } else
2555
+ if (source == blobItem)
15452556 {
15462557 Blob blob = new Blob();
15472558 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2560,15 @@
15492560 //blob.retile();
15502561 makeSomething(blob);
15512562 } else
1552
- if (event.getSource() == latheItem)
2563
+ if (source == latheItem)
15532564 {
15542565 makeSomething(new Lathe());
15552566 } else
1556
- if (event.getSource() == bezierItem)
2567
+ if (source == bezierItem)
15572568 {
15582569 makeSomething(new BezierSurface());
15592570 } else
1560
- if (event.getSource() == checkerItem)
2571
+ if (source == overlayItem || source == overlayButton)
15612572 {
15622573 /*
15632574 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2581,9 @@
15702581 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712582 LA.matInvert(obj.toParent, obj.fromParent);
15722583 */
1573
- makeSomething(new CheckerIG());
2584
+ makeSomething(new Checker());
15742585 } else
1575
- if (event.getSource() == meshItem)
2586
+ if (source == meshItem)
15762587 {
15772588 Object3D itemtomake = new Object3D();
15782589 Object3D child;
....@@ -1593,35 +2604,52 @@
15932604 makeSomething(child);
15942605 }
15952606 } else
1596
- if (event.getSource() == springItem)
2607
+ if (source == springItem)
15972608 {
15982609 cSpring s = new cSpring();
15992610 s.setup();
16002611 makeSomething(s);
16012612 } else
1602
- if (event.getSource() == flagItem)
2613
+ if (source == flagItem)
16032614 {
16042615 cSpring s = new cFlag();
16052616 s.setup();
16062617 makeSomething(s);
16072618 } else
1608
- if (event.getSource() == lightItem)
2619
+ if (source == lightItem || source == lightButton)
16092620 {
16102621 makeSomething(new Light());
16112622 } else
1612
- if (event.getSource() == csgItem)
2623
+// if (source == skybox1Button ||
2624
+// source == skybox2Button ||
2625
+// source == skybox3Button ||
2626
+// source == skybox4Button ||
2627
+// source == skybox5Button ||
2628
+// source == skybox6Button ||
2629
+// source == skybox7Button ||
2630
+// source == skybox11Button ||
2631
+// source == skybox12Button ||
2632
+// source == skybox13Button ||
2633
+// source == skybox14Button ||
2634
+// source == skybox15Button ||
2635
+// source == skybox16Button ||
2636
+// source == skybox17Button)
2637
+// {
2638
+// ChangeSkybox(source);
2639
+// } else
2640
+ if (source == csgItem)
16132641 {
16142642 group(new CSG());
16152643 } else
1616
- if (event.getSource() == templateItem)
2644
+ if (source == templateItem)
16172645 {
16182646 group(new cTemplate());
16192647 } else
1620
- if (event.getSource() == attributeItem)
2648
+ if (source == attributeItem)
16212649 {
16222650 makeSomething(new Attribute());
16232651 } else
1624
- if (event.getSource() == pointflowItem)
2652
+ if (source == pointflowItem)
16252653 {
16262654 makeSomething(new PointFlow());
16272655 } else
....@@ -1633,7 +2661,7 @@
16332661 } else
16342662 */
16352663
1636
- if (event.getSource() == superLoopItem)
2664
+ if (source == superLoopItem)
16372665 {
16382666 Composite g = new cGroup();
16392667 for (int i=0; i<15; i++)
....@@ -1655,30 +2683,38 @@
16552683
16562684 group(g);
16572685 } else
1658
- if (event.getSource() == loopItem)
2686
+ if (source == loopItem || source == loopButton)
16592687 {
2688
+ if (!group.selection.isEmpty())
2689
+ {
16602690 Composite csg = new GroupLeaf();
16612691 csg.count = 5;
1662
- group(csg);
1663
- Composite child = new cGroup();
2692
+ Composite child = new cGroup("Branch");
16642693 csg.addChild(child);
16652694 child.addChild(csg);
2695
+ group(csg);
2696
+ }
16662697 } else
1667
- if (event.getSource() == doubleItem)
2698
+ if (source == doubleItem)
16682699 {
1669
- Composite csg = new GroupLeaf();
2700
+ if (!group.selection.isEmpty())
2701
+ {
2702
+ Composite csg = new GroupLeaf("Fork");
16702703 csg.count = 5;
2704
+ Composite child = new cGroup("Branch A");
2705
+ csg.addChild(child);
2706
+ child.addChild(csg);
2707
+ child = new cGroup("Branch B");
2708
+ csg.addChild(child);
2709
+ child.addChild(csg);
16712710 group(csg);
1672
- Composite child = new cGroup();
1673
- csg.addChild(child);
1674
- child.addChild(csg);
1675
- child = new cGroup();
1676
- csg.addChild(child);
1677
- child.addChild(csg);
2711
+ }
16782712 } else
1679
- if (event.getSource() == tripleItem)
2713
+ if (source == tripleItem)
16802714 {
1681
- Composite csg = new GroupLeaf();
2715
+ if (!group.selection.isEmpty())
2716
+ {
2717
+ Composite csg = new GroupLeaf("Trident");
16822718 csg.count = 4;
16832719 group(csg);
16842720 Composite child = new cGroup();
....@@ -1690,74 +2726,119 @@
16902726 child = new cGroup();
16912727 csg.addChild(child);
16922728 child.addChild(csg);
2729
+ }
16932730 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2731
+ if (source == computeAOItem)
16962732 {
1697
- ImportGFD();
2733
+ Globals.drawMode = CameraPane.OCCLUSION;
2734
+ cameraView.repaint();
16982735 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1700
- {
1701
- ImportVRMLX3D();
1702
- } else
1703
- if (event.getSource() == import3DSItem)
1704
- {
1705
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1706
- } else
1707
- if (event.getSource() == importOBJItem)
1708
- {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1710
- } else
1711
- if (event.getSource() == computeAOItem)
1712
- {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1715
- } else
1716
- if (event.getSource() == recompileItem)
2736
+ if (source == recompileItem)
17172737 {
17182738 Recompile();
17192739 refreshContents();
17202740 } else
1721
- if (event.getSource() == editScriptItem)
2741
+ if (source == editScriptItem)
17222742 {
17232743 OpenDialog();
17242744 refreshContents();
17252745 } else
1726
- if (event.getSource() == invariantsItem)
2746
+ if (source == invariantsItem)
17272747 {
17282748 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2749
+ Grafreed.grafreed.universe.invariants();
17302750 } else
1731
- if (event.getSource() == memoryItem)
2751
+ if (source == memoryItem)
17322752 {
17332753 //System.out.println("Invariants:");
17342754 PrintMemory();
17352755 } else
1736
- if (event.getSource() == pathItem)
2756
+ if (source == pathItem)
17372757 {
17382758 PrintPath();
17392759 } else
1740
- if (event.getSource() == analyzeItem)
2760
+ if (source == analyzeItem)
17412761 {
17422762 AnalyzeObject();
17432763 } else
1744
- if (event.getSource() == dumpItem)
2764
+ if (source == dumpItem)
17452765 {
17462766 DumpObject();
17472767 } else
1748
- if (event.getSource() == screenfitButton)
2768
+ if (source == minButton)
17492769 {
1750
- //Reload(lastConverter, lastFilename, true);
2770
+ Minimize();
2771
+ } else
2772
+ if (source == maxButton)
2773
+ {
2774
+ Maximize();
2775
+ } else
2776
+ if (source == fullButton)
2777
+ {
2778
+ ToggleFullScreen();
2779
+ } else
2780
+ if (source == collapseButton)
2781
+ {
2782
+ this.expandedLayout = radio.layout;
2783
+ CollapseToolbar();
2784
+ } else
2785
+ if (source == maximize3DButton)
2786
+ {
2787
+ this.expandedLayout = radio.layout;
2788
+ radio.layout = twoButton;
2789
+ Show3DView();
2790
+ CollapseToolbar();
2791
+ } else
2792
+ if (source == previousVersionButton)
2793
+ {
2794
+ // Go to previous version
2795
+ //if (!Undo())
2796
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2797
+ PreviousVersion();
2798
+ } else
2799
+ if (source == restoreButton)
2800
+ {
2801
+ // Restore current version
2802
+ Restore();
2803
+ //restoreButton.setEnabled(false);
2804
+ } else
2805
+ if (source == replaceButton)
2806
+ {
2807
+ // Overwrite current version
2808
+ Replace();
2809
+ //replaceButton.setEnabled(false);
2810
+ } else
2811
+ if (source == nextVersionButton)
2812
+ {
2813
+ // Go to next version
2814
+ NextVersion();
2815
+ } else
2816
+ if (source == saveVersionButton)
2817
+ {
2818
+ // Save a new version
2819
+ if (!Save(true))
2820
+ java.awt.Toolkit.getDefaultToolkit().beep();
2821
+ } else
2822
+ if (source == deleteVersionButton)
2823
+ {
2824
+ // Delete a new version
2825
+ DeleteVersion();
2826
+ } else
2827
+ if (source == oneStepButton)
2828
+ {
2829
+ Globals.ONESTEP = true;
2830
+ cameraView.repaint();
2831
+ } else
2832
+ if (source == screenfitButton)
2833
+ {
17512834 ScreenFit();
17522835 } else
1753
- if (event.getSource() == screenfitpointButton)
2836
+ if (source == screenfitpointButton)
17542837 {
1755
- //Reload(lastConverter, lastFilename, true);
17562838 ScreenFitPoint();
17572839 } else
1758
- if (event.getSource() == snapobjectButton)
2840
+ if (source == snapobjectButton)
17592841 {
1760
- //Reload(lastConverter, lastFilename, true);
17612842 SnapObject();
17622843 } else
17632844 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2847,13 @@
17662847 // Recompile();
17672848 // refreshContents();
17682849 // } else
1769
- if (event.getSource() == gcButton)
2850
+ if (source == gcButton)
17702851 {
17712852 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722853 System.gc();
17732854 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742855 } else
1775
- if (event.getSource() == editLeafItem)
2856
+ if (source == editLeafItem)
17762857 {
17772858 Object3D obj;
17782859 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2867,78 @@
17862867 }
17872868 refreshContents(true);
17882869 } else
1789
- if (event.getSource() == openWindowItem)
2870
+ if (source == openWindowItem)
17902871 {
17912872 EditSelection(true);
17922873 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2874
+ if (source == cutItem || source == clearButton)
17942875 {
17952876 loadClipboard(true);
17962877 } else
1797
- if (event.getSource() == duplicateItem)
2878
+ if (source == undoItem)
17982879 {
1799
- Object3D keep = GraphreeD.clipboard;
2880
+ PreviousVersion();
2881
+ } else
2882
+ if (source == redoItem)
2883
+ {
2884
+ NextVersion();
2885
+ } else
2886
+ if (source == duplicateItem)
2887
+ {
2888
+ Object3D keep = Grafreed.clipboard;
18002889 loadClipboard(false);
18012890 paste(false);
1802
- GraphreeD.clipboard = keep;
2891
+ Grafreed.clipboard = keep;
18032892 } else
1804
- if (event.getSource() == cloneItem)
2893
+ if (source == cloneItem)
18052894 {
18062895 CloneSelection(false);
18072896 } else
1808
- if (event.getSource() == cloneSupportItem)
2897
+ if (source == cloneSupportItem)
18092898 {
18102899 CloneSelection(true);
18112900 } else
1812
- if (event.getSource() == copyItem)
2901
+ if (source == copyItem)
18132902 {
18142903 loadClipboard(false);
18152904 } else
1816
- if (event.getSource() == pasteItem)
2905
+ if (source == pasteItem)
18172906 {
18182907 paste(false);
18192908 } else
1820
- if (event.getSource() == pasteLinkItem)
2909
+ if (source == pasteIntoItem)
18212910 {
1822
- pasteInto(false);
2911
+ pasteInto(true, false);
18232912 } else
1824
- if (event.getSource() == pasteCloneItem)
2913
+ if (source == pasteLinkItem)
18252914 {
1826
- pasteInto(true);
2915
+ pasteInto(false, false);
18272916 } else
1828
- if (event.getSource() == pasteExpandItem)
2917
+ if (source == pasteCloneItem)
2918
+ {
2919
+ pasteInto(true, true);
2920
+ } else
2921
+ if (source == pasteExpandItem)
18292922 {
18302923 paste(true);
18312924 } else
1832
- if (event.getSource() == synchronizeItem)
2925
+ if (source == synchronizeItem)
18332926 {
18342927 Overwrite(Object3D.TRANSFORM);
18352928 } else
1836
- if (event.getSource() == overwriteNameItem)
2929
+ if (source == overwriteNameItem)
18372930 {
18382931 Overwrite(Object3D.NAME);
18392932 } else
1840
- if (event.getSource() == overwriteUVItem)
2933
+ if (source == overwriteUVItem)
18412934 {
18422935 Overwrite(Object3D.UV);
18432936 } else
1844
- if (event.getSource() == overwriteMatItem)
2937
+ if (source == overwriteMatItem)
18452938 {
2939
+ /* july 2015
18462940 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2941
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482942 else
18492943 {
18502944 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2950,16 @@
18562950 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572951 }
18582952 }
2953
+ */
2954
+
2955
+ Overwrite(dropAttributes);
18592956 }
1860
- if (event.getSource() == overwriteGeoItem)
2957
+ if (source == overwriteGeoItem)
18612958 {
18622959 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2960
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642961 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2962
+// Object3D content = GrafreeD.clipboard.get(0);
18662963 //
18672964 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682965 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2971,7 @@
18742971 // refreshContents();
18752972 // }
18762973 } else
1877
- if (event.getSource() == generateMeshItem)
2974
+ if (source == generateMeshItem)
18782975 {
18792976 //if (group.selection.size() == 1)
18802977 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2982,7 @@
18852982 ResetModel();
18862983 refreshContents();
18872984 } else
1888
- if (event.getSource() == extractGeometriesItem)
2985
+ if (source == extractGeometriesItem)
18892986 {
18902987 boolean one = false;
18912988
....@@ -1912,7 +3009,7 @@
19123009 ResetModel();
19133010 refreshContents();
19143011 } else
1915
- if (event.getSource() == cloneGeometriesItem)
3012
+ if (source == cloneGeometriesItem)
19163013 {
19173014 boolean one = false;
19183015
....@@ -1938,32 +3035,37 @@
19383035 ResetModel();
19393036 refreshContents();
19403037 } else
1941
- if (event.getSource() == shareGeometriesItem)
3038
+ if (source == shareGeometriesItem)
19423039 {
19433040 boolean one = false;
19443041
19453042 if (group.selection.size() == 1)
19463043 one = true;
19473044
3045
+ Object3D merge = null;
3046
+
19483047 Object3D content = new cGroup();
19493048
19503049 for (int i=0; i<group.selection.size(); i++)
19513050 {
1952
- Object3D sel = new Merge(group.selection.get(i));
3051
+ merge = new Merge(group.selection.get(i));
19533052
19543053 if (one)
1955
- makeSomething(sel, false);
3054
+ makeSomething(merge, false);
19563055 else
1957
- content.addChild(sel);
3056
+ content.addChild(merge);
19583057 }
19593058
19603059 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
3060
+ makeSomething(content, true);
3061
+ else
3062
+ {
3063
+ ResetModel();
3064
+ Select(merge.GetTreePath(), true, false); // unselect... false);
3065
+ refreshContents();
3066
+ }
19653067 } else
1966
- if (event.getSource() == mergeGeometriesItem)
3068
+ if (source == mergeGeometriesItem)
19673069 {
19683070 boolean one = false;
19693071
....@@ -1993,11 +3095,11 @@
19933095 ResetModel();
19943096 refreshContents();
19953097 } else
1996
- if (event.getSource() == linkverticesItem)
3098
+ if (source == linkverticesItem)
19973099 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3100
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19993101 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
3102
+// Object3D content = GrafreeD.clipboard.get(0);
20013103 //
20023104 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20033105 // content = ((cGroup)content).get(0);
....@@ -2006,39 +3108,48 @@
20063108 // group.selection.get(0).setMasterThis(content); // should be identity
20073109 // refreshContents();
20083110 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3111
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20103112 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
3113
+ Object3D content = Grafreed.clipboard.get(0);
20123114
20133115 if (content instanceof cGroup && ((cGroup)content).transientlink )
20143116 content = ((cGroup)content).get(0);
20153117
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3118
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20173119 for (int i=0; i<group.selection.size(); i++)
20183120 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
3121
+ boolean random = CameraPane.SWITCH;
3122
+ CameraPane.SWITCH = false; // parse all random nodes
20213123 group.selection.get(i).linkVerticesThis(content);
20223124 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
3125
+ CameraPane.SWITCH = random;
20243126 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3127
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20263128 refreshContents();
20273129 }
20283130 } else
2029
- if (event.getSource() == resetsupportItem)
3131
+ if (source == resetsupportItem)
20303132 {
20313133 for (int i=0; i<group.selection.size(); i++)
20323134 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
3135
+ boolean random = CameraPane.SWITCH;
3136
+ CameraPane.SWITCH = false; // parse all random nodes
20353137 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
3138
+ CameraPane.SWITCH = random;
20373139 }
20383140
20393141 refreshContents();
20403142 } else
2041
- if (event.getSource() == resetreferencesItem)
3143
+ if (source == relinkverticesItem)
3144
+ {
3145
+ boolean random = CameraPane.SWITCH;
3146
+ CameraPane.SWITCH = false; // parse all random nodes
3147
+ group.selection.RelinkToSupport();
3148
+ CameraPane.SWITCH = random;
3149
+
3150
+ refreshContents();
3151
+ } else
3152
+ if (source == resetreferencesItem)
20423153 {
20433154 for (int i=0; i<group.selection.size(); i++)
20443155 {
....@@ -2047,11 +3158,11 @@
20473158
20483159 refreshContents();
20493160 } else
2050
- if (event.getSource() == setMasterItem)
3161
+ if (source == setMasterItem)
20513162 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3163
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20533164 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
3165
+ Object3D content = Grafreed.clipboard.get(0);
20553166
20563167 if (content instanceof cGroup && ((cGroup)content).transientlink )
20573168 content = ((cGroup)content).get(0);
....@@ -2060,13 +3171,13 @@
20603171 refreshContents();
20613172 }
20623173 } else
2063
- if (event.getSource() == poseMeshItem)
3174
+ if (source == poseMeshItem)
20643175 {
20653176 if (group.selection.size() == 1)
20663177 {
2067
- if (GraphreeD.clipboard.size() == 1)
3178
+ if (Grafreed.clipboard.size() == 1)
20683179 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
3180
+ Object3D content = Grafreed.clipboard.get(0);
20703181
20713182 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723183 content = ((cGroup)content).get(0);
....@@ -2079,19 +3190,19 @@
20793190 }
20803191
20813192 } else
2082
- if (event.getSource() == revertMeshItem)
3193
+ if (source == revertMeshItem)
20833194 {
20843195 RevertMeshes();
20853196 } else
2086
- if (event.getSource() == resetMeshItem)
3197
+ if (source == resetAllItem)
20873198 {
20883199 ResetAll();
20893200 } else
2090
- if (event.getSource() == stepAllItem)
3201
+ if (source == stepAllItem)
20913202 {
20923203 StepAll();
20933204 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3205
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953206 {
20963207 //int indices[] = jList.getSelectedIndices();
20973208 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3210,46 @@
20993210
21003211 ClearSelection(false);
21013212 } else
2102
- if (event.getSource() == clearAllItem)
3213
+ if (source == clearAllItem)
21033214 {
21043215 ClearSelection(true);
21053216 } else
2106
- if (event.getSource() == grabItem)
3217
+ if (source == grabItem || source == groupButton)
21073218 {
2108
- group(new cGroup(), true);
3219
+ group(new cGroup(), false); // true);
21093220 } else
2110
- if (event.getSource() == frontItem)
3221
+ if (source == hideItem)
3222
+ {
3223
+ group(new HiddenObject());
3224
+ } else
3225
+ if (source == frontItem)
21113226 {
21123227 front();
21133228 } else
2114
- if (event.getSource() == backItem)
3229
+ if (source == backItem)
21153230 {
21163231 back();
21173232 } else
2118
- if (event.getSource() == cameraItem)
3233
+ if (source == cameraItem)
21193234 {
21203235 makeSomething(new Camera());
21213236 } else
2122
- if (event.getSource() == compositeItem)
3237
+ if (source == compositeItem || source == compositeButton)
21233238 {
21243239 group(new Composite());
21253240 } else
2126
- if (event.getSource() == randomItem)
3241
+ if (source == switchItem || source == switchButton)
21273242 {
21283243 RandomNode random = new RandomNode();
21293244 group(random);
21303245 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3246
+ random.name = random.get(0).name + "Switch";
21323247 } else
2133
- if (event.getSource() == physicsItem)
3248
+ if (source == physicsItem)
21343249 {
21353250 group(new PhysicsNode());
21363251 } else
2137
- if (event.getSource() == frameselectorItem)
3252
+ if (source == frameselectorItem)
21383253 {
21393254 for (int i=0; i<group.selection.size(); i++)
21403255 {
....@@ -2146,7 +3261,7 @@
21463261 ResetModel();
21473262 refreshContents();
21483263 } else
2149
- if (event.getSource() == switchGeoItem)
3264
+ if (source == switchGeoItem)
21503265 {
21513266 for (int i=0; i<group.selection.size(); i++)
21523267 {
....@@ -2158,7 +3273,7 @@
21583273 ResetModel();
21593274 refreshContents();
21603275 } else
2161
- if (event.getSource() == switchTransfoItem)
3276
+ if (source == switchTransfoItem)
21623277 {
21633278 for (int i=0; i<group.selection.size(); i++)
21643279 {
....@@ -2170,7 +3285,7 @@
21703285 ResetModel();
21713286 refreshContents();
21723287 } else
2173
- if (event.getSource() == morphItem)
3288
+ if (source == morphItem)
21743289 {
21753290 for (int i=0; i<group.selection.size(); i++)
21763291 {
....@@ -2182,7 +3297,7 @@
21823297 ResetModel();
21833298 refreshContents();
21843299 } else
2185
- if (event.getSource() == scriptNodeItem)
3300
+ if (source == scriptNodeItem)
21863301 {
21873302 boolean atleastone = false;
21883303
....@@ -2221,191 +3336,264 @@
22213336 }
22223337 }
22233338 } else
2224
- if (event.getSource() == linkerItem)
3339
+ if (source == linkerItem)
22253340 {
22263341 group(new cLinker());
22273342 } else
2228
- if (event.getSource() == textureItem)
3343
+ if (source == textureItem || source == textureButton)
22293344 {
22303345 group(new TextureNode());
22313346 } else
2232
- if (event.getSource() == shadowXItem)
3347
+ if (source == billboardItem)
3348
+ {
3349
+ group(new BillboardNode());
3350
+ } else
3351
+ if (source == shadowXItem)
22333352 {
22343353 CastShadow(0);
22353354 } else
2236
- if (event.getSource() == shadowYItem)
3355
+ if (source == shadowYItem)
22373356 {
22383357 CastShadow(1);
22393358 } else
2240
- if (event.getSource() == shadowZItem)
3359
+ if (source == shadowZItem)
22413360 {
22423361 CastShadow(2);
22433362 } else
2244
- if (event.getSource() == ungroupItem)
3363
+ if (source == ungroupItem || source == ungroupButton)
22453364 {
2246
- ungroup();
3365
+ boolean canUngroup = true;
3366
+
3367
+ for (int i=0; i<group.selection.size(); i++)
3368
+ {
3369
+ Object3D selectedItem = group.selection.get(i);
3370
+
3371
+ if (selectedItem.Size() == 0)
3372
+ {
3373
+ // Cannot ungroup leaves
3374
+ canUngroup = false;
3375
+ break;
3376
+ }
3377
+
3378
+ if (selectedItem == group)
3379
+ {
3380
+ // Cannot ungroup root
3381
+ canUngroup = false;
3382
+ break;
3383
+ }
3384
+ }
3385
+
3386
+ if (canUngroup)
3387
+ {
3388
+ for (int i=0; i<group.selection.size(); i++)
3389
+ {
3390
+ Object3D selectedItem = group.selection.get(i);
3391
+
3392
+ Ungroup(selectedItem);
3393
+ }
3394
+
3395
+ ClearSelection(false);
3396
+
3397
+ refreshContents();
3398
+ }
22473399 } else
2248
- if (event.getSource() == genUVItem)
3400
+ if (source == genUVItem)
22493401 {
22503402 GenUV();
22513403 } else
2252
- if (event.getSource() == genNormalsCADItem)
3404
+ if (source == genNormalsCADItem)
22533405 {
22543406 GenNormals(true);
22553407 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3408
+ if (source == genNormalsMESHItem)
3409
+ {
3410
+ GenNormalsMESH();
3411
+ } else
3412
+ if (source == genNormalsORGANItem)
22573413 {
22583414 GenNormals(false);
22593415 } else
2260
- if (event.getSource() == stripifyItem)
3416
+ if (source == genNormalsMINEItem)
3417
+ {
3418
+ GenNormalsMINE();
3419
+ } else
3420
+ if (source == stripifyItem)
22613421 {
22623422 Stripify();
22633423 } else
2264
- if (event.getSource() == unstripifyItem)
3424
+ if (source == unstripifyItem)
22653425 {
22663426 Unstripify();
22673427 } else
2268
- if (event.getSource() == trimItem)
3428
+ if (source == trimItem)
22693429 {
22703430 Trim();
22713431 } else
2272
- if (event.getSource() == untrimItem)
3432
+ if (source == untrimItem)
22733433 {
22743434 Untrim();
22753435 } else
2276
- if (event.getSource() == clearColorsItem)
3436
+ if (source == clearColorsItem)
22773437 {
22783438 ClearColors();
22793439 } else
2280
- if (event.getSource() == clearMaterialsItem)
3440
+ if (source == clearMaterialsItem)
22813441 {
22823442 ClearMaterials();
22833443 } else
2284
- if (event.getSource() == liveleavesItem)
3444
+ if (source == liveleavesItem)
22853445 {
22863446 LiveLeaves(true);
22873447 } else
2288
- if (event.getSource() == unliveleavesItem)
3448
+ if (source == unliveleavesItem)
22893449 {
22903450 LiveLeaves(false);
22913451 } else
2292
- if (event.getSource() == supportleavesItem)
3452
+ if (source == supportleavesItem)
22933453 {
22943454 SupportLeaves(true);
22953455 } else
2296
- if (event.getSource() == unsupportleavesItem)
3456
+ if (source == unsupportleavesItem)
22973457 {
22983458 SupportLeaves(false);
22993459 } else
2300
- if (event.getSource() == hideleavesItem)
3460
+ if (source == hideleavesItem)
23013461 {
23023462 HideLeaves(true);
23033463 } else
2304
- if (event.getSource() == showleavesItem)
3464
+ if (source == showleavesItem)
23053465 {
23063466 HideLeaves(false);
23073467 } else
2308
- if (event.getSource() == markleavesItem)
3468
+ if (source == markleavesItem)
23093469 {
23103470 MarkLeaves(true);
23113471 } else
2312
- if (event.getSource() == unmarkleavesItem)
3472
+ if (source == unmarkleavesItem)
23133473 {
23143474 MarkLeaves(false);
23153475 } else
2316
- if (event.getSource() == flipVItem)
3476
+ if (source == rewindleavesItem)
3477
+ {
3478
+ RewindLeaves(true);
3479
+ } else
3480
+ if (source == unrewindleavesItem)
3481
+ {
3482
+ RewindLeaves(false);
3483
+ } else
3484
+ if (source == randomleavesItem)
3485
+ {
3486
+ RandomLeaves(true);
3487
+ } else
3488
+ if (source == unrandomleavesItem)
3489
+ {
3490
+ RandomLeaves(false);
3491
+ } else
3492
+ if (source == flipVItem)
23173493 {
23183494 FlipV(true);
23193495 } else
2320
- if (event.getSource() == unflipVItem)
3496
+ if (source == unflipVItem)
23213497 {
23223498 FlipV(false);
23233499 } else
2324
- if (event.getSource() == lowTexturesItem)
3500
+ if (source == lowTexturesItem)
23253501 {
23263502 SetTexRes(0);
23273503 } else
2328
- if (event.getSource() == normalTexturesItem)
3504
+ if (source == normalTexturesItem)
23293505 {
23303506 SetTexRes(1);
23313507 } else
2332
- if (event.getSource() == highTexturesItem)
3508
+ if (source == highTexturesItem)
23333509 {
23343510 SetTexRes(2);
23353511 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3512
+ if (source == veryhighTexturesItem)
23373513 {
23383514 SetTexRes(3);
23393515 } else
2340
- if (event.getSource() == maxTexturesItem)
3516
+ if (source == maxTexturesItem)
23413517 {
23423518 SetTexRes(4);
23433519 } else
2344
- if (event.getSource() == panoTexturesItem)
3520
+ if (source == panoTexturesItem)
23453521 {
23463522 SetTexRes(5);
23473523 } else
2348
- if (event.getSource() == reverseNormalsItem)
3524
+ if (source == reverseNormalsItem)
23493525 {
23503526 ReverseNormals();
23513527 } else
2352
- if (event.getSource() == parseverticesItem)
3528
+ if (source == parseverticesItem)
23533529 {
23543530 ParseVertices();
23553531 } else
2356
- if (event.getSource() == alignItem)
3532
+ if (source == textureFieldItem)
3533
+ {
3534
+ TextureVertices();
3535
+ } else
3536
+ if (source == alignItem)
23573537 {
23583538 Align();
23593539 } else
2360
- if (event.getSource() == mirrorItem)
3540
+ if (source == mirrorItem)
23613541 {
23623542 MirrorPoses();
23633543 } else
2364
- if (event.getSource() == reduceMorphItem)
3544
+ if (source == reduceMorphItem)
23653545 {
23663546 MeshReduction(false);
23673547 } else
2368
- if (event.getSource() == reduce34MorphItem)
3548
+ if (source == reduce34MorphItem)
23693549 {
23703550 MeshReduction(true);
23713551 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3552
+ if (source == reverseTrianglesItem)
23733553 {
23743554 ReverseTriangles();
23753555 } else
2376
- if (event.getSource() == reduceMeshItem)
3556
+ if (source == reduceMeshItem)
23773557 {
23783558 ReduceMesh(false);
23793559 } else
2380
- if (event.getSource() == reduce34MeshItem)
3560
+ if (source == reduce34MeshItem)
23813561 {
23823562 ReduceMesh(true);
23833563 } else
2384
- if (event.getSource() == increaseMeshItem)
3564
+ if (source == increaseMeshItem)
23853565 {
23863566 IncreaseMesh();
23873567 } else
2388
- if (event.getSource() == clipMeshItem)
3568
+ if (source == clipMeshItem)
23893569 {
23903570 ClipMesh();
23913571 } else
2392
- if (event.getSource() == smoothMeshItem)
3572
+ if (source == smoothMeshItem)
23933573 {
23943574 SmoothMesh();
23953575 } else
2396
- if (event.getSource() == transformgeometryItem)
3576
+ if (source == transformGeometryItem)
23973577 {
23983578 TransformGeometry();
23993579 } else
2400
- if (event.getSource() == resetTransformItem)
3580
+ if (source == transformChildrenItem)
3581
+ {
3582
+ TransformChildren();
3583
+ } else
3584
+ if (source == resetTransformItem)
24013585 {
24023586 ResetTransform();
24033587 } else
2404
- if (event.getSource() == resetCentroidItem)
3588
+ if (source == resetCentroidItem)
24053589 {
2406
- ResetCentroid();
3590
+ ResetCentroid(true);
24073591 } else
2408
- if (event.getSource() == resetParentItem)
3592
+ if (source == resetCentroidXZItem)
3593
+ {
3594
+ ResetCentroid(false);
3595
+ } else
3596
+ if (source == resetParentItem)
24093597 {
24103598 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113599 {
....@@ -2415,7 +3603,7 @@
24153603
24163604 refreshContents();
24173605 } else
2418
- if (event.getSource() == repairParentItem)
3606
+ if (source == repairParentItem)
24193607 {
24203608 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213609 {
....@@ -2429,7 +3617,21 @@
24293617
24303618 refreshContents();
24313619 } else
2432
- if (event.getSource() == sortbysizeItem)
3620
+ if (source == repairShadowItem)
3621
+ {
3622
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3623
+ {
3624
+ Object3D obj = (Object3D)e.nextElement();
3625
+ obj.RepairShadow();
3626
+// for (int i=0; i<obj.size(); i++)
3627
+// {
3628
+// obj.get(i).parent = obj;
3629
+// }
3630
+ }
3631
+
3632
+ refreshContents();
3633
+ } else
3634
+ if (source == sortbysizeItem)
24333635 {
24343636 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353637 {
....@@ -2441,7 +3643,7 @@
24413643 ResetModel();
24423644 refreshContents();
24433645 } else
2444
- if (event.getSource() == sortbynameItem)
3646
+ if (source == sortbynameItem)
24453647 {
24463648 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473649 {
....@@ -2453,7 +3655,7 @@
24533655 ResetModel();
24543656 refreshContents();
24553657 } else
2456
- if (event.getSource() == attachPigmentItem)
3658
+ if (source == attachPigmentItem)
24573659 {
24583660 String texture = GetFile("Attach pigment");
24593661 Object3D obj;
....@@ -2465,7 +3667,7 @@
24653667
24663668 refreshContents();
24673669 } else
2468
- if (event.getSource() == detachPigmentItem)
3670
+ if (source == detachPigmentItem)
24693671 {
24703672 Object3D obj;
24713673 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3678,7 @@
24763678
24773679 refreshContents();
24783680 } else
2479
- if (event.getSource() == attachBumpItem)
3681
+ if (source == attachBumpItem)
24803682 {
24813683 String texture = GetFile("Attach bump");
24823684 Object3D obj;
....@@ -2488,18 +3690,18 @@
24883690
24893691 refreshContents();
24903692 } else
2491
- if (event.getSource() == detachBumpItem)
3693
+ if (source == detachBumpItem)
24923694 {
24933695 Object3D obj;
24943696 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953697 {
24963698 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3699
+ obj.ResetBumpTexture();
24983700 }
24993701
25003702 refreshContents();
25013703 } else
2502
- if (event.getSource() == pigmentBumpItem)
3704
+ if (source == pigmentBumpItem)
25033705 {
25043706 Object3D obj;
25053707 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,159 +3712,233 @@
25103712
25113713 refreshContents();
25123714 } else
2513
- if (event.getSource() == flashSelectionButton)
3715
+ if (source == embedTexturesItem)
3716
+ {
3717
+ Object3D obj;
3718
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3719
+ {
3720
+ obj = (Object3D)e.nextElement();
3721
+ obj.EmbedTextures(true);
3722
+ }
3723
+
3724
+ refreshContents();
3725
+ } else
3726
+ if (source == deEmbedTexturesItem)
3727
+ {
3728
+ Object3D obj;
3729
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3730
+ {
3731
+ obj = (Object3D)e.nextElement();
3732
+ obj.EmbedTextures(false);
3733
+ }
3734
+
3735
+ CameraPane.texturepigment.clear();
3736
+ CameraPane.texturebump.clear();
3737
+
3738
+ refreshContents();
3739
+ } else
3740
+ if (source == flashSelectionButton)
25143741 {
25153742 CameraPane.flash = true;
25163743 refreshContents();
25173744 } else
2518
- if (event.getSource() == oneButton)
3745
+ if (source == oneButton)
25193746 {
25203747 } else
2521
- if (event.getSource() == twoButton)
3748
+ if (source == twoButton)
25223749 {
25233750 radio.layout = twoButton;
2524
- // bug
2525
- //gridPanel.setDividerLocation(1.0);
2526
- //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2529
- bigThree.remove(XYZPanel);
2530
- aWindowConstraints.gridx = 0;
2531
- aWindowConstraints.gridy = 0;
2532
- aWindowConstraints.gridwidth = 1;
2533
- // aConstraints.gridheight = 3;
2534
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2535
- aWindowConstraints.weightx = 0;
2536
- aWindowConstraints.weighty = 1;
2537
- //bigThree.add(jtp, aWindowConstraints);
2538
- aWindowConstraints.weightx = 1;
2539
- aWindowConstraints.gridwidth = 3;
2540
- // aConstraints.gridheight = 3;
2541
- aWindowConstraints.gridx = 1;
2542
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2544
- aWindowConstraints.weightx = 0;
2545
- aWindowConstraints.gridx = 4;
2546
- aWindowConstraints.gridwidth = 1;
2547
- // aConstraints.gridheight = 3;
2548
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2549
- //bigThree.add(XYZPanel, aWindowConstraints);
2550
- bigThree.revalidate();
3751
+
3752
+ if (CameraPane.FULLSCREEN)
3753
+ fullscreenLayout = radio.layout;
3754
+
3755
+ Show3DView();
3756
+
3757
+ cameraView.requestFocusInWindow();
3758
+
3759
+// refreshContents(true);
3760
+//
3761
+// try
3762
+// {
3763
+// java.awt.Robot bot = new java.awt.Robot();
3764
+// int mask = InputEvent.BUTTON1_MASK;
3765
+// bot.mouseMove(100, 100);
3766
+// bot.mousePress(mask);
3767
+// bot.mouseRelease(mask);
3768
+// }
3769
+// catch (Exception e)
3770
+// {
3771
+//
3772
+// }
3773
+
25513774 } else
2552
- if (event.getSource() == threeButton)
3775
+ if (source == threeButton)
25533776 {
25543777 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2557
- bigThree.remove(XYZPanel);
2558
- aWindowConstraints.gridx = 0;
2559
- aWindowConstraints.gridy = 0;
2560
- aWindowConstraints.gridwidth = 1;
2561
- // aConstraints.gridheight = 3;
2562
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2563
- aWindowConstraints.weightx = 0;
2564
- aWindowConstraints.weighty = 1;
2565
- //bigThree.add(jtp, aWindowConstraints);
2566
- aWindowConstraints.weightx = 1;
2567
- aWindowConstraints.gridwidth = 3;
2568
- // aConstraints.gridheight = 3;
2569
- aWindowConstraints.gridx = 1;
2570
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2572
- aWindowConstraints.weightx = 0;
2573
- aWindowConstraints.gridx = 4;
2574
- aWindowConstraints.gridwidth = 1;
2575
- // aConstraints.gridheight = 3;
2576
- aConstraints.fill = GridBagConstraints.VERTICAL;
2577
- bigThree.add(XYZPanel, aWindowConstraints);
2578
- bigThree.revalidate();
3778
+
3779
+ if (CameraPane.FULLSCREEN)
3780
+ fullscreenLayout = radio.layout;
3781
+
3782
+// bigThree.remove(scenePanel);
3783
+// bigThree.remove(centralPanel);
3784
+// bigThree.remove(XYZPanel);
3785
+// aWindowConstraints.gridx = 0;
3786
+// aWindowConstraints.gridy = 0;
3787
+// aWindowConstraints.gridwidth = 1;
3788
+// // aConstraints.gridheight = 3;
3789
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3790
+// aWindowConstraints.weightx = 0;
3791
+// aWindowConstraints.weighty = 1;
3792
+// //bigThree.add(jtp, aWindowConstraints);
3793
+// aWindowConstraints.weightx = 1;
3794
+// aWindowConstraints.gridwidth = 3;
3795
+// // aConstraints.gridheight = 3;
3796
+// aWindowConstraints.gridx = 1;
3797
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3798
+// bigThree.add(centralPanel, aWindowConstraints);
3799
+// aWindowConstraints.weightx = 0;
3800
+// aWindowConstraints.gridx = 4;
3801
+// aWindowConstraints.gridwidth = 1;
3802
+// // aConstraints.gridheight = 3;
3803
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3804
+// bigThree.add(XYZPanel, aWindowConstraints);
3805
+// bigThree.validate();
3806
+// scenePanel.setVisible(false);
3807
+// centralPanel.setVisible(true);
3808
+// XYZPanel.setVisible(true);
3809
+ bigThree.ClearUI();
3810
+ bigThree.add(scenePanel);
3811
+ bigThree.add(centralPanel);
3812
+ bigThree.FlushUI();
3813
+
3814
+ cameraView.requestFocusInWindow();
25793815 } else
2580
- if (event.getSource() == fourButton)
3816
+ if (source == fourButton)
25813817 {
25823818 radio.layout = fourButton;
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aWindowConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2591
- aWindowConstraints.weightx = 1;
2592
- aWindowConstraints.weighty = 1;
2593
- bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- //bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aWindowConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
3819
+
3820
+ if (CameraPane.FULLSCREEN)
3821
+ fullscreenLayout = radio.layout;
3822
+
3823
+// bigThree.remove(scenePanel);
3824
+// bigThree.remove(centralPanel);
3825
+// bigThree.remove(XYZPanel);
3826
+// aWindowConstraints.gridx = 0;
3827
+// aWindowConstraints.gridy = 0;
3828
+// aWindowConstraints.gridwidth = 1;
3829
+// // aWindowConstraints.gridheight = 3;
3830
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3831
+// aWindowConstraints.weightx = 1;
3832
+// aWindowConstraints.weighty = 1;
3833
+// bigThree.add(scenePanel, aWindowConstraints);
3834
+// aWindowConstraints.weightx = 1;
3835
+// aWindowConstraints.gridwidth = 3;
3836
+// // aConstraints.gridheight = 3;
3837
+// aWindowConstraints.gridx = 1;
3838
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3839
+// //bigThree.add(cameraPanel, aWindowConstraints);
3840
+// aWindowConstraints.weightx = 0;
3841
+// aWindowConstraints.gridx = 4;
3842
+// aWindowConstraints.gridwidth = 1;
3843
+// // aWindowConstraints.gridheight = 3;
3844
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3845
+// //bigThree.add(XYZPanel, aWindowConstraints);
3846
+// bigThree.validate();
3847
+// scenePanel.setVisible(true);
3848
+// centralPanel.setVisible(false);
3849
+// XYZPanel.setVisible(false);
3850
+ bigThree.ClearUI();
3851
+ bigThree.add(scenePanel);
3852
+ bigThree.FlushUI();
3853
+
3854
+ cameraView.requestFocusInWindow();
26073855 } else
2608
- if (event.getSource() == sixButton)
3856
+ if (source == sixButton)
26093857 {
26103858 radio.layout = sixButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aWindowConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aWindowConstraints.gridheight = 3;
2632
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2633
- //bigThree.add(XYZPanel, aConstraints);
2634
- bigThree.revalidate();
3859
+
3860
+ if (CameraPane.FULLSCREEN)
3861
+ fullscreenLayout = radio.layout;
3862
+
3863
+// bigThree.remove(scenePanel);
3864
+// bigThree.remove(centralPanel);
3865
+// bigThree.remove(XYZPanel);
3866
+// aWindowConstraints.gridx = 0;
3867
+// aWindowConstraints.gridy = 0;
3868
+// aWindowConstraints.gridwidth = 1;
3869
+// // aConstraints.gridheight = 3;
3870
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3871
+// aWindowConstraints.weightx = 0;
3872
+// aWindowConstraints.weighty = 1;
3873
+// bigThree.add(scenePanel, aWindowConstraints);
3874
+// aWindowConstraints.weightx = 1;
3875
+// aWindowConstraints.gridwidth = 3;
3876
+// // aWindowConstraints.gridheight = 3;
3877
+// aWindowConstraints.gridx = 1;
3878
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3879
+// bigThree.add(centralPanel, aWindowConstraints);
3880
+// aWindowConstraints.weightx = 0;
3881
+// aWindowConstraints.gridx = 4;
3882
+// aWindowConstraints.gridwidth = 1;
3883
+// // aWindowConstraints.gridheight = 3;
3884
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3885
+// //bigThree.add(XYZPanel, aConstraints);
3886
+// bigThree.validate();
3887
+// scenePanel.setVisible(true);
3888
+// centralPanel.setVisible(true);
3889
+// XYZPanel.setVisible(false);
3890
+ bigThree.ClearUI();
3891
+ bigThree.add(centralPanel);
3892
+ bigThree.add(scenePanel);
3893
+ bigThree.FlushUI();
3894
+
3895
+ cameraView.requestFocusInWindow();
26353896 } else
2636
- if (event.getSource() == sevenButton)
3897
+ if (source == sevenButton)
26373898 {
26383899 radio.layout = sevenButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2647
- aWindowConstraints.weightx = 0;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aWindowConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
3900
+
3901
+ if (CameraPane.FULLSCREEN)
3902
+ fullscreenLayout = radio.layout;
3903
+
3904
+// bigThree.remove(scenePanel);
3905
+// bigThree.remove(centralPanel);
3906
+// bigThree.remove(XYZPanel);
3907
+// aWindowConstraints.gridx = 0;
3908
+// aWindowConstraints.gridy = 0;
3909
+// aWindowConstraints.gridwidth = 1;
3910
+// // aWindowConstraints.gridheight = 3;
3911
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3912
+// aWindowConstraints.weightx = 0;
3913
+// aWindowConstraints.weighty = 1;
3914
+// bigThree.add(scenePanel, aWindowConstraints);
3915
+// aWindowConstraints.weightx = 1;
3916
+// aWindowConstraints.gridwidth = 3;
3917
+// // aWindowConstraints.gridheight = 3;
3918
+// aWindowConstraints.gridx = 1;
3919
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3920
+// bigThree.add(centralPanel, aWindowConstraints);
3921
+// aWindowConstraints.weightx = 0;
3922
+// aWindowConstraints.gridx = 4;
3923
+// aWindowConstraints.gridwidth = 1;
3924
+// // aConstraints.gridheight = 3;
3925
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3926
+// bigThree.add(XYZPanel, aWindowConstraints);
3927
+// bigThree.validate();
3928
+// scenePanel.setVisible(true);
3929
+// centralPanel.setVisible(true);
3930
+// XYZPanel.setVisible(true);
3931
+ bigThree.ClearUI();
3932
+ bigThree.add(scenePanel);
3933
+ bigThree.add(centralPanel);
3934
+ bigThree.add(XYZPanel);
3935
+ bigThree.FlushUI();
3936
+
3937
+ cameraView.requestFocusInWindow();
26633938 } else
2664
- if (event.getSource() == rootButton)
3939
+ if (source == rootButton)
26653940 {
3941
+ Replace();
26663942 Object3D obj;
26673943 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26683944 {
....@@ -2671,66 +3947,85 @@
26713947 EditObject(obj);
26723948 }
26733949
3950
+ cameraView.requestFocusInWindow();
26743951 refreshContents(true);
26753952 } else
2676
- if (event.getSource() == closeButton)
3953
+ if (source == closeButton)
26773954 {
26783955 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793956 cRadio ab;
26803957 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813958 {
26823959 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3960
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843961 {
3962
+ // Patch to avoid bug with transparency.
3963
+ if (!ab.hadMaterial)
3964
+ {
3965
+ ab.object.material = null;
3966
+ }
3967
+
26853968 buttonGroup.remove(ab);
26863969 radioPanel.remove(ab);
26873970
2688
- ab.GetObject().editWindow = null;
3971
+ //ab.GetObject().editWindow = null;
3972
+ ab.GetObject().manipWindow = null;
26893973 // ab.GetObject().objectUI = null; // ?????????
26903974
26913975 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923976 break;
26933977 }
26943978 }
3979
+
3980
+ cameraView.requestFocusInWindow();
26953981 refreshContents(true);
26963982 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3983
+ if (source == editItem || source == editButton)
26983984 {
3985
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3986
+ {
3987
+ Object3D child = (Object3D)e.nextElement();
3988
+ child.pinned = true;
3989
+ }
3990
+
26993991 EditSelection(false);
27003992 } else
2701
- if (event.getSource() == uneditButton)
3993
+ if (source == uneditButton)
27023994 {
27033995 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043996 {
27053997 Object3D child = (Object3D)e.nextElement();
27063998 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3999
+ child.pinned = false;
27084000 child.CloseUI();
27094001 listUI.remove(child);
4002
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27104003
2711
- child.editWindow = null; // ???????????
4004
+ //child.editWindow = null; // ???????????
27124005 }
2713
- objEditor.ctrlPanel.revalidate();
4006
+ objEditor.ctrlPanel.FlushUI();
27144007 //objEditor.jTree.clearSelection();
27154008 //objEditor.ResetSliders();
27164009 refreshContents(true);
27174010 } else
2718
- if (event.getSource() == clearPanelButton)
4011
+ if (source == clearPanelButton)
27194012 {
27204013 assert(copy == group);
27214014 //copy.ClearUI();
27224015 for (Object3D obj : listUI)
27234016 {
4017
+ obj.pinned = false;
27244018 obj.CloseUI();
27254019 }
27264020 listUI.clear();
4021
+ SetPinStates(group.selection.size() > 0);
27274022 refreshContents(true);
27284023 } else
2729
- if (event.getSource() == allParamsButton)
4024
+ if (source == allParamsButton)
27304025 {
27314026 assert(copy == group);
27324027
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4028
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27344029
27354030 for (Object3D obj : listUI)
27364031 {
....@@ -2747,19 +4042,19 @@
27474042
27484043 refreshContents(true);
27494044 } else
2750
- if (event.getSource() == unselectButton)
4045
+ if (source == unselectButton)
27514046 {
27524047 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
4048
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27544049 objEditor.ResetSliders();
27554050 refreshContents(true);
27564051 } else
2757
- if(event.getSource() instanceof cRadio)
4052
+ if(source instanceof cRadio)
27584053 {
27594054 group.parent = keepparent;
27604055 group.attributes = 0;
27614056 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
4057
+ /*cRadio*/ radio = (cRadio)source;
27634058 Object3D obj = radio.GetObject();
27644059 System.out.println("Edit " + obj);
27654060 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +4074,8 @@
27794074 }
27804075
27814076 copy = group;
2782
- //CameraPane.theRenderer.object = group;
4077
+
4078
+ //Globals.theRenderer.object = group;
27834079 if(!useclient)
27844080 {
27854081 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +4084,67 @@
27884084 cameraView.cameras[cameraView.cameracount] = radio.camera;
27894085 cameraView.targetLookAt.set(radio.camera.lookAt);
27904086 cameraView.object = group;
2791
- cameraView.lighttouched = true;
4087
+ //cameraView.lighttouched = true;
4088
+ Globals.lighttouched = true;
27924089 topView.object = group;
27934090 frontView.object = group;
27944091 sideView.object = group;
27954092 }
2796
- group.editWindow = this;
4093
+
4094
+// fix "+" issue
4095
+ //group.editWindow = this;
4096
+ group.manipWindow = this;
4097
+
27974098 /*
27984099 currentLayout = radio.layout;
27994100 if (currentLayout == null)
28004101 currentLayout = sevenButton;
28014102 */
28024103 radio.layout.doClick();
4104
+
4105
+ assert(copy instanceof Composite);
4106
+
4107
+ if (copy.versionlist == null)
4108
+ {
4109
+ copy.versionlist = new Object3D[100];
4110
+ copy.versionindex = -1;
4111
+
4112
+ Save(true);
4113
+ }
4114
+
4115
+ SetVersionStates();
4116
+
4117
+ ClearUnpinned();
4118
+
4119
+ //Grafreed.Assert(group != null);
4120
+ //Grafreed.Assert(group.selection != null);
4121
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4122
+ if (group.selection == null || group.selection.size() == 1)
4123
+ EditSelection(false);
28034124 keepparent = group.parent;
28044125 // PARENT = NULL or not???
28054126 //group.parent = null; // ROOT
28064127 //group.attributes = -1;
28074128 ResetModel();
4129
+
4130
+ cameraView.requestFocusInWindow();
28084131 refreshContents(true);
2809
- }
4132
+ } else if (event.getSource() == editCameraItem)
4133
+ {
4134
+ cameraView.ProtectCamera();
4135
+ cameraView.requestFocusInWindow();
4136
+ cameraView.repaint();
4137
+ return;
4138
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4139
+ {
4140
+ cameraView.RevertCamera();
4141
+ cameraView.requestFocusInWindow();
4142
+ cameraView.repaint();
4143
+ return;
4144
+ // } else if (event.getSource() == textureButton)
4145
+ // {
4146
+ // return; // true;
4147
+ }
28104148 else
28114149 {
28124150 //return super.action(event, arg);
....@@ -2815,7 +4153,6 @@
28154153 }
28164154
28174155 boolean useclient = false;
2818
- cRadio radio;
28194156
28204157 void ToggleRoot()
28214158 {
....@@ -2824,7 +4161,7 @@
28244161 if (useclient)
28254162 {
28264163 cameraView.object = client;
2827
- cameraView.lighttouched = true;
4164
+ Globals.lighttouched = true;
28284165 //topView.object = client;
28294166 //frontView.object = client;
28304167 //sideView.object = client;
....@@ -2832,7 +4169,7 @@
28324169 else
28334170 {
28344171 cameraView.object = group;
2835
- cameraView.lighttouched = true;
4172
+ Globals.lighttouched = true;
28364173 //topView.object = group;
28374174 //frontView.object = group;
28384175 //sideView.object = group;
....@@ -2867,6 +4204,28 @@
28674204 refreshContents();
28684205 }
28694206
4207
+ void TransformChildren()
4208
+ {
4209
+ Object3D obj;
4210
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4211
+ {
4212
+ obj = (Object3D)e.nextElement();
4213
+ obj.KeepTextureMatrices();
4214
+ obj.TransformChildren();
4215
+ obj.RestoreTextureMatrices();
4216
+
4217
+// if (obj.parent == null)
4218
+// {
4219
+// System.out.println("NULL PARENT!");
4220
+// new Exception().printStackTrace();
4221
+// }
4222
+// else
4223
+// TouchTransform(obj);
4224
+// //obj.parent.Touch();
4225
+ }
4226
+
4227
+ refreshContents();
4228
+ }
28704229
28714230 void ResetTransform()
28724231 {
....@@ -2979,7 +4338,7 @@
29794338 refreshContents();
29804339 }
29814340
2982
- void ResetCentroid()
4341
+ void ResetCentroid(boolean full)
29834342 {
29844343 Object3D obj;
29854344 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4353,16 @@
29944353 LA.matIdentity(Object3D.mat);
29954354 obj.getBounds(minima, maxima, false);
29964355 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4356
+ if (full)
4357
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984358 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994359 obj.TransformMesh(Object3D.mat);
4360
+
30004361 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4362
+ if (full)
4363
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024364 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4365
+
30034366 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044367 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054368 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4391,8 @@
30284391
30294392 int size = obj.MemorySize();
30304393
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4394
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4395
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324396 }
30334397 }
30344398 catch (Exception e)
....@@ -3065,9 +4429,9 @@
30654429 obj = (Object3D)e.nextElement();
30664430
30674431 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4432
+ Grafreed.AnalyzeObject(obj);
30694433 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4434
+ Grafreed.AnalyzeObject(obj.bRep);
30714435
30724436 // System.err.println((size/1024) + " KB is the size of " + obj);
30734437 }
....@@ -3109,6 +4473,20 @@
31094473 void GenNormals(boolean crease)
31104474 {
31114475 group.GenNormalsS(crease);
4476
+
4477
+ refreshContents();
4478
+ }
4479
+
4480
+ void GenNormalsMESH()
4481
+ {
4482
+ group.GenNormalsMeshS();
4483
+
4484
+ refreshContents();
4485
+ }
4486
+
4487
+ void GenNormalsMINE()
4488
+ {
4489
+ group.selection.GenNormalsMINE();
31124490
31134491 refreshContents();
31144492 }
....@@ -3157,104 +4535,259 @@
31574535
31584536 //Object3D buffer;
31594537 cVector temp = new cVector();
3160
- BoundaryRep temprep;
3161
- Object3D nodes;
3162
- Vector<Vertex> vertices;
3163
-
3164
- public void Vertex(Object3D node, Vertex v)
3165
- {
3166
- vertices.add(v);
3167
- nodes.addElement(node);
3168
-
3169
- if (temprep.GetCache(v) != null)
3170
- {
3171
- temprep.Remove(v);
3172
- }
3173
- else
3174
- {
3175
- temprep.Remember(v);
3176
- }
3177
- }
3178
-
3179
- public void Face(Object3D node, Face f)
3180
- {
3181
-
3182
- }
3183
-
4538
+// BoundaryRep temprep;
4539
+// Object3D nodes;
4540
+// Vector<Vertex> vertices;
4541
+//
4542
+// cGroup buffer;
4543
+//
4544
+// public void Vertex(Object3D node, Vertex v)
4545
+// {
4546
+//// vertices.add(v);
4547
+//// nodes.addElement(node);
4548
+////
4549
+//// if (temprep.GetCache(v) != null)
4550
+//// {
4551
+//// temprep.Remove(v);
4552
+//// } else
4553
+//// {
4554
+//// temprep.Remember(v);
4555
+//// }
4556
+//
4557
+// //Object3D node = nodes.get(index);
4558
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4559
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4560
+//
4561
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4562
+//
4563
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4564
+//
4565
+// cGroup g = new cGroup();
4566
+//
4567
+// if (g.toParent == null)
4568
+// {
4569
+// g.toParent = LA.newMatrix();
4570
+// g.fromParent = LA.newMatrix();
4571
+// }
4572
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4573
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4574
+//
4575
+// g.add(GrafreeD.clipboard);
4576
+//
4577
+// buffer.add(g);
4578
+// }
4579
+//
4580
+// public void Face(Object3D node, Face f)
4581
+// {
4582
+//
4583
+// }
4584
+//
4585
+// void ParseVerticesOld() // ??
4586
+// {
4587
+// //if (group.selection.size() != 1)
4588
+// // return;
4589
+//
4590
+// temprep = new BoundaryRep();
4591
+// nodes = new Object3D();
4592
+// vertices = new Vector<Vertex>();
4593
+//
4594
+// boolean epsequal = GrafreeD.epsequal;
4595
+// GrafreeD.epsequal = true;
4596
+//
4597
+// for (int i=0; i<group.selection.size(); i++)
4598
+// {
4599
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4600
+//
4601
+// group.selection.get(i).Parse(
4602
+//this );
4603
+//
4604
+// int repsize = temprep.VertexCount();
4605
+// int tablesize = temprep.vertextable.size();
4606
+// int nodesize = nodes.size();
4607
+//
4608
+// assert(vertices.size() == nodes.size());
4609
+//
4610
+// temprep.vertextable.elements();
4611
+//
4612
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4613
+//
4614
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4615
+// {
4616
+// cGroup g = new cGroup();
4617
+//
4618
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4619
+//
4620
+// Object3D node = nodes.get(index);
4621
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4622
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4623
+//
4624
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4625
+//
4626
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4627
+//
4628
+// if (g.toParent == null)
4629
+// {
4630
+// g.toParent = LA.newMatrix();
4631
+// g.fromParent = LA.newMatrix();
4632
+// }
4633
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4634
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4635
+//
4636
+// g.add(GrafreeD.clipboard);
4637
+//
4638
+// buffer.add(g);
4639
+// }
4640
+//
4641
+// makeSomething(buffer, i==group.selection.size()-1);
4642
+// }
4643
+//
4644
+// GrafreeD.epsequal = epsequal;
4645
+//
4646
+// //buffer = null;
4647
+// temprep = null;
4648
+// nodes = null;
4649
+//
4650
+// refreshContents();
4651
+// }
4652
+
31844653 void ParseVertices()
31854654 {
3186
- //if (group.selection.size() != 1)
3187
- // return;
3188
-
3189
- temprep = new BoundaryRep();
3190
- nodes = new Object3D();
3191
- vertices = new Vector<Vertex>();
3192
-
3193
- boolean epsequal = GraphreeD.epsequal;
3194
- GraphreeD.epsequal = true;
4655
+ boolean epsequal = Grafreed.epsequal;
4656
+ Grafreed.epsequal = true;
31954657
31964658 for (int i=0; i<group.selection.size(); i++)
31974659 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4660
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994661
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4662
+ group.selection.get(i).Parse(
4663
+
4664
+ new iParse()
4665
+ {
4666
+ public void Vertex(Object3D node, Vertex v)
4667
+ {
4668
+ temp.set(v);
4669
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054670
3206
- assert(vertices.size() == nodes.size());
3207
-
3208
- temprep.vertextable.elements();
3209
-
3210
- java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4671
+ cGroup g = new cGroup();
32114672
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4673
+ if (g.toParent == null)
4674
+ {
4675
+ g.toParent = LA.newMatrix();
4676
+ g.fromParent = LA.newMatrix();
4677
+ }
4678
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4679
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154680
3216
- int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3217
- Object3D node = nodes.get(index);
3218
- temp.set(vertices.get(index)); // temprep.GetVertex(k));
3219
- // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4681
+ g.add(Grafreed.clipboard);
32204682
3221
- LA.xformPos(temp, node.GlobalTransformInv(), temp);
3222
-
3223
- // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3224
-
3225
- if (g.toParent == null)
3226
- {
3227
- g.toParent = LA.newMatrix();
3228
- g.fromParent = LA.newMatrix();
3229
- }
3230
- LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3231
- LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4683
+ buffer.add(g);
4684
+ }
32324685
3233
- g.add(GraphreeD.clipboard);
4686
+ public void Face(Object3D node, Face f)
4687
+ {
32344688
3235
- buffer.add(g);
3236
- }
4689
+ }
4690
+ }
4691
+ );
32374692
32384693 makeSomething(buffer, i==group.selection.size()-1);
32394694 }
32404695
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4696
+ Grafreed.epsequal = epsequal;
32464697
32474698 refreshContents();
32484699 }
3249
-
4700
+
4701
+ void TextureVertices()
4702
+ {
4703
+ for (int i=0; i<group.selection.size(); i++)
4704
+ {
4705
+ group.selection.get(i).Parse(
4706
+ new iParse()
4707
+ {
4708
+ public void Vertex(Object3D node, Vertex v)
4709
+ {
4710
+ cTexture tex = node.GetTextures();
4711
+ String pigment = Object3D.GetPigment(tex);
4712
+ //String bump = Object3D.GetBump(tex);
4713
+
4714
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4715
+
4716
+ try
4717
+ {
4718
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4719
+ }
4720
+ catch (Exception e)
4721
+ {
4722
+ System.err.println("FAIL: " + node);
4723
+ }
4724
+
4725
+ double s = v.s;
4726
+
4727
+ if (s == 1)
4728
+ s = 0;
4729
+
4730
+ double t = v.t;
4731
+
4732
+ if (t == 1)
4733
+ t = 0;
4734
+
4735
+ int indexs = (int) (texturedata.getWidth() * s);
4736
+ int indext = (int) (texturedata.getHeight() * t);
4737
+
4738
+ int index = indext * texturedata.getWidth() + indexs;
4739
+
4740
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4741
+
4742
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4743
+
4744
+ float scale = bytebuf.get(index*slide) & 0xFF;
4745
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4746
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4747
+ scale /= 3;
4748
+
4749
+ scale /= 0xFF;
4750
+ // c'est quoi ca? scale /= 4;
4751
+
4752
+ //v.AO = scale;
4753
+
4754
+ v.x += v.norm.x * scale;
4755
+ v.y += v.norm.y * scale;
4756
+ v.z += v.norm.z * scale;
4757
+ }
4758
+
4759
+ public void Face(Object3D node, Face f)
4760
+ {
4761
+ }
4762
+ }
4763
+ );
4764
+ }
4765
+
4766
+ refreshContents();
4767
+ }
4768
+
32504769 void Align()
32514770 {
4771
+ if (group.selection.size() == 0)
4772
+ return;
4773
+
4774
+ cVector bbmin = new cVector();
4775
+ cVector bbmax = new cVector();
4776
+
4777
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4778
+
4779
+ double dx = bbmax.x - bbmin.x;
4780
+ double dy = bbmax.y - bbmin.y;
4781
+ double dz = bbmax.z - bbmin.z;
4782
+
4783
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4784
+
32524785 for (int i=0; i<group.selection.size(); i++)
32534786 {
32544787 Object3D obj = group.selection.get(i);
32554788
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4789
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4790
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584791 }
32594792
32604793 refreshContents();
....@@ -3267,7 +4800,7 @@
32674800 // ref.SaveSupports();
32684801 // Object3D par = ref.parent;
32694802 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4803
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714804 // ref.parent = par;
32724805 // ref.RestoreSupports();
32734806
....@@ -3275,11 +4808,11 @@
32754808
32764809 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774810
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4811
+ boolean random = CameraPane.SWITCH;
4812
+ CameraPane.SWITCH = false; // parse all random nodes
32804813 lowres.linkVerticesThis(null);
32814814 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4815
+ CameraPane.SWITCH = random;
32834816
32844817 System.err.flush();
32854818
....@@ -3297,7 +4830,7 @@
32974830 // lowres.SaveSupports();
32984831 // par = lowres.parent;
32994832 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4833
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014834 Object3D newlow = CloneObject(lowres, false);
33024835 newlow.name = sn.switchobject.get(i).name;
33034836 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4852,7 @@
33194852 return;
33204853
33214854 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4855
+ Object3D ref = Grafreed.clipboard.get(0);
33234856
33244857 Object3D newgroup = new Object3D("Po:" + poses.name);
33254858
....@@ -3488,7 +5021,7 @@
34885021 group.selection.RelinkToSupport(); // july 2014
34895022 System.out.println("DONE.");
34905023 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
5024
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34925025 }
34935026
34945027 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +5046,20 @@
35135046
35145047 void ClipMesh()
35155048 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
5049
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35175050 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
5051
+ Object3D content = Grafreed.clipboard.get(0);
35195052
35205053 if (content instanceof cGroup && ((cGroup)content).transientlink )
35215054 content = ((cGroup)content).get(0);
35225055
35235056 // for (int i=0; i<group.selection.size(); i++)
35245057 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
5058
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35265059 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
5060
+ group.selection.ClipMesh(Grafreed.clipboard);
35285061 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
5062
+// group.selection.ClipMesh(GrafreeD.clipboard);
35305063 System.out.println("DONE.");
35315064 refreshContents();
35325065 }
....@@ -3571,6 +5104,18 @@
35715104 void MarkLeaves(boolean hide)
35725105 {
35735106 group.selection.MarkLeaves(hide);
5107
+ refreshContents();
5108
+ }
5109
+
5110
+ void RewindLeaves(boolean hide)
5111
+ {
5112
+ group.selection.RewindLeaves(hide);
5113
+ refreshContents();
5114
+ }
5115
+
5116
+ void RandomLeaves(boolean hide)
5117
+ {
5118
+ group.selection.RandomLeaves(hide);
35745119 refreshContents();
35755120 }
35765121
....@@ -3645,28 +5190,25 @@
36455190 // }
36465191 // }
36475192
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525193 void EditSelection(boolean newWindow)
36535194 {
5195
+ if (group.selection == null)
5196
+ {
5197
+ EditElement(group, newWindow); // ? new
5198
+ return;
5199
+ }
5200
+
36545201 // aConstraints.gridy = 0;
36555202 for (int i=0; i<group.selection.size(); i++)
36565203 {
36575204 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585205 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5206
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605207
36615208 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5209
+ if(elem != group || !newWindow)
36635210 {
3664
- // if (!(elem instanceof Composite))
3665
- // newWindow = false;
3666
- listUI.add(elem);
3667
- elem.openEditWindow(this, newWindow); //, false);
3668
- System.out.println("edit : " + elem);
3669
- elem.editWindow.refreshContents(true); // ? new
5211
+ EditElement(elem, newWindow); // ? new
36705212 }
36715213 }
36725214 }
....@@ -3729,9 +5271,7 @@
37295271
37305272 freezemodel = false;
37315273 }
3732
-
3733
- boolean flashIt = true;
3734
-
5274
+
37355275 public void valueChanged(TreeSelectionEvent e)
37365276 //public boolean handleEvent(Event event)
37375277 {
....@@ -3741,7 +5281,8 @@
37415281 //new Exception().printStackTrace();
37425282
37435283 freezemodel = true;
3744
-
5284
+ ClearUnpinned();
5285
+
37455286 /**/
37465287 //switch (event.id)
37475288 {
....@@ -3749,7 +5290,6 @@
37495290 //case 702: // Event.LIST_DESELECT
37505291 group.deselectAll();
37515292 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535293 if (tps != null)
37545294 {
37555295 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5298,39 @@
37585298
37595299 //if (child.parent != null)
37605300 //child.parent.addSelectee(child);
5301
+ objEditor.SetMaterial(child);
37615302 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655303 }
37665304 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5305
+// else
5306
+// {
5307
+// objEditor.SetMaterial(group); // .GetMaterial());
5308
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5309
+// System.err.println("info : " + group.GetPath());
5310
+// }
37735311
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5312
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775313 CameraPane.flash = true;
37785314
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5315
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805316 // a camera
37815317 {
3782
- CameraPane.camerachangeframe = 0; // don't refuse it
3783
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3784
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3785
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5318
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5319
+ {
5320
+ CameraPane.camerachangeframe = 0; // don't refuse it
5321
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5322
+ }
5323
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5324
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865325 }
37875326
5327
+ if (tps != null && tps.length == 1)
5328
+ {
5329
+ EditSelection(false);
5330
+ }
5331
+
5332
+ SetPinStates(tps != null && tps.length > 0);
5333
+
37885334 refreshContents();
37895335 //return true;
37905336 }
....@@ -3793,6 +5339,51 @@
37935339
37945340 freezemodel = false;
37955341 }
5342
+
5343
+ void SetPinStates(boolean enabled)
5344
+ {
5345
+ editButton.setEnabled(enabled);
5346
+ uneditButton.setEnabled(enabled);
5347
+ //unselectButton.setEnabled(enabled);
5348
+ flashSelectionButton.setEnabled(enabled);
5349
+
5350
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5351
+
5352
+ boolean allComposites = true;
5353
+
5354
+ if (group.selection != null)
5355
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5356
+ {
5357
+ if (!(e.nextElement() instanceof Composite))
5358
+ {
5359
+ allComposites = false;
5360
+ break;
5361
+ }
5362
+ }
5363
+
5364
+ rootButton.setEnabled(allComposites);
5365
+ }
5366
+
5367
+ void refreshContents(boolean cp)
5368
+ {
5369
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5370
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5371
+ {
5372
+ objEditor.ClearInfo(); // .GetMaterial());
5373
+
5374
+ for (int i=0; i < group.selection.Size(); i++)
5375
+ {
5376
+ Object3D child = (Object3D) group.selection.get(i);
5377
+
5378
+ objEditor.AddInfo(child, this, true);
5379
+// System.err.println("info : " + child.GetPath());
5380
+ }
5381
+
5382
+ objEditor.SetText(); // jan 2014
5383
+ }
5384
+
5385
+ super.refreshContents(cp);
5386
+ }
37965387
37975388 void linkSomething(Object3D thing)
37985389 {
....@@ -3864,16 +5455,19 @@
38645455 {
38655456 if (group.selection.isEmpty())
38665457 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5458
+
5459
+ Grafreed.clipboardIsTempGroup = false;
38685460 Composite tGroup = null;
38695461 if (group.selection.size() > 0) // 1)
38705462 {
38715463 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5464
+ Grafreed.clipboardIsTempGroup = true;
38735465 }
38745466
38755467 if (cut)
38765468 {
5469
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5470
+// Save();
38775471 //int indices[] = jList.getSelectedIndices();
38785472 //for (int i = indices.length - 1; i >= 0; i--)
38795473 //jList.remove(indices[i]);
....@@ -3909,16 +5503,16 @@
39095503 //System.out.println("cut " + child);
39105504 //System.out.println("parent = " + child.parent);
39115505 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5506
+ if (Grafreed.clipboardIsTempGroup)
39135507 tGroup.add/*Child*/(tmp);
39145508 else
3915
- GraphreeD.clipboard = tmp;
5509
+ Grafreed.clipboard = tmp;
39165510 }
39175511 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5512
+ if (Grafreed.clipboardIsTempGroup)
39195513 tGroup.add/*Child*/(child);
39205514 else
3921
- GraphreeD.clipboard = child;
5515
+ Grafreed.clipboard = child;
39225516 }
39235517
39245518 //ResetModel();
....@@ -3950,21 +5544,23 @@
39505544 //System.out.println("cut " + elem);
39515545 //System.out.println("parent = " + elem.parent);
39525546 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5547
+ if (Grafreed.clipboardIsTempGroup)
39545548 tGroup.add/*Child*/(tmp);
39555549 else
3956
- GraphreeD.clipboard = tmp;
5550
+ Grafreed.clipboard = tmp;
39575551 }
39585552 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5553
+ if (Grafreed.clipboardIsTempGroup)
39605554 tGroup.add/*Child*/(child);
39615555 else
3962
- GraphreeD.clipboard = child;
5556
+ Grafreed.clipboard = child;
39635557 }
39645558
39655559 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5560
+
5561
+ if (Grafreed.clipboardIsTempGroup)
5562
+ Grafreed.clipboard = tGroup;
5563
+
39685564 if (cut)
39695565 {
39705566 ResetModel();
....@@ -3974,11 +5570,15 @@
39745570
39755571 void paste(boolean expand)
39765572 {
3977
- // if (GraphreeD.clipboard == null)
5573
+ if (Globals.REPLACEONMAKE)
5574
+ Save();
5575
+ boolean keep = Globals.REPLACEONMAKE;
5576
+ Globals.REPLACEONMAKE = false;
5577
+ // if (GrafreeD.clipboard == null)
39785578 // return;
39795579 boolean first = true;
39805580
3981
- if (GraphreeD.clipboardIsTempGroup)
5581
+ if (Grafreed.clipboardIsTempGroup)
39825582 {
39835583 Composite temp;
39845584
....@@ -3989,7 +5589,7 @@
39895589 temp = (Composite)Applet3D.clipboard.deepCopy();
39905590 */
39915591 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5592
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935593 {
39945594 Object3D child = (Object3D)e.nextElement();
39955595
....@@ -4003,7 +5603,7 @@
40035603 else
40045604 elem = child.deepCopy(); // ?
40055605 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5606
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075607 // elem = elem.get(0);
40085608 makeSomething(elem, true); // ?? first);
40095609 //group.addChild(elem);
....@@ -4023,23 +5623,24 @@
40235623 //Object3D cb = Applet3D.clipboard;
40245624 //temp.addChild(cb);
40255625 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4026
- assert(GraphreeD.clipboard.parent == null);
4027
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4028
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4029
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4030
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
5626
+ assert(Grafreed.clipboard.parent == null);
5627
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5628
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5629
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5630
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315631 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5632
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5633
+ Grafreed.clipboard.get(0).parent = keepparent;
40345634 }
40355635
5636
+ Globals.REPLACEONMAKE = keep;
40365637 ResetModel();
40375638 refreshContents();
40385639 }
40395640
4040
- void pasteInto(boolean copyit)
5641
+ void pasteInto(boolean copyit, boolean clone)
40415642 {
4042
-// if (GraphreeD.clipboard == null)
5643
+// if (GrafreeD.clipboard == null)
40435644 // return;
40445645
40455646 if (group.selection.size() != 1)
....@@ -4066,15 +5667,22 @@
40665667 if (copyit)
40675668 {
40685669 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5670
+ if (clone)
5671
+ {
5672
+ CloneClipboard(false); // sept 2014
5673
+ }
5674
+ else
5675
+ {
5676
+ paste(false);
5677
+ }
40705678 }
40715679 else
40725680 {
40735681 boolean first = true;
40745682
4075
- if (GraphreeD.clipboardIsTempGroup)
5683
+ if (Grafreed.clipboardIsTempGroup)
40765684 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5685
+ Composite temp = (Composite)Grafreed.clipboard;
40785686 Object3D copy;
40795687 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805688 {
....@@ -4084,7 +5692,7 @@
40845692 }
40855693 } else
40865694 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5695
+ linkSomething(Grafreed.clipboard); //.get(0));
40885696 }
40895697 }
40905698 }
....@@ -4161,6 +5769,10 @@
41615769
41625770 void group(Object3D csg, boolean grab)
41635771 {
5772
+ if (Globals.REPLACEONMAKE)
5773
+ Save();
5774
+ boolean keep = Globals.REPLACEONMAKE;
5775
+ Globals.REPLACEONMAKE = false;
41645776 if (//false) // why??
41655777 !group.selection.isEmpty())
41665778 {
....@@ -4274,8 +5886,34 @@
42745886 //node.add(csg);
42755887 //makeSomething(node);
42765888 makeSomething(csg);
5889
+ Globals.REPLACEONMAKE = keep;
42775890 }
42785891
5892
+ void Ungroup(Object3D g)
5893
+ {
5894
+ if (Globals.REPLACEONMAKE)
5895
+ Save();
5896
+ boolean keep = Globals.REPLACEONMAKE;
5897
+ Globals.REPLACEONMAKE = false;
5898
+ if (g instanceof HiddenObject)
5899
+ {
5900
+ HiddenObject h = (HiddenObject) g;
5901
+
5902
+ for (int i=0; i<h.ActualSize(); i++)
5903
+ {
5904
+ objEditor.makeSomething(h.get(i), false);
5905
+ }
5906
+ }
5907
+ else
5908
+ {
5909
+ for (int i=0; i<g.Size(); i++)
5910
+ {
5911
+ objEditor.makeSomething(g.get(i), false);
5912
+ }
5913
+ }
5914
+ Globals.REPLACEONMAKE = keep;
5915
+ }
5916
+
42795917 void ungroup()
42805918 {
42815919 /*
....@@ -4469,21 +6107,6 @@
44696107 }
44706108 */
44716109
4472
- void ImportGFD()
4473
- {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4475
- browser.show();
4476
- String filename = browser.getFile();
4477
- if (filename != null && filename.length() > 0)
4478
- {
4479
- String fullname = browser.getDirectory() + filename;
4480
-
4481
- //Object3D readobj =
4482
- objEditor.ReadGFD(fullname, objEditor);
4483
- //makeSomething(readobj);
4484
- }
4485
- }
4486
-
44876110 /*
44886111 public void Callback(Object obj)
44896112 {
....@@ -4507,26 +6130,9 @@
45076130 }
45086131 */
45096132
4510
- void ImportVRMLX3D()
4511
- {
4512
- if (GraphreeD.standAlone)
4513
- {
4514
- /**/
4515
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4516
- browser.show();
4517
- String filename = browser.getFile();
4518
- if (filename != null && filename.length() > 0)
4519
- {
4520
- String fullname = browser.getDirectory() + filename;
4521
- LoadVRMLX3D(fullname);
4522
- }
4523
- /**/
4524
- }
4525
- }
4526
-
45276133 String GetFile(String dialogName)
45286134 {
4529
- if (GraphreeD.standAlone)
6135
+ if (Grafreed.standAlone)
45306136 {
45316137 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45326138 browser.show();
....@@ -4590,10 +6196,48 @@
45906196 cButton flashSelectionButton;
45916197 cButton editButton;
45926198 cButton uneditButton;
6199
+ JCheckBox allParamsButton;
45936200 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956201 cButton unselectButton;
45966202
6203
+ cButton restoreCameraButton;
6204
+
6205
+ cButton oneStepButton;
6206
+
6207
+ cButton groupButton;
6208
+ cButton ungroupButton;
6209
+ cButton compositeButton;
6210
+ cButton switchButton;
6211
+ cButton loopButton;
6212
+ cButton textureButton;
6213
+
6214
+ cButton skybox1Button;
6215
+ cButton skybox2Button;
6216
+ cButton skybox3Button;
6217
+ cButton skybox4Button;
6218
+ cButton skybox5Button;
6219
+ cButton skybox6Button;
6220
+ cButton skybox7Button;
6221
+
6222
+ cButton skybox11Button;
6223
+ cButton skybox12Button;
6224
+ cButton skybox13Button;
6225
+ cButton skybox14Button;
6226
+ cButton skybox15Button;
6227
+ cButton skybox16Button;
6228
+ cButton skybox17Button;
6229
+
6230
+ cButton gridButton;
6231
+ cButton boxButton;
6232
+ cButton sphereButton;
6233
+ cButton coneButton;
6234
+ cButton torusButton;
6235
+ cButton superButton;
6236
+ cButton kleinButton;
6237
+ cButton particlesButton;
6238
+ cButton overlayButton;
6239
+ cButton lightButton;
6240
+
45976241 cButton screenfitButton;
45986242 cButton screenfitpointButton;
45996243 cButton snapobjectButton;
....@@ -4605,14 +6249,6 @@
46056249
46066250 cButton setsupportButton;
46076251
4608
- cButton twoButton;
4609
- cButton sixButton;
4610
- cButton threeButton;
4611
- cButton sevenButton;
4612
- cButton fourButton; // full panel
4613
- cButton oneButton; // full XYZ
4614
- //cButton currentLayout;
4615
-
46166252 //
46176253 //Composite
46186254 Object3D // to do !!
....@@ -4622,10 +6258,12 @@
46226258 //JTree jTree;
46236259 private MenuItem lookAtItem;
46246260 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
4626
- private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
4628
- private MenuItem cloneItem;
6261
+ private MenuItem switchViewItem;
6262
+ private JMenuItem cutItem;
6263
+ private MenuItem undoItem;
6264
+ private MenuItem redoItem;
6265
+ private JMenuItem duplicateItem;
6266
+ private JMenuItem cloneItem;
46296267 private MenuItem cloneSupportItem;
46306268 private MenuItem overwriteGeoItem;
46316269 private MenuItem overwriteMatItem;
....@@ -4635,8 +6273,9 @@
46356273 private MenuItem resetsupportItem;
46366274 private MenuItem resetreferencesItem;
46376275 private MenuItem linkverticesItem;
6276
+ private MenuItem relinkverticesItem;
46386277 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6278
+ private MenuItem resetAllItem;
46406279 private MenuItem stepAllItem;
46416280 private MenuItem revertMeshItem;
46426281 private MenuItem poseMeshItem;
....@@ -4645,16 +6284,19 @@
46456284 private MenuItem cloneGeometriesItem;
46466285 private MenuItem shareGeometriesItem;
46476286 private MenuItem mergeGeometriesItem;
4648
- private MenuItem copyItem;
6287
+ private JMenuItem copyItem;
46496288 private MenuItem pasteItem;
4650
- private MenuItem pasteLinkItem;
4651
- private MenuItem pasteCloneItem;
4652
- private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6289
+ private JMenuItem pasteIntoItem;
6290
+ private JMenuItem pasteLinkItem;
6291
+ private JMenuItem pasteCloneItem;
6292
+ private JMenuItem pasteExpandItem;
6293
+ private JMenuItem deleteItem;
46546294 private MenuItem clearAllItem;
46556295 private MenuItem genUVItem;
6296
+ private MenuItem genNormalsMESHItem;
46566297 private MenuItem genNormalsCADItem;
46576298 private MenuItem genNormalsORGANItem;
6299
+ private MenuItem genNormalsMINEItem;
46586300 private MenuItem stripifyItem;
46596301 private MenuItem unstripifyItem;
46606302 private MenuItem trimItem;
....@@ -4683,6 +6325,10 @@
46836325 private MenuItem showleavesItem;
46846326 private MenuItem markleavesItem;
46856327 private MenuItem unmarkleavesItem;
6328
+ private MenuItem rewindleavesItem;
6329
+ private MenuItem unrewindleavesItem;
6330
+ private MenuItem randomleavesItem;
6331
+ private MenuItem unrandomleavesItem;
46866332
46876333 private MenuItem flipVItem;
46886334 private MenuItem unflipVItem;
....@@ -4694,14 +6340,17 @@
46946340 private MenuItem panoTexturesItem;
46956341
46966342 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6343
+ private MenuItem resetCentroidXZItem;
46986344 private MenuItem resetTransformItem;
6345
+ private MenuItem transformGeometryItem;
6346
+ private MenuItem transformChildrenItem;
6347
+ private MenuItem hideItem;
46996348 private MenuItem grabItem;
47006349 private MenuItem backItem;
47016350 private MenuItem frontItem;
47026351 private MenuItem cameraItem;
47036352 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6353
+ private MenuItem switchItem;
47056354 private MenuItem physicsItem;
47066355 private MenuItem frameselectorItem;
47076356 private MenuItem scriptNodeItem;
....@@ -4709,13 +6358,14 @@
47096358 private MenuItem switchTransfoItem;
47106359 private MenuItem morphItem;
47116360 private MenuItem linkerItem;
4712
- private MenuItem ungroupItem;
6361
+ private JMenuItem ungroupItem;
47136362 private MenuItem editItem;
47146363 private MenuItem openWindowItem;
47156364 private MenuItem editLeafItem;
47166365
47176366 private MenuItem resetParentItem;
47186367 private MenuItem repairParentItem;
6368
+ private MenuItem repairShadowItem;
47196369 private MenuItem sortbysizeItem;
47206370 private MenuItem sortbynameItem;
47216371
....@@ -4724,20 +6374,25 @@
47246374 private MenuItem attachBumpItem;
47256375 private MenuItem detachBumpItem;
47266376 private MenuItem pigmentBumpItem;
6377
+ private MenuItem embedTexturesItem;
6378
+ private MenuItem deEmbedTexturesItem;
47276379
47286380 private MenuItem particleItem;
47296381 private MenuItem ragdollItem;
47306382 private MenuItem ragdoll2Item;
6383
+ private MenuItem heightFieldItem;
6384
+ private MenuItem textureFieldItem;
47316385 private MenuItem gridItem;
47326386 private MenuItem rectoidItem;
47336387 private MenuItem ellipsoidItem;
47346388 private MenuItem coneItem;
47356389 private MenuItem torusItem;
47366390 private MenuItem superItem;
6391
+ private MenuItem kleinItem;
47376392 private MenuItem blobItem;
47386393 private MenuItem latheItem;
47396394 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6395
+ private MenuItem overlayItem;
47416396 private MenuItem meshItem;
47426397 // private MenuItem meshGroupItem;
47436398 private MenuItem springItem;
....@@ -4746,6 +6401,7 @@
47466401 private MenuItem csgItem;
47476402 private MenuItem templateItem;
47486403 private MenuItem textureItem;
6404
+ private MenuItem billboardItem;
47496405 private MenuItem shadowXItem;
47506406 private MenuItem shadowYItem;
47516407 private MenuItem shadowZItem;
....@@ -4758,11 +6414,6 @@
47586414 private MenuItem doubleItem;
47596415 private MenuItem tripleItem;
47606416
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666417 private MenuItem computeAOItem;
47676418 private MenuItem recompileItem;
47686419 private MenuItem editScriptItem;
....@@ -4772,4 +6423,8 @@
47726423 private MenuItem analyzeItem;
47736424 private MenuItem dumpItem;
47746425 //boolean freezemodel = false;
6426
+
6427
+ Menu cameraMenu;
6428
+ MenuItem editCameraItem;
6429
+ MenuItem restoreCameraItem;
47756430 }