Normand Briere
2019-08-15 33504fc9a180903aace77613264550754fba5706
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(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ superButton.setToolTipText("Create superellipsoid");
1192
+ superButton.addActionListener(this);
1193
+
1194
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
+ sphereButton.setToolTipText("Create sphere");
1196
+ sphereButton.addActionListener(this);
1197
+
1198
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
+ coneButton.setToolTipText("Create cone");
1200
+ coneButton.addActionListener(this);
1201
+
1202
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1203
+ torusButton.setToolTipText("Create torus");
1204
+ torusButton.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,38 @@
12232165 shadow.material = new cMaterial(obj.material);
12242166 shadow.material.diffuse = 0.0001f;
12252167 shadow.material.specular = 0.0001f;
2168
+ shadow.material.opacity = 0.75f;
2169
+
2170
+ AllocProjectedVertices(shadow);
2171
+
2172
+ shadow.projectedVertices[1].x = 300;
12262173
12272174 makeSomething(shadow);
12282175 }
2176
+
2177
+ private void ClearUnpinned()
2178
+ {
2179
+ //for (Object3D obj : listUI)
2180
+ for (int i=listUI.size(); --i>=0;)
2181
+ {
2182
+ Object3D obj = listUI.elementAt(i);
2183
+ if (!obj.pinned)
2184
+ {
2185
+ obj.CloseUI();
2186
+ listUI.remove(i);
2187
+ }
2188
+ }
2189
+ }
2190
+
2191
+ private void EditElement(Object3D elem, boolean newWindow)
2192
+ {
2193
+ // if (!(elem instanceof Composite))
2194
+ // newWindow = false;
2195
+ listUI.add(elem);
2196
+ elem.openEditWindow(this, newWindow); //, false);
2197
+ System.out.println("edit : " + elem);
2198
+ elem.editWindow.refreshContents(true); // ? new
2199
+ }
12292200
12302201 /**
12312202 * applyExample
....@@ -1429,9 +2400,9 @@
14292400
14302401 void Overwrite(int mask)
14312402 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2403
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332404 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2405
+ Object3D content = Grafreed.clipboard.get(0);
14352406
14362407 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372408 content = ((cGroup)content).get(0);
....@@ -1454,6 +2425,7 @@
14542425 //
14552426 public void actionPerformed(ActionEvent event) // , Object arg)
14562427 {
2428
+ Object source = event.getSource();
14572429 /*
14582430 if (event.getSource() == nameField)
14592431 {
....@@ -1465,11 +2437,11 @@
14652437 }
14662438 else
14672439 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2440
+ if (source == lookAtItem || source == lookFromItem)
14692441 {
14702442 ScreenFit();
14712443 } else
1472
- if (event.getSource() == switchItem)
2444
+ if (source == switchViewItem)
14732445 {
14742446 cVector v1 = new cVector();
14752447 cVector v2 = new cVector();
....@@ -1478,11 +2450,11 @@
14782450 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792451 objEditor.cameraView.repaint();
14802452 } else
1481
- if (event.getSource() == rectoidItem)
2453
+ if (source == rectoidItem || source == boxButton)
14822454 {
14832455 makeSomething(new Box());
14842456 } else
1485
- if (event.getSource() == particleItem)
2457
+ if (source == particleItem || source == particlesButton)
14862458 {
14872459 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882460 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2475,9 @@
15032475 applyExample(particleGeom, "SMOKE");
15042476 makeSomething(particleGeom);
15052477 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2478
+ if (source == ragdollItem || source == ragdoll2Item)
15072479 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2480
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092481
15102482 ragdoll.toParent = LA.newMatrix();
15112483 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2493,71 @@
15212493 makeSomething(ragdoll);
15222494 //makeSomething(new VehicleDemo());
15232495 } else
1524
- if (event.getSource() == gridItem)
2496
+ /*
2497
+ */
2498
+ if (source == heightFieldItem)
2499
+ {
2500
+ Object3D obj = new Object3D();
2501
+
2502
+ obj.CreateMaterial();
2503
+ obj.bRep = new BoundaryRep();
2504
+
2505
+ obj.bRep.CreateMesh(new iHeightField()
2506
+ {
2507
+ public double f(double x, double y)
2508
+ {
2509
+ // The Mandelbrot set is represented by coloring
2510
+ // each point (x,y) according to the number of
2511
+ // iterations it takes before the while loop in
2512
+ // this method ends. For points that are actually
2513
+ // in the Mandelbrot set, or very close to it, the
2514
+ // count will reach the maximum value, 80. These
2515
+ // points will be colored purple. All other colors
2516
+ // represent points that are definitely NOT in the set.
2517
+ x -= 600;
2518
+ y -= 500;
2519
+ x /= 200;
2520
+ y /= 200;
2521
+ int count = 0;
2522
+ double zx = x;
2523
+ double zy = y;
2524
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2525
+ double new_zx = zx*zx - zy*zy + x;
2526
+ zy = 2*zx*zy + y;
2527
+ zx = new_zx;
2528
+ count++;
2529
+ }
2530
+ return count; // Math.sqrt(count);
2531
+ }
2532
+ }, 1000,1000);
2533
+
2534
+ makeSomething(obj);
2535
+ } else
2536
+ if (source == gridItem || source == gridButton)
15252537 {
15262538 makeSomething(new Grid());
15272539 } else
1528
- if (event.getSource() == ellipsoidItem)
2540
+ if (source == ellipsoidItem || source == sphereButton)
15292541 {
15302542 makeSomething(new Sphere());
15312543 } else
1532
- if (event.getSource() == coneItem)
2544
+ if (source == coneItem || source == coneButton)
15332545 {
15342546 makeSomething(new Cone());
15352547 } else
1536
- if (event.getSource() == torusItem)
2548
+ if (source == torusItem || source == torusButton)
15372549 {
15382550 makeSomething(new Torus());
15392551 } else
1540
- if (event.getSource() == superItem)
2552
+ if (source == superItem || source == superButton)
15412553 {
15422554 makeSomething(new Superellipsoid());
15432555 } else
1544
- if (event.getSource() == blobItem)
2556
+ if (source == kleinItem || source == kleinButton)
2557
+ {
2558
+ makeSomething(new Klein());
2559
+ } else
2560
+ if (source == blobItem)
15452561 {
15462562 Blob blob = new Blob();
15472563 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2565,15 @@
15492565 //blob.retile();
15502566 makeSomething(blob);
15512567 } else
1552
- if (event.getSource() == latheItem)
2568
+ if (source == latheItem)
15532569 {
15542570 makeSomething(new Lathe());
15552571 } else
1556
- if (event.getSource() == bezierItem)
2572
+ if (source == bezierItem)
15572573 {
15582574 makeSomething(new BezierSurface());
15592575 } else
1560
- if (event.getSource() == checkerItem)
2576
+ if (source == overlayItem || source == overlayButton)
15612577 {
15622578 /*
15632579 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2586,9 @@
15702586 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712587 LA.matInvert(obj.toParent, obj.fromParent);
15722588 */
1573
- makeSomething(new CheckerIG());
2589
+ makeSomething(new Checker());
15742590 } else
1575
- if (event.getSource() == meshItem)
2591
+ if (source == meshItem)
15762592 {
15772593 Object3D itemtomake = new Object3D();
15782594 Object3D child;
....@@ -1593,35 +2609,52 @@
15932609 makeSomething(child);
15942610 }
15952611 } else
1596
- if (event.getSource() == springItem)
2612
+ if (source == springItem)
15972613 {
15982614 cSpring s = new cSpring();
15992615 s.setup();
16002616 makeSomething(s);
16012617 } else
1602
- if (event.getSource() == flagItem)
2618
+ if (source == flagItem)
16032619 {
16042620 cSpring s = new cFlag();
16052621 s.setup();
16062622 makeSomething(s);
16072623 } else
1608
- if (event.getSource() == lightItem)
2624
+ if (source == lightItem || source == lightButton)
16092625 {
16102626 makeSomething(new Light());
16112627 } else
1612
- if (event.getSource() == csgItem)
2628
+// if (source == skybox1Button ||
2629
+// source == skybox2Button ||
2630
+// source == skybox3Button ||
2631
+// source == skybox4Button ||
2632
+// source == skybox5Button ||
2633
+// source == skybox6Button ||
2634
+// source == skybox7Button ||
2635
+// source == skybox11Button ||
2636
+// source == skybox12Button ||
2637
+// source == skybox13Button ||
2638
+// source == skybox14Button ||
2639
+// source == skybox15Button ||
2640
+// source == skybox16Button ||
2641
+// source == skybox17Button)
2642
+// {
2643
+// ChangeSkybox(source);
2644
+// } else
2645
+ if (source == csgItem)
16132646 {
16142647 group(new CSG());
16152648 } else
1616
- if (event.getSource() == templateItem)
2649
+ if (source == templateItem)
16172650 {
16182651 group(new cTemplate());
16192652 } else
1620
- if (event.getSource() == attributeItem)
2653
+ if (source == attributeItem)
16212654 {
16222655 makeSomething(new Attribute());
16232656 } else
1624
- if (event.getSource() == pointflowItem)
2657
+ if (source == pointflowItem)
16252658 {
16262659 makeSomething(new PointFlow());
16272660 } else
....@@ -1633,7 +2666,7 @@
16332666 } else
16342667 */
16352668
1636
- if (event.getSource() == superLoopItem)
2669
+ if (source == superLoopItem)
16372670 {
16382671 Composite g = new cGroup();
16392672 for (int i=0; i<15; i++)
....@@ -1655,30 +2688,38 @@
16552688
16562689 group(g);
16572690 } else
1658
- if (event.getSource() == loopItem)
2691
+ if (source == loopItem || source == loopButton)
16592692 {
2693
+ if (!group.selection.isEmpty())
2694
+ {
16602695 Composite csg = new GroupLeaf();
16612696 csg.count = 5;
1662
- group(csg);
1663
- Composite child = new cGroup();
2697
+ Composite child = new cGroup("Branch");
16642698 csg.addChild(child);
16652699 child.addChild(csg);
2700
+ group(csg);
2701
+ }
16662702 } else
1667
- if (event.getSource() == doubleItem)
2703
+ if (source == doubleItem)
16682704 {
1669
- Composite csg = new GroupLeaf();
2705
+ if (!group.selection.isEmpty())
2706
+ {
2707
+ Composite csg = new GroupLeaf("Fork");
16702708 csg.count = 5;
2709
+ Composite child = new cGroup("Branch A");
2710
+ csg.addChild(child);
2711
+ child.addChild(csg);
2712
+ child = new cGroup("Branch B");
2713
+ csg.addChild(child);
2714
+ child.addChild(csg);
16712715 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);
2716
+ }
16782717 } else
1679
- if (event.getSource() == tripleItem)
2718
+ if (source == tripleItem)
16802719 {
1681
- Composite csg = new GroupLeaf();
2720
+ if (!group.selection.isEmpty())
2721
+ {
2722
+ Composite csg = new GroupLeaf("Trident");
16822723 csg.count = 4;
16832724 group(csg);
16842725 Composite child = new cGroup();
....@@ -1690,74 +2731,119 @@
16902731 child = new cGroup();
16912732 csg.addChild(child);
16922733 child.addChild(csg);
2734
+ }
16932735 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2736
+ if (source == computeAOItem)
16962737 {
1697
- ImportGFD();
2738
+ Globals.drawMode = CameraPane.OCCLUSION;
2739
+ cameraView.repaint();
16982740 } 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)
2741
+ if (source == recompileItem)
17172742 {
17182743 Recompile();
17192744 refreshContents();
17202745 } else
1721
- if (event.getSource() == editScriptItem)
2746
+ if (source == editScriptItem)
17222747 {
17232748 OpenDialog();
17242749 refreshContents();
17252750 } else
1726
- if (event.getSource() == invariantsItem)
2751
+ if (source == invariantsItem)
17272752 {
17282753 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2754
+ Grafreed.grafreed.universe.invariants();
17302755 } else
1731
- if (event.getSource() == memoryItem)
2756
+ if (source == memoryItem)
17322757 {
17332758 //System.out.println("Invariants:");
17342759 PrintMemory();
17352760 } else
1736
- if (event.getSource() == pathItem)
2761
+ if (source == pathItem)
17372762 {
17382763 PrintPath();
17392764 } else
1740
- if (event.getSource() == analyzeItem)
2765
+ if (source == analyzeItem)
17412766 {
17422767 AnalyzeObject();
17432768 } else
1744
- if (event.getSource() == dumpItem)
2769
+ if (source == dumpItem)
17452770 {
17462771 DumpObject();
17472772 } else
1748
- if (event.getSource() == screenfitButton)
2773
+ if (source == minButton)
17492774 {
1750
- //Reload(lastConverter, lastFilename, true);
2775
+ Minimize();
2776
+ } else
2777
+ if (source == maxButton)
2778
+ {
2779
+ Maximize();
2780
+ } else
2781
+ if (source == fullButton)
2782
+ {
2783
+ ToggleFullScreen();
2784
+ } else
2785
+ if (source == collapseButton)
2786
+ {
2787
+ this.expandedLayout = radio.layout;
2788
+ CollapseToolbar();
2789
+ } else
2790
+ if (source == maximize3DButton)
2791
+ {
2792
+ this.expandedLayout = radio.layout;
2793
+ radio.layout = twoButton;
2794
+ Show3DView();
2795
+ CollapseToolbar();
2796
+ } else
2797
+ if (source == previousVersionButton)
2798
+ {
2799
+ // Go to previous version
2800
+ //if (!Undo())
2801
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2802
+ PreviousVersion();
2803
+ } else
2804
+ if (source == restoreButton)
2805
+ {
2806
+ // Restore current version
2807
+ Restore();
2808
+ //restoreButton.setEnabled(false);
2809
+ } else
2810
+ if (source == replaceButton)
2811
+ {
2812
+ // Overwrite current version
2813
+ Replace();
2814
+ //replaceButton.setEnabled(false);
2815
+ } else
2816
+ if (source == nextVersionButton)
2817
+ {
2818
+ // Go to next version
2819
+ NextVersion();
2820
+ } else
2821
+ if (source == saveVersionButton)
2822
+ {
2823
+ // Save a new version
2824
+ if (!Save(true))
2825
+ java.awt.Toolkit.getDefaultToolkit().beep();
2826
+ } else
2827
+ if (source == deleteVersionButton)
2828
+ {
2829
+ // Delete a new version
2830
+ DeleteVersion();
2831
+ } else
2832
+ if (source == oneStepButton)
2833
+ {
2834
+ Globals.ONESTEP = true;
2835
+ cameraView.repaint();
2836
+ } else
2837
+ if (source == screenfitButton)
2838
+ {
17512839 ScreenFit();
17522840 } else
1753
- if (event.getSource() == screenfitpointButton)
2841
+ if (source == screenfitpointButton)
17542842 {
1755
- //Reload(lastConverter, lastFilename, true);
17562843 ScreenFitPoint();
17572844 } else
1758
- if (event.getSource() == snapobjectButton)
2845
+ if (source == snapobjectButton)
17592846 {
1760
- //Reload(lastConverter, lastFilename, true);
17612847 SnapObject();
17622848 } else
17632849 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2852,13 @@
17662852 // Recompile();
17672853 // refreshContents();
17682854 // } else
1769
- if (event.getSource() == gcButton)
2855
+ if (source == gcButton)
17702856 {
17712857 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722858 System.gc();
17732859 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742860 } else
1775
- if (event.getSource() == editLeafItem)
2861
+ if (source == editLeafItem)
17762862 {
17772863 Object3D obj;
17782864 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2872,78 @@
17862872 }
17872873 refreshContents(true);
17882874 } else
1789
- if (event.getSource() == openWindowItem)
2875
+ if (source == openWindowItem)
17902876 {
17912877 EditSelection(true);
17922878 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2879
+ if (source == cutItem || source == clearButton)
17942880 {
17952881 loadClipboard(true);
17962882 } else
1797
- if (event.getSource() == duplicateItem)
2883
+ if (source == undoItem)
17982884 {
1799
- Object3D keep = GraphreeD.clipboard;
2885
+ PreviousVersion();
2886
+ } else
2887
+ if (source == redoItem)
2888
+ {
2889
+ NextVersion();
2890
+ } else
2891
+ if (source == duplicateItem)
2892
+ {
2893
+ Object3D keep = Grafreed.clipboard;
18002894 loadClipboard(false);
18012895 paste(false);
1802
- GraphreeD.clipboard = keep;
2896
+ Grafreed.clipboard = keep;
18032897 } else
1804
- if (event.getSource() == cloneItem)
2898
+ if (source == cloneItem)
18052899 {
18062900 CloneSelection(false);
18072901 } else
1808
- if (event.getSource() == cloneSupportItem)
2902
+ if (source == cloneSupportItem)
18092903 {
18102904 CloneSelection(true);
18112905 } else
1812
- if (event.getSource() == copyItem)
2906
+ if (source == copyItem)
18132907 {
18142908 loadClipboard(false);
18152909 } else
1816
- if (event.getSource() == pasteItem)
2910
+ if (source == pasteItem)
18172911 {
18182912 paste(false);
18192913 } else
1820
- if (event.getSource() == pasteLinkItem)
2914
+ if (source == pasteIntoItem)
18212915 {
1822
- pasteInto(false);
2916
+ pasteInto(true, false);
18232917 } else
1824
- if (event.getSource() == pasteCloneItem)
2918
+ if (source == pasteLinkItem)
18252919 {
1826
- pasteInto(true);
2920
+ pasteInto(false, false);
18272921 } else
1828
- if (event.getSource() == pasteExpandItem)
2922
+ if (source == pasteCloneItem)
2923
+ {
2924
+ pasteInto(true, true);
2925
+ } else
2926
+ if (source == pasteExpandItem)
18292927 {
18302928 paste(true);
18312929 } else
1832
- if (event.getSource() == synchronizeItem)
2930
+ if (source == synchronizeItem)
18332931 {
18342932 Overwrite(Object3D.TRANSFORM);
18352933 } else
1836
- if (event.getSource() == overwriteNameItem)
2934
+ if (source == overwriteNameItem)
18372935 {
18382936 Overwrite(Object3D.NAME);
18392937 } else
1840
- if (event.getSource() == overwriteUVItem)
2938
+ if (source == overwriteUVItem)
18412939 {
18422940 Overwrite(Object3D.UV);
18432941 } else
1844
- if (event.getSource() == overwriteMatItem)
2942
+ if (source == overwriteMatItem)
18452943 {
2944
+ /* july 2015
18462945 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2946
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482947 else
18492948 {
18502949 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2955,16 @@
18562955 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572956 }
18582957 }
2958
+ */
2959
+
2960
+ Overwrite(dropAttributes);
18592961 }
1860
- if (event.getSource() == overwriteGeoItem)
2962
+ if (source == overwriteGeoItem)
18612963 {
18622964 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2965
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642966 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2967
+// Object3D content = GrafreeD.clipboard.get(0);
18662968 //
18672969 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682970 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2976,7 @@
18742976 // refreshContents();
18752977 // }
18762978 } else
1877
- if (event.getSource() == generateMeshItem)
2979
+ if (source == generateMeshItem)
18782980 {
18792981 //if (group.selection.size() == 1)
18802982 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2987,7 @@
18852987 ResetModel();
18862988 refreshContents();
18872989 } else
1888
- if (event.getSource() == extractGeometriesItem)
2990
+ if (source == extractGeometriesItem)
18892991 {
18902992 boolean one = false;
18912993
....@@ -1912,7 +3014,7 @@
19123014 ResetModel();
19133015 refreshContents();
19143016 } else
1915
- if (event.getSource() == cloneGeometriesItem)
3017
+ if (source == cloneGeometriesItem)
19163018 {
19173019 boolean one = false;
19183020
....@@ -1938,32 +3040,37 @@
19383040 ResetModel();
19393041 refreshContents();
19403042 } else
1941
- if (event.getSource() == shareGeometriesItem)
3043
+ if (source == shareGeometriesItem)
19423044 {
19433045 boolean one = false;
19443046
19453047 if (group.selection.size() == 1)
19463048 one = true;
19473049
3050
+ Object3D merge = null;
3051
+
19483052 Object3D content = new cGroup();
19493053
19503054 for (int i=0; i<group.selection.size(); i++)
19513055 {
1952
- Object3D sel = new Merge(group.selection.get(i));
3056
+ merge = new Merge(group.selection.get(i));
19533057
19543058 if (one)
1955
- makeSomething(sel, false);
3059
+ makeSomething(merge, false);
19563060 else
1957
- content.addChild(sel);
3061
+ content.addChild(merge);
19583062 }
19593063
19603064 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
3065
+ makeSomething(content, true);
3066
+ else
3067
+ {
3068
+ ResetModel();
3069
+ Select(merge.GetTreePath(), true, false); // unselect... false);
3070
+ refreshContents();
3071
+ }
19653072 } else
1966
- if (event.getSource() == mergeGeometriesItem)
3073
+ if (source == mergeGeometriesItem)
19673074 {
19683075 boolean one = false;
19693076
....@@ -1993,11 +3100,11 @@
19933100 ResetModel();
19943101 refreshContents();
19953102 } else
1996
- if (event.getSource() == linkverticesItem)
3103
+ if (source == linkverticesItem)
19973104 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3105
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19993106 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
3107
+// Object3D content = GrafreeD.clipboard.get(0);
20013108 //
20023109 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20033110 // content = ((cGroup)content).get(0);
....@@ -2006,39 +3113,48 @@
20063113 // group.selection.get(0).setMasterThis(content); // should be identity
20073114 // refreshContents();
20083115 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3116
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20103117 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
3118
+ Object3D content = Grafreed.clipboard.get(0);
20123119
20133120 if (content instanceof cGroup && ((cGroup)content).transientlink )
20143121 content = ((cGroup)content).get(0);
20153122
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3123
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20173124 for (int i=0; i<group.selection.size(); i++)
20183125 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
3126
+ boolean random = CameraPane.SWITCH;
3127
+ CameraPane.SWITCH = false; // parse all random nodes
20213128 group.selection.get(i).linkVerticesThis(content);
20223129 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
3130
+ CameraPane.SWITCH = random;
20243131 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3132
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20263133 refreshContents();
20273134 }
20283135 } else
2029
- if (event.getSource() == resetsupportItem)
3136
+ if (source == resetsupportItem)
20303137 {
20313138 for (int i=0; i<group.selection.size(); i++)
20323139 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
3140
+ boolean random = CameraPane.SWITCH;
3141
+ CameraPane.SWITCH = false; // parse all random nodes
20353142 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
3143
+ CameraPane.SWITCH = random;
20373144 }
20383145
20393146 refreshContents();
20403147 } else
2041
- if (event.getSource() == resetreferencesItem)
3148
+ if (source == relinkverticesItem)
3149
+ {
3150
+ boolean random = CameraPane.SWITCH;
3151
+ CameraPane.SWITCH = false; // parse all random nodes
3152
+ group.selection.RelinkToSupport();
3153
+ CameraPane.SWITCH = random;
3154
+
3155
+ refreshContents();
3156
+ } else
3157
+ if (source == resetreferencesItem)
20423158 {
20433159 for (int i=0; i<group.selection.size(); i++)
20443160 {
....@@ -2047,11 +3163,11 @@
20473163
20483164 refreshContents();
20493165 } else
2050
- if (event.getSource() == setMasterItem)
3166
+ if (source == setMasterItem)
20513167 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3168
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20533169 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
3170
+ Object3D content = Grafreed.clipboard.get(0);
20553171
20563172 if (content instanceof cGroup && ((cGroup)content).transientlink )
20573173 content = ((cGroup)content).get(0);
....@@ -2060,13 +3176,13 @@
20603176 refreshContents();
20613177 }
20623178 } else
2063
- if (event.getSource() == poseMeshItem)
3179
+ if (source == poseMeshItem)
20643180 {
20653181 if (group.selection.size() == 1)
20663182 {
2067
- if (GraphreeD.clipboard.size() == 1)
3183
+ if (Grafreed.clipboard.size() == 1)
20683184 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
3185
+ Object3D content = Grafreed.clipboard.get(0);
20703186
20713187 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723188 content = ((cGroup)content).get(0);
....@@ -2079,19 +3195,19 @@
20793195 }
20803196
20813197 } else
2082
- if (event.getSource() == revertMeshItem)
3198
+ if (source == revertMeshItem)
20833199 {
20843200 RevertMeshes();
20853201 } else
2086
- if (event.getSource() == resetMeshItem)
3202
+ if (source == resetAllItem)
20873203 {
20883204 ResetAll();
20893205 } else
2090
- if (event.getSource() == stepAllItem)
3206
+ if (source == stepAllItem)
20913207 {
20923208 StepAll();
20933209 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3210
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953211 {
20963212 //int indices[] = jList.getSelectedIndices();
20973213 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3215,46 @@
20993215
21003216 ClearSelection(false);
21013217 } else
2102
- if (event.getSource() == clearAllItem)
3218
+ if (source == clearAllItem)
21033219 {
21043220 ClearSelection(true);
21053221 } else
2106
- if (event.getSource() == grabItem)
3222
+ if (source == grabItem || source == groupButton)
21073223 {
2108
- group(new cGroup(), true);
3224
+ group(new cGroup(), false); // true);
21093225 } else
2110
- if (event.getSource() == frontItem)
3226
+ if (source == hideItem)
3227
+ {
3228
+ group(new HiddenObject());
3229
+ } else
3230
+ if (source == frontItem)
21113231 {
21123232 front();
21133233 } else
2114
- if (event.getSource() == backItem)
3234
+ if (source == backItem)
21153235 {
21163236 back();
21173237 } else
2118
- if (event.getSource() == cameraItem)
3238
+ if (source == cameraItem)
21193239 {
21203240 makeSomething(new Camera());
21213241 } else
2122
- if (event.getSource() == compositeItem)
3242
+ if (source == compositeItem || source == compositeButton)
21233243 {
21243244 group(new Composite());
21253245 } else
2126
- if (event.getSource() == randomItem)
3246
+ if (source == switchItem || source == switchButton)
21273247 {
21283248 RandomNode random = new RandomNode();
21293249 group(random);
21303250 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3251
+ random.name = random.get(0).name + "Switch";
21323252 } else
2133
- if (event.getSource() == physicsItem)
3253
+ if (source == physicsItem)
21343254 {
21353255 group(new PhysicsNode());
21363256 } else
2137
- if (event.getSource() == frameselectorItem)
3257
+ if (source == frameselectorItem)
21383258 {
21393259 for (int i=0; i<group.selection.size(); i++)
21403260 {
....@@ -2146,7 +3266,7 @@
21463266 ResetModel();
21473267 refreshContents();
21483268 } else
2149
- if (event.getSource() == switchGeoItem)
3269
+ if (source == switchGeoItem)
21503270 {
21513271 for (int i=0; i<group.selection.size(); i++)
21523272 {
....@@ -2158,7 +3278,7 @@
21583278 ResetModel();
21593279 refreshContents();
21603280 } else
2161
- if (event.getSource() == switchTransfoItem)
3281
+ if (source == switchTransfoItem)
21623282 {
21633283 for (int i=0; i<group.selection.size(); i++)
21643284 {
....@@ -2170,7 +3290,7 @@
21703290 ResetModel();
21713291 refreshContents();
21723292 } else
2173
- if (event.getSource() == morphItem)
3293
+ if (source == morphItem)
21743294 {
21753295 for (int i=0; i<group.selection.size(); i++)
21763296 {
....@@ -2182,7 +3302,7 @@
21823302 ResetModel();
21833303 refreshContents();
21843304 } else
2185
- if (event.getSource() == scriptNodeItem)
3305
+ if (source == scriptNodeItem)
21863306 {
21873307 boolean atleastone = false;
21883308
....@@ -2221,191 +3341,264 @@
22213341 }
22223342 }
22233343 } else
2224
- if (event.getSource() == linkerItem)
3344
+ if (source == linkerItem)
22253345 {
22263346 group(new cLinker());
22273347 } else
2228
- if (event.getSource() == textureItem)
3348
+ if (source == textureItem || source == textureButton)
22293349 {
22303350 group(new TextureNode());
22313351 } else
2232
- if (event.getSource() == shadowXItem)
3352
+ if (source == billboardItem)
3353
+ {
3354
+ group(new BillboardNode());
3355
+ } else
3356
+ if (source == shadowXItem)
22333357 {
22343358 CastShadow(0);
22353359 } else
2236
- if (event.getSource() == shadowYItem)
3360
+ if (source == shadowYItem)
22373361 {
22383362 CastShadow(1);
22393363 } else
2240
- if (event.getSource() == shadowZItem)
3364
+ if (source == shadowZItem)
22413365 {
22423366 CastShadow(2);
22433367 } else
2244
- if (event.getSource() == ungroupItem)
3368
+ if (source == ungroupItem || source == ungroupButton)
22453369 {
2246
- ungroup();
3370
+ boolean canUngroup = true;
3371
+
3372
+ for (int i=0; i<group.selection.size(); i++)
3373
+ {
3374
+ Object3D selectedItem = group.selection.get(i);
3375
+
3376
+ if (selectedItem.Size() == 0)
3377
+ {
3378
+ // Cannot ungroup leaves
3379
+ canUngroup = false;
3380
+ break;
3381
+ }
3382
+
3383
+ if (selectedItem == group)
3384
+ {
3385
+ // Cannot ungroup root
3386
+ canUngroup = false;
3387
+ break;
3388
+ }
3389
+ }
3390
+
3391
+ if (canUngroup)
3392
+ {
3393
+ for (int i=0; i<group.selection.size(); i++)
3394
+ {
3395
+ Object3D selectedItem = group.selection.get(i);
3396
+
3397
+ Ungroup(selectedItem);
3398
+ }
3399
+
3400
+ ClearSelection(false);
3401
+
3402
+ refreshContents();
3403
+ }
22473404 } else
2248
- if (event.getSource() == genUVItem)
3405
+ if (source == genUVItem)
22493406 {
22503407 GenUV();
22513408 } else
2252
- if (event.getSource() == genNormalsCADItem)
3409
+ if (source == genNormalsCADItem)
22533410 {
22543411 GenNormals(true);
22553412 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3413
+ if (source == genNormalsMESHItem)
3414
+ {
3415
+ GenNormalsMESH();
3416
+ } else
3417
+ if (source == genNormalsORGANItem)
22573418 {
22583419 GenNormals(false);
22593420 } else
2260
- if (event.getSource() == stripifyItem)
3421
+ if (source == genNormalsMINEItem)
3422
+ {
3423
+ GenNormalsMINE();
3424
+ } else
3425
+ if (source == stripifyItem)
22613426 {
22623427 Stripify();
22633428 } else
2264
- if (event.getSource() == unstripifyItem)
3429
+ if (source == unstripifyItem)
22653430 {
22663431 Unstripify();
22673432 } else
2268
- if (event.getSource() == trimItem)
3433
+ if (source == trimItem)
22693434 {
22703435 Trim();
22713436 } else
2272
- if (event.getSource() == untrimItem)
3437
+ if (source == untrimItem)
22733438 {
22743439 Untrim();
22753440 } else
2276
- if (event.getSource() == clearColorsItem)
3441
+ if (source == clearColorsItem)
22773442 {
22783443 ClearColors();
22793444 } else
2280
- if (event.getSource() == clearMaterialsItem)
3445
+ if (source == clearMaterialsItem)
22813446 {
22823447 ClearMaterials();
22833448 } else
2284
- if (event.getSource() == liveleavesItem)
3449
+ if (source == liveleavesItem)
22853450 {
22863451 LiveLeaves(true);
22873452 } else
2288
- if (event.getSource() == unliveleavesItem)
3453
+ if (source == unliveleavesItem)
22893454 {
22903455 LiveLeaves(false);
22913456 } else
2292
- if (event.getSource() == supportleavesItem)
3457
+ if (source == supportleavesItem)
22933458 {
22943459 SupportLeaves(true);
22953460 } else
2296
- if (event.getSource() == unsupportleavesItem)
3461
+ if (source == unsupportleavesItem)
22973462 {
22983463 SupportLeaves(false);
22993464 } else
2300
- if (event.getSource() == hideleavesItem)
3465
+ if (source == hideleavesItem)
23013466 {
23023467 HideLeaves(true);
23033468 } else
2304
- if (event.getSource() == showleavesItem)
3469
+ if (source == showleavesItem)
23053470 {
23063471 HideLeaves(false);
23073472 } else
2308
- if (event.getSource() == markleavesItem)
3473
+ if (source == markleavesItem)
23093474 {
23103475 MarkLeaves(true);
23113476 } else
2312
- if (event.getSource() == unmarkleavesItem)
3477
+ if (source == unmarkleavesItem)
23133478 {
23143479 MarkLeaves(false);
23153480 } else
2316
- if (event.getSource() == flipVItem)
3481
+ if (source == rewindleavesItem)
3482
+ {
3483
+ RewindLeaves(true);
3484
+ } else
3485
+ if (source == unrewindleavesItem)
3486
+ {
3487
+ RewindLeaves(false);
3488
+ } else
3489
+ if (source == randomleavesItem)
3490
+ {
3491
+ RandomLeaves(true);
3492
+ } else
3493
+ if (source == unrandomleavesItem)
3494
+ {
3495
+ RandomLeaves(false);
3496
+ } else
3497
+ if (source == flipVItem)
23173498 {
23183499 FlipV(true);
23193500 } else
2320
- if (event.getSource() == unflipVItem)
3501
+ if (source == unflipVItem)
23213502 {
23223503 FlipV(false);
23233504 } else
2324
- if (event.getSource() == lowTexturesItem)
3505
+ if (source == lowTexturesItem)
23253506 {
23263507 SetTexRes(0);
23273508 } else
2328
- if (event.getSource() == normalTexturesItem)
3509
+ if (source == normalTexturesItem)
23293510 {
23303511 SetTexRes(1);
23313512 } else
2332
- if (event.getSource() == highTexturesItem)
3513
+ if (source == highTexturesItem)
23333514 {
23343515 SetTexRes(2);
23353516 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3517
+ if (source == veryhighTexturesItem)
23373518 {
23383519 SetTexRes(3);
23393520 } else
2340
- if (event.getSource() == maxTexturesItem)
3521
+ if (source == maxTexturesItem)
23413522 {
23423523 SetTexRes(4);
23433524 } else
2344
- if (event.getSource() == panoTexturesItem)
3525
+ if (source == panoTexturesItem)
23453526 {
23463527 SetTexRes(5);
23473528 } else
2348
- if (event.getSource() == reverseNormalsItem)
3529
+ if (source == reverseNormalsItem)
23493530 {
23503531 ReverseNormals();
23513532 } else
2352
- if (event.getSource() == parseverticesItem)
3533
+ if (source == parseverticesItem)
23533534 {
23543535 ParseVertices();
23553536 } else
2356
- if (event.getSource() == alignItem)
3537
+ if (source == textureFieldItem)
3538
+ {
3539
+ TextureVertices();
3540
+ } else
3541
+ if (source == alignItem)
23573542 {
23583543 Align();
23593544 } else
2360
- if (event.getSource() == mirrorItem)
3545
+ if (source == mirrorItem)
23613546 {
23623547 MirrorPoses();
23633548 } else
2364
- if (event.getSource() == reduceMorphItem)
3549
+ if (source == reduceMorphItem)
23653550 {
23663551 MeshReduction(false);
23673552 } else
2368
- if (event.getSource() == reduce34MorphItem)
3553
+ if (source == reduce34MorphItem)
23693554 {
23703555 MeshReduction(true);
23713556 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3557
+ if (source == reverseTrianglesItem)
23733558 {
23743559 ReverseTriangles();
23753560 } else
2376
- if (event.getSource() == reduceMeshItem)
3561
+ if (source == reduceMeshItem)
23773562 {
23783563 ReduceMesh(false);
23793564 } else
2380
- if (event.getSource() == reduce34MeshItem)
3565
+ if (source == reduce34MeshItem)
23813566 {
23823567 ReduceMesh(true);
23833568 } else
2384
- if (event.getSource() == increaseMeshItem)
3569
+ if (source == increaseMeshItem)
23853570 {
23863571 IncreaseMesh();
23873572 } else
2388
- if (event.getSource() == clipMeshItem)
3573
+ if (source == clipMeshItem)
23893574 {
23903575 ClipMesh();
23913576 } else
2392
- if (event.getSource() == smoothMeshItem)
3577
+ if (source == smoothMeshItem)
23933578 {
23943579 SmoothMesh();
23953580 } else
2396
- if (event.getSource() == transformgeometryItem)
3581
+ if (source == transformGeometryItem)
23973582 {
23983583 TransformGeometry();
23993584 } else
2400
- if (event.getSource() == resetTransformItem)
3585
+ if (source == transformChildrenItem)
3586
+ {
3587
+ TransformChildren();
3588
+ } else
3589
+ if (source == resetTransformItem)
24013590 {
24023591 ResetTransform();
24033592 } else
2404
- if (event.getSource() == resetCentroidItem)
3593
+ if (source == resetCentroidItem)
24053594 {
2406
- ResetCentroid();
3595
+ ResetCentroid(true);
24073596 } else
2408
- if (event.getSource() == resetParentItem)
3597
+ if (source == resetCentroidXZItem)
3598
+ {
3599
+ ResetCentroid(false);
3600
+ } else
3601
+ if (source == resetParentItem)
24093602 {
24103603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113604 {
....@@ -2415,7 +3608,7 @@
24153608
24163609 refreshContents();
24173610 } else
2418
- if (event.getSource() == repairParentItem)
3611
+ if (source == repairParentItem)
24193612 {
24203613 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213614 {
....@@ -2429,7 +3622,21 @@
24293622
24303623 refreshContents();
24313624 } else
2432
- if (event.getSource() == sortbysizeItem)
3625
+ if (source == repairShadowItem)
3626
+ {
3627
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3628
+ {
3629
+ Object3D obj = (Object3D)e.nextElement();
3630
+ obj.RepairShadow();
3631
+// for (int i=0; i<obj.size(); i++)
3632
+// {
3633
+// obj.get(i).parent = obj;
3634
+// }
3635
+ }
3636
+
3637
+ refreshContents();
3638
+ } else
3639
+ if (source == sortbysizeItem)
24333640 {
24343641 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353642 {
....@@ -2441,7 +3648,7 @@
24413648 ResetModel();
24423649 refreshContents();
24433650 } else
2444
- if (event.getSource() == sortbynameItem)
3651
+ if (source == sortbynameItem)
24453652 {
24463653 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473654 {
....@@ -2453,7 +3660,7 @@
24533660 ResetModel();
24543661 refreshContents();
24553662 } else
2456
- if (event.getSource() == attachPigmentItem)
3663
+ if (source == attachPigmentItem)
24573664 {
24583665 String texture = GetFile("Attach pigment");
24593666 Object3D obj;
....@@ -2465,7 +3672,7 @@
24653672
24663673 refreshContents();
24673674 } else
2468
- if (event.getSource() == detachPigmentItem)
3675
+ if (source == detachPigmentItem)
24693676 {
24703677 Object3D obj;
24713678 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3683,7 @@
24763683
24773684 refreshContents();
24783685 } else
2479
- if (event.getSource() == attachBumpItem)
3686
+ if (source == attachBumpItem)
24803687 {
24813688 String texture = GetFile("Attach bump");
24823689 Object3D obj;
....@@ -2488,18 +3695,18 @@
24883695
24893696 refreshContents();
24903697 } else
2491
- if (event.getSource() == detachBumpItem)
3698
+ if (source == detachBumpItem)
24923699 {
24933700 Object3D obj;
24943701 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953702 {
24963703 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3704
+ obj.ResetBumpTexture();
24983705 }
24993706
25003707 refreshContents();
25013708 } else
2502
- if (event.getSource() == pigmentBumpItem)
3709
+ if (source == pigmentBumpItem)
25033710 {
25043711 Object3D obj;
25053712 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,159 +3717,233 @@
25103717
25113718 refreshContents();
25123719 } else
2513
- if (event.getSource() == flashSelectionButton)
3720
+ if (source == embedTexturesItem)
3721
+ {
3722
+ Object3D obj;
3723
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3724
+ {
3725
+ obj = (Object3D)e.nextElement();
3726
+ obj.EmbedTextures(true);
3727
+ }
3728
+
3729
+ refreshContents();
3730
+ } else
3731
+ if (source == deEmbedTexturesItem)
3732
+ {
3733
+ Object3D obj;
3734
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3735
+ {
3736
+ obj = (Object3D)e.nextElement();
3737
+ obj.EmbedTextures(false);
3738
+ }
3739
+
3740
+ CameraPane.texturepigment.clear();
3741
+ CameraPane.texturebump.clear();
3742
+
3743
+ refreshContents();
3744
+ } else
3745
+ if (source == flashSelectionButton)
25143746 {
25153747 CameraPane.flash = true;
25163748 refreshContents();
25173749 } else
2518
- if (event.getSource() == oneButton)
3750
+ if (source == oneButton)
25193751 {
25203752 } else
2521
- if (event.getSource() == twoButton)
3753
+ if (source == twoButton)
25223754 {
25233755 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();
3756
+
3757
+ if (CameraPane.FULLSCREEN)
3758
+ fullscreenLayout = radio.layout;
3759
+
3760
+ Show3DView();
3761
+
3762
+ cameraView.requestFocusInWindow();
3763
+
3764
+// refreshContents(true);
3765
+//
3766
+// try
3767
+// {
3768
+// java.awt.Robot bot = new java.awt.Robot();
3769
+// int mask = InputEvent.BUTTON1_MASK;
3770
+// bot.mouseMove(100, 100);
3771
+// bot.mousePress(mask);
3772
+// bot.mouseRelease(mask);
3773
+// }
3774
+// catch (Exception e)
3775
+// {
3776
+//
3777
+// }
3778
+
25513779 } else
2552
- if (event.getSource() == threeButton)
3780
+ if (source == threeButton)
25533781 {
25543782 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();
3783
+
3784
+ if (CameraPane.FULLSCREEN)
3785
+ fullscreenLayout = radio.layout;
3786
+
3787
+// bigThree.remove(scenePanel);
3788
+// bigThree.remove(centralPanel);
3789
+// bigThree.remove(XYZPanel);
3790
+// aWindowConstraints.gridx = 0;
3791
+// aWindowConstraints.gridy = 0;
3792
+// aWindowConstraints.gridwidth = 1;
3793
+// // aConstraints.gridheight = 3;
3794
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3795
+// aWindowConstraints.weightx = 0;
3796
+// aWindowConstraints.weighty = 1;
3797
+// //bigThree.add(jtp, aWindowConstraints);
3798
+// aWindowConstraints.weightx = 1;
3799
+// aWindowConstraints.gridwidth = 3;
3800
+// // aConstraints.gridheight = 3;
3801
+// aWindowConstraints.gridx = 1;
3802
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3803
+// bigThree.add(centralPanel, aWindowConstraints);
3804
+// aWindowConstraints.weightx = 0;
3805
+// aWindowConstraints.gridx = 4;
3806
+// aWindowConstraints.gridwidth = 1;
3807
+// // aConstraints.gridheight = 3;
3808
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3809
+// bigThree.add(XYZPanel, aWindowConstraints);
3810
+// bigThree.validate();
3811
+// scenePanel.setVisible(false);
3812
+// centralPanel.setVisible(true);
3813
+// XYZPanel.setVisible(true);
3814
+ bigThree.ClearUI();
3815
+ bigThree.add(scenePanel);
3816
+ bigThree.add(centralPanel);
3817
+ bigThree.FlushUI();
3818
+
3819
+ cameraView.requestFocusInWindow();
25793820 } else
2580
- if (event.getSource() == fourButton)
3821
+ if (source == fourButton)
25813822 {
25823823 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();
3824
+
3825
+ if (CameraPane.FULLSCREEN)
3826
+ fullscreenLayout = radio.layout;
3827
+
3828
+// bigThree.remove(scenePanel);
3829
+// bigThree.remove(centralPanel);
3830
+// bigThree.remove(XYZPanel);
3831
+// aWindowConstraints.gridx = 0;
3832
+// aWindowConstraints.gridy = 0;
3833
+// aWindowConstraints.gridwidth = 1;
3834
+// // aWindowConstraints.gridheight = 3;
3835
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3836
+// aWindowConstraints.weightx = 1;
3837
+// aWindowConstraints.weighty = 1;
3838
+// bigThree.add(scenePanel, aWindowConstraints);
3839
+// aWindowConstraints.weightx = 1;
3840
+// aWindowConstraints.gridwidth = 3;
3841
+// // aConstraints.gridheight = 3;
3842
+// aWindowConstraints.gridx = 1;
3843
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3844
+// //bigThree.add(cameraPanel, aWindowConstraints);
3845
+// aWindowConstraints.weightx = 0;
3846
+// aWindowConstraints.gridx = 4;
3847
+// aWindowConstraints.gridwidth = 1;
3848
+// // aWindowConstraints.gridheight = 3;
3849
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3850
+// //bigThree.add(XYZPanel, aWindowConstraints);
3851
+// bigThree.validate();
3852
+// scenePanel.setVisible(true);
3853
+// centralPanel.setVisible(false);
3854
+// XYZPanel.setVisible(false);
3855
+ bigThree.ClearUI();
3856
+ bigThree.add(scenePanel);
3857
+ bigThree.FlushUI();
3858
+
3859
+ cameraView.requestFocusInWindow();
26073860 } else
2608
- if (event.getSource() == sixButton)
3861
+ if (source == sixButton)
26093862 {
26103863 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();
3864
+
3865
+ if (CameraPane.FULLSCREEN)
3866
+ fullscreenLayout = radio.layout;
3867
+
3868
+// bigThree.remove(scenePanel);
3869
+// bigThree.remove(centralPanel);
3870
+// bigThree.remove(XYZPanel);
3871
+// aWindowConstraints.gridx = 0;
3872
+// aWindowConstraints.gridy = 0;
3873
+// aWindowConstraints.gridwidth = 1;
3874
+// // aConstraints.gridheight = 3;
3875
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3876
+// aWindowConstraints.weightx = 0;
3877
+// aWindowConstraints.weighty = 1;
3878
+// bigThree.add(scenePanel, aWindowConstraints);
3879
+// aWindowConstraints.weightx = 1;
3880
+// aWindowConstraints.gridwidth = 3;
3881
+// // aWindowConstraints.gridheight = 3;
3882
+// aWindowConstraints.gridx = 1;
3883
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3884
+// bigThree.add(centralPanel, aWindowConstraints);
3885
+// aWindowConstraints.weightx = 0;
3886
+// aWindowConstraints.gridx = 4;
3887
+// aWindowConstraints.gridwidth = 1;
3888
+// // aWindowConstraints.gridheight = 3;
3889
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3890
+// //bigThree.add(XYZPanel, aConstraints);
3891
+// bigThree.validate();
3892
+// scenePanel.setVisible(true);
3893
+// centralPanel.setVisible(true);
3894
+// XYZPanel.setVisible(false);
3895
+ bigThree.ClearUI();
3896
+ bigThree.add(centralPanel);
3897
+ bigThree.add(scenePanel);
3898
+ bigThree.FlushUI();
3899
+
3900
+ cameraView.requestFocusInWindow();
26353901 } else
2636
- if (event.getSource() == sevenButton)
3902
+ if (source == sevenButton)
26373903 {
26383904 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();
3905
+
3906
+ if (CameraPane.FULLSCREEN)
3907
+ fullscreenLayout = radio.layout;
3908
+
3909
+// bigThree.remove(scenePanel);
3910
+// bigThree.remove(centralPanel);
3911
+// bigThree.remove(XYZPanel);
3912
+// aWindowConstraints.gridx = 0;
3913
+// aWindowConstraints.gridy = 0;
3914
+// aWindowConstraints.gridwidth = 1;
3915
+// // aWindowConstraints.gridheight = 3;
3916
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3917
+// aWindowConstraints.weightx = 0;
3918
+// aWindowConstraints.weighty = 1;
3919
+// bigThree.add(scenePanel, aWindowConstraints);
3920
+// aWindowConstraints.weightx = 1;
3921
+// aWindowConstraints.gridwidth = 3;
3922
+// // aWindowConstraints.gridheight = 3;
3923
+// aWindowConstraints.gridx = 1;
3924
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3925
+// bigThree.add(centralPanel, aWindowConstraints);
3926
+// aWindowConstraints.weightx = 0;
3927
+// aWindowConstraints.gridx = 4;
3928
+// aWindowConstraints.gridwidth = 1;
3929
+// // aConstraints.gridheight = 3;
3930
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3931
+// bigThree.add(XYZPanel, aWindowConstraints);
3932
+// bigThree.validate();
3933
+// scenePanel.setVisible(true);
3934
+// centralPanel.setVisible(true);
3935
+// XYZPanel.setVisible(true);
3936
+ bigThree.ClearUI();
3937
+ bigThree.add(scenePanel);
3938
+ bigThree.add(centralPanel);
3939
+ bigThree.add(XYZPanel);
3940
+ bigThree.FlushUI();
3941
+
3942
+ cameraView.requestFocusInWindow();
26633943 } else
2664
- if (event.getSource() == rootButton)
3944
+ if (source == rootButton)
26653945 {
3946
+ Replace();
26663947 Object3D obj;
26673948 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26683949 {
....@@ -2671,66 +3952,85 @@
26713952 EditObject(obj);
26723953 }
26733954
3955
+ cameraView.requestFocusInWindow();
26743956 refreshContents(true);
26753957 } else
2676
- if (event.getSource() == closeButton)
3958
+ if (source == closeButton)
26773959 {
26783960 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793961 cRadio ab;
26803962 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813963 {
26823964 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3965
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843966 {
3967
+ // Patch to avoid bug with transparency.
3968
+ if (!ab.hadMaterial)
3969
+ {
3970
+ ab.object.material = null;
3971
+ }
3972
+
26853973 buttonGroup.remove(ab);
26863974 radioPanel.remove(ab);
26873975
2688
- ab.GetObject().editWindow = null;
3976
+ //ab.GetObject().editWindow = null;
3977
+ ab.GetObject().manipWindow = null;
26893978 // ab.GetObject().objectUI = null; // ?????????
26903979
26913980 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923981 break;
26933982 }
26943983 }
3984
+
3985
+ cameraView.requestFocusInWindow();
26953986 refreshContents(true);
26963987 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3988
+ if (source == editItem || source == editButton)
26983989 {
3990
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3991
+ {
3992
+ Object3D child = (Object3D)e.nextElement();
3993
+ child.pinned = true;
3994
+ }
3995
+
26993996 EditSelection(false);
27003997 } else
2701
- if (event.getSource() == uneditButton)
3998
+ if (source == uneditButton)
27023999 {
27034000 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27044001 {
27054002 Object3D child = (Object3D)e.nextElement();
27064003 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4004
+ child.pinned = false;
27084005 child.CloseUI();
27094006 listUI.remove(child);
4007
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27104008
2711
- child.editWindow = null; // ???????????
4009
+ //child.editWindow = null; // ???????????
27124010 }
2713
- objEditor.ctrlPanel.revalidate();
4011
+ objEditor.ctrlPanel.FlushUI();
27144012 //objEditor.jTree.clearSelection();
27154013 //objEditor.ResetSliders();
27164014 refreshContents(true);
27174015 } else
2718
- if (event.getSource() == clearPanelButton)
4016
+ if (source == clearPanelButton)
27194017 {
27204018 assert(copy == group);
27214019 //copy.ClearUI();
27224020 for (Object3D obj : listUI)
27234021 {
4022
+ obj.pinned = false;
27244023 obj.CloseUI();
27254024 }
27264025 listUI.clear();
4026
+ SetPinStates(group.selection.size() > 0);
27274027 refreshContents(true);
27284028 } else
2729
- if (event.getSource() == allParamsButton)
4029
+ if (source == allParamsButton)
27304030 {
27314031 assert(copy == group);
27324032
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4033
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27344034
27354035 for (Object3D obj : listUI)
27364036 {
....@@ -2747,19 +4047,19 @@
27474047
27484048 refreshContents(true);
27494049 } else
2750
- if (event.getSource() == unselectButton)
4050
+ if (source == unselectButton)
27514051 {
27524052 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
4053
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27544054 objEditor.ResetSliders();
27554055 refreshContents(true);
27564056 } else
2757
- if(event.getSource() instanceof cRadio)
4057
+ if(source instanceof cRadio)
27584058 {
27594059 group.parent = keepparent;
27604060 group.attributes = 0;
27614061 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
4062
+ /*cRadio*/ radio = (cRadio)source;
27634063 Object3D obj = radio.GetObject();
27644064 System.out.println("Edit " + obj);
27654065 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +4079,8 @@
27794079 }
27804080
27814081 copy = group;
2782
- //CameraPane.theRenderer.object = group;
4082
+
4083
+ //Globals.theRenderer.object = group;
27834084 if(!useclient)
27844085 {
27854086 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +4089,67 @@
27884089 cameraView.cameras[cameraView.cameracount] = radio.camera;
27894090 cameraView.targetLookAt.set(radio.camera.lookAt);
27904091 cameraView.object = group;
2791
- cameraView.lighttouched = true;
4092
+ //cameraView.lighttouched = true;
4093
+ Globals.lighttouched = true;
27924094 topView.object = group;
27934095 frontView.object = group;
27944096 sideView.object = group;
27954097 }
2796
- group.editWindow = this;
4098
+
4099
+// fix "+" issue
4100
+ //group.editWindow = this;
4101
+ group.manipWindow = this;
4102
+
27974103 /*
27984104 currentLayout = radio.layout;
27994105 if (currentLayout == null)
28004106 currentLayout = sevenButton;
28014107 */
28024108 radio.layout.doClick();
4109
+
4110
+ assert(copy instanceof Composite);
4111
+
4112
+ if (copy.versionlist == null)
4113
+ {
4114
+ copy.versionlist = new Object3D[100];
4115
+ copy.versionindex = -1;
4116
+
4117
+ Save(true);
4118
+ }
4119
+
4120
+ SetVersionStates();
4121
+
4122
+ ClearUnpinned();
4123
+
4124
+ //Grafreed.Assert(group != null);
4125
+ //Grafreed.Assert(group.selection != null);
4126
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4127
+ if (group.selection == null || group.selection.size() == 1)
4128
+ EditSelection(false);
28034129 keepparent = group.parent;
28044130 // PARENT = NULL or not???
28054131 //group.parent = null; // ROOT
28064132 //group.attributes = -1;
28074133 ResetModel();
4134
+
4135
+ cameraView.requestFocusInWindow();
28084136 refreshContents(true);
2809
- }
4137
+ } else if (event.getSource() == editCameraItem)
4138
+ {
4139
+ cameraView.ProtectCamera();
4140
+ cameraView.requestFocusInWindow();
4141
+ cameraView.repaint();
4142
+ return;
4143
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4144
+ {
4145
+ cameraView.RevertCamera();
4146
+ cameraView.requestFocusInWindow();
4147
+ cameraView.repaint();
4148
+ return;
4149
+ // } else if (event.getSource() == textureButton)
4150
+ // {
4151
+ // return; // true;
4152
+ }
28104153 else
28114154 {
28124155 //return super.action(event, arg);
....@@ -2815,7 +4158,6 @@
28154158 }
28164159
28174160 boolean useclient = false;
2818
- cRadio radio;
28194161
28204162 void ToggleRoot()
28214163 {
....@@ -2824,7 +4166,7 @@
28244166 if (useclient)
28254167 {
28264168 cameraView.object = client;
2827
- cameraView.lighttouched = true;
4169
+ Globals.lighttouched = true;
28284170 //topView.object = client;
28294171 //frontView.object = client;
28304172 //sideView.object = client;
....@@ -2832,7 +4174,7 @@
28324174 else
28334175 {
28344176 cameraView.object = group;
2835
- cameraView.lighttouched = true;
4177
+ Globals.lighttouched = true;
28364178 //topView.object = group;
28374179 //frontView.object = group;
28384180 //sideView.object = group;
....@@ -2867,6 +4209,28 @@
28674209 refreshContents();
28684210 }
28694211
4212
+ void TransformChildren()
4213
+ {
4214
+ Object3D obj;
4215
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4216
+ {
4217
+ obj = (Object3D)e.nextElement();
4218
+ obj.KeepTextureMatrices();
4219
+ obj.TransformChildren();
4220
+ obj.RestoreTextureMatrices();
4221
+
4222
+// if (obj.parent == null)
4223
+// {
4224
+// System.out.println("NULL PARENT!");
4225
+// new Exception().printStackTrace();
4226
+// }
4227
+// else
4228
+// TouchTransform(obj);
4229
+// //obj.parent.Touch();
4230
+ }
4231
+
4232
+ refreshContents();
4233
+ }
28704234
28714235 void ResetTransform()
28724236 {
....@@ -2979,7 +4343,7 @@
29794343 refreshContents();
29804344 }
29814345
2982
- void ResetCentroid()
4346
+ void ResetCentroid(boolean full)
29834347 {
29844348 Object3D obj;
29854349 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4358,16 @@
29944358 LA.matIdentity(Object3D.mat);
29954359 obj.getBounds(minima, maxima, false);
29964360 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4361
+ if (full)
4362
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984363 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994364 obj.TransformMesh(Object3D.mat);
4365
+
30004366 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4367
+ if (full)
4368
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024369 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4370
+
30034371 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044372 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054373 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4396,8 @@
30284396
30294397 int size = obj.MemorySize();
30304398
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4399
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4400
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324401 }
30334402 }
30344403 catch (Exception e)
....@@ -3065,9 +4434,9 @@
30654434 obj = (Object3D)e.nextElement();
30664435
30674436 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4437
+ Grafreed.AnalyzeObject(obj);
30694438 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4439
+ Grafreed.AnalyzeObject(obj.bRep);
30714440
30724441 // System.err.println((size/1024) + " KB is the size of " + obj);
30734442 }
....@@ -3109,6 +4478,20 @@
31094478 void GenNormals(boolean crease)
31104479 {
31114480 group.GenNormalsS(crease);
4481
+
4482
+ refreshContents();
4483
+ }
4484
+
4485
+ void GenNormalsMESH()
4486
+ {
4487
+ group.GenNormalsMeshS();
4488
+
4489
+ refreshContents();
4490
+ }
4491
+
4492
+ void GenNormalsMINE()
4493
+ {
4494
+ group.selection.GenNormalsMINE();
31124495
31134496 refreshContents();
31144497 }
....@@ -3157,104 +4540,259 @@
31574540
31584541 //Object3D buffer;
31594542 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
-
4543
+// BoundaryRep temprep;
4544
+// Object3D nodes;
4545
+// Vector<Vertex> vertices;
4546
+//
4547
+// cGroup buffer;
4548
+//
4549
+// public void Vertex(Object3D node, Vertex v)
4550
+// {
4551
+//// vertices.add(v);
4552
+//// nodes.addElement(node);
4553
+////
4554
+//// if (temprep.GetCache(v) != null)
4555
+//// {
4556
+//// temprep.Remove(v);
4557
+//// } else
4558
+//// {
4559
+//// temprep.Remember(v);
4560
+//// }
4561
+//
4562
+// //Object3D node = nodes.get(index);
4563
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4564
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4565
+//
4566
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4567
+//
4568
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4569
+//
4570
+// cGroup g = new cGroup();
4571
+//
4572
+// if (g.toParent == null)
4573
+// {
4574
+// g.toParent = LA.newMatrix();
4575
+// g.fromParent = LA.newMatrix();
4576
+// }
4577
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4578
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4579
+//
4580
+// g.add(GrafreeD.clipboard);
4581
+//
4582
+// buffer.add(g);
4583
+// }
4584
+//
4585
+// public void Face(Object3D node, Face f)
4586
+// {
4587
+//
4588
+// }
4589
+//
4590
+// void ParseVerticesOld() // ??
4591
+// {
4592
+// //if (group.selection.size() != 1)
4593
+// // return;
4594
+//
4595
+// temprep = new BoundaryRep();
4596
+// nodes = new Object3D();
4597
+// vertices = new Vector<Vertex>();
4598
+//
4599
+// boolean epsequal = GrafreeD.epsequal;
4600
+// GrafreeD.epsequal = true;
4601
+//
4602
+// for (int i=0; i<group.selection.size(); i++)
4603
+// {
4604
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4605
+//
4606
+// group.selection.get(i).Parse(
4607
+//this );
4608
+//
4609
+// int repsize = temprep.VertexCount();
4610
+// int tablesize = temprep.vertextable.size();
4611
+// int nodesize = nodes.size();
4612
+//
4613
+// assert(vertices.size() == nodes.size());
4614
+//
4615
+// temprep.vertextable.elements();
4616
+//
4617
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4618
+//
4619
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4620
+// {
4621
+// cGroup g = new cGroup();
4622
+//
4623
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4624
+//
4625
+// Object3D node = nodes.get(index);
4626
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4627
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4628
+//
4629
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4630
+//
4631
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4632
+//
4633
+// if (g.toParent == null)
4634
+// {
4635
+// g.toParent = LA.newMatrix();
4636
+// g.fromParent = LA.newMatrix();
4637
+// }
4638
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4639
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4640
+//
4641
+// g.add(GrafreeD.clipboard);
4642
+//
4643
+// buffer.add(g);
4644
+// }
4645
+//
4646
+// makeSomething(buffer, i==group.selection.size()-1);
4647
+// }
4648
+//
4649
+// GrafreeD.epsequal = epsequal;
4650
+//
4651
+// //buffer = null;
4652
+// temprep = null;
4653
+// nodes = null;
4654
+//
4655
+// refreshContents();
4656
+// }
4657
+
31844658 void ParseVertices()
31854659 {
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;
4660
+ boolean epsequal = Grafreed.epsequal;
4661
+ Grafreed.epsequal = true;
31954662
31964663 for (int i=0; i<group.selection.size(); i++)
31974664 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4665
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994666
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4667
+ group.selection.get(i).Parse(
4668
+
4669
+ new iParse()
4670
+ {
4671
+ public void Vertex(Object3D node, Vertex v)
4672
+ {
4673
+ temp.set(v);
4674
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054675
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();
4676
+ cGroup g = new cGroup();
32114677
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4678
+ if (g.toParent == null)
4679
+ {
4680
+ g.toParent = LA.newMatrix();
4681
+ g.fromParent = LA.newMatrix();
4682
+ }
4683
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4684
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154685
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);
4686
+ g.add(Grafreed.clipboard);
32204687
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);
4688
+ buffer.add(g);
4689
+ }
32324690
3233
- g.add(GraphreeD.clipboard);
4691
+ public void Face(Object3D node, Face f)
4692
+ {
32344693
3235
- buffer.add(g);
3236
- }
4694
+ }
4695
+ }
4696
+ );
32374697
32384698 makeSomething(buffer, i==group.selection.size()-1);
32394699 }
32404700
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4701
+ Grafreed.epsequal = epsequal;
32464702
32474703 refreshContents();
32484704 }
3249
-
4705
+
4706
+ void TextureVertices()
4707
+ {
4708
+ for (int i=0; i<group.selection.size(); i++)
4709
+ {
4710
+ group.selection.get(i).Parse(
4711
+ new iParse()
4712
+ {
4713
+ public void Vertex(Object3D node, Vertex v)
4714
+ {
4715
+ cTexture tex = node.GetTextures();
4716
+ String pigment = Object3D.GetPigment(tex);
4717
+ //String bump = Object3D.GetBump(tex);
4718
+
4719
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4720
+
4721
+ try
4722
+ {
4723
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4724
+ }
4725
+ catch (Exception e)
4726
+ {
4727
+ System.err.println("FAIL: " + node);
4728
+ }
4729
+
4730
+ double s = v.s;
4731
+
4732
+ if (s == 1)
4733
+ s = 0;
4734
+
4735
+ double t = v.t;
4736
+
4737
+ if (t == 1)
4738
+ t = 0;
4739
+
4740
+ int indexs = (int) (texturedata.getWidth() * s);
4741
+ int indext = (int) (texturedata.getHeight() * t);
4742
+
4743
+ int index = indext * texturedata.getWidth() + indexs;
4744
+
4745
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4746
+
4747
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4748
+
4749
+ float scale = bytebuf.get(index*slide) & 0xFF;
4750
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4751
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4752
+ scale /= 3;
4753
+
4754
+ scale /= 0xFF;
4755
+ // c'est quoi ca? scale /= 4;
4756
+
4757
+ //v.AO = scale;
4758
+
4759
+ v.x += v.norm.x * scale;
4760
+ v.y += v.norm.y * scale;
4761
+ v.z += v.norm.z * scale;
4762
+ }
4763
+
4764
+ public void Face(Object3D node, Face f)
4765
+ {
4766
+ }
4767
+ }
4768
+ );
4769
+ }
4770
+
4771
+ refreshContents();
4772
+ }
4773
+
32504774 void Align()
32514775 {
4776
+ if (group.selection.size() == 0)
4777
+ return;
4778
+
4779
+ cVector bbmin = new cVector();
4780
+ cVector bbmax = new cVector();
4781
+
4782
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4783
+
4784
+ double dx = bbmax.x - bbmin.x;
4785
+ double dy = bbmax.y - bbmin.y;
4786
+ double dz = bbmax.z - bbmin.z;
4787
+
4788
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4789
+
32524790 for (int i=0; i<group.selection.size(); i++)
32534791 {
32544792 Object3D obj = group.selection.get(i);
32554793
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4794
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4795
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584796 }
32594797
32604798 refreshContents();
....@@ -3267,7 +4805,7 @@
32674805 // ref.SaveSupports();
32684806 // Object3D par = ref.parent;
32694807 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4808
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714809 // ref.parent = par;
32724810 // ref.RestoreSupports();
32734811
....@@ -3275,11 +4813,11 @@
32754813
32764814 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774815
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4816
+ boolean random = CameraPane.SWITCH;
4817
+ CameraPane.SWITCH = false; // parse all random nodes
32804818 lowres.linkVerticesThis(null);
32814819 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4820
+ CameraPane.SWITCH = random;
32834821
32844822 System.err.flush();
32854823
....@@ -3297,7 +4835,7 @@
32974835 // lowres.SaveSupports();
32984836 // par = lowres.parent;
32994837 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4838
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014839 Object3D newlow = CloneObject(lowres, false);
33024840 newlow.name = sn.switchobject.get(i).name;
33034841 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4857,7 @@
33194857 return;
33204858
33214859 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4860
+ Object3D ref = Grafreed.clipboard.get(0);
33234861
33244862 Object3D newgroup = new Object3D("Po:" + poses.name);
33254863
....@@ -3488,7 +5026,7 @@
34885026 group.selection.RelinkToSupport(); // july 2014
34895027 System.out.println("DONE.");
34905028 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
5029
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34925030 }
34935031
34945032 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +5051,20 @@
35135051
35145052 void ClipMesh()
35155053 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
5054
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35175055 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
5056
+ Object3D content = Grafreed.clipboard.get(0);
35195057
35205058 if (content instanceof cGroup && ((cGroup)content).transientlink )
35215059 content = ((cGroup)content).get(0);
35225060
35235061 // for (int i=0; i<group.selection.size(); i++)
35245062 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
5063
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35265064 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
5065
+ group.selection.ClipMesh(Grafreed.clipboard);
35285066 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
5067
+// group.selection.ClipMesh(GrafreeD.clipboard);
35305068 System.out.println("DONE.");
35315069 refreshContents();
35325070 }
....@@ -3571,6 +5109,18 @@
35715109 void MarkLeaves(boolean hide)
35725110 {
35735111 group.selection.MarkLeaves(hide);
5112
+ refreshContents();
5113
+ }
5114
+
5115
+ void RewindLeaves(boolean hide)
5116
+ {
5117
+ group.selection.RewindLeaves(hide);
5118
+ refreshContents();
5119
+ }
5120
+
5121
+ void RandomLeaves(boolean hide)
5122
+ {
5123
+ group.selection.RandomLeaves(hide);
35745124 refreshContents();
35755125 }
35765126
....@@ -3645,28 +5195,25 @@
36455195 // }
36465196 // }
36475197
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525198 void EditSelection(boolean newWindow)
36535199 {
5200
+ if (group.selection == null)
5201
+ {
5202
+ EditElement(group, newWindow); // ? new
5203
+ return;
5204
+ }
5205
+
36545206 // aConstraints.gridy = 0;
36555207 for (int i=0; i<group.selection.size(); i++)
36565208 {
36575209 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585210 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5211
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605212
36615213 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5214
+ if(elem != group || !newWindow)
36635215 {
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
5216
+ EditElement(elem, newWindow); // ? new
36705217 }
36715218 }
36725219 }
....@@ -3729,9 +5276,7 @@
37295276
37305277 freezemodel = false;
37315278 }
3732
-
3733
- boolean flashIt = true;
3734
-
5279
+
37355280 public void valueChanged(TreeSelectionEvent e)
37365281 //public boolean handleEvent(Event event)
37375282 {
....@@ -3741,7 +5286,8 @@
37415286 //new Exception().printStackTrace();
37425287
37435288 freezemodel = true;
3744
-
5289
+ ClearUnpinned();
5290
+
37455291 /**/
37465292 //switch (event.id)
37475293 {
....@@ -3749,7 +5295,6 @@
37495295 //case 702: // Event.LIST_DESELECT
37505296 group.deselectAll();
37515297 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535298 if (tps != null)
37545299 {
37555300 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5303,39 @@
37585303
37595304 //if (child.parent != null)
37605305 //child.parent.addSelectee(child);
5306
+ objEditor.SetMaterial(child);
37615307 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655308 }
37665309 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5310
+// else
5311
+// {
5312
+// objEditor.SetMaterial(group); // .GetMaterial());
5313
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5314
+// System.err.println("info : " + group.GetPath());
5315
+// }
37735316
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5317
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775318 CameraPane.flash = true;
37785319
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5320
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805321 // a camera
37815322 {
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;
5323
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5324
+ {
5325
+ CameraPane.camerachangeframe = 0; // don't refuse it
5326
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5327
+ }
5328
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5329
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865330 }
37875331
5332
+ if (tps != null && tps.length == 1)
5333
+ {
5334
+ EditSelection(false);
5335
+ }
5336
+
5337
+ SetPinStates(tps != null && tps.length > 0);
5338
+
37885339 refreshContents();
37895340 //return true;
37905341 }
....@@ -3793,6 +5344,51 @@
37935344
37945345 freezemodel = false;
37955346 }
5347
+
5348
+ void SetPinStates(boolean enabled)
5349
+ {
5350
+ editButton.setEnabled(enabled);
5351
+ uneditButton.setEnabled(enabled);
5352
+ //unselectButton.setEnabled(enabled);
5353
+ flashSelectionButton.setEnabled(enabled);
5354
+
5355
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5356
+
5357
+ boolean allComposites = true;
5358
+
5359
+ if (group.selection != null)
5360
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5361
+ {
5362
+ if (!(e.nextElement() instanceof Composite))
5363
+ {
5364
+ allComposites = false;
5365
+ break;
5366
+ }
5367
+ }
5368
+
5369
+ rootButton.setEnabled(allComposites);
5370
+ }
5371
+
5372
+ void refreshContents(boolean cp)
5373
+ {
5374
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5375
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5376
+ {
5377
+ objEditor.ClearInfo(); // .GetMaterial());
5378
+
5379
+ for (int i=0; i < group.selection.Size(); i++)
5380
+ {
5381
+ Object3D child = (Object3D) group.selection.get(i);
5382
+
5383
+ objEditor.AddInfo(child, this, true);
5384
+// System.err.println("info : " + child.GetPath());
5385
+ }
5386
+
5387
+ objEditor.SetText(); // jan 2014
5388
+ }
5389
+
5390
+ super.refreshContents(cp);
5391
+ }
37965392
37975393 void linkSomething(Object3D thing)
37985394 {
....@@ -3864,16 +5460,19 @@
38645460 {
38655461 if (group.selection.isEmpty())
38665462 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5463
+
5464
+ Grafreed.clipboardIsTempGroup = false;
38685465 Composite tGroup = null;
38695466 if (group.selection.size() > 0) // 1)
38705467 {
38715468 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5469
+ Grafreed.clipboardIsTempGroup = true;
38735470 }
38745471
38755472 if (cut)
38765473 {
5474
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5475
+// Save();
38775476 //int indices[] = jList.getSelectedIndices();
38785477 //for (int i = indices.length - 1; i >= 0; i--)
38795478 //jList.remove(indices[i]);
....@@ -3909,16 +5508,16 @@
39095508 //System.out.println("cut " + child);
39105509 //System.out.println("parent = " + child.parent);
39115510 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5511
+ if (Grafreed.clipboardIsTempGroup)
39135512 tGroup.add/*Child*/(tmp);
39145513 else
3915
- GraphreeD.clipboard = tmp;
5514
+ Grafreed.clipboard = tmp;
39165515 }
39175516 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5517
+ if (Grafreed.clipboardIsTempGroup)
39195518 tGroup.add/*Child*/(child);
39205519 else
3921
- GraphreeD.clipboard = child;
5520
+ Grafreed.clipboard = child;
39225521 }
39235522
39245523 //ResetModel();
....@@ -3950,21 +5549,23 @@
39505549 //System.out.println("cut " + elem);
39515550 //System.out.println("parent = " + elem.parent);
39525551 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5552
+ if (Grafreed.clipboardIsTempGroup)
39545553 tGroup.add/*Child*/(tmp);
39555554 else
3956
- GraphreeD.clipboard = tmp;
5555
+ Grafreed.clipboard = tmp;
39575556 }
39585557 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5558
+ if (Grafreed.clipboardIsTempGroup)
39605559 tGroup.add/*Child*/(child);
39615560 else
3962
- GraphreeD.clipboard = child;
5561
+ Grafreed.clipboard = child;
39635562 }
39645563
39655564 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5565
+
5566
+ if (Grafreed.clipboardIsTempGroup)
5567
+ Grafreed.clipboard = tGroup;
5568
+
39685569 if (cut)
39695570 {
39705571 ResetModel();
....@@ -3974,11 +5575,15 @@
39745575
39755576 void paste(boolean expand)
39765577 {
3977
- // if (GraphreeD.clipboard == null)
5578
+ if (Globals.REPLACEONMAKE)
5579
+ Save();
5580
+ boolean keep = Globals.REPLACEONMAKE;
5581
+ Globals.REPLACEONMAKE = false;
5582
+ // if (GrafreeD.clipboard == null)
39785583 // return;
39795584 boolean first = true;
39805585
3981
- if (GraphreeD.clipboardIsTempGroup)
5586
+ if (Grafreed.clipboardIsTempGroup)
39825587 {
39835588 Composite temp;
39845589
....@@ -3989,7 +5594,7 @@
39895594 temp = (Composite)Applet3D.clipboard.deepCopy();
39905595 */
39915596 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5597
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935598 {
39945599 Object3D child = (Object3D)e.nextElement();
39955600
....@@ -4003,7 +5608,7 @@
40035608 else
40045609 elem = child.deepCopy(); // ?
40055610 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5611
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075612 // elem = elem.get(0);
40085613 makeSomething(elem, true); // ?? first);
40095614 //group.addChild(elem);
....@@ -4023,23 +5628,24 @@
40235628 //Object3D cb = Applet3D.clipboard;
40245629 //temp.addChild(cb);
40255630 //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());
5631
+ assert(Grafreed.clipboard.parent == null);
5632
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5633
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5634
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5635
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315636 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5637
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5638
+ Grafreed.clipboard.get(0).parent = keepparent;
40345639 }
40355640
5641
+ Globals.REPLACEONMAKE = keep;
40365642 ResetModel();
40375643 refreshContents();
40385644 }
40395645
4040
- void pasteInto(boolean copyit)
5646
+ void pasteInto(boolean copyit, boolean clone)
40415647 {
4042
-// if (GraphreeD.clipboard == null)
5648
+// if (GrafreeD.clipboard == null)
40435649 // return;
40445650
40455651 if (group.selection.size() != 1)
....@@ -4066,15 +5672,22 @@
40665672 if (copyit)
40675673 {
40685674 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5675
+ if (clone)
5676
+ {
5677
+ CloneClipboard(false); // sept 2014
5678
+ }
5679
+ else
5680
+ {
5681
+ paste(false);
5682
+ }
40705683 }
40715684 else
40725685 {
40735686 boolean first = true;
40745687
4075
- if (GraphreeD.clipboardIsTempGroup)
5688
+ if (Grafreed.clipboardIsTempGroup)
40765689 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5690
+ Composite temp = (Composite)Grafreed.clipboard;
40785691 Object3D copy;
40795692 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805693 {
....@@ -4084,7 +5697,7 @@
40845697 }
40855698 } else
40865699 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5700
+ linkSomething(Grafreed.clipboard); //.get(0));
40885701 }
40895702 }
40905703 }
....@@ -4161,6 +5774,10 @@
41615774
41625775 void group(Object3D csg, boolean grab)
41635776 {
5777
+ if (Globals.REPLACEONMAKE)
5778
+ Save();
5779
+ boolean keep = Globals.REPLACEONMAKE;
5780
+ Globals.REPLACEONMAKE = false;
41645781 if (//false) // why??
41655782 !group.selection.isEmpty())
41665783 {
....@@ -4274,8 +5891,34 @@
42745891 //node.add(csg);
42755892 //makeSomething(node);
42765893 makeSomething(csg);
5894
+ Globals.REPLACEONMAKE = keep;
42775895 }
42785896
5897
+ void Ungroup(Object3D g)
5898
+ {
5899
+ if (Globals.REPLACEONMAKE)
5900
+ Save();
5901
+ boolean keep = Globals.REPLACEONMAKE;
5902
+ Globals.REPLACEONMAKE = false;
5903
+ if (g instanceof HiddenObject)
5904
+ {
5905
+ HiddenObject h = (HiddenObject) g;
5906
+
5907
+ for (int i=0; i<h.ActualSize(); i++)
5908
+ {
5909
+ objEditor.makeSomething(h.get(i), false);
5910
+ }
5911
+ }
5912
+ else
5913
+ {
5914
+ for (int i=0; i<g.Size(); i++)
5915
+ {
5916
+ objEditor.makeSomething(g.get(i), false);
5917
+ }
5918
+ }
5919
+ Globals.REPLACEONMAKE = keep;
5920
+ }
5921
+
42795922 void ungroup()
42805923 {
42815924 /*
....@@ -4469,21 +6112,6 @@
44696112 }
44706113 */
44716114
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
-
44876115 /*
44886116 public void Callback(Object obj)
44896117 {
....@@ -4507,26 +6135,9 @@
45076135 }
45086136 */
45096137
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
-
45276138 String GetFile(String dialogName)
45286139 {
4529
- if (GraphreeD.standAlone)
6140
+ if (Grafreed.standAlone)
45306141 {
45316142 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45326143 browser.show();
....@@ -4590,10 +6201,48 @@
45906201 cButton flashSelectionButton;
45916202 cButton editButton;
45926203 cButton uneditButton;
6204
+ JCheckBox allParamsButton;
45936205 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956206 cButton unselectButton;
45966207
6208
+ cButton restoreCameraButton;
6209
+
6210
+ cButton oneStepButton;
6211
+
6212
+ cButton groupButton;
6213
+ cButton ungroupButton;
6214
+ cButton compositeButton;
6215
+ cButton switchButton;
6216
+ cButton loopButton;
6217
+ cButton textureButton;
6218
+
6219
+ cButton skybox1Button;
6220
+ cButton skybox2Button;
6221
+ cButton skybox3Button;
6222
+ cButton skybox4Button;
6223
+ cButton skybox5Button;
6224
+ cButton skybox6Button;
6225
+ cButton skybox7Button;
6226
+
6227
+ cButton skybox11Button;
6228
+ cButton skybox12Button;
6229
+ cButton skybox13Button;
6230
+ cButton skybox14Button;
6231
+ cButton skybox15Button;
6232
+ cButton skybox16Button;
6233
+ cButton skybox17Button;
6234
+
6235
+ cButton gridButton;
6236
+ cButton boxButton;
6237
+ cButton sphereButton;
6238
+ cButton coneButton;
6239
+ cButton torusButton;
6240
+ cButton superButton;
6241
+ cButton kleinButton;
6242
+ cButton particlesButton;
6243
+ cButton overlayButton;
6244
+ cButton lightButton;
6245
+
45976246 cButton screenfitButton;
45986247 cButton screenfitpointButton;
45996248 cButton snapobjectButton;
....@@ -4605,14 +6254,6 @@
46056254
46066255 cButton setsupportButton;
46076256
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
-
46166257 //
46176258 //Composite
46186259 Object3D // to do !!
....@@ -4622,10 +6263,12 @@
46226263 //JTree jTree;
46236264 private MenuItem lookAtItem;
46246265 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
4626
- private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
4628
- private MenuItem cloneItem;
6266
+ private MenuItem switchViewItem;
6267
+ private JMenuItem cutItem;
6268
+ private MenuItem undoItem;
6269
+ private MenuItem redoItem;
6270
+ private JMenuItem duplicateItem;
6271
+ private JMenuItem cloneItem;
46296272 private MenuItem cloneSupportItem;
46306273 private MenuItem overwriteGeoItem;
46316274 private MenuItem overwriteMatItem;
....@@ -4635,8 +6278,9 @@
46356278 private MenuItem resetsupportItem;
46366279 private MenuItem resetreferencesItem;
46376280 private MenuItem linkverticesItem;
6281
+ private MenuItem relinkverticesItem;
46386282 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6283
+ private MenuItem resetAllItem;
46406284 private MenuItem stepAllItem;
46416285 private MenuItem revertMeshItem;
46426286 private MenuItem poseMeshItem;
....@@ -4645,16 +6289,19 @@
46456289 private MenuItem cloneGeometriesItem;
46466290 private MenuItem shareGeometriesItem;
46476291 private MenuItem mergeGeometriesItem;
4648
- private MenuItem copyItem;
6292
+ private JMenuItem copyItem;
46496293 private MenuItem pasteItem;
4650
- private MenuItem pasteLinkItem;
4651
- private MenuItem pasteCloneItem;
4652
- private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6294
+ private JMenuItem pasteIntoItem;
6295
+ private JMenuItem pasteLinkItem;
6296
+ private JMenuItem pasteCloneItem;
6297
+ private JMenuItem pasteExpandItem;
6298
+ private JMenuItem deleteItem;
46546299 private MenuItem clearAllItem;
46556300 private MenuItem genUVItem;
6301
+ private MenuItem genNormalsMESHItem;
46566302 private MenuItem genNormalsCADItem;
46576303 private MenuItem genNormalsORGANItem;
6304
+ private MenuItem genNormalsMINEItem;
46586305 private MenuItem stripifyItem;
46596306 private MenuItem unstripifyItem;
46606307 private MenuItem trimItem;
....@@ -4683,6 +6330,10 @@
46836330 private MenuItem showleavesItem;
46846331 private MenuItem markleavesItem;
46856332 private MenuItem unmarkleavesItem;
6333
+ private MenuItem rewindleavesItem;
6334
+ private MenuItem unrewindleavesItem;
6335
+ private MenuItem randomleavesItem;
6336
+ private MenuItem unrandomleavesItem;
46866337
46876338 private MenuItem flipVItem;
46886339 private MenuItem unflipVItem;
....@@ -4694,14 +6345,17 @@
46946345 private MenuItem panoTexturesItem;
46956346
46966347 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6348
+ private MenuItem resetCentroidXZItem;
46986349 private MenuItem resetTransformItem;
6350
+ private MenuItem transformGeometryItem;
6351
+ private MenuItem transformChildrenItem;
6352
+ private MenuItem hideItem;
46996353 private MenuItem grabItem;
47006354 private MenuItem backItem;
47016355 private MenuItem frontItem;
47026356 private MenuItem cameraItem;
47036357 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6358
+ private MenuItem switchItem;
47056359 private MenuItem physicsItem;
47066360 private MenuItem frameselectorItem;
47076361 private MenuItem scriptNodeItem;
....@@ -4709,13 +6363,14 @@
47096363 private MenuItem switchTransfoItem;
47106364 private MenuItem morphItem;
47116365 private MenuItem linkerItem;
4712
- private MenuItem ungroupItem;
6366
+ private JMenuItem ungroupItem;
47136367 private MenuItem editItem;
47146368 private MenuItem openWindowItem;
47156369 private MenuItem editLeafItem;
47166370
47176371 private MenuItem resetParentItem;
47186372 private MenuItem repairParentItem;
6373
+ private MenuItem repairShadowItem;
47196374 private MenuItem sortbysizeItem;
47206375 private MenuItem sortbynameItem;
47216376
....@@ -4724,20 +6379,25 @@
47246379 private MenuItem attachBumpItem;
47256380 private MenuItem detachBumpItem;
47266381 private MenuItem pigmentBumpItem;
6382
+ private MenuItem embedTexturesItem;
6383
+ private MenuItem deEmbedTexturesItem;
47276384
47286385 private MenuItem particleItem;
47296386 private MenuItem ragdollItem;
47306387 private MenuItem ragdoll2Item;
6388
+ private MenuItem heightFieldItem;
6389
+ private MenuItem textureFieldItem;
47316390 private MenuItem gridItem;
47326391 private MenuItem rectoidItem;
47336392 private MenuItem ellipsoidItem;
47346393 private MenuItem coneItem;
47356394 private MenuItem torusItem;
47366395 private MenuItem superItem;
6396
+ private MenuItem kleinItem;
47376397 private MenuItem blobItem;
47386398 private MenuItem latheItem;
47396399 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6400
+ private MenuItem overlayItem;
47416401 private MenuItem meshItem;
47426402 // private MenuItem meshGroupItem;
47436403 private MenuItem springItem;
....@@ -4746,6 +6406,7 @@
47466406 private MenuItem csgItem;
47476407 private MenuItem templateItem;
47486408 private MenuItem textureItem;
6409
+ private MenuItem billboardItem;
47496410 private MenuItem shadowXItem;
47506411 private MenuItem shadowYItem;
47516412 private MenuItem shadowZItem;
....@@ -4758,11 +6419,6 @@
47586419 private MenuItem doubleItem;
47596420 private MenuItem tripleItem;
47606421
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666422 private MenuItem computeAOItem;
47676423 private MenuItem recompileItem;
47686424 private MenuItem editScriptItem;
....@@ -4772,4 +6428,8 @@
47726428 private MenuItem analyzeItem;
47736429 private MenuItem dumpItem;
47746430 //boolean freezemodel = false;
6431
+
6432
+ Menu cameraMenu;
6433
+ MenuItem editCameraItem;
6434
+ MenuItem restoreCameraItem;
47756435 }