Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
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,130 @@
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 && !path[0].equals("") && !path[0].equals(".DS_Store"))
949
+ {
950
+ currenttab = new cGridBag();
951
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
+ currenttab.setName(tabname);
953
+ //added = false;
954
+ resourcecontainer.add(currenttab);
955
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
956
+ rowcount = 1;
957
+ colcount = 0;
958
+ texturecount = 0;
959
+ }
960
+
961
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
962
+ {
963
+ //if (!added)
964
+ {
965
+ //added = true;
966
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
967
+ currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname));
968
+ }
969
+
970
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
971
+
972
+ if (++colcount >= columns)
973
+ {
974
+ colcount = 0;
975
+ currenttab.Return();
976
+
977
+ if (rowcount++ >= rows)
978
+ {
979
+ rowcount = 0;
980
+ }
981
+ }
982
+ }
983
+ else
984
+ {
985
+// if (!path[path.length-1].equals("icons"))
986
+// resourcecontainer.Return();
987
+ }
988
+ }
989
+
990
+ void CreateTexturePanel(cGridBag container)
991
+ {
992
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
993
+ container.add(resourcecontainer);
994
+
995
+ Grafreed.ParseResources("textures", this);
996
+ }
997
+
379998 void SetupUI2(ObjEditor oe)
380999 {
1000
+ // June 2019
1001
+ if (oe == null)
1002
+ {
1003
+ //super.SetupUI2(this);
1004
+ //return;
1005
+ }
1006
+
1007
+ if (copy != group)
1008
+ {
1009
+ //super.SetupUI2(this);
1010
+ }
1011
+
3811012 //new Exception().printStackTrace();
3821013
3831014 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;
3891015 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
3901016
3911017 oe.buttonGroup = new ButtonGroup();
....@@ -406,150 +1032,263 @@
4061032 oe.radioPanel.add(dummyButton);
4071033 oe.buttonGroup.add(dummyButton);
4081034 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
1035
+ cGridBag copyOptionsPanel = new cGridBag();
1036
+
1037
+ copyOptionsPanel.preferredHeight = 2;
4121038
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
1039
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1040
+
1041
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ //minButton.setToolTipText("Minimize window");
1043
+ //minButton.addActionListener(this);
1044
+
1045
+ if (Globals.ADVANCED)
1046
+ {
1047
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1048
+// maxButton.setToolTipText("Maximize window");
1049
+// maxButton.addActionListener(this);
1050
+ }
1051
+
1052
+ cButton gcButton;
1053
+
1054
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+// gcButton.setToolTipText("Garbage collect");
1056
+// gcButton.addActionListener(new ActionListener()
1057
+// {
1058
+// public void actionPerformed(ActionEvent e)
1059
+// {
1060
+// System.gc();
1061
+// }
1062
+// });
1063
+
1064
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ collapseButton.setToolTipText("Collapse toolbar");
1066
+ collapseButton.addActionListener(this);
1067
+
1068
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1069
+ maximize3DButton.setToolTipText("Maximize 3D view");
1070
+ maximize3DButton.addActionListener(this);
1071
+
1072
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ twoButton.setToolTipText("Show 3D view only");
1074
+ twoButton.addActionListener(this);
1075
+ this.fullscreenLayout = twoButton;
1076
+
1077
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1078
+ threeButton.setToolTipText("Show controls and 3D view");
1079
+ threeButton.addActionListener(this);
1080
+ if (Globals.ADVANCED)
1081
+ {
1082
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1083
+ sixButton.setToolTipText("Show 3D view and controls");
1084
+ sixButton.addActionListener(this);
1085
+ }
1086
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1087
+// sevenButton.setToolTipText("3-column layout");
1088
+// sevenButton.addActionListener(this);
1089
+ //
1090
+
1091
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ fullButton.setToolTipText("Full-screen window");
1093
+ fullButton.addActionListener(this);
1094
+
1095
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ screenfitButton.setToolTipText("Screen fit");
1097
+ screenfitButton.addActionListener(this);
1098
+
1099
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1101
+ restoreCameraButton.addActionListener(this);
1102
+
1103
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1104
+ saveVersionButton.setToolTipText("Duplicate current version");
1105
+ saveVersionButton.addActionListener(this);
1106
+
1107
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ deleteVersionButton.setToolTipText("Delete current version");
1109
+ deleteVersionButton.addActionListener(this);
1110
+
1111
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ previousVersionButton.setToolTipText("Previous version");
1113
+ previousVersionButton.addActionListener(this);
1114
+ previousVersionButton.setEnabled(false);
1115
+
1116
+ cGridBag updown = new cGridBag().setVertical(true);
1117
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+ restoreButton.setToolTipText("Undo (restore current version)");
1119
+ restoreButton.addActionListener(this);
1120
+ //restoreButton.setEnabled(false);
1121
+
1122
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ replaceButton.setToolTipText("Save (replace current version)");
1124
+ replaceButton.addActionListener(this);
1125
+ //replaceButton.setEnabled(false);
1126
+
1127
+ copyOptionsPanel.add(updown);
1128
+
1129
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1130
+ nextVersionButton.setToolTipText("Next version");
1131
+ nextVersionButton.addActionListener(this);
1132
+ nextVersionButton.setEnabled(false);
1133
+
1134
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1135
+ oneStepButton.setToolTipText("Animate one step forward");
1136
+ oneStepButton.addActionListener(this);
1137
+
1138
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1139
+ liveCB.setToolTipText("Enable animation");
4141140 liveCB.addItemListener(this);
4151141
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);
1142
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1143
+ fastCB.setToolTipText("Fast mode");
4341144 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);
1145
+
1146
+ //oe.toolboxPanel.Return();
1147
+
1148
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1149
+// trackCB.setToolTipText("Enable tracking");
1150
+// trackCB.addItemListener(this);
4411151
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;
4821152 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
4831153 // 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;
4881154
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);
1155
+ if (Globals.ADVANCED)
1156
+ {
1157
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1158
+ snapobjectButton.addActionListener(this);
1159
+ snapobjectButton.setToolTipText("Snap Object");
1160
+
1161
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5041162 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
- //
1163
+ fourButton.setToolTipText("Show control panel only");
1164
+ }
5121165
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1166
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1167
+
1168
+
1169
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1170
+ rootButton.setToolTipText("Open selection in new tab");
5141171 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1172
+
1173
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1174
+ closeButton.setToolTipText("Close tab");
5171175 closeButton.addActionListener(this);
5181176 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5191177 //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;
5281178
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1179
+ cGridBag row1 = new cGridBag();
1180
+
1181
+ // INSERT
1182
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ gridButton.setToolTipText("Create ground");
1184
+ gridButton.addActionListener(this);
1185
+
1186
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ boxButton.setToolTipText("Create box");
1188
+ boxButton.addActionListener(this);
1189
+
1190
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ sphereButton.setToolTipText("Create sphere");
1192
+ sphereButton.addActionListener(this);
1193
+
1194
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
+ coneButton.setToolTipText("Create cone");
1196
+ coneButton.addActionListener(this);
1197
+
1198
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
+ torusButton.setToolTipText("Create torus");
1200
+ torusButton.addActionListener(this);
1201
+
1202
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1203
+ superButton.setToolTipText("Create superellipsoid");
1204
+ superButton.addActionListener(this);
1205
+
1206
+ if (Globals.ADVANCED)
1207
+ {
1208
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1209
+ kleinButton.setToolTipText("Create Klein bottle");
1210
+ kleinButton.addActionListener(this);
1211
+ }
1212
+
1213
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1214
+ particlesButton.setToolTipText("Create particle system");
1215
+ particlesButton.addActionListener(this);
1216
+
1217
+ oe.toolboxPanel.add(row1);
1218
+
1219
+ cGridBag row2 = new cGridBag();
1220
+
1221
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1222
+ groupButton.setToolTipText("Create group");
1223
+ groupButton.addActionListener(this);
1224
+
1225
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1226
+ compositeButton.setToolTipText("Create composite");
1227
+ compositeButton.addActionListener(this);
1228
+
1229
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1230
+ switchButton.setToolTipText("Create item switcher");
1231
+ switchButton.addActionListener(this);
1232
+
1233
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1234
+ loopButton.setToolTipText("Create loop");
1235
+ loopButton.addActionListener(this);
1236
+
1237
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1238
+ textureButton.setToolTipText("Create texture");
1239
+ textureButton.addActionListener(this);
1240
+
1241
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1242
+ overlayButton.setToolTipText("Create overlay");
1243
+ overlayButton.addActionListener(this);
1244
+
1245
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1246
+ lightButton.setToolTipText("Create light");
1247
+ lightButton.addActionListener(this);
1248
+
1249
+ oe.toolboxPanel.add(row2);
1250
+
1251
+ cGridBag textures = new cGridBag();
1252
+
1253
+ CreateTexturePanel(textures);
1254
+
1255
+ oe.toolboxPanel.add(textures);
1256
+
1257
+ textures.preferredHeight = 100;
1258
+
1259
+ CreateSkyboxPanel(oe.skyboxPanel);
1260
+
1261
+ // EDIT panel
1262
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1263
+ editButton.setToolTipText("Pin selection controls");
1264
+ editButton.addActionListener(this);
1265
+
1266
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1267
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5301268 uneditButton.addActionListener(this);
5311269
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);
1270
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1271
+ allParamsButton.setToolTipText("Show all controls");
5441272 allParamsButton.addActionListener(this);
5451273
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);
1274
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1275
+ clearPanelButton.setToolTipText("Clear all controls");
1276
+ clearPanelButton.addActionListener(this);
5521277
1278
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1279
+ //unselectButton.setToolTipText("Unselect");
1280
+ //unselectButton.addActionListener(this);
1281
+
1282
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1283
+ flashSelectionButton.setToolTipText("Highlight selection");
1284
+ flashSelectionButton.addActionListener(this);
1285
+
1286
+ editCommandsPanel.preferredHeight = 1;
1287
+
1288
+ SetPinStates(false);
1289
+// oe.treePanel.add(commandsPanel);
1290
+// oe.treePanel.Return();
1291
+
5531292 // oe.aConstraints.gridx += 1;
5541293 // oe.aConstraints.weighty = 0;
5551294 // oe.aConstraints.gridwidth = 1;
....@@ -561,47 +1300,32 @@
5611300 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5621301 // gcButton.addActionListener(this);
5631302
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;
1303
+ cGridBag jSPPanel = new cGridBag();
1304
+
1305
+ JScrollPane jSP;
5751306 //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);
1307
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5771308 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;
5971309
1310
+ oe.treePanel.add(jSPPanel);
1311
+ oe.treePanel.Return();
1312
+
1313
+ oe.treePanel.add(copyOptionsPanel);
1314
+ oe.treePanel.Return();
1315
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1316
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1317
+ sliderPane.preferredHeight = 1;
1318
+
1319
+// mainPanel.setDividerLocation(0.1); //1.0);
1320
+ mainPanel.setResizeWeight(0.4);
1321
+
5981322 //jList.addListSelectionListener(this);
5991323 oe.jTree.addTreeSelectionListener(this);
6001324 //jTree.setRootVisible(false);
6011325 //jTree.setEditable(true);
6021326 oe.jTree.setDragEnabled(true);
6031327 //jTree.setPreferredSize(new Dimension(10,10));
604
- jSP.setPreferredSize(new Dimension(100,200));
1328
+ //jSP.setPreferredSize(new Dimension(100,200));
6051329
6061330 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6071331
....@@ -613,23 +1337,171 @@
6131337 dgr.addDragGestureListener(this);
6141338 }catch(Exception e) {}
6151339 */
616
- radio.layout = sevenButton;
1340
+ radio.layout = threeButton; // sixButton;
6171341 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6181342 }
1343
+
1344
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1345
+ {
1346
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1347
+ colorCB.setToolTipText("Copy color when dropped");
1348
+ colorCB.addItemListener(this);
1349
+
1350
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1351
+ materialCB.setToolTipText("Copy material when dropped");
1352
+ materialCB.addItemListener(this);
1353
+
1354
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1355
+ textureCB.setToolTipText("Copy texture when dropped");
1356
+ textureCB.addItemListener(this);
1357
+
1358
+ panel.Return();
1359
+
1360
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1361
+ boxCB.setToolTipText("Display bounding boxes");
1362
+ boxCB.addItemListener(this);
1363
+
1364
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1365
+ zoomBoxCB.setToolTipText("Display only for wheel");
1366
+ zoomBoxCB.addItemListener(this);
1367
+
1368
+ if (true) // Globals.ADVANCED)
1369
+ {
1370
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1371
+// supportCB.setToolTipText("Enable rigging");
1372
+// supportCB.addItemListener(this);
1373
+
1374
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1375
+ freezeCB.setToolTipText("Fast moving camera");
1376
+ freezeCB.addItemListener(this);
1377
+
1378
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1379
+ // localCB.addItemListener(this);
1380
+
1381
+ panel.Return();
1382
+
1383
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1384
+ crowdCB.setToolTipText("Used for crowds");
1385
+ crowdCB.addItemListener(this);
1386
+
1387
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1388
+ smoothCB.setToolTipText("Snapping delay");
1389
+ smoothCB.addItemListener(this);
1390
+
1391
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1392
+// slowCB.setToolTipText("Smooth interpolation");
1393
+// slowCB.addItemListener(this);
1394
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1395
+ minshaderCB.setToolTipText("Minimal fast shader");
1396
+ minshaderCB.addItemListener(this);
1397
+
1398
+// constraints.gridy += 1;
1399
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1400
+// speakerMocapCB.addItemListener(this);
1401
+
1402
+ panel.Return();
1403
+
1404
+ if (false)
1405
+ {
1406
+ // handled in scripts
1407
+ //constraints.gridy += 1;
1408
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1409
+ speakerCameraCB.addItemListener(this);
1410
+
1411
+ //constraints.gridy += 1;
1412
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1413
+ speakerFocusCB.addItemListener(this);
1414
+
1415
+ //constraints.gridy += 1;
1416
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1417
+ smoothfocusCB.addItemListener(this);
1418
+ panel.Return();
1419
+ }
1420
+
1421
+//constraints.gridx += 1;
1422
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1423
+// debugCB.addItemListener(this);
1424
+
1425
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1426
+ trackCB.setToolTipText("Enable tracking target");
1427
+ trackCB.addItemListener(this);
1428
+
1429
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1430
+ oeilCB.setToolTipText("Move camera when tracking");
1431
+ oeilCB.addItemListener(this);
1432
+
1433
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1434
+ shadowCB.setToolTipText("When live compute shadows");
1435
+ shadowCB.addItemListener(this);
1436
+
1437
+ panel.Return();
1438
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1439
+ toggleTextureCB.setToolTipText("Load textures");
1440
+ toggleTextureCB.addItemListener(this);
1441
+
1442
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1443
+ toggleSwitchCB.setToolTipText("Choose a single item");
1444
+ toggleSwitchCB.addItemListener(this);
1445
+
1446
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1447
+ autokeepCB.setToolTipText("On structure change");
1448
+ autokeepCB.addItemListener(this);
1449
+
1450
+ panel.Return();
1451
+ if (Globals.ADVANCED)
1452
+ {
1453
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1454
+ lookAtCB.setToolTipText("Look-at target");
1455
+ lookAtCB.addItemListener(this);
1456
+ }
1457
+
1458
+ }
1459
+
1460
+ cGridBag fill = new cGridBag();
1461
+ fill.preferredHeight = 200;
1462
+ cGridBag fill2 = new cGridBag();
1463
+ fill2.preferredHeight = 200;
1464
+ cGridBag fill3 = new cGridBag();
1465
+ fill3.preferredHeight = 200;
1466
+
1467
+ panel.add(fill);
1468
+ panel.add(fill2);
1469
+ panel.add(fill3);
1470
+
1471
+ }
6191472
6201473 void EditObject(Object3D obj)
6211474 {
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();
1475
+ assert(obj instanceof Composite);
1476
+
1477
+// if (obj.versionlist == null)
1478
+// {
1479
+// obj.versionlist = new Object3D[100];
1480
+// obj.versionindex = -1;
1481
+// }
1482
+
1483
+ cRadio radioButton = new cRadio(obj.name);
1484
+
1485
+ // June 2019. Patch to avoid bug with transparency.
1486
+ radioButton.hadMaterial = obj.material != null;
1487
+ if (!radioButton.hadMaterial)
1488
+ {
1489
+ obj.material = new cMaterial();
1490
+ }
1491
+
1492
+ radioButton.SetObject(obj);
1493
+ radioButton.layout = threeButton; // sixButton;
1494
+ radioButton.SetCamera(cameraView.renderCamera, false);
1495
+ radioButton.addActionListener(this);
1496
+ radioPanel.add(radioButton);
1497
+ buttonGroup.add(radioButton);
1498
+ radioButton.doClick();
6301499 }
1500
+
6311501 void SetupViews(ObjEditor oe)
6321502 {
1503
+ theFrame = this;
1504
+
6331505 oe.SetupViews();
6341506
6351507 System.out.println("SetupViews");
....@@ -638,22 +1510,30 @@
6381510 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391511 }
6401512
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;
1513
+ cToggleButton liveCB;
1514
+ cCheckBox supportCB;
1515
+ cCheckBox localCB;
1516
+ cCheckBox crowdCB;
1517
+ cCheckBox smoothCB;
1518
+ cCheckBox minshaderCB;
1519
+
1520
+ cToggleButton fastCB;
1521
+ cCheckBox slowCB;
1522
+ cCheckBox boxCB;
1523
+ cCheckBox zoomBoxCB;
1524
+ cCheckBox freezeCB;
1525
+ //cToggleButton trackCB;
1526
+ cCheckBox trackCB;
1527
+ cCheckBox smoothfocusCB;
6511528 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1529
+ cCheckBox speakerCameraCB;
1530
+ cCheckBox speakerFocusCB;
1531
+ cCheckBox debugCB;
1532
+
1533
+ cCheckBox oeilCB;
1534
+ cCheckBox shadowCB;
1535
+ cCheckBox autokeepCB;
1536
+ cCheckBox lookAtCB;
6571537
6581538 // static int COLOR = 1;
6591539 // static int MATERIAL = 2;
....@@ -661,9 +1541,9 @@
6611541
6621542 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631543
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1544
+ cCheckBox colorCB;
1545
+ cCheckBox materialCB;
1546
+ cCheckBox textureCB;
6671547
6681548 public void itemStateChanged(ItemEvent e)
6691549 {
....@@ -688,10 +1568,10 @@
6881568 dropAttributes |= Object3D.TEXTURE;
6891569 else
6901570 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1571
+ } else if(e.getSource() == liveCB)
6931572 {
6941573 cameraView.ToggleLive();
1574
+ refreshContents(false);
6951575 }
6961576 else if(e.getSource() == supportCB)
6971577 {
....@@ -707,6 +1587,12 @@
7071587 {
7081588 cameraView.ToggleInertia();
7091589 cameraView.repaint();
1590
+ }
1591
+ else if(e.getSource() == minshaderCB)
1592
+ {
1593
+ Globals.MINSHADER ^= true;
1594
+ cameraView.programInitialized = false;
1595
+ cameraView.repaint();
7101596 }
7111597 else if(e.getSource() == localCB)
7121598 {
....@@ -726,6 +1612,10 @@
7261612 Recompile();
7271613 cameraView.repaint();
7281614 // refreshContents();
1615
+ }
1616
+ else if(e.getSource() == zoomBoxCB)
1617
+ {
1618
+ cameraView.ToggleZoomBoxMode();
7291619 }
7301620 else if(e.getSource() == smoothfocusCB)
7311621 {
....@@ -752,6 +1642,18 @@
7521642 {
7531643 cameraView.ToggleOeil();
7541644 }
1645
+ else if(e.getSource() == shadowCB)
1646
+ {
1647
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1648
+ }
1649
+ else if(e.getSource() == freezeCB)
1650
+ {
1651
+ Globals.FREEZEONMOVE ^= true;
1652
+ }
1653
+ else if(e.getSource() == autokeepCB)
1654
+ {
1655
+ Globals.REPLACEONMAKE ^= true;
1656
+ }
7551657 else if(e.getSource() == lookAtCB)
7561658 {
7571659 cameraView.ToggleLookAt();
....@@ -768,7 +1670,8 @@
7681670
7691671 /**/
7701672 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1673
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1674
+ TreePath path = objEditor.jTree.getSelectionPath();
7721675 if ((path == null) || (path.getPathCount() <= 1)) {
7731676 // We can't move the root node or an empty selection
7741677 return;
....@@ -831,8 +1734,6 @@
8311734 }
8321735 }
8331736
834
- String string = (String) object;
835
-
8361737 System.out.println("Transfer = " + object + "; drop : " + target);
8371738 // if( object instanceof java.io.File[])
8381739 // {
....@@ -840,7 +1741,11 @@
8401741 // objEditor.DropFile((java.io.File[]) object, true);
8411742 // return;
8421743 // }
843
- if (string.charAt(0) == '/')
1744
+
1745
+ String string = object.toString();
1746
+
1747
+ // File path for Mac and Windows
1748
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441749 {
8451750 // file(s)
8461751 String[] names = string.split("\n");
....@@ -867,7 +1772,7 @@
8671772
8681773 flashIt = false;
8691774 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1775
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711776 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721777
8731778 if (group.selection.size() == 1)
....@@ -883,23 +1788,33 @@
8831788
8841789 assert target == objEditor.jTree;
8851790 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1791
+ Object3D destinationLeaf;
8861792 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1793
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881794 } catch (Exception e) {
8891795 System.out.println("destinationPath : " + destinationPath);
8901796 return;
8911797 }
8921798
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1799
+ for (int i=group.selection.size(); --i>=0;)
8941800 {
1801
+ Object3D child = (Object3D)group.selection.elementAt(i);
1802
+
1803
+ // Cannot move into itself
1804
+ if (child == destinationLeaf)
1805
+ return;
1806
+ }
1807
+
1808
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1809
+// {
8951810 loadClipboard(true);
8961811 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1812
+ pasteInto(false, false);
1813
+// } else {
1814
+// loadClipboard(false);
1815
+// objEditor.jTree.setSelectionPath(destinationPath);
1816
+// pasteInto(false, false); // true); // ???
1817
+// }
9031818 }
9041819 public void dropActionChanged(DropTargetDragEvent dtde)
9051820 // Called if the user has modified the current drop gesture
....@@ -955,7 +1870,12 @@
9551870 TreePath path;
9561871
9571872 public TransferableTreePath(TreePath tp) {
958
- path = tp;
1873
+ Object[] objs = new Object[tp.getPathCount()];
1874
+ for (int i=0; i<objs.length; i++)
1875
+ {
1876
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1877
+ }
1878
+ path = new TreePath(objs);
9591879 }
9601880
9611881 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1002,90 +1922,109 @@
10021922
10031923 void buildCreateMenu(Menu menu)
10041924 {
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);
1925
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1926
+ //heightFieldItem.addActionListener(this);
1927
+// gridItem = menu.add(new MenuItem("Grid"));
1928
+// gridItem.addActionListener(this);
1929
+// rectoidItem = menu.add(new MenuItem("Box"));
1930
+// rectoidItem.addActionListener(this);
1931
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1932
+// ellipsoidItem.addActionListener(this);
1933
+// coneItem = menu.add(new MenuItem("Cone"));
1934
+// coneItem.addActionListener(this);
1935
+// torusItem = menu.add(new MenuItem("Torus"));
1936
+// torusItem.addActionListener(this);
1937
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1938
+// superItem.addActionListener(this);
1939
+
1940
+ cameraItem = menu.add(new MenuItem("Camera"));
1941
+ cameraItem.addActionListener(this);
1942
+
1943
+ if (!Globals.ADVANCED)
1944
+ {
1945
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1946
+ kleinItem.addActionListener(this);
1947
+ }
1948
+
1949
+// particleItem = menu.add(new MenuItem("Particle system"));
1950
+// particleItem.addActionListener(this);
1951
+ if (Globals.ADVANCED)
1952
+ {
10191953 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201954 ragdollItem.addActionListener(this);
10211955 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221956 ragdoll2Item.addActionListener(this);
1957
+ }
10231958 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1959
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251960 meshItem.addActionListener(this);
10261961 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271962 // meshGroupItem.addActionListener(this);
1963
+ if (Globals.ADVANCED)
1964
+ {
10281965 springItem = menu.add(new MenuItem("Spring"));
10291966 springItem.addActionListener(this);
10301967 flagItem = menu.add(new MenuItem("Flag"));
10311968 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);
10361969 blobItem = menu.add(new MenuItem("Blob"));
10371970 blobItem.addActionListener(this);
10381971 latheItem = menu.add(new MenuItem("Lathe"));
10391972 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1973
+ }
1974
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1975
+ bezierItem.addActionListener(this);
1976
+// overlayItem = menu.add(new MenuItem("Overlay"));
1977
+// overlayItem.addActionListener(this);
1978
+// lightItem = menu.add(new MenuItem("Light"));
1979
+// lightItem.addActionListener(this);
10421980 menu.add("-");
10431981 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441982 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1983
+// loopItem = menu.add(new MenuItem("Loop"));
1984
+// loopItem.addActionListener(this);
10471985 doubleItem = menu.add(new MenuItem("Fork"));
10481986 doubleItem.addActionListener(this);
1987
+ if (Globals.ADVANCED)
1988
+ {
10491989 tripleItem = menu.add(new MenuItem("Trident"));
10501990 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);
1991
+ }
10601992 }
10611993
10621994 void buildToolsMenu(Menu menu)
10631995 {
10641996 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651997 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1998
+ animationItem.setState(Globals.ANIMATION);
1999
+
2000
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
2001
+ archiveItem.addActionListener(this);
10672002
10682003 menu.add("-");
10692004 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10702005 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
2006
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
2007
+ textureFieldItem.addActionListener(this);
2008
+ alignItem = menu.add(new MenuItem("Align Objects"));
10722009 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10752010 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10762011 reduceMorphItem.addActionListener(this);
10772012 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10782013 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10822014 menu.add("-");
1083
-
10842015 menu.add(memoryItem = new MenuItem("Memory Usage"));
10852016 memoryItem.addActionListener(this);
2017
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
2018
+ computeAOItem.addActionListener(this);
2019
+
2020
+ if (Globals.ADVANCED)
2021
+ {
2022
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
2023
+ mirrorItem.addActionListener(this);
2024
+ menu.add("-");
10862025 menu.add(analyzeItem = new MenuItem("Analyze"));
10872026 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
2027
+ menu.add(dumpItem = new MenuItem("Print"));
10892028 dumpItem.addActionListener(this);
10902029 // menu.add(pathItem = new MenuItem("From-to path"));
10912030 // pathItem.addActionListener(this);
....@@ -1094,6 +2033,8 @@
10942033 resetParentItem.addActionListener(this);
10952034 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10962035 repairParentItem.addActionListener(this);
2036
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
2037
+ repairShadowItem.addActionListener(this);
10972038 menu.add(invariantsItem = new MenuItem("Invariants"));
10982039 invariantsItem.addActionListener(this);
10992040 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +2042,7 @@
11012042 menu.add("-");
11022043 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11032044 editScriptItem.addActionListener(this);
2045
+ }
11042046 }
11052047
11062048 void ScreenFit()
....@@ -1223,9 +2165,34 @@
12232165 shadow.material = new cMaterial(obj.material);
12242166 shadow.material.diffuse = 0.0001f;
12252167 shadow.material.specular = 0.0001f;
2168
+ //shadow.projectedVertices[1].x = 300;
12262169
12272170 makeSomething(shadow);
12282171 }
2172
+
2173
+ private void ClearUnpinned()
2174
+ {
2175
+ //for (Object3D obj : listUI)
2176
+ for (int i=listUI.size(); --i>=0;)
2177
+ {
2178
+ Object3D obj = listUI.elementAt(i);
2179
+ if (!obj.pinned)
2180
+ {
2181
+ obj.CloseUI();
2182
+ listUI.remove(i);
2183
+ }
2184
+ }
2185
+ }
2186
+
2187
+ private void EditElement(Object3D elem, boolean newWindow)
2188
+ {
2189
+ // if (!(elem instanceof Composite))
2190
+ // newWindow = false;
2191
+ listUI.add(elem);
2192
+ elem.openEditWindow(this, newWindow); //, false);
2193
+ System.out.println("edit : " + elem);
2194
+ elem.editWindow.refreshContents(true); // ? new
2195
+ }
12292196
12302197 /**
12312198 * applyExample
....@@ -1429,9 +2396,9 @@
14292396
14302397 void Overwrite(int mask)
14312398 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2399
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332400 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2401
+ Object3D content = Grafreed.clipboard.get(0);
14352402
14362403 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372404 content = ((cGroup)content).get(0);
....@@ -1454,6 +2421,7 @@
14542421 //
14552422 public void actionPerformed(ActionEvent event) // , Object arg)
14562423 {
2424
+ Object source = event.getSource();
14572425 /*
14582426 if (event.getSource() == nameField)
14592427 {
....@@ -1465,11 +2433,11 @@
14652433 }
14662434 else
14672435 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2436
+ if (source == lookAtItem || source == lookFromItem)
14692437 {
14702438 ScreenFit();
14712439 } else
1472
- if (event.getSource() == switchItem)
2440
+ if (source == switchViewItem)
14732441 {
14742442 cVector v1 = new cVector();
14752443 cVector v2 = new cVector();
....@@ -1478,11 +2446,11 @@
14782446 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792447 objEditor.cameraView.repaint();
14802448 } else
1481
- if (event.getSource() == rectoidItem)
2449
+ if (source == rectoidItem || source == boxButton)
14822450 {
14832451 makeSomething(new Box());
14842452 } else
1485
- if (event.getSource() == particleItem)
2453
+ if (source == particleItem || source == particlesButton)
14862454 {
14872455 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882456 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2471,9 @@
15032471 applyExample(particleGeom, "SMOKE");
15042472 makeSomething(particleGeom);
15052473 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2474
+ if (source == ragdollItem || source == ragdoll2Item)
15072475 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2476
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092477
15102478 ragdoll.toParent = LA.newMatrix();
15112479 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2489,71 @@
15212489 makeSomething(ragdoll);
15222490 //makeSomething(new VehicleDemo());
15232491 } else
1524
- if (event.getSource() == gridItem)
2492
+ /*
2493
+ */
2494
+ if (source == heightFieldItem)
2495
+ {
2496
+ Object3D obj = new Object3D();
2497
+
2498
+ obj.CreateMaterial();
2499
+ obj.bRep = new BoundaryRep();
2500
+
2501
+ obj.bRep.CreateMesh(new iHeightField()
2502
+ {
2503
+ public double f(double x, double y)
2504
+ {
2505
+ // The Mandelbrot set is represented by coloring
2506
+ // each point (x,y) according to the number of
2507
+ // iterations it takes before the while loop in
2508
+ // this method ends. For points that are actually
2509
+ // in the Mandelbrot set, or very close to it, the
2510
+ // count will reach the maximum value, 80. These
2511
+ // points will be colored purple. All other colors
2512
+ // represent points that are definitely NOT in the set.
2513
+ x -= 600;
2514
+ y -= 500;
2515
+ x /= 200;
2516
+ y /= 200;
2517
+ int count = 0;
2518
+ double zx = x;
2519
+ double zy = y;
2520
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2521
+ double new_zx = zx*zx - zy*zy + x;
2522
+ zy = 2*zx*zy + y;
2523
+ zx = new_zx;
2524
+ count++;
2525
+ }
2526
+ return count; // Math.sqrt(count);
2527
+ }
2528
+ }, 1000,1000);
2529
+
2530
+ makeSomething(obj);
2531
+ } else
2532
+ if (source == gridItem || source == gridButton)
15252533 {
15262534 makeSomething(new Grid());
15272535 } else
1528
- if (event.getSource() == ellipsoidItem)
2536
+ if (source == ellipsoidItem || source == sphereButton)
15292537 {
15302538 makeSomething(new Sphere());
15312539 } else
1532
- if (event.getSource() == coneItem)
2540
+ if (source == coneItem || source == coneButton)
15332541 {
15342542 makeSomething(new Cone());
15352543 } else
1536
- if (event.getSource() == torusItem)
2544
+ if (source == torusItem || source == torusButton)
15372545 {
15382546 makeSomething(new Torus());
15392547 } else
1540
- if (event.getSource() == superItem)
2548
+ if (source == superItem || source == superButton)
15412549 {
15422550 makeSomething(new Superellipsoid());
15432551 } else
1544
- if (event.getSource() == blobItem)
2552
+ if (source == kleinItem || source == kleinButton)
2553
+ {
2554
+ makeSomething(new Klein());
2555
+ } else
2556
+ if (source == blobItem)
15452557 {
15462558 Blob blob = new Blob();
15472559 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2561,15 @@
15492561 //blob.retile();
15502562 makeSomething(blob);
15512563 } else
1552
- if (event.getSource() == latheItem)
2564
+ if (source == latheItem)
15532565 {
15542566 makeSomething(new Lathe());
15552567 } else
1556
- if (event.getSource() == bezierItem)
2568
+ if (source == bezierItem)
15572569 {
15582570 makeSomething(new BezierSurface());
15592571 } else
1560
- if (event.getSource() == checkerItem)
2572
+ if (source == overlayItem || source == overlayButton)
15612573 {
15622574 /*
15632575 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2582,9 @@
15702582 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712583 LA.matInvert(obj.toParent, obj.fromParent);
15722584 */
1573
- makeSomething(new CheckerIG());
2585
+ makeSomething(new Checker());
15742586 } else
1575
- if (event.getSource() == meshItem)
2587
+ if (source == meshItem)
15762588 {
15772589 Object3D itemtomake = new Object3D();
15782590 Object3D child;
....@@ -1593,35 +2605,52 @@
15932605 makeSomething(child);
15942606 }
15952607 } else
1596
- if (event.getSource() == springItem)
2608
+ if (source == springItem)
15972609 {
15982610 cSpring s = new cSpring();
15992611 s.setup();
16002612 makeSomething(s);
16012613 } else
1602
- if (event.getSource() == flagItem)
2614
+ if (source == flagItem)
16032615 {
16042616 cSpring s = new cFlag();
16052617 s.setup();
16062618 makeSomething(s);
16072619 } else
1608
- if (event.getSource() == lightItem)
2620
+ if (source == lightItem || source == lightButton)
16092621 {
16102622 makeSomething(new Light());
16112623 } else
1612
- if (event.getSource() == csgItem)
2624
+// if (source == skybox1Button ||
2625
+// source == skybox2Button ||
2626
+// source == skybox3Button ||
2627
+// source == skybox4Button ||
2628
+// source == skybox5Button ||
2629
+// source == skybox6Button ||
2630
+// source == skybox7Button ||
2631
+// source == skybox11Button ||
2632
+// source == skybox12Button ||
2633
+// source == skybox13Button ||
2634
+// source == skybox14Button ||
2635
+// source == skybox15Button ||
2636
+// source == skybox16Button ||
2637
+// source == skybox17Button)
2638
+// {
2639
+// ChangeSkybox(source);
2640
+// } else
2641
+ if (source == csgItem)
16132642 {
16142643 group(new CSG());
16152644 } else
1616
- if (event.getSource() == templateItem)
2645
+ if (source == templateItem)
16172646 {
16182647 group(new cTemplate());
16192648 } else
1620
- if (event.getSource() == attributeItem)
2649
+ if (source == attributeItem)
16212650 {
16222651 makeSomething(new Attribute());
16232652 } else
1624
- if (event.getSource() == pointflowItem)
2653
+ if (source == pointflowItem)
16252654 {
16262655 makeSomething(new PointFlow());
16272656 } else
....@@ -1633,7 +2662,7 @@
16332662 } else
16342663 */
16352664
1636
- if (event.getSource() == superLoopItem)
2665
+ if (source == superLoopItem)
16372666 {
16382667 Composite g = new cGroup();
16392668 for (int i=0; i<15; i++)
....@@ -1655,30 +2684,38 @@
16552684
16562685 group(g);
16572686 } else
1658
- if (event.getSource() == loopItem)
2687
+ if (source == loopItem || source == loopButton)
16592688 {
2689
+ if (!group.selection.isEmpty())
2690
+ {
16602691 Composite csg = new GroupLeaf();
16612692 csg.count = 5;
1662
- group(csg);
1663
- Composite child = new cGroup();
2693
+ Composite child = new cGroup("Branch");
16642694 csg.addChild(child);
16652695 child.addChild(csg);
2696
+ group(csg);
2697
+ }
16662698 } else
1667
- if (event.getSource() == doubleItem)
2699
+ if (source == doubleItem)
16682700 {
1669
- Composite csg = new GroupLeaf();
2701
+ if (!group.selection.isEmpty())
2702
+ {
2703
+ Composite csg = new GroupLeaf("Fork");
16702704 csg.count = 5;
2705
+ Composite child = new cGroup("Branch A");
2706
+ csg.addChild(child);
2707
+ child.addChild(csg);
2708
+ child = new cGroup("Branch B");
2709
+ csg.addChild(child);
2710
+ child.addChild(csg);
16712711 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);
2712
+ }
16782713 } else
1679
- if (event.getSource() == tripleItem)
2714
+ if (source == tripleItem)
16802715 {
1681
- Composite csg = new GroupLeaf();
2716
+ if (!group.selection.isEmpty())
2717
+ {
2718
+ Composite csg = new GroupLeaf("Trident");
16822719 csg.count = 4;
16832720 group(csg);
16842721 Composite child = new cGroup();
....@@ -1690,74 +2727,119 @@
16902727 child = new cGroup();
16912728 csg.addChild(child);
16922729 child.addChild(csg);
2730
+ }
16932731 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2732
+ if (source == computeAOItem)
16962733 {
1697
- ImportGFD();
2734
+ Globals.drawMode = CameraPane.OCCLUSION;
2735
+ cameraView.repaint();
16982736 } 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)
2737
+ if (source == recompileItem)
17172738 {
17182739 Recompile();
17192740 refreshContents();
17202741 } else
1721
- if (event.getSource() == editScriptItem)
2742
+ if (source == editScriptItem)
17222743 {
17232744 OpenDialog();
17242745 refreshContents();
17252746 } else
1726
- if (event.getSource() == invariantsItem)
2747
+ if (source == invariantsItem)
17272748 {
17282749 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2750
+ Grafreed.grafreed.universe.invariants();
17302751 } else
1731
- if (event.getSource() == memoryItem)
2752
+ if (source == memoryItem)
17322753 {
17332754 //System.out.println("Invariants:");
17342755 PrintMemory();
17352756 } else
1736
- if (event.getSource() == pathItem)
2757
+ if (source == pathItem)
17372758 {
17382759 PrintPath();
17392760 } else
1740
- if (event.getSource() == analyzeItem)
2761
+ if (source == analyzeItem)
17412762 {
17422763 AnalyzeObject();
17432764 } else
1744
- if (event.getSource() == dumpItem)
2765
+ if (source == dumpItem)
17452766 {
17462767 DumpObject();
17472768 } else
1748
- if (event.getSource() == screenfitButton)
2769
+ if (source == minButton)
17492770 {
1750
- //Reload(lastConverter, lastFilename, true);
2771
+ Minimize();
2772
+ } else
2773
+ if (source == maxButton)
2774
+ {
2775
+ Maximize();
2776
+ } else
2777
+ if (source == fullButton)
2778
+ {
2779
+ ToggleFullScreen();
2780
+ } else
2781
+ if (source == collapseButton)
2782
+ {
2783
+ this.expandedLayout = radio.layout;
2784
+ CollapseToolbar();
2785
+ } else
2786
+ if (source == maximize3DButton)
2787
+ {
2788
+ this.expandedLayout = radio.layout;
2789
+ radio.layout = twoButton;
2790
+ Show3DView();
2791
+ CollapseToolbar();
2792
+ } else
2793
+ if (source == previousVersionButton)
2794
+ {
2795
+ // Go to previous version
2796
+ //if (!Undo())
2797
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2798
+ PreviousVersion();
2799
+ } else
2800
+ if (source == restoreButton)
2801
+ {
2802
+ // Restore current version
2803
+ Restore();
2804
+ //restoreButton.setEnabled(false);
2805
+ } else
2806
+ if (source == replaceButton)
2807
+ {
2808
+ // Overwrite current version
2809
+ Replace();
2810
+ //replaceButton.setEnabled(false);
2811
+ } else
2812
+ if (source == nextVersionButton)
2813
+ {
2814
+ // Go to next version
2815
+ NextVersion();
2816
+ } else
2817
+ if (source == saveVersionButton)
2818
+ {
2819
+ // Save a new version
2820
+ if (!Save(true))
2821
+ java.awt.Toolkit.getDefaultToolkit().beep();
2822
+ } else
2823
+ if (source == deleteVersionButton)
2824
+ {
2825
+ // Delete a new version
2826
+ DeleteVersion();
2827
+ } else
2828
+ if (source == oneStepButton)
2829
+ {
2830
+ Globals.ONESTEP = true;
2831
+ cameraView.repaint();
2832
+ } else
2833
+ if (source == screenfitButton)
2834
+ {
17512835 ScreenFit();
17522836 } else
1753
- if (event.getSource() == screenfitpointButton)
2837
+ if (source == screenfitpointButton)
17542838 {
1755
- //Reload(lastConverter, lastFilename, true);
17562839 ScreenFitPoint();
17572840 } else
1758
- if (event.getSource() == snapobjectButton)
2841
+ if (source == snapobjectButton)
17592842 {
1760
- //Reload(lastConverter, lastFilename, true);
17612843 SnapObject();
17622844 } else
17632845 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2848,13 @@
17662848 // Recompile();
17672849 // refreshContents();
17682850 // } else
1769
- if (event.getSource() == gcButton)
2851
+ if (source == gcButton)
17702852 {
17712853 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722854 System.gc();
17732855 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742856 } else
1775
- if (event.getSource() == editLeafItem)
2857
+ if (source == editLeafItem)
17762858 {
17772859 Object3D obj;
17782860 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2868,78 @@
17862868 }
17872869 refreshContents(true);
17882870 } else
1789
- if (event.getSource() == openWindowItem)
2871
+ if (source == openWindowItem)
17902872 {
17912873 EditSelection(true);
17922874 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2875
+ if (source == cutItem || source == clearButton)
17942876 {
17952877 loadClipboard(true);
17962878 } else
1797
- if (event.getSource() == duplicateItem)
2879
+ if (source == undoItem)
17982880 {
1799
- Object3D keep = GraphreeD.clipboard;
2881
+ PreviousVersion();
2882
+ } else
2883
+ if (source == redoItem)
2884
+ {
2885
+ NextVersion();
2886
+ } else
2887
+ if (source == duplicateItem)
2888
+ {
2889
+ Object3D keep = Grafreed.clipboard;
18002890 loadClipboard(false);
18012891 paste(false);
1802
- GraphreeD.clipboard = keep;
2892
+ Grafreed.clipboard = keep;
18032893 } else
1804
- if (event.getSource() == cloneItem)
2894
+ if (source == cloneItem)
18052895 {
18062896 CloneSelection(false);
18072897 } else
1808
- if (event.getSource() == cloneSupportItem)
2898
+ if (source == cloneSupportItem)
18092899 {
18102900 CloneSelection(true);
18112901 } else
1812
- if (event.getSource() == copyItem)
2902
+ if (source == copyItem)
18132903 {
18142904 loadClipboard(false);
18152905 } else
1816
- if (event.getSource() == pasteItem)
2906
+ if (source == pasteItem)
18172907 {
18182908 paste(false);
18192909 } else
1820
- if (event.getSource() == pasteLinkItem)
2910
+ if (source == pasteIntoItem)
18212911 {
1822
- pasteInto(false);
2912
+ pasteInto(true, false);
18232913 } else
1824
- if (event.getSource() == pasteCloneItem)
2914
+ if (source == pasteLinkItem)
18252915 {
1826
- pasteInto(true);
2916
+ pasteInto(false, false);
18272917 } else
1828
- if (event.getSource() == pasteExpandItem)
2918
+ if (source == pasteCloneItem)
2919
+ {
2920
+ pasteInto(true, true);
2921
+ } else
2922
+ if (source == pasteExpandItem)
18292923 {
18302924 paste(true);
18312925 } else
1832
- if (event.getSource() == synchronizeItem)
2926
+ if (source == synchronizeItem)
18332927 {
18342928 Overwrite(Object3D.TRANSFORM);
18352929 } else
1836
- if (event.getSource() == overwriteNameItem)
2930
+ if (source == overwriteNameItem)
18372931 {
18382932 Overwrite(Object3D.NAME);
18392933 } else
1840
- if (event.getSource() == overwriteUVItem)
2934
+ if (source == overwriteUVItem)
18412935 {
18422936 Overwrite(Object3D.UV);
18432937 } else
1844
- if (event.getSource() == overwriteMatItem)
2938
+ if (source == overwriteMatItem)
18452939 {
2940
+ /* july 2015
18462941 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2942
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482943 else
18492944 {
18502945 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2951,16 @@
18562951 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572952 }
18582953 }
2954
+ */
2955
+
2956
+ Overwrite(dropAttributes);
18592957 }
1860
- if (event.getSource() == overwriteGeoItem)
2958
+ if (source == overwriteGeoItem)
18612959 {
18622960 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2961
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642962 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2963
+// Object3D content = GrafreeD.clipboard.get(0);
18662964 //
18672965 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682966 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2972,7 @@
18742972 // refreshContents();
18752973 // }
18762974 } else
1877
- if (event.getSource() == generateMeshItem)
2975
+ if (source == generateMeshItem)
18782976 {
18792977 //if (group.selection.size() == 1)
18802978 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2983,7 @@
18852983 ResetModel();
18862984 refreshContents();
18872985 } else
1888
- if (event.getSource() == extractGeometriesItem)
2986
+ if (source == extractGeometriesItem)
18892987 {
18902988 boolean one = false;
18912989
....@@ -1912,7 +3010,7 @@
19123010 ResetModel();
19133011 refreshContents();
19143012 } else
1915
- if (event.getSource() == cloneGeometriesItem)
3013
+ if (source == cloneGeometriesItem)
19163014 {
19173015 boolean one = false;
19183016
....@@ -1938,32 +3036,37 @@
19383036 ResetModel();
19393037 refreshContents();
19403038 } else
1941
- if (event.getSource() == shareGeometriesItem)
3039
+ if (source == shareGeometriesItem)
19423040 {
19433041 boolean one = false;
19443042
19453043 if (group.selection.size() == 1)
19463044 one = true;
19473045
3046
+ Object3D merge = null;
3047
+
19483048 Object3D content = new cGroup();
19493049
19503050 for (int i=0; i<group.selection.size(); i++)
19513051 {
1952
- Object3D sel = new Merge(group.selection.get(i));
3052
+ merge = new Merge(group.selection.get(i));
19533053
19543054 if (one)
1955
- makeSomething(sel, false);
3055
+ makeSomething(merge, false);
19563056 else
1957
- content.addChild(sel);
3057
+ content.addChild(merge);
19583058 }
19593059
19603060 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
3061
+ makeSomething(content, true);
3062
+ else
3063
+ {
3064
+ ResetModel();
3065
+ Select(merge.GetTreePath(), true, false); // unselect... false);
3066
+ refreshContents();
3067
+ }
19653068 } else
1966
- if (event.getSource() == mergeGeometriesItem)
3069
+ if (source == mergeGeometriesItem)
19673070 {
19683071 boolean one = false;
19693072
....@@ -1993,11 +3096,11 @@
19933096 ResetModel();
19943097 refreshContents();
19953098 } else
1996
- if (event.getSource() == linkverticesItem)
3099
+ if (source == linkverticesItem)
19973100 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3101
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19993102 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
3103
+// Object3D content = GrafreeD.clipboard.get(0);
20013104 //
20023105 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20033106 // content = ((cGroup)content).get(0);
....@@ -2006,39 +3109,48 @@
20063109 // group.selection.get(0).setMasterThis(content); // should be identity
20073110 // refreshContents();
20083111 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3112
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20103113 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
3114
+ Object3D content = Grafreed.clipboard.get(0);
20123115
20133116 if (content instanceof cGroup && ((cGroup)content).transientlink )
20143117 content = ((cGroup)content).get(0);
20153118
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3119
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20173120 for (int i=0; i<group.selection.size(); i++)
20183121 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
3122
+ boolean random = CameraPane.SWITCH;
3123
+ CameraPane.SWITCH = false; // parse all random nodes
20213124 group.selection.get(i).linkVerticesThis(content);
20223125 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
3126
+ CameraPane.SWITCH = random;
20243127 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3128
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20263129 refreshContents();
20273130 }
20283131 } else
2029
- if (event.getSource() == resetsupportItem)
3132
+ if (source == resetsupportItem)
20303133 {
20313134 for (int i=0; i<group.selection.size(); i++)
20323135 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
3136
+ boolean random = CameraPane.SWITCH;
3137
+ CameraPane.SWITCH = false; // parse all random nodes
20353138 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
3139
+ CameraPane.SWITCH = random;
20373140 }
20383141
20393142 refreshContents();
20403143 } else
2041
- if (event.getSource() == resetreferencesItem)
3144
+ if (source == relinkverticesItem)
3145
+ {
3146
+ boolean random = CameraPane.SWITCH;
3147
+ CameraPane.SWITCH = false; // parse all random nodes
3148
+ group.selection.RelinkToSupport();
3149
+ CameraPane.SWITCH = random;
3150
+
3151
+ refreshContents();
3152
+ } else
3153
+ if (source == resetreferencesItem)
20423154 {
20433155 for (int i=0; i<group.selection.size(); i++)
20443156 {
....@@ -2047,11 +3159,11 @@
20473159
20483160 refreshContents();
20493161 } else
2050
- if (event.getSource() == setMasterItem)
3162
+ if (source == setMasterItem)
20513163 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3164
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20533165 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
3166
+ Object3D content = Grafreed.clipboard.get(0);
20553167
20563168 if (content instanceof cGroup && ((cGroup)content).transientlink )
20573169 content = ((cGroup)content).get(0);
....@@ -2060,13 +3172,13 @@
20603172 refreshContents();
20613173 }
20623174 } else
2063
- if (event.getSource() == poseMeshItem)
3175
+ if (source == poseMeshItem)
20643176 {
20653177 if (group.selection.size() == 1)
20663178 {
2067
- if (GraphreeD.clipboard.size() == 1)
3179
+ if (Grafreed.clipboard.size() == 1)
20683180 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
3181
+ Object3D content = Grafreed.clipboard.get(0);
20703182
20713183 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723184 content = ((cGroup)content).get(0);
....@@ -2079,19 +3191,19 @@
20793191 }
20803192
20813193 } else
2082
- if (event.getSource() == revertMeshItem)
3194
+ if (source == revertMeshItem)
20833195 {
20843196 RevertMeshes();
20853197 } else
2086
- if (event.getSource() == resetMeshItem)
3198
+ if (source == resetAllItem)
20873199 {
20883200 ResetAll();
20893201 } else
2090
- if (event.getSource() == stepAllItem)
3202
+ if (source == stepAllItem)
20913203 {
20923204 StepAll();
20933205 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3206
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953207 {
20963208 //int indices[] = jList.getSelectedIndices();
20973209 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3211,46 @@
20993211
21003212 ClearSelection(false);
21013213 } else
2102
- if (event.getSource() == clearAllItem)
3214
+ if (source == clearAllItem)
21033215 {
21043216 ClearSelection(true);
21053217 } else
2106
- if (event.getSource() == grabItem)
3218
+ if (source == grabItem || source == groupButton)
21073219 {
2108
- group(new cGroup(), true);
3220
+ group(new cGroup(), false); // true);
21093221 } else
2110
- if (event.getSource() == frontItem)
3222
+ if (source == hideItem)
3223
+ {
3224
+ group(new HiddenObject());
3225
+ } else
3226
+ if (source == frontItem)
21113227 {
21123228 front();
21133229 } else
2114
- if (event.getSource() == backItem)
3230
+ if (source == backItem)
21153231 {
21163232 back();
21173233 } else
2118
- if (event.getSource() == cameraItem)
3234
+ if (source == cameraItem)
21193235 {
21203236 makeSomething(new Camera());
21213237 } else
2122
- if (event.getSource() == compositeItem)
3238
+ if (source == compositeItem || source == compositeButton)
21233239 {
21243240 group(new Composite());
21253241 } else
2126
- if (event.getSource() == randomItem)
3242
+ if (source == switchItem || source == switchButton)
21273243 {
21283244 RandomNode random = new RandomNode();
21293245 group(random);
21303246 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3247
+ random.name = random.get(0).name + "Switch";
21323248 } else
2133
- if (event.getSource() == physicsItem)
3249
+ if (source == physicsItem)
21343250 {
21353251 group(new PhysicsNode());
21363252 } else
2137
- if (event.getSource() == frameselectorItem)
3253
+ if (source == frameselectorItem)
21383254 {
21393255 for (int i=0; i<group.selection.size(); i++)
21403256 {
....@@ -2146,7 +3262,7 @@
21463262 ResetModel();
21473263 refreshContents();
21483264 } else
2149
- if (event.getSource() == switchGeoItem)
3265
+ if (source == switchGeoItem)
21503266 {
21513267 for (int i=0; i<group.selection.size(); i++)
21523268 {
....@@ -2158,7 +3274,7 @@
21583274 ResetModel();
21593275 refreshContents();
21603276 } else
2161
- if (event.getSource() == switchTransfoItem)
3277
+ if (source == switchTransfoItem)
21623278 {
21633279 for (int i=0; i<group.selection.size(); i++)
21643280 {
....@@ -2170,7 +3286,7 @@
21703286 ResetModel();
21713287 refreshContents();
21723288 } else
2173
- if (event.getSource() == morphItem)
3289
+ if (source == morphItem)
21743290 {
21753291 for (int i=0; i<group.selection.size(); i++)
21763292 {
....@@ -2182,7 +3298,7 @@
21823298 ResetModel();
21833299 refreshContents();
21843300 } else
2185
- if (event.getSource() == scriptNodeItem)
3301
+ if (source == scriptNodeItem)
21863302 {
21873303 boolean atleastone = false;
21883304
....@@ -2221,191 +3337,264 @@
22213337 }
22223338 }
22233339 } else
2224
- if (event.getSource() == linkerItem)
3340
+ if (source == linkerItem)
22253341 {
22263342 group(new cLinker());
22273343 } else
2228
- if (event.getSource() == textureItem)
3344
+ if (source == textureItem || source == textureButton)
22293345 {
22303346 group(new TextureNode());
22313347 } else
2232
- if (event.getSource() == shadowXItem)
3348
+ if (source == billboardItem)
3349
+ {
3350
+ group(new BillboardNode());
3351
+ } else
3352
+ if (source == shadowXItem)
22333353 {
22343354 CastShadow(0);
22353355 } else
2236
- if (event.getSource() == shadowYItem)
3356
+ if (source == shadowYItem)
22373357 {
22383358 CastShadow(1);
22393359 } else
2240
- if (event.getSource() == shadowZItem)
3360
+ if (source == shadowZItem)
22413361 {
22423362 CastShadow(2);
22433363 } else
2244
- if (event.getSource() == ungroupItem)
3364
+ if (source == ungroupItem || source == ungroupButton)
22453365 {
2246
- ungroup();
3366
+ boolean canUngroup = true;
3367
+
3368
+ for (int i=0; i<group.selection.size(); i++)
3369
+ {
3370
+ Object3D selectedItem = group.selection.get(i);
3371
+
3372
+ if (selectedItem.Size() == 0)
3373
+ {
3374
+ // Cannot ungroup leaves
3375
+ canUngroup = false;
3376
+ break;
3377
+ }
3378
+
3379
+ if (selectedItem == group)
3380
+ {
3381
+ // Cannot ungroup root
3382
+ canUngroup = false;
3383
+ break;
3384
+ }
3385
+ }
3386
+
3387
+ if (canUngroup)
3388
+ {
3389
+ for (int i=0; i<group.selection.size(); i++)
3390
+ {
3391
+ Object3D selectedItem = group.selection.get(i);
3392
+
3393
+ Ungroup(selectedItem);
3394
+ }
3395
+
3396
+ ClearSelection(false);
3397
+
3398
+ refreshContents();
3399
+ }
22473400 } else
2248
- if (event.getSource() == genUVItem)
3401
+ if (source == genUVItem)
22493402 {
22503403 GenUV();
22513404 } else
2252
- if (event.getSource() == genNormalsCADItem)
3405
+ if (source == genNormalsCADItem)
22533406 {
22543407 GenNormals(true);
22553408 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3409
+ if (source == genNormalsMESHItem)
3410
+ {
3411
+ GenNormalsMESH();
3412
+ } else
3413
+ if (source == genNormalsORGANItem)
22573414 {
22583415 GenNormals(false);
22593416 } else
2260
- if (event.getSource() == stripifyItem)
3417
+ if (source == genNormalsMINEItem)
3418
+ {
3419
+ GenNormalsMINE();
3420
+ } else
3421
+ if (source == stripifyItem)
22613422 {
22623423 Stripify();
22633424 } else
2264
- if (event.getSource() == unstripifyItem)
3425
+ if (source == unstripifyItem)
22653426 {
22663427 Unstripify();
22673428 } else
2268
- if (event.getSource() == trimItem)
3429
+ if (source == trimItem)
22693430 {
22703431 Trim();
22713432 } else
2272
- if (event.getSource() == untrimItem)
3433
+ if (source == untrimItem)
22733434 {
22743435 Untrim();
22753436 } else
2276
- if (event.getSource() == clearColorsItem)
3437
+ if (source == clearColorsItem)
22773438 {
22783439 ClearColors();
22793440 } else
2280
- if (event.getSource() == clearMaterialsItem)
3441
+ if (source == clearMaterialsItem)
22813442 {
22823443 ClearMaterials();
22833444 } else
2284
- if (event.getSource() == liveleavesItem)
3445
+ if (source == liveleavesItem)
22853446 {
22863447 LiveLeaves(true);
22873448 } else
2288
- if (event.getSource() == unliveleavesItem)
3449
+ if (source == unliveleavesItem)
22893450 {
22903451 LiveLeaves(false);
22913452 } else
2292
- if (event.getSource() == supportleavesItem)
3453
+ if (source == supportleavesItem)
22933454 {
22943455 SupportLeaves(true);
22953456 } else
2296
- if (event.getSource() == unsupportleavesItem)
3457
+ if (source == unsupportleavesItem)
22973458 {
22983459 SupportLeaves(false);
22993460 } else
2300
- if (event.getSource() == hideleavesItem)
3461
+ if (source == hideleavesItem)
23013462 {
23023463 HideLeaves(true);
23033464 } else
2304
- if (event.getSource() == showleavesItem)
3465
+ if (source == showleavesItem)
23053466 {
23063467 HideLeaves(false);
23073468 } else
2308
- if (event.getSource() == markleavesItem)
3469
+ if (source == markleavesItem)
23093470 {
23103471 MarkLeaves(true);
23113472 } else
2312
- if (event.getSource() == unmarkleavesItem)
3473
+ if (source == unmarkleavesItem)
23133474 {
23143475 MarkLeaves(false);
23153476 } else
2316
- if (event.getSource() == flipVItem)
3477
+ if (source == rewindleavesItem)
3478
+ {
3479
+ RewindLeaves(true);
3480
+ } else
3481
+ if (source == unrewindleavesItem)
3482
+ {
3483
+ RewindLeaves(false);
3484
+ } else
3485
+ if (source == randomleavesItem)
3486
+ {
3487
+ RandomLeaves(true);
3488
+ } else
3489
+ if (source == unrandomleavesItem)
3490
+ {
3491
+ RandomLeaves(false);
3492
+ } else
3493
+ if (source == flipVItem)
23173494 {
23183495 FlipV(true);
23193496 } else
2320
- if (event.getSource() == unflipVItem)
3497
+ if (source == unflipVItem)
23213498 {
23223499 FlipV(false);
23233500 } else
2324
- if (event.getSource() == lowTexturesItem)
3501
+ if (source == lowTexturesItem)
23253502 {
23263503 SetTexRes(0);
23273504 } else
2328
- if (event.getSource() == normalTexturesItem)
3505
+ if (source == normalTexturesItem)
23293506 {
23303507 SetTexRes(1);
23313508 } else
2332
- if (event.getSource() == highTexturesItem)
3509
+ if (source == highTexturesItem)
23333510 {
23343511 SetTexRes(2);
23353512 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3513
+ if (source == veryhighTexturesItem)
23373514 {
23383515 SetTexRes(3);
23393516 } else
2340
- if (event.getSource() == maxTexturesItem)
3517
+ if (source == maxTexturesItem)
23413518 {
23423519 SetTexRes(4);
23433520 } else
2344
- if (event.getSource() == panoTexturesItem)
3521
+ if (source == panoTexturesItem)
23453522 {
23463523 SetTexRes(5);
23473524 } else
2348
- if (event.getSource() == reverseNormalsItem)
3525
+ if (source == reverseNormalsItem)
23493526 {
23503527 ReverseNormals();
23513528 } else
2352
- if (event.getSource() == parseverticesItem)
3529
+ if (source == parseverticesItem)
23533530 {
23543531 ParseVertices();
23553532 } else
2356
- if (event.getSource() == alignItem)
3533
+ if (source == textureFieldItem)
3534
+ {
3535
+ TextureVertices();
3536
+ } else
3537
+ if (source == alignItem)
23573538 {
23583539 Align();
23593540 } else
2360
- if (event.getSource() == mirrorItem)
3541
+ if (source == mirrorItem)
23613542 {
23623543 MirrorPoses();
23633544 } else
2364
- if (event.getSource() == reduceMorphItem)
3545
+ if (source == reduceMorphItem)
23653546 {
23663547 MeshReduction(false);
23673548 } else
2368
- if (event.getSource() == reduce34MorphItem)
3549
+ if (source == reduce34MorphItem)
23693550 {
23703551 MeshReduction(true);
23713552 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3553
+ if (source == reverseTrianglesItem)
23733554 {
23743555 ReverseTriangles();
23753556 } else
2376
- if (event.getSource() == reduceMeshItem)
3557
+ if (source == reduceMeshItem)
23773558 {
23783559 ReduceMesh(false);
23793560 } else
2380
- if (event.getSource() == reduce34MeshItem)
3561
+ if (source == reduce34MeshItem)
23813562 {
23823563 ReduceMesh(true);
23833564 } else
2384
- if (event.getSource() == increaseMeshItem)
3565
+ if (source == increaseMeshItem)
23853566 {
23863567 IncreaseMesh();
23873568 } else
2388
- if (event.getSource() == clipMeshItem)
3569
+ if (source == clipMeshItem)
23893570 {
23903571 ClipMesh();
23913572 } else
2392
- if (event.getSource() == smoothMeshItem)
3573
+ if (source == smoothMeshItem)
23933574 {
23943575 SmoothMesh();
23953576 } else
2396
- if (event.getSource() == transformgeometryItem)
3577
+ if (source == transformGeometryItem)
23973578 {
23983579 TransformGeometry();
23993580 } else
2400
- if (event.getSource() == resetTransformItem)
3581
+ if (source == transformChildrenItem)
3582
+ {
3583
+ TransformChildren();
3584
+ } else
3585
+ if (source == resetTransformItem)
24013586 {
24023587 ResetTransform();
24033588 } else
2404
- if (event.getSource() == resetCentroidItem)
3589
+ if (source == resetCentroidItem)
24053590 {
2406
- ResetCentroid();
3591
+ ResetCentroid(true);
24073592 } else
2408
- if (event.getSource() == resetParentItem)
3593
+ if (source == resetCentroidXZItem)
3594
+ {
3595
+ ResetCentroid(false);
3596
+ } else
3597
+ if (source == resetParentItem)
24093598 {
24103599 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113600 {
....@@ -2415,7 +3604,7 @@
24153604
24163605 refreshContents();
24173606 } else
2418
- if (event.getSource() == repairParentItem)
3607
+ if (source == repairParentItem)
24193608 {
24203609 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213610 {
....@@ -2429,7 +3618,21 @@
24293618
24303619 refreshContents();
24313620 } else
2432
- if (event.getSource() == sortbysizeItem)
3621
+ if (source == repairShadowItem)
3622
+ {
3623
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3624
+ {
3625
+ Object3D obj = (Object3D)e.nextElement();
3626
+ obj.RepairShadow();
3627
+// for (int i=0; i<obj.size(); i++)
3628
+// {
3629
+// obj.get(i).parent = obj;
3630
+// }
3631
+ }
3632
+
3633
+ refreshContents();
3634
+ } else
3635
+ if (source == sortbysizeItem)
24333636 {
24343637 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353638 {
....@@ -2441,7 +3644,7 @@
24413644 ResetModel();
24423645 refreshContents();
24433646 } else
2444
- if (event.getSource() == sortbynameItem)
3647
+ if (source == sortbynameItem)
24453648 {
24463649 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473650 {
....@@ -2453,7 +3656,7 @@
24533656 ResetModel();
24543657 refreshContents();
24553658 } else
2456
- if (event.getSource() == attachPigmentItem)
3659
+ if (source == attachPigmentItem)
24573660 {
24583661 String texture = GetFile("Attach pigment");
24593662 Object3D obj;
....@@ -2465,7 +3668,7 @@
24653668
24663669 refreshContents();
24673670 } else
2468
- if (event.getSource() == detachPigmentItem)
3671
+ if (source == detachPigmentItem)
24693672 {
24703673 Object3D obj;
24713674 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3679,7 @@
24763679
24773680 refreshContents();
24783681 } else
2479
- if (event.getSource() == attachBumpItem)
3682
+ if (source == attachBumpItem)
24803683 {
24813684 String texture = GetFile("Attach bump");
24823685 Object3D obj;
....@@ -2488,18 +3691,18 @@
24883691
24893692 refreshContents();
24903693 } else
2491
- if (event.getSource() == detachBumpItem)
3694
+ if (source == detachBumpItem)
24923695 {
24933696 Object3D obj;
24943697 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953698 {
24963699 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3700
+ obj.ResetBumpTexture();
24983701 }
24993702
25003703 refreshContents();
25013704 } else
2502
- if (event.getSource() == pigmentBumpItem)
3705
+ if (source == pigmentBumpItem)
25033706 {
25043707 Object3D obj;
25053708 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,159 +3713,233 @@
25103713
25113714 refreshContents();
25123715 } else
2513
- if (event.getSource() == flashSelectionButton)
3716
+ if (source == embedTexturesItem)
3717
+ {
3718
+ Object3D obj;
3719
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3720
+ {
3721
+ obj = (Object3D)e.nextElement();
3722
+ obj.EmbedTextures(true);
3723
+ }
3724
+
3725
+ refreshContents();
3726
+ } else
3727
+ if (source == deEmbedTexturesItem)
3728
+ {
3729
+ Object3D obj;
3730
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3731
+ {
3732
+ obj = (Object3D)e.nextElement();
3733
+ obj.EmbedTextures(false);
3734
+ }
3735
+
3736
+ CameraPane.texturepigment.clear();
3737
+ CameraPane.texturebump.clear();
3738
+
3739
+ refreshContents();
3740
+ } else
3741
+ if (source == flashSelectionButton)
25143742 {
25153743 CameraPane.flash = true;
25163744 refreshContents();
25173745 } else
2518
- if (event.getSource() == oneButton)
3746
+ if (source == oneButton)
25193747 {
25203748 } else
2521
- if (event.getSource() == twoButton)
3749
+ if (source == twoButton)
25223750 {
25233751 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();
3752
+
3753
+ if (CameraPane.FULLSCREEN)
3754
+ fullscreenLayout = radio.layout;
3755
+
3756
+ Show3DView();
3757
+
3758
+ cameraView.requestFocusInWindow();
3759
+
3760
+// refreshContents(true);
3761
+//
3762
+// try
3763
+// {
3764
+// java.awt.Robot bot = new java.awt.Robot();
3765
+// int mask = InputEvent.BUTTON1_MASK;
3766
+// bot.mouseMove(100, 100);
3767
+// bot.mousePress(mask);
3768
+// bot.mouseRelease(mask);
3769
+// }
3770
+// catch (Exception e)
3771
+// {
3772
+//
3773
+// }
3774
+
25513775 } else
2552
- if (event.getSource() == threeButton)
3776
+ if (source == threeButton)
25533777 {
25543778 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();
3779
+
3780
+ if (CameraPane.FULLSCREEN)
3781
+ fullscreenLayout = radio.layout;
3782
+
3783
+// bigThree.remove(scenePanel);
3784
+// bigThree.remove(centralPanel);
3785
+// bigThree.remove(XYZPanel);
3786
+// aWindowConstraints.gridx = 0;
3787
+// aWindowConstraints.gridy = 0;
3788
+// aWindowConstraints.gridwidth = 1;
3789
+// // aConstraints.gridheight = 3;
3790
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3791
+// aWindowConstraints.weightx = 0;
3792
+// aWindowConstraints.weighty = 1;
3793
+// //bigThree.add(jtp, aWindowConstraints);
3794
+// aWindowConstraints.weightx = 1;
3795
+// aWindowConstraints.gridwidth = 3;
3796
+// // aConstraints.gridheight = 3;
3797
+// aWindowConstraints.gridx = 1;
3798
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3799
+// bigThree.add(centralPanel, aWindowConstraints);
3800
+// aWindowConstraints.weightx = 0;
3801
+// aWindowConstraints.gridx = 4;
3802
+// aWindowConstraints.gridwidth = 1;
3803
+// // aConstraints.gridheight = 3;
3804
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3805
+// bigThree.add(XYZPanel, aWindowConstraints);
3806
+// bigThree.validate();
3807
+// scenePanel.setVisible(false);
3808
+// centralPanel.setVisible(true);
3809
+// XYZPanel.setVisible(true);
3810
+ bigThree.ClearUI();
3811
+ bigThree.add(scenePanel);
3812
+ bigThree.add(centralPanel);
3813
+ bigThree.FlushUI();
3814
+
3815
+ cameraView.requestFocusInWindow();
25793816 } else
2580
- if (event.getSource() == fourButton)
3817
+ if (source == fourButton)
25813818 {
25823819 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();
3820
+
3821
+ if (CameraPane.FULLSCREEN)
3822
+ fullscreenLayout = radio.layout;
3823
+
3824
+// bigThree.remove(scenePanel);
3825
+// bigThree.remove(centralPanel);
3826
+// bigThree.remove(XYZPanel);
3827
+// aWindowConstraints.gridx = 0;
3828
+// aWindowConstraints.gridy = 0;
3829
+// aWindowConstraints.gridwidth = 1;
3830
+// // aWindowConstraints.gridheight = 3;
3831
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3832
+// aWindowConstraints.weightx = 1;
3833
+// aWindowConstraints.weighty = 1;
3834
+// bigThree.add(scenePanel, aWindowConstraints);
3835
+// aWindowConstraints.weightx = 1;
3836
+// aWindowConstraints.gridwidth = 3;
3837
+// // aConstraints.gridheight = 3;
3838
+// aWindowConstraints.gridx = 1;
3839
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3840
+// //bigThree.add(cameraPanel, aWindowConstraints);
3841
+// aWindowConstraints.weightx = 0;
3842
+// aWindowConstraints.gridx = 4;
3843
+// aWindowConstraints.gridwidth = 1;
3844
+// // aWindowConstraints.gridheight = 3;
3845
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3846
+// //bigThree.add(XYZPanel, aWindowConstraints);
3847
+// bigThree.validate();
3848
+// scenePanel.setVisible(true);
3849
+// centralPanel.setVisible(false);
3850
+// XYZPanel.setVisible(false);
3851
+ bigThree.ClearUI();
3852
+ bigThree.add(scenePanel);
3853
+ bigThree.FlushUI();
3854
+
3855
+ cameraView.requestFocusInWindow();
26073856 } else
2608
- if (event.getSource() == sixButton)
3857
+ if (source == sixButton)
26093858 {
26103859 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();
3860
+
3861
+ if (CameraPane.FULLSCREEN)
3862
+ fullscreenLayout = radio.layout;
3863
+
3864
+// bigThree.remove(scenePanel);
3865
+// bigThree.remove(centralPanel);
3866
+// bigThree.remove(XYZPanel);
3867
+// aWindowConstraints.gridx = 0;
3868
+// aWindowConstraints.gridy = 0;
3869
+// aWindowConstraints.gridwidth = 1;
3870
+// // aConstraints.gridheight = 3;
3871
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3872
+// aWindowConstraints.weightx = 0;
3873
+// aWindowConstraints.weighty = 1;
3874
+// bigThree.add(scenePanel, aWindowConstraints);
3875
+// aWindowConstraints.weightx = 1;
3876
+// aWindowConstraints.gridwidth = 3;
3877
+// // aWindowConstraints.gridheight = 3;
3878
+// aWindowConstraints.gridx = 1;
3879
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3880
+// bigThree.add(centralPanel, aWindowConstraints);
3881
+// aWindowConstraints.weightx = 0;
3882
+// aWindowConstraints.gridx = 4;
3883
+// aWindowConstraints.gridwidth = 1;
3884
+// // aWindowConstraints.gridheight = 3;
3885
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3886
+// //bigThree.add(XYZPanel, aConstraints);
3887
+// bigThree.validate();
3888
+// scenePanel.setVisible(true);
3889
+// centralPanel.setVisible(true);
3890
+// XYZPanel.setVisible(false);
3891
+ bigThree.ClearUI();
3892
+ bigThree.add(centralPanel);
3893
+ bigThree.add(scenePanel);
3894
+ bigThree.FlushUI();
3895
+
3896
+ cameraView.requestFocusInWindow();
26353897 } else
2636
- if (event.getSource() == sevenButton)
3898
+ if (source == sevenButton)
26373899 {
26383900 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();
3901
+
3902
+ if (CameraPane.FULLSCREEN)
3903
+ fullscreenLayout = radio.layout;
3904
+
3905
+// bigThree.remove(scenePanel);
3906
+// bigThree.remove(centralPanel);
3907
+// bigThree.remove(XYZPanel);
3908
+// aWindowConstraints.gridx = 0;
3909
+// aWindowConstraints.gridy = 0;
3910
+// aWindowConstraints.gridwidth = 1;
3911
+// // aWindowConstraints.gridheight = 3;
3912
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3913
+// aWindowConstraints.weightx = 0;
3914
+// aWindowConstraints.weighty = 1;
3915
+// bigThree.add(scenePanel, aWindowConstraints);
3916
+// aWindowConstraints.weightx = 1;
3917
+// aWindowConstraints.gridwidth = 3;
3918
+// // aWindowConstraints.gridheight = 3;
3919
+// aWindowConstraints.gridx = 1;
3920
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3921
+// bigThree.add(centralPanel, aWindowConstraints);
3922
+// aWindowConstraints.weightx = 0;
3923
+// aWindowConstraints.gridx = 4;
3924
+// aWindowConstraints.gridwidth = 1;
3925
+// // aConstraints.gridheight = 3;
3926
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3927
+// bigThree.add(XYZPanel, aWindowConstraints);
3928
+// bigThree.validate();
3929
+// scenePanel.setVisible(true);
3930
+// centralPanel.setVisible(true);
3931
+// XYZPanel.setVisible(true);
3932
+ bigThree.ClearUI();
3933
+ bigThree.add(scenePanel);
3934
+ bigThree.add(centralPanel);
3935
+ bigThree.add(XYZPanel);
3936
+ bigThree.FlushUI();
3937
+
3938
+ cameraView.requestFocusInWindow();
26633939 } else
2664
- if (event.getSource() == rootButton)
3940
+ if (source == rootButton)
26653941 {
3942
+ Replace();
26663943 Object3D obj;
26673944 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26683945 {
....@@ -2671,66 +3948,85 @@
26713948 EditObject(obj);
26723949 }
26733950
3951
+ cameraView.requestFocusInWindow();
26743952 refreshContents(true);
26753953 } else
2676
- if (event.getSource() == closeButton)
3954
+ if (source == closeButton)
26773955 {
26783956 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793957 cRadio ab;
26803958 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813959 {
26823960 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3961
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843962 {
3963
+ // Patch to avoid bug with transparency.
3964
+ if (!ab.hadMaterial)
3965
+ {
3966
+ ab.object.material = null;
3967
+ }
3968
+
26853969 buttonGroup.remove(ab);
26863970 radioPanel.remove(ab);
26873971
2688
- ab.GetObject().editWindow = null;
3972
+ //ab.GetObject().editWindow = null;
3973
+ ab.GetObject().manipWindow = null;
26893974 // ab.GetObject().objectUI = null; // ?????????
26903975
26913976 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923977 break;
26933978 }
26943979 }
3980
+
3981
+ cameraView.requestFocusInWindow();
26953982 refreshContents(true);
26963983 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3984
+ if (source == editItem || source == editButton)
26983985 {
3986
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3987
+ {
3988
+ Object3D child = (Object3D)e.nextElement();
3989
+ child.pinned = true;
3990
+ }
3991
+
26993992 EditSelection(false);
27003993 } else
2701
- if (event.getSource() == uneditButton)
3994
+ if (source == uneditButton)
27023995 {
27033996 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043997 {
27053998 Object3D child = (Object3D)e.nextElement();
27063999 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4000
+ child.pinned = false;
27084001 child.CloseUI();
27094002 listUI.remove(child);
4003
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27104004
2711
- child.editWindow = null; // ???????????
4005
+ //child.editWindow = null; // ???????????
27124006 }
2713
- objEditor.ctrlPanel.revalidate();
4007
+ objEditor.ctrlPanel.FlushUI();
27144008 //objEditor.jTree.clearSelection();
27154009 //objEditor.ResetSliders();
27164010 refreshContents(true);
27174011 } else
2718
- if (event.getSource() == clearPanelButton)
4012
+ if (source == clearPanelButton)
27194013 {
27204014 assert(copy == group);
27214015 //copy.ClearUI();
27224016 for (Object3D obj : listUI)
27234017 {
4018
+ obj.pinned = false;
27244019 obj.CloseUI();
27254020 }
27264021 listUI.clear();
4022
+ SetPinStates(group.selection.size() > 0);
27274023 refreshContents(true);
27284024 } else
2729
- if (event.getSource() == allParamsButton)
4025
+ if (source == allParamsButton)
27304026 {
27314027 assert(copy == group);
27324028
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4029
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27344030
27354031 for (Object3D obj : listUI)
27364032 {
....@@ -2747,19 +4043,19 @@
27474043
27484044 refreshContents(true);
27494045 } else
2750
- if (event.getSource() == unselectButton)
4046
+ if (source == unselectButton)
27514047 {
27524048 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
4049
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27544050 objEditor.ResetSliders();
27554051 refreshContents(true);
27564052 } else
2757
- if(event.getSource() instanceof cRadio)
4053
+ if(source instanceof cRadio)
27584054 {
27594055 group.parent = keepparent;
27604056 group.attributes = 0;
27614057 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
4058
+ /*cRadio*/ radio = (cRadio)source;
27634059 Object3D obj = radio.GetObject();
27644060 System.out.println("Edit " + obj);
27654061 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +4075,8 @@
27794075 }
27804076
27814077 copy = group;
2782
- //CameraPane.theRenderer.object = group;
4078
+
4079
+ //Globals.theRenderer.object = group;
27834080 if(!useclient)
27844081 {
27854082 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +4085,67 @@
27884085 cameraView.cameras[cameraView.cameracount] = radio.camera;
27894086 cameraView.targetLookAt.set(radio.camera.lookAt);
27904087 cameraView.object = group;
2791
- cameraView.lighttouched = true;
4088
+ //cameraView.lighttouched = true;
4089
+ Globals.lighttouched = true;
27924090 topView.object = group;
27934091 frontView.object = group;
27944092 sideView.object = group;
27954093 }
2796
- group.editWindow = this;
4094
+
4095
+// fix "+" issue
4096
+ //group.editWindow = this;
4097
+ group.manipWindow = this;
4098
+
27974099 /*
27984100 currentLayout = radio.layout;
27994101 if (currentLayout == null)
28004102 currentLayout = sevenButton;
28014103 */
28024104 radio.layout.doClick();
4105
+
4106
+ assert(copy instanceof Composite);
4107
+
4108
+ if (copy.versionlist == null)
4109
+ {
4110
+ copy.versionlist = new Object3D[100];
4111
+ copy.versionindex = -1;
4112
+
4113
+ Save(true);
4114
+ }
4115
+
4116
+ SetVersionStates();
4117
+
4118
+ ClearUnpinned();
4119
+
4120
+ //Grafreed.Assert(group != null);
4121
+ //Grafreed.Assert(group.selection != null);
4122
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4123
+ if (group.selection == null || group.selection.size() == 1)
4124
+ EditSelection(false);
28034125 keepparent = group.parent;
28044126 // PARENT = NULL or not???
28054127 //group.parent = null; // ROOT
28064128 //group.attributes = -1;
28074129 ResetModel();
4130
+
4131
+ cameraView.requestFocusInWindow();
28084132 refreshContents(true);
2809
- }
4133
+ } else if (event.getSource() == editCameraItem)
4134
+ {
4135
+ cameraView.ProtectCamera();
4136
+ cameraView.requestFocusInWindow();
4137
+ cameraView.repaint();
4138
+ return;
4139
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4140
+ {
4141
+ cameraView.RevertCamera();
4142
+ cameraView.requestFocusInWindow();
4143
+ cameraView.repaint();
4144
+ return;
4145
+ // } else if (event.getSource() == textureButton)
4146
+ // {
4147
+ // return; // true;
4148
+ }
28104149 else
28114150 {
28124151 //return super.action(event, arg);
....@@ -2815,7 +4154,6 @@
28154154 }
28164155
28174156 boolean useclient = false;
2818
- cRadio radio;
28194157
28204158 void ToggleRoot()
28214159 {
....@@ -2824,7 +4162,7 @@
28244162 if (useclient)
28254163 {
28264164 cameraView.object = client;
2827
- cameraView.lighttouched = true;
4165
+ Globals.lighttouched = true;
28284166 //topView.object = client;
28294167 //frontView.object = client;
28304168 //sideView.object = client;
....@@ -2832,7 +4170,7 @@
28324170 else
28334171 {
28344172 cameraView.object = group;
2835
- cameraView.lighttouched = true;
4173
+ Globals.lighttouched = true;
28364174 //topView.object = group;
28374175 //frontView.object = group;
28384176 //sideView.object = group;
....@@ -2867,6 +4205,28 @@
28674205 refreshContents();
28684206 }
28694207
4208
+ void TransformChildren()
4209
+ {
4210
+ Object3D obj;
4211
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4212
+ {
4213
+ obj = (Object3D)e.nextElement();
4214
+ obj.KeepTextureMatrices();
4215
+ obj.TransformChildren();
4216
+ obj.RestoreTextureMatrices();
4217
+
4218
+// if (obj.parent == null)
4219
+// {
4220
+// System.out.println("NULL PARENT!");
4221
+// new Exception().printStackTrace();
4222
+// }
4223
+// else
4224
+// TouchTransform(obj);
4225
+// //obj.parent.Touch();
4226
+ }
4227
+
4228
+ refreshContents();
4229
+ }
28704230
28714231 void ResetTransform()
28724232 {
....@@ -2979,7 +4339,7 @@
29794339 refreshContents();
29804340 }
29814341
2982
- void ResetCentroid()
4342
+ void ResetCentroid(boolean full)
29834343 {
29844344 Object3D obj;
29854345 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4354,16 @@
29944354 LA.matIdentity(Object3D.mat);
29954355 obj.getBounds(minima, maxima, false);
29964356 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4357
+ if (full)
4358
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984359 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994360 obj.TransformMesh(Object3D.mat);
4361
+
30004362 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4363
+ if (full)
4364
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024365 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4366
+
30034367 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044368 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054369 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4392,8 @@
30284392
30294393 int size = obj.MemorySize();
30304394
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4395
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4396
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324397 }
30334398 }
30344399 catch (Exception e)
....@@ -3065,9 +4430,9 @@
30654430 obj = (Object3D)e.nextElement();
30664431
30674432 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4433
+ Grafreed.AnalyzeObject(obj);
30694434 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4435
+ Grafreed.AnalyzeObject(obj.bRep);
30714436
30724437 // System.err.println((size/1024) + " KB is the size of " + obj);
30734438 }
....@@ -3109,6 +4474,20 @@
31094474 void GenNormals(boolean crease)
31104475 {
31114476 group.GenNormalsS(crease);
4477
+
4478
+ refreshContents();
4479
+ }
4480
+
4481
+ void GenNormalsMESH()
4482
+ {
4483
+ group.GenNormalsMeshS();
4484
+
4485
+ refreshContents();
4486
+ }
4487
+
4488
+ void GenNormalsMINE()
4489
+ {
4490
+ group.selection.GenNormalsMINE();
31124491
31134492 refreshContents();
31144493 }
....@@ -3157,104 +4536,259 @@
31574536
31584537 //Object3D buffer;
31594538 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
-
4539
+// BoundaryRep temprep;
4540
+// Object3D nodes;
4541
+// Vector<Vertex> vertices;
4542
+//
4543
+// cGroup buffer;
4544
+//
4545
+// public void Vertex(Object3D node, Vertex v)
4546
+// {
4547
+//// vertices.add(v);
4548
+//// nodes.addElement(node);
4549
+////
4550
+//// if (temprep.GetCache(v) != null)
4551
+//// {
4552
+//// temprep.Remove(v);
4553
+//// } else
4554
+//// {
4555
+//// temprep.Remember(v);
4556
+//// }
4557
+//
4558
+// //Object3D node = nodes.get(index);
4559
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4560
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4561
+//
4562
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4563
+//
4564
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4565
+//
4566
+// cGroup g = new cGroup();
4567
+//
4568
+// if (g.toParent == null)
4569
+// {
4570
+// g.toParent = LA.newMatrix();
4571
+// g.fromParent = LA.newMatrix();
4572
+// }
4573
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4574
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4575
+//
4576
+// g.add(GrafreeD.clipboard);
4577
+//
4578
+// buffer.add(g);
4579
+// }
4580
+//
4581
+// public void Face(Object3D node, Face f)
4582
+// {
4583
+//
4584
+// }
4585
+//
4586
+// void ParseVerticesOld() // ??
4587
+// {
4588
+// //if (group.selection.size() != 1)
4589
+// // return;
4590
+//
4591
+// temprep = new BoundaryRep();
4592
+// nodes = new Object3D();
4593
+// vertices = new Vector<Vertex>();
4594
+//
4595
+// boolean epsequal = GrafreeD.epsequal;
4596
+// GrafreeD.epsequal = true;
4597
+//
4598
+// for (int i=0; i<group.selection.size(); i++)
4599
+// {
4600
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4601
+//
4602
+// group.selection.get(i).Parse(
4603
+//this );
4604
+//
4605
+// int repsize = temprep.VertexCount();
4606
+// int tablesize = temprep.vertextable.size();
4607
+// int nodesize = nodes.size();
4608
+//
4609
+// assert(vertices.size() == nodes.size());
4610
+//
4611
+// temprep.vertextable.elements();
4612
+//
4613
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4614
+//
4615
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4616
+// {
4617
+// cGroup g = new cGroup();
4618
+//
4619
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4620
+//
4621
+// Object3D node = nodes.get(index);
4622
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4623
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4624
+//
4625
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4626
+//
4627
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4628
+//
4629
+// if (g.toParent == null)
4630
+// {
4631
+// g.toParent = LA.newMatrix();
4632
+// g.fromParent = LA.newMatrix();
4633
+// }
4634
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4635
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4636
+//
4637
+// g.add(GrafreeD.clipboard);
4638
+//
4639
+// buffer.add(g);
4640
+// }
4641
+//
4642
+// makeSomething(buffer, i==group.selection.size()-1);
4643
+// }
4644
+//
4645
+// GrafreeD.epsequal = epsequal;
4646
+//
4647
+// //buffer = null;
4648
+// temprep = null;
4649
+// nodes = null;
4650
+//
4651
+// refreshContents();
4652
+// }
4653
+
31844654 void ParseVertices()
31854655 {
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;
4656
+ boolean epsequal = Grafreed.epsequal;
4657
+ Grafreed.epsequal = true;
31954658
31964659 for (int i=0; i<group.selection.size(); i++)
31974660 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4661
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994662
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4663
+ group.selection.get(i).Parse(
4664
+
4665
+ new iParse()
4666
+ {
4667
+ public void Vertex(Object3D node, Vertex v)
4668
+ {
4669
+ temp.set(v);
4670
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054671
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();
4672
+ cGroup g = new cGroup();
32114673
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4674
+ if (g.toParent == null)
4675
+ {
4676
+ g.toParent = LA.newMatrix();
4677
+ g.fromParent = LA.newMatrix();
4678
+ }
4679
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4680
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154681
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);
4682
+ g.add(Grafreed.clipboard);
32204683
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);
4684
+ buffer.add(g);
4685
+ }
32324686
3233
- g.add(GraphreeD.clipboard);
4687
+ public void Face(Object3D node, Face f)
4688
+ {
32344689
3235
- buffer.add(g);
3236
- }
4690
+ }
4691
+ }
4692
+ );
32374693
32384694 makeSomething(buffer, i==group.selection.size()-1);
32394695 }
32404696
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4697
+ Grafreed.epsequal = epsequal;
32464698
32474699 refreshContents();
32484700 }
3249
-
4701
+
4702
+ void TextureVertices()
4703
+ {
4704
+ for (int i=0; i<group.selection.size(); i++)
4705
+ {
4706
+ group.selection.get(i).Parse(
4707
+ new iParse()
4708
+ {
4709
+ public void Vertex(Object3D node, Vertex v)
4710
+ {
4711
+ cTexture tex = node.GetTextures();
4712
+ String pigment = Object3D.GetPigment(tex);
4713
+ //String bump = Object3D.GetBump(tex);
4714
+
4715
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4716
+
4717
+ try
4718
+ {
4719
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4720
+ }
4721
+ catch (Exception e)
4722
+ {
4723
+ System.err.println("FAIL: " + node);
4724
+ }
4725
+
4726
+ double s = v.s;
4727
+
4728
+ if (s == 1)
4729
+ s = 0;
4730
+
4731
+ double t = v.t;
4732
+
4733
+ if (t == 1)
4734
+ t = 0;
4735
+
4736
+ int indexs = (int) (texturedata.getWidth() * s);
4737
+ int indext = (int) (texturedata.getHeight() * t);
4738
+
4739
+ int index = indext * texturedata.getWidth() + indexs;
4740
+
4741
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4742
+
4743
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4744
+
4745
+ float scale = bytebuf.get(index*slide) & 0xFF;
4746
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4747
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4748
+ scale /= 3;
4749
+
4750
+ scale /= 0xFF;
4751
+ // c'est quoi ca? scale /= 4;
4752
+
4753
+ //v.AO = scale;
4754
+
4755
+ v.x += v.norm.x * scale;
4756
+ v.y += v.norm.y * scale;
4757
+ v.z += v.norm.z * scale;
4758
+ }
4759
+
4760
+ public void Face(Object3D node, Face f)
4761
+ {
4762
+ }
4763
+ }
4764
+ );
4765
+ }
4766
+
4767
+ refreshContents();
4768
+ }
4769
+
32504770 void Align()
32514771 {
4772
+ if (group.selection.size() == 0)
4773
+ return;
4774
+
4775
+ cVector bbmin = new cVector();
4776
+ cVector bbmax = new cVector();
4777
+
4778
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4779
+
4780
+ double dx = bbmax.x - bbmin.x;
4781
+ double dy = bbmax.y - bbmin.y;
4782
+ double dz = bbmax.z - bbmin.z;
4783
+
4784
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4785
+
32524786 for (int i=0; i<group.selection.size(); i++)
32534787 {
32544788 Object3D obj = group.selection.get(i);
32554789
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4790
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4791
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584792 }
32594793
32604794 refreshContents();
....@@ -3267,7 +4801,7 @@
32674801 // ref.SaveSupports();
32684802 // Object3D par = ref.parent;
32694803 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4804
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714805 // ref.parent = par;
32724806 // ref.RestoreSupports();
32734807
....@@ -3275,11 +4809,11 @@
32754809
32764810 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774811
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4812
+ boolean random = CameraPane.SWITCH;
4813
+ CameraPane.SWITCH = false; // parse all random nodes
32804814 lowres.linkVerticesThis(null);
32814815 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4816
+ CameraPane.SWITCH = random;
32834817
32844818 System.err.flush();
32854819
....@@ -3297,7 +4831,7 @@
32974831 // lowres.SaveSupports();
32984832 // par = lowres.parent;
32994833 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4834
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014835 Object3D newlow = CloneObject(lowres, false);
33024836 newlow.name = sn.switchobject.get(i).name;
33034837 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4853,7 @@
33194853 return;
33204854
33214855 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4856
+ Object3D ref = Grafreed.clipboard.get(0);
33234857
33244858 Object3D newgroup = new Object3D("Po:" + poses.name);
33254859
....@@ -3488,7 +5022,7 @@
34885022 group.selection.RelinkToSupport(); // july 2014
34895023 System.out.println("DONE.");
34905024 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
5025
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34925026 }
34935027
34945028 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +5047,20 @@
35135047
35145048 void ClipMesh()
35155049 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
5050
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35175051 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
5052
+ Object3D content = Grafreed.clipboard.get(0);
35195053
35205054 if (content instanceof cGroup && ((cGroup)content).transientlink )
35215055 content = ((cGroup)content).get(0);
35225056
35235057 // for (int i=0; i<group.selection.size(); i++)
35245058 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
5059
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35265060 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
5061
+ group.selection.ClipMesh(Grafreed.clipboard);
35285062 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
5063
+// group.selection.ClipMesh(GrafreeD.clipboard);
35305064 System.out.println("DONE.");
35315065 refreshContents();
35325066 }
....@@ -3571,6 +5105,18 @@
35715105 void MarkLeaves(boolean hide)
35725106 {
35735107 group.selection.MarkLeaves(hide);
5108
+ refreshContents();
5109
+ }
5110
+
5111
+ void RewindLeaves(boolean hide)
5112
+ {
5113
+ group.selection.RewindLeaves(hide);
5114
+ refreshContents();
5115
+ }
5116
+
5117
+ void RandomLeaves(boolean hide)
5118
+ {
5119
+ group.selection.RandomLeaves(hide);
35745120 refreshContents();
35755121 }
35765122
....@@ -3645,28 +5191,25 @@
36455191 // }
36465192 // }
36475193
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525194 void EditSelection(boolean newWindow)
36535195 {
5196
+ if (group.selection == null)
5197
+ {
5198
+ EditElement(group, newWindow); // ? new
5199
+ return;
5200
+ }
5201
+
36545202 // aConstraints.gridy = 0;
36555203 for (int i=0; i<group.selection.size(); i++)
36565204 {
36575205 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585206 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5207
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605208
36615209 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5210
+ if(elem != group || !newWindow)
36635211 {
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
5212
+ EditElement(elem, newWindow); // ? new
36705213 }
36715214 }
36725215 }
....@@ -3729,9 +5272,7 @@
37295272
37305273 freezemodel = false;
37315274 }
3732
-
3733
- boolean flashIt = true;
3734
-
5275
+
37355276 public void valueChanged(TreeSelectionEvent e)
37365277 //public boolean handleEvent(Event event)
37375278 {
....@@ -3741,7 +5282,8 @@
37415282 //new Exception().printStackTrace();
37425283
37435284 freezemodel = true;
3744
-
5285
+ ClearUnpinned();
5286
+
37455287 /**/
37465288 //switch (event.id)
37475289 {
....@@ -3749,7 +5291,6 @@
37495291 //case 702: // Event.LIST_DESELECT
37505292 group.deselectAll();
37515293 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535294 if (tps != null)
37545295 {
37555296 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5299,39 @@
37585299
37595300 //if (child.parent != null)
37605301 //child.parent.addSelectee(child);
5302
+ objEditor.SetMaterial(child);
37615303 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655304 }
37665305 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5306
+// else
5307
+// {
5308
+// objEditor.SetMaterial(group); // .GetMaterial());
5309
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5310
+// System.err.println("info : " + group.GetPath());
5311
+// }
37735312
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5313
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775314 CameraPane.flash = true;
37785315
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5316
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805317 // a camera
37815318 {
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;
5319
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5320
+ {
5321
+ CameraPane.camerachangeframe = 0; // don't refuse it
5322
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5323
+ }
5324
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5325
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865326 }
37875327
5328
+ if (tps != null && tps.length == 1)
5329
+ {
5330
+ EditSelection(false);
5331
+ }
5332
+
5333
+ SetPinStates(tps != null && tps.length > 0);
5334
+
37885335 refreshContents();
37895336 //return true;
37905337 }
....@@ -3793,6 +5340,51 @@
37935340
37945341 freezemodel = false;
37955342 }
5343
+
5344
+ void SetPinStates(boolean enabled)
5345
+ {
5346
+ editButton.setEnabled(enabled);
5347
+ uneditButton.setEnabled(enabled);
5348
+ //unselectButton.setEnabled(enabled);
5349
+ flashSelectionButton.setEnabled(enabled);
5350
+
5351
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5352
+
5353
+ boolean allComposites = true;
5354
+
5355
+ if (group.selection != null)
5356
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5357
+ {
5358
+ if (!(e.nextElement() instanceof Composite))
5359
+ {
5360
+ allComposites = false;
5361
+ break;
5362
+ }
5363
+ }
5364
+
5365
+ rootButton.setEnabled(allComposites);
5366
+ }
5367
+
5368
+ void refreshContents(boolean cp)
5369
+ {
5370
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5371
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5372
+ {
5373
+ objEditor.ClearInfo(); // .GetMaterial());
5374
+
5375
+ for (int i=0; i < group.selection.Size(); i++)
5376
+ {
5377
+ Object3D child = (Object3D) group.selection.get(i);
5378
+
5379
+ objEditor.AddInfo(child, this, true);
5380
+// System.err.println("info : " + child.GetPath());
5381
+ }
5382
+
5383
+ objEditor.SetText(); // jan 2014
5384
+ }
5385
+
5386
+ super.refreshContents(cp);
5387
+ }
37965388
37975389 void linkSomething(Object3D thing)
37985390 {
....@@ -3864,16 +5456,19 @@
38645456 {
38655457 if (group.selection.isEmpty())
38665458 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5459
+
5460
+ Grafreed.clipboardIsTempGroup = false;
38685461 Composite tGroup = null;
38695462 if (group.selection.size() > 0) // 1)
38705463 {
38715464 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5465
+ Grafreed.clipboardIsTempGroup = true;
38735466 }
38745467
38755468 if (cut)
38765469 {
5470
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5471
+// Save();
38775472 //int indices[] = jList.getSelectedIndices();
38785473 //for (int i = indices.length - 1; i >= 0; i--)
38795474 //jList.remove(indices[i]);
....@@ -3909,16 +5504,16 @@
39095504 //System.out.println("cut " + child);
39105505 //System.out.println("parent = " + child.parent);
39115506 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5507
+ if (Grafreed.clipboardIsTempGroup)
39135508 tGroup.add/*Child*/(tmp);
39145509 else
3915
- GraphreeD.clipboard = tmp;
5510
+ Grafreed.clipboard = tmp;
39165511 }
39175512 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5513
+ if (Grafreed.clipboardIsTempGroup)
39195514 tGroup.add/*Child*/(child);
39205515 else
3921
- GraphreeD.clipboard = child;
5516
+ Grafreed.clipboard = child;
39225517 }
39235518
39245519 //ResetModel();
....@@ -3950,21 +5545,23 @@
39505545 //System.out.println("cut " + elem);
39515546 //System.out.println("parent = " + elem.parent);
39525547 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5548
+ if (Grafreed.clipboardIsTempGroup)
39545549 tGroup.add/*Child*/(tmp);
39555550 else
3956
- GraphreeD.clipboard = tmp;
5551
+ Grafreed.clipboard = tmp;
39575552 }
39585553 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5554
+ if (Grafreed.clipboardIsTempGroup)
39605555 tGroup.add/*Child*/(child);
39615556 else
3962
- GraphreeD.clipboard = child;
5557
+ Grafreed.clipboard = child;
39635558 }
39645559
39655560 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5561
+
5562
+ if (Grafreed.clipboardIsTempGroup)
5563
+ Grafreed.clipboard = tGroup;
5564
+
39685565 if (cut)
39695566 {
39705567 ResetModel();
....@@ -3974,11 +5571,15 @@
39745571
39755572 void paste(boolean expand)
39765573 {
3977
- // if (GraphreeD.clipboard == null)
5574
+ if (Globals.REPLACEONMAKE)
5575
+ Save();
5576
+ boolean keep = Globals.REPLACEONMAKE;
5577
+ Globals.REPLACEONMAKE = false;
5578
+ // if (GrafreeD.clipboard == null)
39785579 // return;
39795580 boolean first = true;
39805581
3981
- if (GraphreeD.clipboardIsTempGroup)
5582
+ if (Grafreed.clipboardIsTempGroup)
39825583 {
39835584 Composite temp;
39845585
....@@ -3989,7 +5590,7 @@
39895590 temp = (Composite)Applet3D.clipboard.deepCopy();
39905591 */
39915592 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5593
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935594 {
39945595 Object3D child = (Object3D)e.nextElement();
39955596
....@@ -4003,7 +5604,7 @@
40035604 else
40045605 elem = child.deepCopy(); // ?
40055606 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5607
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075608 // elem = elem.get(0);
40085609 makeSomething(elem, true); // ?? first);
40095610 //group.addChild(elem);
....@@ -4023,23 +5624,24 @@
40235624 //Object3D cb = Applet3D.clipboard;
40245625 //temp.addChild(cb);
40255626 //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());
5627
+ assert(Grafreed.clipboard.parent == null);
5628
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5629
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5630
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5631
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315632 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5633
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5634
+ Grafreed.clipboard.get(0).parent = keepparent;
40345635 }
40355636
5637
+ Globals.REPLACEONMAKE = keep;
40365638 ResetModel();
40375639 refreshContents();
40385640 }
40395641
4040
- void pasteInto(boolean copyit)
5642
+ void pasteInto(boolean copyit, boolean clone)
40415643 {
4042
-// if (GraphreeD.clipboard == null)
5644
+// if (GrafreeD.clipboard == null)
40435645 // return;
40445646
40455647 if (group.selection.size() != 1)
....@@ -4066,15 +5668,22 @@
40665668 if (copyit)
40675669 {
40685670 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5671
+ if (clone)
5672
+ {
5673
+ CloneClipboard(false); // sept 2014
5674
+ }
5675
+ else
5676
+ {
5677
+ paste(false);
5678
+ }
40705679 }
40715680 else
40725681 {
40735682 boolean first = true;
40745683
4075
- if (GraphreeD.clipboardIsTempGroup)
5684
+ if (Grafreed.clipboardIsTempGroup)
40765685 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5686
+ Composite temp = (Composite)Grafreed.clipboard;
40785687 Object3D copy;
40795688 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805689 {
....@@ -4084,7 +5693,7 @@
40845693 }
40855694 } else
40865695 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5696
+ linkSomething(Grafreed.clipboard); //.get(0));
40885697 }
40895698 }
40905699 }
....@@ -4161,6 +5770,10 @@
41615770
41625771 void group(Object3D csg, boolean grab)
41635772 {
5773
+ if (Globals.REPLACEONMAKE)
5774
+ Save();
5775
+ boolean keep = Globals.REPLACEONMAKE;
5776
+ Globals.REPLACEONMAKE = false;
41645777 if (//false) // why??
41655778 !group.selection.isEmpty())
41665779 {
....@@ -4274,8 +5887,34 @@
42745887 //node.add(csg);
42755888 //makeSomething(node);
42765889 makeSomething(csg);
5890
+ Globals.REPLACEONMAKE = keep;
42775891 }
42785892
5893
+ void Ungroup(Object3D g)
5894
+ {
5895
+ if (Globals.REPLACEONMAKE)
5896
+ Save();
5897
+ boolean keep = Globals.REPLACEONMAKE;
5898
+ Globals.REPLACEONMAKE = false;
5899
+ if (g instanceof HiddenObject)
5900
+ {
5901
+ HiddenObject h = (HiddenObject) g;
5902
+
5903
+ for (int i=0; i<h.ActualSize(); i++)
5904
+ {
5905
+ objEditor.makeSomething(h.get(i), false);
5906
+ }
5907
+ }
5908
+ else
5909
+ {
5910
+ for (int i=0; i<g.Size(); i++)
5911
+ {
5912
+ objEditor.makeSomething(g.get(i), false);
5913
+ }
5914
+ }
5915
+ Globals.REPLACEONMAKE = keep;
5916
+ }
5917
+
42795918 void ungroup()
42805919 {
42815920 /*
....@@ -4469,21 +6108,6 @@
44696108 }
44706109 */
44716110
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
-
44876111 /*
44886112 public void Callback(Object obj)
44896113 {
....@@ -4507,26 +6131,9 @@
45076131 }
45086132 */
45096133
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
-
45276134 String GetFile(String dialogName)
45286135 {
4529
- if (GraphreeD.standAlone)
6136
+ if (Grafreed.standAlone)
45306137 {
45316138 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45326139 browser.show();
....@@ -4590,10 +6197,48 @@
45906197 cButton flashSelectionButton;
45916198 cButton editButton;
45926199 cButton uneditButton;
6200
+ JCheckBox allParamsButton;
45936201 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956202 cButton unselectButton;
45966203
6204
+ cButton restoreCameraButton;
6205
+
6206
+ cButton oneStepButton;
6207
+
6208
+ cButton groupButton;
6209
+ cButton ungroupButton;
6210
+ cButton compositeButton;
6211
+ cButton switchButton;
6212
+ cButton loopButton;
6213
+ cButton textureButton;
6214
+
6215
+ cButton skybox1Button;
6216
+ cButton skybox2Button;
6217
+ cButton skybox3Button;
6218
+ cButton skybox4Button;
6219
+ cButton skybox5Button;
6220
+ cButton skybox6Button;
6221
+ cButton skybox7Button;
6222
+
6223
+ cButton skybox11Button;
6224
+ cButton skybox12Button;
6225
+ cButton skybox13Button;
6226
+ cButton skybox14Button;
6227
+ cButton skybox15Button;
6228
+ cButton skybox16Button;
6229
+ cButton skybox17Button;
6230
+
6231
+ cButton gridButton;
6232
+ cButton boxButton;
6233
+ cButton sphereButton;
6234
+ cButton coneButton;
6235
+ cButton torusButton;
6236
+ cButton superButton;
6237
+ cButton kleinButton;
6238
+ cButton particlesButton;
6239
+ cButton overlayButton;
6240
+ cButton lightButton;
6241
+
45976242 cButton screenfitButton;
45986243 cButton screenfitpointButton;
45996244 cButton snapobjectButton;
....@@ -4605,14 +6250,6 @@
46056250
46066251 cButton setsupportButton;
46076252
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
-
46166253 //
46176254 //Composite
46186255 Object3D // to do !!
....@@ -4622,10 +6259,12 @@
46226259 //JTree jTree;
46236260 private MenuItem lookAtItem;
46246261 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
4626
- private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
4628
- private MenuItem cloneItem;
6262
+ private MenuItem switchViewItem;
6263
+ private JMenuItem cutItem;
6264
+ private MenuItem undoItem;
6265
+ private MenuItem redoItem;
6266
+ private JMenuItem duplicateItem;
6267
+ private JMenuItem cloneItem;
46296268 private MenuItem cloneSupportItem;
46306269 private MenuItem overwriteGeoItem;
46316270 private MenuItem overwriteMatItem;
....@@ -4635,8 +6274,9 @@
46356274 private MenuItem resetsupportItem;
46366275 private MenuItem resetreferencesItem;
46376276 private MenuItem linkverticesItem;
6277
+ private MenuItem relinkverticesItem;
46386278 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6279
+ private MenuItem resetAllItem;
46406280 private MenuItem stepAllItem;
46416281 private MenuItem revertMeshItem;
46426282 private MenuItem poseMeshItem;
....@@ -4645,16 +6285,19 @@
46456285 private MenuItem cloneGeometriesItem;
46466286 private MenuItem shareGeometriesItem;
46476287 private MenuItem mergeGeometriesItem;
4648
- private MenuItem copyItem;
6288
+ private JMenuItem copyItem;
46496289 private MenuItem pasteItem;
4650
- private MenuItem pasteLinkItem;
4651
- private MenuItem pasteCloneItem;
4652
- private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6290
+ private JMenuItem pasteIntoItem;
6291
+ private JMenuItem pasteLinkItem;
6292
+ private JMenuItem pasteCloneItem;
6293
+ private JMenuItem pasteExpandItem;
6294
+ private JMenuItem deleteItem;
46546295 private MenuItem clearAllItem;
46556296 private MenuItem genUVItem;
6297
+ private MenuItem genNormalsMESHItem;
46566298 private MenuItem genNormalsCADItem;
46576299 private MenuItem genNormalsORGANItem;
6300
+ private MenuItem genNormalsMINEItem;
46586301 private MenuItem stripifyItem;
46596302 private MenuItem unstripifyItem;
46606303 private MenuItem trimItem;
....@@ -4683,6 +6326,10 @@
46836326 private MenuItem showleavesItem;
46846327 private MenuItem markleavesItem;
46856328 private MenuItem unmarkleavesItem;
6329
+ private MenuItem rewindleavesItem;
6330
+ private MenuItem unrewindleavesItem;
6331
+ private MenuItem randomleavesItem;
6332
+ private MenuItem unrandomleavesItem;
46866333
46876334 private MenuItem flipVItem;
46886335 private MenuItem unflipVItem;
....@@ -4694,14 +6341,17 @@
46946341 private MenuItem panoTexturesItem;
46956342
46966343 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6344
+ private MenuItem resetCentroidXZItem;
46986345 private MenuItem resetTransformItem;
6346
+ private MenuItem transformGeometryItem;
6347
+ private MenuItem transformChildrenItem;
6348
+ private MenuItem hideItem;
46996349 private MenuItem grabItem;
47006350 private MenuItem backItem;
47016351 private MenuItem frontItem;
47026352 private MenuItem cameraItem;
47036353 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6354
+ private MenuItem switchItem;
47056355 private MenuItem physicsItem;
47066356 private MenuItem frameselectorItem;
47076357 private MenuItem scriptNodeItem;
....@@ -4709,13 +6359,14 @@
47096359 private MenuItem switchTransfoItem;
47106360 private MenuItem morphItem;
47116361 private MenuItem linkerItem;
4712
- private MenuItem ungroupItem;
6362
+ private JMenuItem ungroupItem;
47136363 private MenuItem editItem;
47146364 private MenuItem openWindowItem;
47156365 private MenuItem editLeafItem;
47166366
47176367 private MenuItem resetParentItem;
47186368 private MenuItem repairParentItem;
6369
+ private MenuItem repairShadowItem;
47196370 private MenuItem sortbysizeItem;
47206371 private MenuItem sortbynameItem;
47216372
....@@ -4724,20 +6375,25 @@
47246375 private MenuItem attachBumpItem;
47256376 private MenuItem detachBumpItem;
47266377 private MenuItem pigmentBumpItem;
6378
+ private MenuItem embedTexturesItem;
6379
+ private MenuItem deEmbedTexturesItem;
47276380
47286381 private MenuItem particleItem;
47296382 private MenuItem ragdollItem;
47306383 private MenuItem ragdoll2Item;
6384
+ private MenuItem heightFieldItem;
6385
+ private MenuItem textureFieldItem;
47316386 private MenuItem gridItem;
47326387 private MenuItem rectoidItem;
47336388 private MenuItem ellipsoidItem;
47346389 private MenuItem coneItem;
47356390 private MenuItem torusItem;
47366391 private MenuItem superItem;
6392
+ private MenuItem kleinItem;
47376393 private MenuItem blobItem;
47386394 private MenuItem latheItem;
47396395 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6396
+ private MenuItem overlayItem;
47416397 private MenuItem meshItem;
47426398 // private MenuItem meshGroupItem;
47436399 private MenuItem springItem;
....@@ -4746,6 +6402,7 @@
47466402 private MenuItem csgItem;
47476403 private MenuItem templateItem;
47486404 private MenuItem textureItem;
6405
+ private MenuItem billboardItem;
47496406 private MenuItem shadowXItem;
47506407 private MenuItem shadowYItem;
47516408 private MenuItem shadowZItem;
....@@ -4758,11 +6415,6 @@
47586415 private MenuItem doubleItem;
47596416 private MenuItem tripleItem;
47606417
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666418 private MenuItem computeAOItem;
47676419 private MenuItem recompileItem;
47686420 private MenuItem editScriptItem;
....@@ -4772,4 +6424,8 @@
47726424 private MenuItem analyzeItem;
47736425 private MenuItem dumpItem;
47746426 //boolean freezemodel = false;
6427
+
6428
+ Menu cameraMenu;
6429
+ MenuItem editCameraItem;
6430
+ MenuItem restoreCameraItem;
47756431 }