Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
GroupEditor.java
....@@ -12,9 +12,11 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1820 ObjectUI,
1921 Runnable,
2022 ActionListener,
....@@ -22,6 +24,335 @@
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);
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, final String t, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(f + "s");
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", "rgb", 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
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ cameraView.repaint();
354
+ }
355
+
25356 //ObjEditor objEditor;
26357 public void closeUI2()
27358 {
....@@ -59,6 +390,12 @@
59390 this.copy = this.group = group;
60391 //selectees = this.group.selectees;
61392
393
+ if (copy.versionlist == null)
394
+ {
395
+ copy.versionlist = new Object3D[100];
396
+ copy.versionindex = -1;
397
+ }
398
+
62399 if(ui)
63400 SetupUI(objEditor);
64401 }
....@@ -73,16 +410,28 @@
73410 this.copy = this.group = copy;
74411 //selectees = this.group.selectees;
75412
76
- SetupMenu2(objEditor);
413
+ SetupMenu2(this); //objEditor);
77414 SetupUI2(objEditor);
78415 objEditor.SetupUI(true);
79416 SetupViews(objEditor);
80417
81418 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
419
+
420
+ if (copy.versionlist == null)
421
+ {
422
+ copy.versionlist = new Object3D[100];
423
+ copy.versionindex = -1;
424
+
425
+ Save(true);
426
+ }
82427 }
83428
84429 void CloneSelection(boolean supports)
85430 {
431
+ if (Globals.REPLACEONMAKE)
432
+ Save();
433
+ boolean keep = Globals.REPLACEONMAKE;
434
+ Globals.REPLACEONMAKE = false;
86435 // Object3D keep = GrafreeD.clipboard;
87436 //Object3D obj;
88437 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +442,19 @@
93442
94443 makeSomething(clone, i==group.selection.size()-1);
95444 }
445
+ Globals.REPLACEONMAKE = keep;
96446 }
97447
98448 void CloneClipboard(boolean supports)
99449 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
450
+ assert(Grafreed.clipboard.parent == null);
451
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
452
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
453
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
454
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105455 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
456
+ makeSomething(CloneObject(Grafreed.clipboard, false));
457
+ Grafreed.clipboard.get(0).parent = keepparent;
108458 }
109459
110460 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +468,7 @@
118468 // obj.support = null;
119469 if (!supports)
120470 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
471
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122472 obj.parent = parent;
123473 // obj.support = support;
124474 // clone.support = support; // aout 2013
....@@ -147,30 +497,29 @@
147497
148498 //JTextField nameField;
149499
150
- void SetupMenu2(ObjEditor oe)
500
+ void SetupMenu2(GroupEditor oe)
151501 {
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);
502
+ oe.jTree = new cTree();
503
+
163504 Menu menu;
164505 oe.menuBar.add(menu = new Menu("Edit"));
165506 //editItem = menu.add(new MenuItem("Edit"));
166507 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
508
+
509
+// undoItem = menu.add(new MenuItem("Undo"));
510
+// undoItem.addActionListener(this);
511
+// redoItem = menu.add(new MenuItem("Redo"));
512
+// redoItem.addActionListener(this);
513
+// menu.add("-");
514
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168515 duplicateItem.addActionListener(this);
169
- menu.add("-");
170516 cloneItem = menu.add(new MenuItem("Clone"));
171517 cloneItem.addActionListener(this);
518
+ if (Globals.ADVANCED)
519
+ {
172520 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173521 cloneSupportItem.addActionListener(this);
522
+ }
174523 menu.add("-");
175524 cutItem = menu.add(new MenuItem("Cut"));
176525 cutItem.addActionListener(this);
....@@ -178,27 +527,123 @@
178527 copyItem.addActionListener(this);
179528 pasteItem = menu.add(new MenuItem("Paste"));
180529 pasteItem.addActionListener(this);
530
+
531
+ menu.add("-");
532
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
533
+ pasteIntoItem.addActionListener(this);
181534 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182535 pasteLinkItem.addActionListener(this);
183536 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184537 pasteCloneItem.addActionListener(this);
185538 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186539 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
540
+ menu.add("-");
541
+ deleteItem = menu.add(new MenuItem("Delete"));
542
+ deleteItem.addActionListener(this);
543
+
544
+ if (Globals.ADVANCED)
545
+ {
546
+ // Deletes the cameras...
189547 clearAllItem = menu.add(new MenuItem("Clear All"));
190548 clearAllItem.addActionListener(this);
549
+ }
550
+
551
+ menuBar.add(cameraMenu = new Menu("View"));
552
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
553
+ //zBufferItem.addActionListener(this);
554
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
555
+ //normalLensItem.addActionListener(this);
556
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
557
+ restoreCameraItem.addActionListener(this);
558
+
559
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
560
+// toggleFullScreenItem.addItemListener(this);
561
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
562
+// cameraMenu.add("-");
563
+//
564
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
565
+// toggleTextureItem.addItemListener(this);
566
+// toggleTextureItem.setState(CameraPane.textureon);
567
+//
568
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
569
+// toggleSwitchItem.addItemListener(this);
570
+// toggleSwitchItem.setState(CameraPane.SWITCH);
571
+
572
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
573
+ toggleHandleItem.addItemListener(this);
574
+ toggleHandleItem.setState(CameraPane.HANDLES);
575
+
576
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
577
+ togglePaintItem.addItemListener(this);
578
+ togglePaintItem.setState(CameraPane.PAINTMODE);
579
+
580
+ if (Globals.ADVANCED)
581
+ {
582
+ cameraMenu.add("-");
583
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
584
+ toggleLiveItem.addItemListener(this);
585
+ toggleLiveItem.setState(Globals.isLIVE());
191586
587
+ cameraMenu.add(stepItem = new MenuItem("Step"));
588
+ stepItem.addActionListener(this);
589
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
590
+ // toggleDLItem.addItemListener(this);
591
+ // toggleDLItem.setState(false);
592
+
593
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
594
+ toggleRenderItem.addItemListener(this);
595
+ toggleRenderItem.setState(!CameraPane.frozen);
596
+
597
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
598
+ toggleDebugItem.addItemListener(this);
599
+ toggleDebugItem.setState(Globals.DEBUG);
600
+
601
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
602
+ toggleFrustumItem.addItemListener(this);
603
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
604
+
605
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
606
+ toggleFootContactItem.addItemListener(this);
607
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
608
+
609
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
610
+ toggleTimelineItem.addItemListener(this);
611
+ }
612
+
613
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
614
+// toggleRootItem.addItemListener(this);
615
+// toggleRootItem.setState(false);
616
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
617
+// animationItem.addItemListener(this);
618
+// animationItem.setState(CameraPane.ANIMATION);
619
+ cameraMenu.add("-");
620
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
621
+ editCameraItem.addActionListener(this);
622
+
623
+ if (Globals.ADVANCED)
624
+ {
625
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629
+ oe.cameraMenu.add("-");
630
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631
+ openWindowItem.addActionListener(this);
632
+ editLeafItem.addActionListener(this);
633
+ lookAtItem.addActionListener(this);
634
+ //lookFromItem.addActinoListener(this);
635
+ //switchViewItem.addActionListener(this);
636
+ }
637
+
192638 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
639
+ if (Globals.ADVANCED)
640
+ {
197641 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198642 revertMeshItem.addActionListener(this);
199643 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200644 resetreferencesItem.addActionListener(this);
201645 menu.add("-");
646
+ }
202647 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203648 overwriteGeoItem.addActionListener(this);
204649 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +655,104 @@
210655 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211656 overwriteUVItem.addActionListener(this);
212657 menu.add("-");
658
+ if (Globals.ADVANCED)
659
+ {
213660 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214661 generateMeshItem.addActionListener(this);
215662 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216663 poseMeshItem.addActionListener(this);
217664 menu.add("-");
665
+ }
218666 resetsupportItem = menu.add(new MenuItem("Reset support"));
219667 resetsupportItem.addActionListener(this);
220668 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221669 linkverticesItem.addActionListener(this);
222670 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223671 relinkverticesItem.addActionListener(this);
672
+
673
+ if (Globals.ADVANCED)
674
+ {
224675 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225676 setMasterItem.addActionListener(this);
677
+ }
226678
227679 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
230682 backItem = menu.add(new MenuItem("Back"));
231683 backItem.addActionListener(this);
232684 frontItem = menu.add(new MenuItem("Front"));
233685 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
686
+// compositeItem = menu.add(new MenuItem("Composite"));
687
+// compositeItem.addActionListener(this);
688
+
689
+ if (Globals.ADVANCED)
690
+ {
691
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237692 hideItem.addActionListener(this);
693
+ }
238694 ungroupItem = menu.add(new MenuItem("Ungroup"));
239695 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
696
+
697
+// menu.add("-");
698
+//
699
+// switchItem = menu.add(new MenuItem("Switch node"));
700
+// switchItem.addActionListener(this);
701
+ if (Globals.ADVANCED)
702
+ {
247703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248704 switchGeoItem.addActionListener(this);
249705 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250706 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
707
+ morphItem = menu.add(new MenuItem("Morph Group"));
252708 morphItem.addActionListener(this);
709
+
710
+ menu.add("-");
711
+ physicsItem = menu.add(new MenuItem("Physics"));
712
+ physicsItem.addActionListener(this);
713
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
714
+ frameselectorItem.addActionListener(this);
253715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254716 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
717
+ }
257718
258719 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
261722 billboardItem = menu.add(new MenuItem("Billboard"));
262723 billboardItem.addActionListener(this);
263724 csgItem = menu.add(new MenuItem("CSG"));
264725 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
726
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266727 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
728
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268729 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
730
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270731 shadowZItem.addActionListener(this);
732
+ attributeItem = menu.add(new MenuItem("Attribute"));
733
+ attributeItem.addActionListener(this);
734
+
735
+ if (Globals.ADVANCED)
736
+ {
737
+ menu.add("-");
271738 linkerItem = menu.add(new MenuItem("Linker"));
272739 linkerItem.addActionListener(this);
273740 templateItem = menu.add(new MenuItem("Template"));
274741 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277742 pointflowItem = menu.add(new MenuItem("Point Flow"));
278743 pointflowItem.addActionListener(this);
744
+ }
279745 menu.add("-");
280746 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281747 resetTransformItem.addActionListener(this);
282748 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283749 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
750
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
751
+ resetCentroidXZItem.addActionListener(this);
752
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
753
+ transformGeometryItem.addActionListener(this);
754
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
755
+ transformChildrenItem.addActionListener(this);
286756
287757 oe.menuBar.add(menu = new Menu("Geometry"));
288758 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +763,11 @@
293763 genNormalsCADItem.addActionListener(this);
294764 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295765 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
766
+ if (Globals.ADVANCED)
767
+ {
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297769 genNormalsMINEItem.addActionListener(this);
770
+ }
298771 stripifyItem = menu.add(new MenuItem("Stripify"));
299772 stripifyItem.addActionListener(this);
300773 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +789,34 @@
316789 reduce34MeshItem.addActionListener(this);
317790 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318791 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321792 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322793 clipMeshItem.addActionListener(this);
794
+
795
+ if (Globals.ADVANCED)
796
+ {
797
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
798
+ smoothMeshItem.addActionListener(this);
799
+ }
323800
324801 oe.menuBar.add(menu = new Menu("Attributes"));
325802 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326803 clearMaterialsItem.addActionListener(this);
804
+ resetAllItem = menu.add(new MenuItem("Reset All"));
805
+ resetAllItem.addActionListener(this);
806
+ stepAllItem = menu.add(new MenuItem("Step All"));
807
+ stepAllItem.addActionListener(this);
327808 menu.add("-");
328809 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329810 liveleavesItem.addActionListener(this);
330811 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331812 unliveleavesItem.addActionListener(this);
813
+ if (Globals.ADVANCED)
814
+ {
332815 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333816 supportleavesItem.addActionListener(this);
334817 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335818 unsupportleavesItem.addActionListener(this);
819
+ }
336820 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337821 hideleavesItem.addActionListener(this);
338822 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +825,14 @@
341825 markleavesItem.addActionListener(this);
342826 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343827 unmarkleavesItem.addActionListener(this);
828
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
829
+ rewindleavesItem.addActionListener(this);
830
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
831
+ unrewindleavesItem.addActionListener(this);
832
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
833
+ randomleavesItem.addActionListener(this);
834
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
835
+ unrandomleavesItem.addActionListener(this);
344836 menu.add("-");
345837 flipVItem = menu.add(new MenuItem("Flip V"));
346838 flipVItem.addActionListener(this);
....@@ -366,45 +858,117 @@
366858 attachBumpItem.addActionListener(this);
367859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
368860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
369862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
370863 detachPigmentItem.addActionListener(this);
371864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
372865 detachBumpItem.addActionListener(this);
866
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
867
+ embedTexturesItem.addActionListener(this);
868
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
869
+ deEmbedTexturesItem.addActionListener(this);
373870 menu.add("-");
374871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
375872 sortbysizeItem.addActionListener(this);
376873 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377874 sortbynameItem.addActionListener(this);
378875 menu.add("-");
876
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
877
+ shareGeometriesItem.addActionListener(this);
878
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879
+ mergeGeometriesItem.addActionListener(this);
880
+ if (Globals.ADVANCED)
881
+ {
882
+ // Pretty much the same as duplicate and clone.
379883 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380884 extractGeometriesItem.addActionListener(this);
381885 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382886 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
887
+ }
387888
388889 oe.menuBar.add(menu = new Menu("Insert"));
389890 buildCreateMenu(menu);
390891
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402892 oe.menuBar.add(menu = new Menu("Tools"));
403893 buildToolsMenu(menu);
404894 }
405895
896
+ JTabbedPane resourcecontainer;
897
+ cGridBag currenttab;
898
+ boolean added; // patch for jar
899
+
900
+ int tabcount = 0;
901
+ int colcount = 0;
902
+ int rowcount = 0;
903
+
904
+ int columns = 5;
905
+ int rows = 7;
906
+
907
+ public void ResourceCallBack(String[] path)
908
+ {
909
+ for (int i = 0; i < path.length; i++)
910
+ System.out.print(path[i] + "/");
911
+ System.out.println();
912
+ if (rowcount == 0)
913
+ {
914
+ currenttab = new cGridBag();
915
+ added = false;
916
+ String tabname = String.valueOf((char)('A'+tabcount));
917
+ currenttab.setName(tabname);
918
+ rowcount = 1;
919
+ }
920
+
921
+ if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
922
+ {
923
+ if (!added)
924
+ {
925
+ added = true;
926
+ resourcecontainer.add(currenttab);
927
+ String tabname = String.valueOf((char)('A'+tabcount));
928
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929
+ }
930
+
931
+ AddTextureButton(path[0], path[1], currenttab);
932
+ if (++colcount >= columns)
933
+ {
934
+ colcount = 0;
935
+ currenttab.Return();
936
+
937
+ if (rowcount++ >= rows)
938
+ {
939
+ rowcount = 0;
940
+ }
941
+ }
942
+ }
943
+ else
944
+ {
945
+// if (!path[path.length-1].equals("icons"))
946
+// resourcecontainer.Return();
947
+ }
948
+ }
949
+
950
+ void CreateTexturePanel(cGridBag container)
951
+ {
952
+ resourcecontainer = new JTabbedPane();
953
+ container.add(resourcecontainer);
954
+
955
+ Grafreed.ParseResources("textures", this);
956
+ }
957
+
406958 void SetupUI2(ObjEditor oe)
407959 {
960
+ // June 2019
961
+ if (oe == null)
962
+ {
963
+ //super.SetupUI2(this);
964
+ //return;
965
+ }
966
+
967
+ if (copy != group)
968
+ {
969
+ //super.SetupUI2(this);
970
+ }
971
+
408972 //new Exception().printStackTrace();
409973
410974 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,176 +997,239 @@
433997 oe.radioPanel.add(dummyButton);
434998 oe.buttonGroup.add(dummyButton);
435999 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
4391003
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
441
- liveCB.setToolTipText("Enabled animation");
442
- liveCB.addItemListener(this);
443
-
444
- oe.aConstraints.gridx += 1;
445
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
446
- fastCB.setToolTipText("Fast mode");
447
- fastCB.addItemListener(this);
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
450
- supportCB.setToolTipText("Enabled rigging");
451
- supportCB.addItemListener(this);
452
-
453
- // oe.aConstraints.gridx += 1;
454
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
455
- // localCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints);
459
- crowdCB.setToolTipText("Used for crowds");
460
- crowdCB.addItemListener(this);
461
-
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
464
- smoothCB.setToolTipText("Snapping delay");
465
- smoothCB.addItemListener(this);
466
-
467
- oe.aConstraints.gridx += 1;
468
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
469
- slowCB.setToolTipText("Smooth interpolation");
470
- slowCB.addItemListener(this);
471
- oe.aConstraints.gridx += 1;
472
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), oe.aConstraints);
473
- boxCB.setToolTipText("Display bounding boxes");
474
- boxCB.addItemListener(this);
475
- oe.aConstraints.gridx += 1;
476
- oe.toolbarPanel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), oe.aConstraints);
477
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
478
- zoomBoxCB.addItemListener(this);
479
-
480
-// oe.aConstraints.gridx += 1;
481
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
482
-// speakerMocapCB.addItemListener(this);
483
-
484
- if (false)
485
- {
486
- // handled in scripts
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
489
- speakerCameraCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
493
- speakerFocusCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
497
- smoothfocusCB.addItemListener(this);
498
- }
499
-
500
-//oe.aConstraints.gridx += 1;
501
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
502
-// debugCB.addItemListener(this);
503
-
504
- oe.aConstraints.gridx += 1;
505
- oe.toolbarPanel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), oe.aConstraints);
506
- oeilCB.addItemListener(this);
507
-
508
- oe.aConstraints.gridx += 1;
509
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), oe.aConstraints);
510
- lookAtCB.setToolTipText("Look-at target");
511
- lookAtCB.addItemListener(this);
512
-
513
- oe.aConstraints.gridx += 1;
514
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
515
- trackCB.setToolTipText("Enable tracking");
516
- trackCB.addItemListener(this);
517
-
518
- oe.aConstraints.gridx += 1;
519
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
1004
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1005
+
1006
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ //minButton.setToolTipText("Minimize window");
1008
+ //minButton.addActionListener(this);
1009
+
1010
+ if (Globals.ADVANCED)
1011
+ {
1012
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ maxButton.setToolTipText("Maximize window");
1014
+ maxButton.addActionListener(this);
1015
+ }
1016
+
1017
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ fullButton.setToolTipText("Full-screen window");
1019
+ fullButton.addActionListener(this);
1020
+
1021
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5201022 screenfitButton.setToolTipText("Screen fit");
5211023 screenfitButton.addActionListener(this);
522
- oe.aConstraints.gridx += 1;
1024
+
1025
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1027
+ restoreCameraButton.addActionListener(this);
1028
+
1029
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ saveVersionButton.setToolTipText("Duplicate current version");
1031
+ saveVersionButton.addActionListener(this);
1032
+
1033
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ deleteVersionButton.setToolTipText("Delete current version");
1035
+ deleteVersionButton.addActionListener(this);
1036
+
1037
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ previousVersionButton.setToolTipText("Previous version");
1039
+ previousVersionButton.addActionListener(this);
1040
+ previousVersionButton.setEnabled(false);
1041
+
1042
+ cGridBag updown = new cGridBag().setVertical(true);
1043
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1044
+ restoreButton.setToolTipText("Undo (restore current version)");
1045
+ restoreButton.addActionListener(this);
1046
+ //restoreButton.setEnabled(false);
1047
+
1048
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ replaceButton.setToolTipText("Save (replace current version)");
1050
+ replaceButton.addActionListener(this);
1051
+ //replaceButton.setEnabled(false);
1052
+
1053
+ copyOptionsPanel.add(updown);
1054
+
1055
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ nextVersionButton.setToolTipText("Next version");
1057
+ nextVersionButton.addActionListener(this);
1058
+ nextVersionButton.setEnabled(false);
1059
+
1060
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
+ liveCB.setToolTipText("Enable animation");
1062
+ liveCB.addItemListener(this);
1063
+
1064
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ oneStepButton.setToolTipText("Animate one step forward");
1066
+ oneStepButton.addActionListener(this);
1067
+
1068
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1069
+ fastCB.setToolTipText("Fast mode");
1070
+ fastCB.addItemListener(this);
1071
+
1072
+ //oe.toolboxPanel.Return();
1073
+
1074
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1075
+// trackCB.setToolTipText("Enable tracking");
1076
+// trackCB.addItemListener(this);
1077
+
5231078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5241079 // screenfitpointButton.addActionListener(this);
525
-// oe.aConstraints.gridx += 1;
526
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
527
- snapobjectButton.addActionListener(this);
528
- snapobjectButton.setToolTipText("Snap Object");
529
- oe.aConstraints.gridx += 1;
5301080
531
- //aConstraints.gridx = 0;
532
- //aConstraints.gridy += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
537
- flashSelectionButton.setToolTipText("Show selection");
538
- flashSelectionButton.addActionListener(this);
539
-
540
- oe.toolbarPanel.add(new cButton(" ", false));
541
-
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545
-
546
- //
547
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
548
- twoButton.setToolTipText("Show center view only");
549
- twoButton.addActionListener(this);
550
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
1081
+ if (Globals.ADVANCED)
1082
+ {
1083
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ snapobjectButton.addActionListener(this);
1085
+ snapobjectButton.setToolTipText("Snap Object");
1086
+
1087
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5511088 fourButton.addActionListener(this);
552
- fourButton.setToolTipText("Show left panel only");
553
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
554
- sixButton.setToolTipText("2-column layout left");
555
- sixButton.addActionListener(this);
556
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
557
- threeButton.setToolTipText("2-column layout right");
1089
+ fourButton.setToolTipText("Show control panel only");
1090
+ }
1091
+
1092
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1093
+
1094
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ twoButton.setToolTipText("Show 3D view only");
1096
+ twoButton.addActionListener(this);
1097
+ this.fullscreenLayout = twoButton;
1098
+
1099
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ threeButton.setToolTipText("Show controls and 3D view");
5581101 threeButton.addActionListener(this);
559
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
560
- sevenButton.setToolTipText("3-column layout");
561
- sevenButton.addActionListener(this);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ sixButton.setToolTipText("Show 3D view and controls");
1104
+ sixButton.addActionListener(this);
1105
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+// sevenButton.setToolTipText("3-column layout");
1107
+// sevenButton.addActionListener(this);
5621108 //
5631109
564
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
565
- rootButton.setToolTipText("Edit object in new tab");
1110
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ rootButton.setToolTipText("Open selection in new tab");
5661112 rootButton.addActionListener(this);
567
- oe.aConstraints.gridx += 1;
568
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1113
+
1114
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5691115 closeButton.setToolTipText("Close tab");
5701116 closeButton.addActionListener(this);
5711117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5721118 //clearButton.addActionListener(this);
573
- oe.aConstraints.gridx += 1;
574
-
575
- oe.aConstraints.gridx = 1; //
576
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
577
- editButton.addActionListener(this);
578
- oe.aConstraints.gridx += 1;
579
- oe.aConstraints.weighty = 0;
580
- oe.aConstraints.gridwidth = 1;
5811119
582
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1120
+ cGridBag row1 = new cGridBag();
1121
+
1122
+ // INSERT
1123
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ gridButton.setToolTipText("Create grid");
1125
+ gridButton.addActionListener(this);
1126
+
1127
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ boxButton.setToolTipText("Create box");
1129
+ boxButton.addActionListener(this);
1130
+
1131
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
+ sphereButton.setToolTipText("Create sphere");
1133
+ sphereButton.addActionListener(this);
1134
+
1135
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ coneButton.setToolTipText("Create cone");
1137
+ coneButton.addActionListener(this);
1138
+
1139
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ torusButton.setToolTipText("Create torus");
1141
+ torusButton.addActionListener(this);
1142
+
1143
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ superButton.setToolTipText("Create superellipsoid");
1145
+ superButton.addActionListener(this);
1146
+
1147
+ if (Globals.ADVANCED)
1148
+ {
1149
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1150
+ kleinButton.setToolTipText("Create Klein bottle");
1151
+ kleinButton.addActionListener(this);
1152
+ }
1153
+
1154
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ particlesButton.setToolTipText("Create particle system");
1156
+ particlesButton.addActionListener(this);
1157
+
1158
+ oe.toolboxPanel.add(row1);
1159
+
1160
+ cGridBag row2 = new cGridBag();
1161
+
1162
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1163
+ groupButton.setToolTipText("Create group");
1164
+ groupButton.addActionListener(this);
1165
+
1166
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ compositeButton.setToolTipText("Create composite");
1168
+ compositeButton.addActionListener(this);
1169
+
1170
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ switchButton.setToolTipText("Create item switcher");
1172
+ switchButton.addActionListener(this);
1173
+
1174
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ loopButton.setToolTipText("Create loop");
1176
+ loopButton.addActionListener(this);
1177
+
1178
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ textureButton.setToolTipText("Create texture");
1180
+ textureButton.addActionListener(this);
1181
+
1182
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ overlayButton.setToolTipText("Create overlay");
1184
+ overlayButton.addActionListener(this);
1185
+
1186
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ lightButton.setToolTipText("Create light");
1188
+ lightButton.addActionListener(this);
1189
+
1190
+ oe.toolboxPanel.add(row2);
1191
+
1192
+ cGridBag textures = new cGridBag();
1193
+
1194
+ CreateTexturePanel(textures);
1195
+
1196
+ oe.toolboxPanel.add(textures);
1197
+
1198
+ textures.preferredHeight = 100;
1199
+
1200
+ CreateSkyboxPanel(oe.skyboxPanel);
1201
+
1202
+ // EDIT panel
1203
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ editButton.setToolTipText("Pin selection controls");
1205
+ editButton.addActionListener(this);
1206
+
1207
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5831209 uneditButton.addActionListener(this);
5841210
585
- oe.aConstraints.gridx += 1;
586
- oe.aConstraints.weighty = 0;
587
- oe.aConstraints.gridwidth = 1;
588
-
589
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
590
- clearPanelButton.addActionListener(this);
591
-
592
- oe.aConstraints.gridx += 1;
593
- oe.aConstraints.weighty = 0;
594
- oe.aConstraints.gridwidth = 1;
595
-
596
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1211
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1212
+ allParamsButton.setToolTipText("Show all controls");
5971213 allParamsButton.addActionListener(this);
5981214
599
- oe.aConstraints.gridx += 1;
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 1;
602
-
603
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
604
- unselectButton.addActionListener(this);
1215
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ clearPanelButton.setToolTipText("Clear all controls");
1217
+ clearPanelButton.addActionListener(this);
6051218
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
1222
+
1223
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ flashSelectionButton.setToolTipText("Highlight selection");
1225
+ flashSelectionButton.addActionListener(this);
1226
+
1227
+ editCommandsPanel.preferredHeight = 1;
1228
+
1229
+ SetPinStates(false);
1230
+// oe.treePanel.add(commandsPanel);
1231
+// oe.treePanel.Return();
1232
+
6061233 // oe.aConstraints.gridx += 1;
6071234 // oe.aConstraints.weighty = 0;
6081235 // oe.aConstraints.gridwidth = 1;
....@@ -614,47 +1241,32 @@
6141241 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
6151242 // gcButton.addActionListener(this);
6161243
617
- oe.aConstraints.gridx = 0;
618
- oe.aConstraints.gridy += 1;
619
-
620
- //ctrlPanel.add(objList = new List(5, true));
621
- oe.aConstraints.gridwidth = 100;
622
- // oe.aConstraints.gridheight = 100;
623
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
624
- oe.aConstraints.gridheight = 1;
625
- oe.aConstraints.weighty = 0.5;
626
- oe.aConstraints.gridx = 0;
627
- JScrollPane jSP;
1244
+ cGridBag jSPPanel = new cGridBag();
1245
+
1246
+ JScrollPane jSP;
6281247 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
629
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6301249 ResetModel();
631
- oe.aConstraints.weighty = 0.5;
632
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
633
- oe.aConstraints.gridy += 1;
634
- oe.aConstraints.gridwidth = 1;
635
-
636
- oe.aConstraints.weighty = 0;
637
- oe.aConstraints.gridwidth = 2;
638
-
639
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
640
- colorCB.addItemListener(this);
641
- oe.aConstraints.gridx += 2;
642
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
643
- materialCB.addItemListener(this);
644
- oe.aConstraints.gridx += 2;
645
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
646
- textureCB.addItemListener(this);
647
-
648
- oe.aConstraints.gridx = 0;
649
- oe.aConstraints.gridy += 1;
6501250
1251
+ oe.treePanel.add(jSPPanel);
1252
+ oe.treePanel.Return();
1253
+
1254
+ oe.treePanel.add(copyOptionsPanel);
1255
+ oe.treePanel.Return();
1256
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
+ sliderPane.preferredHeight = 1;
1259
+
1260
+// mainPanel.setDividerLocation(0.1); //1.0);
1261
+ mainPanel.setResizeWeight(0.4);
1262
+
6511263 //jList.addListSelectionListener(this);
6521264 oe.jTree.addTreeSelectionListener(this);
6531265 //jTree.setRootVisible(false);
6541266 //jTree.setEditable(true);
6551267 oe.jTree.setDragEnabled(true);
6561268 //jTree.setPreferredSize(new Dimension(10,10));
657
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6581270
6591271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6601272
....@@ -666,23 +1278,163 @@
6661278 dgr.addDragGestureListener(this);
6671279 }catch(Exception e) {}
6681280 */
669
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6701282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6711283 }
1284
+
1285
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1286
+ {
1287
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1288
+ colorCB.setToolTipText("Copy color when dropped");
1289
+ colorCB.addItemListener(this);
1290
+
1291
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1292
+ materialCB.setToolTipText("Copy material when dropped");
1293
+ materialCB.addItemListener(this);
1294
+
1295
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1296
+ textureCB.setToolTipText("Copy texture when dropped");
1297
+ textureCB.addItemListener(this);
1298
+
1299
+ panel.Return();
1300
+
1301
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1302
+ boxCB.setToolTipText("Display bounding boxes");
1303
+ boxCB.addItemListener(this);
1304
+
1305
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1306
+ zoomBoxCB.setToolTipText("Display only for wheel");
1307
+ zoomBoxCB.addItemListener(this);
1308
+
1309
+ if (true) // Globals.ADVANCED)
1310
+ {
1311
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1312
+// supportCB.setToolTipText("Enable rigging");
1313
+// supportCB.addItemListener(this);
1314
+
1315
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1316
+ freezeCB.setToolTipText("Fast moving camera");
1317
+ freezeCB.addItemListener(this);
1318
+
1319
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1320
+ // localCB.addItemListener(this);
1321
+
1322
+ panel.Return();
1323
+
1324
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1325
+ crowdCB.setToolTipText("Used for crowds");
1326
+ crowdCB.addItemListener(this);
1327
+
1328
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1329
+ smoothCB.setToolTipText("Snapping delay");
1330
+ smoothCB.addItemListener(this);
1331
+
1332
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1333
+// slowCB.setToolTipText("Smooth interpolation");
1334
+// slowCB.addItemListener(this);
1335
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1336
+ minshaderCB.setToolTipText("Minimal fast shader");
1337
+ minshaderCB.addItemListener(this);
1338
+
1339
+// constraints.gridy += 1;
1340
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1341
+// speakerMocapCB.addItemListener(this);
1342
+
1343
+ panel.Return();
1344
+
1345
+ if (false)
1346
+ {
1347
+ // handled in scripts
1348
+ //constraints.gridy += 1;
1349
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1350
+ speakerCameraCB.addItemListener(this);
1351
+
1352
+ //constraints.gridy += 1;
1353
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1354
+ speakerFocusCB.addItemListener(this);
1355
+
1356
+ //constraints.gridy += 1;
1357
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1358
+ smoothfocusCB.addItemListener(this);
1359
+ panel.Return();
1360
+ }
1361
+
1362
+//constraints.gridx += 1;
1363
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1364
+// debugCB.addItemListener(this);
1365
+
1366
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1367
+ trackCB.setToolTipText("Enable tracking target");
1368
+ trackCB.addItemListener(this);
1369
+
1370
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1371
+ oeilCB.setToolTipText("Move camera when tracking");
1372
+ oeilCB.addItemListener(this);
1373
+
1374
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1375
+ shadowCB.setToolTipText("When live compute shadows");
1376
+ shadowCB.addItemListener(this);
1377
+
1378
+ panel.Return();
1379
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1380
+ toggleTextureCB.setToolTipText("Load textures");
1381
+ toggleTextureCB.addItemListener(this);
1382
+
1383
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1384
+ toggleSwitchCB.setToolTipText("Choose a single item");
1385
+ toggleSwitchCB.addItemListener(this);
1386
+
1387
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1388
+ autokeepCB.setToolTipText("On structure change");
1389
+ autokeepCB.addItemListener(this);
1390
+
1391
+ panel.Return();
1392
+ if (Globals.ADVANCED)
1393
+ {
1394
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1395
+ lookAtCB.setToolTipText("Look-at target");
1396
+ lookAtCB.addItemListener(this);
1397
+ }
1398
+
1399
+ }
1400
+
1401
+ cGridBag fill = new cGridBag();
1402
+ fill.preferredHeight = 200;
1403
+ cGridBag fill2 = new cGridBag();
1404
+ fill2.preferredHeight = 200;
1405
+ cGridBag fill3 = new cGridBag();
1406
+ fill3.preferredHeight = 200;
1407
+
1408
+ panel.add(fill);
1409
+ panel.add(fill2);
1410
+ panel.add(fill3);
1411
+
1412
+ }
6721413
6731414 void EditObject(Object3D obj)
6741415 {
6751416 cRadio radioButton = new cRadio(obj.name);
1417
+
1418
+ // June 2019. Patch to avoid bug with transparency.
1419
+ radioButton.hadMaterial = obj.material != null;
1420
+ if (!radioButton.hadMaterial)
1421
+ {
1422
+ obj.material = new cMaterial();
1423
+ }
1424
+
6761425 radioButton.SetObject(obj);
677
- radioButton.layout = sevenButton;
1426
+ radioButton.layout = threeButton; // sixButton;
6781427 radioButton.SetCamera(cameraView.renderCamera, false);
6791428 radioButton.addActionListener(this);
6801429 radioPanel.add(radioButton);
6811430 buttonGroup.add(radioButton);
6821431 radioButton.doClick();
6831432 }
1433
+
6841434 void SetupViews(ObjEditor oe)
6851435 {
1436
+ theFrame = this;
1437
+
6861438 oe.SetupViews();
6871439
6881440 System.out.println("SetupViews");
....@@ -691,23 +1443,30 @@
6911443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6921444 }
6931445
694
- JCheckBox liveCB;
695
- JCheckBox supportCB;
696
- JCheckBox localCB;
697
- JCheckBox crowdCB;
698
- JCheckBox smoothCB;
699
- JCheckBox fastCB;
700
- JCheckBox slowCB;
701
- JCheckBox boxCB;
702
- JCheckBox zoomBoxCB;
703
- JCheckBox trackCB;
704
- JCheckBox smoothfocusCB;
1446
+ cToggleButton liveCB;
1447
+ cCheckBox supportCB;
1448
+ cCheckBox localCB;
1449
+ cCheckBox crowdCB;
1450
+ cCheckBox smoothCB;
1451
+ cCheckBox minshaderCB;
1452
+
1453
+ cToggleButton fastCB;
1454
+ cCheckBox slowCB;
1455
+ cCheckBox boxCB;
1456
+ cCheckBox zoomBoxCB;
1457
+ cCheckBox freezeCB;
1458
+ //cToggleButton trackCB;
1459
+ cCheckBox trackCB;
1460
+ cCheckBox smoothfocusCB;
7051461 // JCheckBox speakerMocapCB;
706
- JCheckBox speakerCameraCB;
707
- JCheckBox speakerFocusCB;
708
- JCheckBox debugCB;
709
- JCheckBox oeilCB;
710
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
7111470
7121471 // static int COLOR = 1;
7131472 // static int MATERIAL = 2;
....@@ -715,9 +1474,9 @@
7151474
7161475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7171476
718
- JCheckBox colorCB;
719
- JCheckBox materialCB;
720
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
7211480
7221481 public void itemStateChanged(ItemEvent e)
7231482 {
....@@ -745,6 +1504,7 @@
7451504 } else if(e.getSource() == liveCB)
7461505 {
7471506 cameraView.ToggleLive();
1507
+ refreshContents(false);
7481508 }
7491509 else if(e.getSource() == supportCB)
7501510 {
....@@ -760,6 +1520,12 @@
7601520 {
7611521 cameraView.ToggleInertia();
7621522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
7631529 }
7641530 else if(e.getSource() == localCB)
7651531 {
....@@ -809,6 +1575,18 @@
8091575 {
8101576 cameraView.ToggleOeil();
8111577 }
1578
+ else if(e.getSource() == shadowCB)
1579
+ {
1580
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1581
+ }
1582
+ else if(e.getSource() == freezeCB)
1583
+ {
1584
+ Globals.FREEZEONMOVE ^= true;
1585
+ }
1586
+ else if(e.getSource() == autokeepCB)
1587
+ {
1588
+ Globals.REPLACEONMAKE ^= true;
1589
+ }
8121590 else if(e.getSource() == lookAtCB)
8131591 {
8141592 cameraView.ToggleLookAt();
....@@ -825,7 +1603,8 @@
8251603
8261604 /**/
8271605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
828
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
8291608 if ((path == null) || (path.getPathCount() <= 1)) {
8301609 // We can't move the root node or an empty selection
8311610 return;
....@@ -888,8 +1667,6 @@
8881667 }
8891668 }
8901669
891
- String string = (String) object;
892
-
8931670 System.out.println("Transfer = " + object + "; drop : " + target);
8941671 // if( object instanceof java.io.File[])
8951672 // {
....@@ -897,7 +1674,11 @@
8971674 // objEditor.DropFile((java.io.File[]) object, true);
8981675 // return;
8991676 // }
900
- if (string.charAt(0) == '/')
1677
+
1678
+ String string = object.toString();
1679
+
1680
+ // File path for Mac and Windows
1681
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9011682 {
9021683 // file(s)
9031684 String[] names = string.split("\n");
....@@ -924,7 +1705,7 @@
9241705
9251706 flashIt = false;
9261707 CameraPane pane = (CameraPane) target;
927
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1708
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9281709 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9291710
9301711 if (group.selection.size() == 1)
....@@ -940,23 +1721,33 @@
9401721
9411722 assert target == objEditor.jTree;
9421723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
9431725 try {
944
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9451727 } catch (Exception e) {
9461728 System.out.println("destinationPath : " + destinationPath);
9471729 return;
9481730 }
9491731
950
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
9511733 {
1734
+ Object3D child = (Object3D)group.selection.elementAt(i);
1735
+
1736
+ // Cannot move into itself
1737
+ if (child == destinationLeaf)
1738
+ return;
1739
+ }
1740
+
1741
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1742
+// {
9521743 loadClipboard(true);
9531744 objEditor.jTree.setSelectionPath(destinationPath);
954
- pasteInto(false);
955
- } else {
956
- loadClipboard(false);
957
- objEditor.jTree.setSelectionPath(destinationPath);
958
- pasteInto(false); // true); // ???
959
- }
1745
+ pasteInto(false, false);
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
9601751 }
9611752 public void dropActionChanged(DropTargetDragEvent dtde)
9621753 // Called if the user has modified the current drop gesture
....@@ -1061,85 +1852,107 @@
10611852 {
10621853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10631854 //heightFieldItem.addActionListener(this);
1064
- gridItem = menu.add(new MenuItem("Grid"));
1065
- gridItem.addActionListener(this);
1066
- rectoidItem = menu.add(new MenuItem("Box"));
1067
- rectoidItem.addActionListener(this);
1068
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1069
- ellipsoidItem.addActionListener(this);
1070
- coneItem = menu.add(new MenuItem("Cone"));
1071
- coneItem.addActionListener(this);
1072
- torusItem = menu.add(new MenuItem("Torus"));
1073
- torusItem.addActionListener(this);
1074
- superItem = menu.add(new MenuItem("Superellipsoid"));
1075
- superItem.addActionListener(this);
1855
+// gridItem = menu.add(new MenuItem("Grid"));
1856
+// gridItem.addActionListener(this);
1857
+// rectoidItem = menu.add(new MenuItem("Box"));
1858
+// rectoidItem.addActionListener(this);
1859
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1860
+// ellipsoidItem.addActionListener(this);
1861
+// coneItem = menu.add(new MenuItem("Cone"));
1862
+// coneItem.addActionListener(this);
1863
+// torusItem = menu.add(new MenuItem("Torus"));
1864
+// torusItem.addActionListener(this);
1865
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1866
+// superItem.addActionListener(this);
1867
+
1868
+ cameraItem = menu.add(new MenuItem("Camera"));
1869
+ cameraItem.addActionListener(this);
1870
+
1871
+ if (!Globals.ADVANCED)
1872
+ {
10761873 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10771874 kleinItem.addActionListener(this);
1078
- particleItem = menu.add(new MenuItem("Particle system"));
1079
- particleItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
1879
+ if (Globals.ADVANCED)
1880
+ {
10801881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10811882 ragdollItem.addActionListener(this);
10821883 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10831884 ragdoll2Item.addActionListener(this);
1885
+ }
10841886 menu.add("-");
1085
- meshItem = menu.add(new MenuItem("Mesh"));
1887
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10861888 meshItem.addActionListener(this);
10871889 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10881890 // meshGroupItem.addActionListener(this);
1891
+ if (Globals.ADVANCED)
1892
+ {
10891893 springItem = menu.add(new MenuItem("Spring"));
10901894 springItem.addActionListener(this);
10911895 flagItem = menu.add(new MenuItem("Flag"));
10921896 flagItem.addActionListener(this);
1093
- bezierItem = menu.add(new MenuItem("Patch"));
1094
- bezierItem.addActionListener(this);
1095
- checkerItem = menu.add(new MenuItem("Checker"));
1096
- checkerItem.addActionListener(this);
10971897 blobItem = menu.add(new MenuItem("Blob"));
10981898 blobItem.addActionListener(this);
10991899 latheItem = menu.add(new MenuItem("Lathe"));
11001900 latheItem.addActionListener(this);
1101
- lightItem = menu.add(new MenuItem("Light"));
1102
- lightItem.addActionListener(this);
1901
+ }
1902
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1903
+ bezierItem.addActionListener(this);
1904
+// overlayItem = menu.add(new MenuItem("Overlay"));
1905
+// overlayItem.addActionListener(this);
1906
+// lightItem = menu.add(new MenuItem("Light"));
1907
+// lightItem.addActionListener(this);
11031908 menu.add("-");
11041909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11051910 //superLoopItem.addActionListener(this);
1106
- loopItem = menu.add(new MenuItem("Loop"));
1107
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
11081913 doubleItem = menu.add(new MenuItem("Fork"));
11091914 doubleItem.addActionListener(this);
1915
+ if (Globals.ADVANCED)
1916
+ {
11101917 tripleItem = menu.add(new MenuItem("Trident"));
11111918 tripleItem.addActionListener(this);
1919
+ }
11121920 }
11131921
11141922 void buildToolsMenu(Menu menu)
11151923 {
11161924 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11171925 animationItem.addItemListener(this);
1118
- animationItem.setState(CameraPane.ANIMATION);
1926
+ animationItem.setState(Globals.ANIMATION);
1927
+
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
11191930
11201931 menu.add("-");
11211932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11221933 parseverticesItem.addActionListener(this);
11231934 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11241935 textureFieldItem.addActionListener(this);
1125
- alignItem = menu.add(new MenuItem("Align"));
1936
+ alignItem = menu.add(new MenuItem("Align Objects"));
11261937 alignItem.addActionListener(this);
1127
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1128
- mirrorItem.addActionListener(this);
11291938 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11301939 reduceMorphItem.addActionListener(this);
11311940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11321941 reduce34MorphItem.addActionListener(this);
1133
-
1134
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1135
- computeAOItem.addActionListener(this);
11361942 menu.add("-");
1137
-
11381943 menu.add(memoryItem = new MenuItem("Memory Usage"));
11391944 memoryItem.addActionListener(this);
1945
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1946
+ computeAOItem.addActionListener(this);
1947
+
1948
+ if (Globals.ADVANCED)
1949
+ {
1950
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1951
+ mirrorItem.addActionListener(this);
1952
+ menu.add("-");
11401953 menu.add(analyzeItem = new MenuItem("Analyze"));
11411954 analyzeItem.addActionListener(this);
1142
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
11431956 dumpItem.addActionListener(this);
11441957 // menu.add(pathItem = new MenuItem("From-to path"));
11451958 // pathItem.addActionListener(this);
....@@ -1157,6 +1970,7 @@
11571970 menu.add("-");
11581971 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11591972 editScriptItem.addActionListener(this);
1973
+ }
11601974 }
11611975
11621976 void ScreenFit()
....@@ -1279,9 +2093,34 @@
12792093 shadow.material = new cMaterial(obj.material);
12802094 shadow.material.diffuse = 0.0001f;
12812095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
12822097
12832098 makeSomething(shadow);
12842099 }
2100
+
2101
+ private void ClearUnpinned()
2102
+ {
2103
+ //for (Object3D obj : listUI)
2104
+ for (int i=listUI.size(); --i>=0;)
2105
+ {
2106
+ Object3D obj = listUI.elementAt(i);
2107
+ if (!obj.pinned)
2108
+ {
2109
+ obj.CloseUI();
2110
+ listUI.remove(i);
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+ private void EditElement(Object3D elem, boolean newWindow)
2116
+ {
2117
+ // if (!(elem instanceof Composite))
2118
+ // newWindow = false;
2119
+ listUI.add(elem);
2120
+ elem.openEditWindow(this, newWindow); //, false);
2121
+ System.out.println("edit : " + elem);
2122
+ elem.editWindow.refreshContents(true); // ? new
2123
+ }
12852124
12862125 /**
12872126 * applyExample
....@@ -1485,9 +2324,9 @@
14852324
14862325 void Overwrite(int mask)
14872326 {
1488
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14892328 {
1490
- Object3D content = GrafreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
14912330
14922331 if (content instanceof cGroup && ((cGroup)content).transientlink )
14932332 content = ((cGroup)content).get(0);
....@@ -1510,6 +2349,7 @@
15102349 //
15112350 public void actionPerformed(ActionEvent event) // , Object arg)
15122351 {
2352
+ Object source = event.getSource();
15132353 /*
15142354 if (event.getSource() == nameField)
15152355 {
....@@ -1521,11 +2361,11 @@
15212361 }
15222362 else
15232363 */
1524
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2364
+ if (source == lookAtItem || source == lookFromItem)
15252365 {
15262366 ScreenFit();
15272367 } else
1528
- if (event.getSource() == switchItem)
2368
+ if (source == switchViewItem)
15292369 {
15302370 cVector v1 = new cVector();
15312371 cVector v2 = new cVector();
....@@ -1534,11 +2374,11 @@
15342374 objEditor.cameraView.renderCamera.setAim(v2, v1);
15352375 objEditor.cameraView.repaint();
15362376 } else
1537
- if (event.getSource() == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
15382378 {
15392379 makeSomething(new Box());
15402380 } else
1541
- if (event.getSource() == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
15422382 {
15432383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15442384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1559,9 +2399,9 @@
15592399 applyExample(particleGeom, "SMOKE");
15602400 makeSomething(particleGeom);
15612401 } else
1562
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2402
+ if (source == ragdollItem || source == ragdoll2Item)
15632403 {
1564
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2404
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15652405
15662406 ragdoll.toParent = LA.newMatrix();
15672407 ragdoll.fromParent = LA.newMatrix();
....@@ -1579,7 +2419,7 @@
15792419 } else
15802420 /*
15812421 */
1582
- if (event.getSource() == heightFieldItem)
2422
+ if (source == heightFieldItem)
15832423 {
15842424 Object3D obj = new Object3D();
15852425
....@@ -1617,31 +2457,31 @@
16172457
16182458 makeSomething(obj);
16192459 } else
1620
- if (event.getSource() == gridItem)
2460
+ if (source == gridItem || source == gridButton)
16212461 {
16222462 makeSomething(new Grid());
16232463 } else
1624
- if (event.getSource() == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
16252465 {
16262466 makeSomething(new Sphere());
16272467 } else
1628
- if (event.getSource() == coneItem)
2468
+ if (source == coneItem || source == coneButton)
16292469 {
16302470 makeSomething(new Cone());
16312471 } else
1632
- if (event.getSource() == torusItem)
2472
+ if (source == torusItem || source == torusButton)
16332473 {
16342474 makeSomething(new Torus());
16352475 } else
1636
- if (event.getSource() == superItem)
2476
+ if (source == superItem || source == superButton)
16372477 {
16382478 makeSomething(new Superellipsoid());
16392479 } else
1640
- if (event.getSource() == kleinItem)
2480
+ if (source == kleinItem || source == kleinButton)
16412481 {
16422482 makeSomething(new Klein());
16432483 } else
1644
- if (event.getSource() == blobItem)
2484
+ if (source == blobItem)
16452485 {
16462486 Blob blob = new Blob();
16472487 BlobComponent comp = new BlobComponent();
....@@ -1649,15 +2489,15 @@
16492489 //blob.retile();
16502490 makeSomething(blob);
16512491 } else
1652
- if (event.getSource() == latheItem)
2492
+ if (source == latheItem)
16532493 {
16542494 makeSomething(new Lathe());
16552495 } else
1656
- if (event.getSource() == bezierItem)
2496
+ if (source == bezierItem)
16572497 {
16582498 makeSomething(new BezierSurface());
16592499 } else
1660
- if (event.getSource() == checkerItem)
2500
+ if (source == overlayItem || source == overlayButton)
16612501 {
16622502 /*
16632503 Object3D obj = new BezierSurface(5,8);
....@@ -1672,7 +2512,7 @@
16722512 */
16732513 makeSomething(new Checker());
16742514 } else
1675
- if (event.getSource() == meshItem)
2515
+ if (source == meshItem)
16762516 {
16772517 Object3D itemtomake = new Object3D();
16782518 Object3D child;
....@@ -1693,35 +2533,52 @@
16932533 makeSomething(child);
16942534 }
16952535 } else
1696
- if (event.getSource() == springItem)
2536
+ if (source == springItem)
16972537 {
16982538 cSpring s = new cSpring();
16992539 s.setup();
17002540 makeSomething(s);
17012541 } else
1702
- if (event.getSource() == flagItem)
2542
+ if (source == flagItem)
17032543 {
17042544 cSpring s = new cFlag();
17052545 s.setup();
17062546 makeSomething(s);
17072547 } else
1708
- if (event.getSource() == lightItem)
2548
+ if (source == lightItem || source == lightButton)
17092549 {
17102550 makeSomething(new Light());
17112551 } else
1712
- if (event.getSource() == csgItem)
2552
+// if (source == skybox1Button ||
2553
+// source == skybox2Button ||
2554
+// source == skybox3Button ||
2555
+// source == skybox4Button ||
2556
+// source == skybox5Button ||
2557
+// source == skybox6Button ||
2558
+// source == skybox7Button ||
2559
+// source == skybox11Button ||
2560
+// source == skybox12Button ||
2561
+// source == skybox13Button ||
2562
+// source == skybox14Button ||
2563
+// source == skybox15Button ||
2564
+// source == skybox16Button ||
2565
+// source == skybox17Button)
2566
+// {
2567
+// ChangeSkybox(source);
2568
+// } else
2569
+ if (source == csgItem)
17132570 {
17142571 group(new CSG());
17152572 } else
1716
- if (event.getSource() == templateItem)
2573
+ if (source == templateItem)
17172574 {
17182575 group(new cTemplate());
17192576 } else
1720
- if (event.getSource() == attributeItem)
2577
+ if (source == attributeItem)
17212578 {
17222579 makeSomething(new Attribute());
17232580 } else
1724
- if (event.getSource() == pointflowItem)
2581
+ if (source == pointflowItem)
17252582 {
17262583 makeSomething(new PointFlow());
17272584 } else
....@@ -1733,7 +2590,7 @@
17332590 } else
17342591 */
17352592
1736
- if (event.getSource() == superLoopItem)
2593
+ if (source == superLoopItem)
17372594 {
17382595 Composite g = new cGroup();
17392596 for (int i=0; i<15; i++)
....@@ -1755,30 +2612,30 @@
17552612
17562613 group(g);
17572614 } else
1758
- if (event.getSource() == loopItem)
2615
+ if (source == loopItem || source == loopButton)
17592616 {
17602617 Composite csg = new GroupLeaf();
17612618 csg.count = 5;
17622619 group(csg);
1763
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
17642621 csg.addChild(child);
17652622 child.addChild(csg);
17662623 } else
1767
- if (event.getSource() == doubleItem)
2624
+ if (source == doubleItem)
17682625 {
1769
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
17702627 csg.count = 5;
17712628 group(csg);
1772
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
17732630 csg.addChild(child);
17742631 child.addChild(csg);
1775
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
17762633 csg.addChild(child);
17772634 child.addChild(csg);
17782635 } else
1779
- if (event.getSource() == tripleItem)
2636
+ if (source == tripleItem)
17802637 {
1781
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
17822639 csg.count = 4;
17832640 group(csg);
17842641 Composite child = new cGroup();
....@@ -1791,73 +2648,105 @@
17912648 csg.addChild(child);
17922649 child.addChild(csg);
17932650 } else
1794
-
1795
- if (event.getSource() == importGFDItem)
1796
- {
1797
- ImportGFD();
1798
- } else
1799
- if (event.getSource() == importVRMLX3DItem)
1800
- {
1801
- ImportVRMLX3D();
1802
- } else
1803
- if (event.getSource() == import3DSItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1806
- } else
1807
- if (event.getSource() == importOBJItem)
1808
- {
1809
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1810
- } else
1811
- if (event.getSource() == computeAOItem)
2651
+ if (source == computeAOItem)
18122652 {
18132653 Globals.drawMode = CameraPane.OCCLUSION;
1814
- Globals.theRenderer.repaint();
2654
+ cameraView.repaint();
18152655 } else
1816
- if (event.getSource() == recompileItem)
2656
+ if (source == recompileItem)
18172657 {
18182658 Recompile();
18192659 refreshContents();
18202660 } else
1821
- if (event.getSource() == editScriptItem)
2661
+ if (source == editScriptItem)
18222662 {
18232663 OpenDialog();
18242664 refreshContents();
18252665 } else
1826
- if (event.getSource() == invariantsItem)
2666
+ if (source == invariantsItem)
18272667 {
18282668 System.out.println("Invariants:");
1829
- GrafreeD.grafreeD.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
18302670 } else
1831
- if (event.getSource() == memoryItem)
2671
+ if (source == memoryItem)
18322672 {
18332673 //System.out.println("Invariants:");
18342674 PrintMemory();
18352675 } else
1836
- if (event.getSource() == pathItem)
2676
+ if (source == pathItem)
18372677 {
18382678 PrintPath();
18392679 } else
1840
- if (event.getSource() == analyzeItem)
2680
+ if (source == analyzeItem)
18412681 {
18422682 AnalyzeObject();
18432683 } else
1844
- if (event.getSource() == dumpItem)
2684
+ if (source == dumpItem)
18452685 {
18462686 DumpObject();
18472687 } else
1848
- if (event.getSource() == screenfitButton)
2688
+ if (source == minButton)
18492689 {
1850
- //Reload(lastConverter, lastFilename, true);
2690
+ Minimize();
2691
+ } else
2692
+ if (source == maxButton)
2693
+ {
2694
+ Maximize();
2695
+ } else
2696
+ if (source == fullButton)
2697
+ {
2698
+ ToggleFullScreen();
2699
+ } else
2700
+ if (source == previousVersionButton)
2701
+ {
2702
+ // Go to previous version
2703
+ //if (!Undo())
2704
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2705
+ PreviousVersion();
2706
+ } else
2707
+ if (source == restoreButton)
2708
+ {
2709
+ // Restore current version
2710
+ Restore();
2711
+ //restoreButton.setEnabled(false);
2712
+ } else
2713
+ if (source == replaceButton)
2714
+ {
2715
+ // Overwrite current version
2716
+ Replace();
2717
+ //replaceButton.setEnabled(false);
2718
+ } else
2719
+ if (source == nextVersionButton)
2720
+ {
2721
+ // Go to next version
2722
+ NextVersion();
2723
+ } else
2724
+ if (source == saveVersionButton)
2725
+ {
2726
+ // Save a new version
2727
+ if (!Save(true))
2728
+ java.awt.Toolkit.getDefaultToolkit().beep();
2729
+ } else
2730
+ if (source == deleteVersionButton)
2731
+ {
2732
+ // Delete a new version
2733
+ DeleteVersion();
2734
+ } else
2735
+ if (source == oneStepButton)
2736
+ {
2737
+ Globals.ONESTEP = true;
2738
+ cameraView.repaint();
2739
+ } else
2740
+ if (source == screenfitButton)
2741
+ {
18512742 ScreenFit();
18522743 } else
1853
- if (event.getSource() == screenfitpointButton)
2744
+ if (source == screenfitpointButton)
18542745 {
1855
- //Reload(lastConverter, lastFilename, true);
18562746 ScreenFitPoint();
18572747 } else
1858
- if (event.getSource() == snapobjectButton)
2748
+ if (source == snapobjectButton)
18592749 {
1860
- //Reload(lastConverter, lastFilename, true);
18612750 SnapObject();
18622751 } else
18632752 // if (event.getSource() == recompileButton)
....@@ -1866,13 +2755,13 @@
18662755 // Recompile();
18672756 // refreshContents();
18682757 // } else
1869
- if (event.getSource() == gcButton)
2758
+ if (source == gcButton)
18702759 {
18712760 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18722761 System.gc();
18732762 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18742763 } else
1875
- if (event.getSource() == editLeafItem)
2764
+ if (source == editLeafItem)
18762765 {
18772766 Object3D obj;
18782767 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1886,62 +2775,74 @@
18862775 }
18872776 refreshContents(true);
18882777 } else
1889
- if (event.getSource() == openWindowItem)
2778
+ if (source == openWindowItem)
18902779 {
18912780 EditSelection(true);
18922781 } else
1893
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2782
+ if (source == cutItem || source == clearButton)
18942783 {
18952784 loadClipboard(true);
18962785 } else
1897
- if (event.getSource() == duplicateItem)
2786
+ if (source == undoItem)
18982787 {
1899
- Object3D keep = GrafreeD.clipboard;
2788
+ PreviousVersion();
2789
+ } else
2790
+ if (source == redoItem)
2791
+ {
2792
+ NextVersion();
2793
+ } else
2794
+ if (source == duplicateItem)
2795
+ {
2796
+ Object3D keep = Grafreed.clipboard;
19002797 loadClipboard(false);
19012798 paste(false);
1902
- GrafreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
19032800 } else
1904
- if (event.getSource() == cloneItem)
2801
+ if (source == cloneItem)
19052802 {
19062803 CloneSelection(false);
19072804 } else
1908
- if (event.getSource() == cloneSupportItem)
2805
+ if (source == cloneSupportItem)
19092806 {
19102807 CloneSelection(true);
19112808 } else
1912
- if (event.getSource() == copyItem)
2809
+ if (source == copyItem)
19132810 {
19142811 loadClipboard(false);
19152812 } else
1916
- if (event.getSource() == pasteItem)
2813
+ if (source == pasteItem)
19172814 {
19182815 paste(false);
19192816 } else
1920
- if (event.getSource() == pasteLinkItem)
2817
+ if (source == pasteIntoItem)
19212818 {
1922
- pasteInto(false);
2819
+ pasteInto(true, false);
19232820 } else
1924
- if (event.getSource() == pasteCloneItem)
2821
+ if (source == pasteLinkItem)
19252822 {
1926
- pasteInto(true);
2823
+ pasteInto(false, false);
19272824 } else
1928
- if (event.getSource() == pasteExpandItem)
2825
+ if (source == pasteCloneItem)
2826
+ {
2827
+ pasteInto(true, true);
2828
+ } else
2829
+ if (source == pasteExpandItem)
19292830 {
19302831 paste(true);
19312832 } else
1932
- if (event.getSource() == synchronizeItem)
2833
+ if (source == synchronizeItem)
19332834 {
19342835 Overwrite(Object3D.TRANSFORM);
19352836 } else
1936
- if (event.getSource() == overwriteNameItem)
2837
+ if (source == overwriteNameItem)
19372838 {
19382839 Overwrite(Object3D.NAME);
19392840 } else
1940
- if (event.getSource() == overwriteUVItem)
2841
+ if (source == overwriteUVItem)
19412842 {
19422843 Overwrite(Object3D.UV);
19432844 } else
1944
- if (event.getSource() == overwriteMatItem)
2845
+ if (source == overwriteMatItem)
19452846 {
19462847 /* july 2015
19472848 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1961,7 +2862,7 @@
19612862
19622863 Overwrite(dropAttributes);
19632864 }
1964
- if (event.getSource() == overwriteGeoItem)
2865
+ if (source == overwriteGeoItem)
19652866 {
19662867 Overwrite(Object3D.GEOMETRY);
19672868 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1978,7 +2879,7 @@
19782879 // refreshContents();
19792880 // }
19802881 } else
1981
- if (event.getSource() == generateMeshItem)
2882
+ if (source == generateMeshItem)
19822883 {
19832884 //if (group.selection.size() == 1)
19842885 // for (int i=0; i<group.selection.size(); i++)
....@@ -1989,7 +2890,7 @@
19892890 ResetModel();
19902891 refreshContents();
19912892 } else
1992
- if (event.getSource() == extractGeometriesItem)
2893
+ if (source == extractGeometriesItem)
19932894 {
19942895 boolean one = false;
19952896
....@@ -2016,7 +2917,7 @@
20162917 ResetModel();
20172918 refreshContents();
20182919 } else
2019
- if (event.getSource() == cloneGeometriesItem)
2920
+ if (source == cloneGeometriesItem)
20202921 {
20212922 boolean one = false;
20222923
....@@ -2042,7 +2943,7 @@
20422943 ResetModel();
20432944 refreshContents();
20442945 } else
2045
- if (event.getSource() == shareGeometriesItem)
2946
+ if (source == shareGeometriesItem)
20462947 {
20472948 boolean one = false;
20482949
....@@ -2072,7 +2973,7 @@
20722973 refreshContents();
20732974 }
20742975 } else
2075
- if (event.getSource() == mergeGeometriesItem)
2976
+ if (source == mergeGeometriesItem)
20762977 {
20772978 boolean one = false;
20782979
....@@ -2102,7 +3003,7 @@
21023003 ResetModel();
21033004 refreshContents();
21043005 } else
2105
- if (event.getSource() == linkverticesItem)
3006
+ if (source == linkverticesItem)
21063007 {
21073008 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21083009 // {
....@@ -2115,9 +3016,9 @@
21153016 // group.selection.get(0).setMasterThis(content); // should be identity
21163017 // refreshContents();
21173018 // }
2118
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21193020 {
2120
- Object3D content = GrafreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
21213022
21223023 if (content instanceof cGroup && ((cGroup)content).transientlink )
21233024 content = ((cGroup)content).get(0);
....@@ -2125,38 +3026,38 @@
21253026 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21263027 for (int i=0; i<group.selection.size(); i++)
21273028 {
2128
- boolean random = CameraPane.RANDOM;
2129
- CameraPane.RANDOM = false; // parse all random nodes
3029
+ boolean random = CameraPane.SWITCH;
3030
+ CameraPane.SWITCH = false; // parse all random nodes
21303031 group.selection.get(i).linkVerticesThis(content);
21313032 // group.selection.get(i).setMasterThis(content); // should be identity
2132
- CameraPane.RANDOM = random;
3033
+ CameraPane.SWITCH = random;
21333034 }
21343035 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21353036 refreshContents();
21363037 }
21373038 } else
2138
- if (event.getSource() == resetsupportItem)
3039
+ if (source == resetsupportItem)
21393040 {
21403041 for (int i=0; i<group.selection.size(); i++)
21413042 {
2142
- boolean random = CameraPane.RANDOM;
2143
- CameraPane.RANDOM = false; // parse all random nodes
3043
+ boolean random = CameraPane.SWITCH;
3044
+ CameraPane.SWITCH = false; // parse all random nodes
21443045 group.selection.get(i).linkVerticesThis(null);
2145
- CameraPane.RANDOM = random;
3046
+ CameraPane.SWITCH = random;
21463047 }
21473048
21483049 refreshContents();
21493050 } else
2150
- if (event.getSource() == relinkverticesItem)
3051
+ if (source == relinkverticesItem)
21513052 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
3053
+ boolean random = CameraPane.SWITCH;
3054
+ CameraPane.SWITCH = false; // parse all random nodes
21543055 group.selection.RelinkToSupport();
2155
- CameraPane.RANDOM = random;
3056
+ CameraPane.SWITCH = random;
21563057
21573058 refreshContents();
21583059 } else
2159
- if (event.getSource() == resetreferencesItem)
3060
+ if (source == resetreferencesItem)
21603061 {
21613062 for (int i=0; i<group.selection.size(); i++)
21623063 {
....@@ -2165,11 +3066,11 @@
21653066
21663067 refreshContents();
21673068 } else
2168
- if (event.getSource() == setMasterItem)
3069
+ if (source == setMasterItem)
21693070 {
2170
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21713072 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
21733074
21743075 if (content instanceof cGroup && ((cGroup)content).transientlink )
21753076 content = ((cGroup)content).get(0);
....@@ -2178,13 +3079,13 @@
21783079 refreshContents();
21793080 }
21803081 } else
2181
- if (event.getSource() == poseMeshItem)
3082
+ if (source == poseMeshItem)
21823083 {
21833084 if (group.selection.size() == 1)
21843085 {
2185
- if (GrafreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
21863087 {
2187
- Object3D content = GrafreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
21883089
21893090 if (content instanceof cGroup && ((cGroup)content).transientlink )
21903091 content = ((cGroup)content).get(0);
....@@ -2197,19 +3098,19 @@
21973098 }
21983099
21993100 } else
2200
- if (event.getSource() == revertMeshItem)
3101
+ if (source == revertMeshItem)
22013102 {
22023103 RevertMeshes();
22033104 } else
2204
- if (event.getSource() == resetMeshItem)
3105
+ if (source == resetAllItem)
22053106 {
22063107 ResetAll();
22073108 } else
2208
- if (event.getSource() == stepAllItem)
3109
+ if (source == stepAllItem)
22093110 {
22103111 StepAll();
22113112 } else
2212
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
22133114 {
22143115 //int indices[] = jList.getSelectedIndices();
22153116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2217,46 +3118,46 @@
22173118
22183119 ClearSelection(false);
22193120 } else
2220
- if (event.getSource() == clearAllItem)
3121
+ if (source == clearAllItem)
22213122 {
22223123 ClearSelection(true);
22233124 } else
2224
- if (event.getSource() == grabItem)
3125
+ if (source == grabItem || source == groupButton)
22253126 {
2226
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
22273128 } else
2228
- if (event.getSource() == hideItem)
3129
+ if (source == hideItem)
22293130 {
22303131 group(new HiddenObject());
22313132 } else
2232
- if (event.getSource() == frontItem)
3133
+ if (source == frontItem)
22333134 {
22343135 front();
22353136 } else
2236
- if (event.getSource() == backItem)
3137
+ if (source == backItem)
22373138 {
22383139 back();
22393140 } else
2240
- if (event.getSource() == cameraItem)
3141
+ if (source == cameraItem)
22413142 {
22423143 makeSomething(new Camera());
22433144 } else
2244
- if (event.getSource() == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
22453146 {
22463147 group(new Composite());
22473148 } else
2248
- if (event.getSource() == randomItem)
3149
+ if (source == switchItem || source == switchButton)
22493150 {
22503151 RandomNode random = new RandomNode();
22513152 group(random);
22523153 if (random.size() > 0)
2253
- random.name = random.get(0).name + "Rnd";
3154
+ random.name = random.get(0).name + "Switch";
22543155 } else
2255
- if (event.getSource() == physicsItem)
3156
+ if (source == physicsItem)
22563157 {
22573158 group(new PhysicsNode());
22583159 } else
2259
- if (event.getSource() == frameselectorItem)
3160
+ if (source == frameselectorItem)
22603161 {
22613162 for (int i=0; i<group.selection.size(); i++)
22623163 {
....@@ -2268,7 +3169,7 @@
22683169 ResetModel();
22693170 refreshContents();
22703171 } else
2271
- if (event.getSource() == switchGeoItem)
3172
+ if (source == switchGeoItem)
22723173 {
22733174 for (int i=0; i<group.selection.size(); i++)
22743175 {
....@@ -2280,7 +3181,7 @@
22803181 ResetModel();
22813182 refreshContents();
22823183 } else
2283
- if (event.getSource() == switchTransfoItem)
3184
+ if (source == switchTransfoItem)
22843185 {
22853186 for (int i=0; i<group.selection.size(); i++)
22863187 {
....@@ -2292,7 +3193,7 @@
22923193 ResetModel();
22933194 refreshContents();
22943195 } else
2295
- if (event.getSource() == morphItem)
3196
+ if (source == morphItem)
22963197 {
22973198 for (int i=0; i<group.selection.size(); i++)
22983199 {
....@@ -2304,7 +3205,7 @@
23043205 ResetModel();
23053206 refreshContents();
23063207 } else
2307
- if (event.getSource() == scriptNodeItem)
3208
+ if (source == scriptNodeItem)
23083209 {
23093210 boolean atleastone = false;
23103211
....@@ -2343,215 +3244,252 @@
23433244 }
23443245 }
23453246 } else
2346
- if (event.getSource() == linkerItem)
3247
+ if (source == linkerItem)
23473248 {
23483249 group(new cLinker());
23493250 } else
2350
- if (event.getSource() == textureItem)
3251
+ if (source == textureItem || source == textureButton)
23513252 {
23523253 group(new TextureNode());
23533254 } else
2354
- if (event.getSource() == billboardItem)
3255
+ if (source == billboardItem)
23553256 {
23563257 group(new BillboardNode());
23573258 } else
2358
- if (event.getSource() == shadowXItem)
3259
+ if (source == shadowXItem)
23593260 {
23603261 CastShadow(0);
23613262 } else
2362
- if (event.getSource() == shadowYItem)
3263
+ if (source == shadowYItem)
23633264 {
23643265 CastShadow(1);
23653266 } else
2366
- if (event.getSource() == shadowZItem)
3267
+ if (source == shadowZItem)
23673268 {
23683269 CastShadow(2);
23693270 } else
2370
- if (event.getSource() == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
23713272 {
2372
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
23733275 for (int i=0; i<group.selection.size(); i++)
23743276 {
2375
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
23763282 }
23773283
2378
- ClearSelection(false);
2379
-
2380
- refreshContents();
3284
+ if (!hasRoot)
3285
+ {
3286
+ for (int i=0; i<group.selection.size(); i++)
3287
+ {
3288
+ Ungroup(group.selection.get(i));
3289
+ }
3290
+
3291
+ ClearSelection(false);
3292
+
3293
+ refreshContents();
3294
+ }
23813295 } else
2382
- if (event.getSource() == genUVItem)
3296
+ if (source == genUVItem)
23833297 {
23843298 GenUV();
23853299 } else
2386
- if (event.getSource() == genNormalsCADItem)
3300
+ if (source == genNormalsCADItem)
23873301 {
23883302 GenNormals(true);
23893303 } else
2390
- if (event.getSource() == genNormalsMESHItem)
3304
+ if (source == genNormalsMESHItem)
23913305 {
2392
- GenNormals(true); // TODO
3306
+ GenNormalsMESH();
23933307 } else
2394
- if (event.getSource() == genNormalsORGANItem)
3308
+ if (source == genNormalsORGANItem)
23953309 {
23963310 GenNormals(false);
23973311 } else
2398
- if (event.getSource() == genNormalsMINEItem)
3312
+ if (source == genNormalsMINEItem)
23993313 {
24003314 GenNormalsMINE();
24013315 } else
2402
- if (event.getSource() == stripifyItem)
3316
+ if (source == stripifyItem)
24033317 {
24043318 Stripify();
24053319 } else
2406
- if (event.getSource() == unstripifyItem)
3320
+ if (source == unstripifyItem)
24073321 {
24083322 Unstripify();
24093323 } else
2410
- if (event.getSource() == trimItem)
3324
+ if (source == trimItem)
24113325 {
24123326 Trim();
24133327 } else
2414
- if (event.getSource() == untrimItem)
3328
+ if (source == untrimItem)
24153329 {
24163330 Untrim();
24173331 } else
2418
- if (event.getSource() == clearColorsItem)
3332
+ if (source == clearColorsItem)
24193333 {
24203334 ClearColors();
24213335 } else
2422
- if (event.getSource() == clearMaterialsItem)
3336
+ if (source == clearMaterialsItem)
24233337 {
24243338 ClearMaterials();
24253339 } else
2426
- if (event.getSource() == liveleavesItem)
3340
+ if (source == liveleavesItem)
24273341 {
24283342 LiveLeaves(true);
24293343 } else
2430
- if (event.getSource() == unliveleavesItem)
3344
+ if (source == unliveleavesItem)
24313345 {
24323346 LiveLeaves(false);
24333347 } else
2434
- if (event.getSource() == supportleavesItem)
3348
+ if (source == supportleavesItem)
24353349 {
24363350 SupportLeaves(true);
24373351 } else
2438
- if (event.getSource() == unsupportleavesItem)
3352
+ if (source == unsupportleavesItem)
24393353 {
24403354 SupportLeaves(false);
24413355 } else
2442
- if (event.getSource() == hideleavesItem)
3356
+ if (source == hideleavesItem)
24433357 {
24443358 HideLeaves(true);
24453359 } else
2446
- if (event.getSource() == showleavesItem)
3360
+ if (source == showleavesItem)
24473361 {
24483362 HideLeaves(false);
24493363 } else
2450
- if (event.getSource() == markleavesItem)
3364
+ if (source == markleavesItem)
24513365 {
24523366 MarkLeaves(true);
24533367 } else
2454
- if (event.getSource() == unmarkleavesItem)
3368
+ if (source == unmarkleavesItem)
24553369 {
24563370 MarkLeaves(false);
24573371 } else
2458
- if (event.getSource() == flipVItem)
3372
+ if (source == rewindleavesItem)
3373
+ {
3374
+ RewindLeaves(true);
3375
+ } else
3376
+ if (source == unrewindleavesItem)
3377
+ {
3378
+ RewindLeaves(false);
3379
+ } else
3380
+ if (source == randomleavesItem)
3381
+ {
3382
+ RandomLeaves(true);
3383
+ } else
3384
+ if (source == unrandomleavesItem)
3385
+ {
3386
+ RandomLeaves(false);
3387
+ } else
3388
+ if (source == flipVItem)
24593389 {
24603390 FlipV(true);
24613391 } else
2462
- if (event.getSource() == unflipVItem)
3392
+ if (source == unflipVItem)
24633393 {
24643394 FlipV(false);
24653395 } else
2466
- if (event.getSource() == lowTexturesItem)
3396
+ if (source == lowTexturesItem)
24673397 {
24683398 SetTexRes(0);
24693399 } else
2470
- if (event.getSource() == normalTexturesItem)
3400
+ if (source == normalTexturesItem)
24713401 {
24723402 SetTexRes(1);
24733403 } else
2474
- if (event.getSource() == highTexturesItem)
3404
+ if (source == highTexturesItem)
24753405 {
24763406 SetTexRes(2);
24773407 } else
2478
- if (event.getSource() == veryhighTexturesItem)
3408
+ if (source == veryhighTexturesItem)
24793409 {
24803410 SetTexRes(3);
24813411 } else
2482
- if (event.getSource() == maxTexturesItem)
3412
+ if (source == maxTexturesItem)
24833413 {
24843414 SetTexRes(4);
24853415 } else
2486
- if (event.getSource() == panoTexturesItem)
3416
+ if (source == panoTexturesItem)
24873417 {
24883418 SetTexRes(5);
24893419 } else
2490
- if (event.getSource() == reverseNormalsItem)
3420
+ if (source == reverseNormalsItem)
24913421 {
24923422 ReverseNormals();
24933423 } else
2494
- if (event.getSource() == parseverticesItem)
3424
+ if (source == parseverticesItem)
24953425 {
24963426 ParseVertices();
24973427 } else
2498
- if (event.getSource() == textureFieldItem)
3428
+ if (source == textureFieldItem)
24993429 {
25003430 TextureVertices();
25013431 } else
2502
- if (event.getSource() == alignItem)
3432
+ if (source == alignItem)
25033433 {
25043434 Align();
25053435 } else
2506
- if (event.getSource() == mirrorItem)
3436
+ if (source == mirrorItem)
25073437 {
25083438 MirrorPoses();
25093439 } else
2510
- if (event.getSource() == reduceMorphItem)
3440
+ if (source == reduceMorphItem)
25113441 {
25123442 MeshReduction(false);
25133443 } else
2514
- if (event.getSource() == reduce34MorphItem)
3444
+ if (source == reduce34MorphItem)
25153445 {
25163446 MeshReduction(true);
25173447 } else
2518
- if (event.getSource() == reverseTrianglesItem)
3448
+ if (source == reverseTrianglesItem)
25193449 {
25203450 ReverseTriangles();
25213451 } else
2522
- if (event.getSource() == reduceMeshItem)
3452
+ if (source == reduceMeshItem)
25233453 {
25243454 ReduceMesh(false);
25253455 } else
2526
- if (event.getSource() == reduce34MeshItem)
3456
+ if (source == reduce34MeshItem)
25273457 {
25283458 ReduceMesh(true);
25293459 } else
2530
- if (event.getSource() == increaseMeshItem)
3460
+ if (source == increaseMeshItem)
25313461 {
25323462 IncreaseMesh();
25333463 } else
2534
- if (event.getSource() == clipMeshItem)
3464
+ if (source == clipMeshItem)
25353465 {
25363466 ClipMesh();
25373467 } else
2538
- if (event.getSource() == smoothMeshItem)
3468
+ if (source == smoothMeshItem)
25393469 {
25403470 SmoothMesh();
25413471 } else
2542
- if (event.getSource() == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
25433473 {
25443474 TransformGeometry();
25453475 } else
2546
- if (event.getSource() == resetTransformItem)
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
3479
+ } else
3480
+ if (source == resetTransformItem)
25473481 {
25483482 ResetTransform();
25493483 } else
2550
- if (event.getSource() == resetCentroidItem)
3484
+ if (source == resetCentroidItem)
25513485 {
2552
- ResetCentroid();
3486
+ ResetCentroid(true);
25533487 } else
2554
- if (event.getSource() == resetParentItem)
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
3491
+ } else
3492
+ if (source == resetParentItem)
25553493 {
25563494 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25573495 {
....@@ -2561,7 +3499,7 @@
25613499
25623500 refreshContents();
25633501 } else
2564
- if (event.getSource() == repairParentItem)
3502
+ if (source == repairParentItem)
25653503 {
25663504 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673505 {
....@@ -2575,7 +3513,7 @@
25753513
25763514 refreshContents();
25773515 } else
2578
- if (event.getSource() == repairShadowItem)
3516
+ if (source == repairShadowItem)
25793517 {
25803518 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25813519 {
....@@ -2589,7 +3527,7 @@
25893527
25903528 refreshContents();
25913529 } else
2592
- if (event.getSource() == sortbysizeItem)
3530
+ if (source == sortbysizeItem)
25933531 {
25943532 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25953533 {
....@@ -2601,7 +3539,7 @@
26013539 ResetModel();
26023540 refreshContents();
26033541 } else
2604
- if (event.getSource() == sortbynameItem)
3542
+ if (source == sortbynameItem)
26053543 {
26063544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26073545 {
....@@ -2613,7 +3551,7 @@
26133551 ResetModel();
26143552 refreshContents();
26153553 } else
2616
- if (event.getSource() == attachPigmentItem)
3554
+ if (source == attachPigmentItem)
26173555 {
26183556 String texture = GetFile("Attach pigment");
26193557 Object3D obj;
....@@ -2625,7 +3563,7 @@
26253563
26263564 refreshContents();
26273565 } else
2628
- if (event.getSource() == detachPigmentItem)
3566
+ if (source == detachPigmentItem)
26293567 {
26303568 Object3D obj;
26313569 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2636,7 +3574,7 @@
26363574
26373575 refreshContents();
26383576 } else
2639
- if (event.getSource() == attachBumpItem)
3577
+ if (source == attachBumpItem)
26403578 {
26413579 String texture = GetFile("Attach bump");
26423580 Object3D obj;
....@@ -2648,18 +3586,18 @@
26483586
26493587 refreshContents();
26503588 } else
2651
- if (event.getSource() == detachBumpItem)
3589
+ if (source == detachBumpItem)
26523590 {
26533591 Object3D obj;
26543592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26553593 {
26563594 obj = (Object3D)e.nextElement();
2657
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
26583596 }
26593597
26603598 refreshContents();
26613599 } else
2662
- if (event.getSource() == pigmentBumpItem)
3600
+ if (source == pigmentBumpItem)
26633601 {
26643602 Object3D obj;
26653603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2670,158 +3608,262 @@
26703608
26713609 refreshContents();
26723610 } else
2673
- if (event.getSource() == flashSelectionButton)
3611
+ if (source == embedTexturesItem)
3612
+ {
3613
+ Object3D obj;
3614
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3615
+ {
3616
+ obj = (Object3D)e.nextElement();
3617
+ obj.EmbedTextures(true);
3618
+ }
3619
+
3620
+ refreshContents();
3621
+ } else
3622
+ if (source == deEmbedTexturesItem)
3623
+ {
3624
+ Object3D obj;
3625
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3626
+ {
3627
+ obj = (Object3D)e.nextElement();
3628
+ obj.EmbedTextures(false);
3629
+ }
3630
+
3631
+ CameraPane.texturepigment.clear();
3632
+ CameraPane.texturebump.clear();
3633
+
3634
+ refreshContents();
3635
+ } else
3636
+ if (source == flashSelectionButton)
26743637 {
26753638 CameraPane.flash = true;
26763639 refreshContents();
26773640 } else
2678
- if (event.getSource() == oneButton)
3641
+ if (source == oneButton)
26793642 {
26803643 } else
2681
- if (event.getSource() == twoButton)
3644
+ if (source == twoButton)
26823645 {
26833646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
26843651 // bug
26853652 //gridPanel.setDividerLocation(1.0);
26863653 //bigPanel.setDividerLocation(0.0);
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2709
- //bigThree.add(XYZPanel, aWindowConstraints);
2710
- bigThree.revalidate();
3654
+// bigThree.remove(scenePanel);
3655
+// bigThree.remove(centralPanel);
3656
+// bigThree.remove(XYZPanel);
3657
+// aWindowConstraints.gridx = 0;
3658
+// aWindowConstraints.gridy = 0;
3659
+// aWindowConstraints.gridwidth = 1;
3660
+// // aConstraints.gridheight = 3;
3661
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3662
+// aWindowConstraints.weightx = 0;
3663
+// aWindowConstraints.weighty = 1;
3664
+// //bigThree.add(jtp, aWindowConstraints);
3665
+// aWindowConstraints.weightx = 1;
3666
+// aWindowConstraints.gridwidth = 3;
3667
+// // aConstraints.gridheight = 3;
3668
+// aWindowConstraints.gridx = 1;
3669
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3670
+// bigThree.add(centralPanel, aWindowConstraints);
3671
+// aWindowConstraints.weightx = 0;
3672
+// aWindowConstraints.gridx = 4;
3673
+// aWindowConstraints.gridwidth = 1;
3674
+// // aConstraints.gridheight = 3;
3675
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3676
+// //bigThree.add(XYZPanel, aWindowConstraints);
3677
+// scenePanel.setVisible(false);
3678
+// centralPanel.setVisible(true);
3679
+// XYZPanel.setVisible(false);
3680
+ bigThree.ClearUI();
3681
+ bigThree.add(centralPanel);
3682
+ bigThree.FlushUI();
3683
+
3684
+ cameraView.requestFocusInWindow();
3685
+
3686
+// refreshContents(true);
3687
+//
3688
+// try
3689
+// {
3690
+// java.awt.Robot bot = new java.awt.Robot();
3691
+// int mask = InputEvent.BUTTON1_MASK;
3692
+// bot.mouseMove(100, 100);
3693
+// bot.mousePress(mask);
3694
+// bot.mouseRelease(mask);
3695
+// }
3696
+// catch (Exception e)
3697
+// {
3698
+//
3699
+// }
3700
+
27113701 } else
2712
- if (event.getSource() == threeButton)
3702
+ if (source == threeButton)
27133703 {
27143704 radio.layout = threeButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2723
- aWindowConstraints.weightx = 0;
2724
- aWindowConstraints.weighty = 1;
2725
- //bigThree.add(jtp, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- bigThree.add(centralPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aConstraints.gridheight = 3;
2736
- aConstraints.fill = GridBagConstraints.VERTICAL;
2737
- bigThree.add(XYZPanel, aWindowConstraints);
2738
- bigThree.revalidate();
3705
+
3706
+ if (CameraPane.FULLSCREEN)
3707
+ fullscreenLayout = radio.layout;
3708
+
3709
+// bigThree.remove(scenePanel);
3710
+// bigThree.remove(centralPanel);
3711
+// bigThree.remove(XYZPanel);
3712
+// aWindowConstraints.gridx = 0;
3713
+// aWindowConstraints.gridy = 0;
3714
+// aWindowConstraints.gridwidth = 1;
3715
+// // aConstraints.gridheight = 3;
3716
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3717
+// aWindowConstraints.weightx = 0;
3718
+// aWindowConstraints.weighty = 1;
3719
+// //bigThree.add(jtp, aWindowConstraints);
3720
+// aWindowConstraints.weightx = 1;
3721
+// aWindowConstraints.gridwidth = 3;
3722
+// // aConstraints.gridheight = 3;
3723
+// aWindowConstraints.gridx = 1;
3724
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3725
+// bigThree.add(centralPanel, aWindowConstraints);
3726
+// aWindowConstraints.weightx = 0;
3727
+// aWindowConstraints.gridx = 4;
3728
+// aWindowConstraints.gridwidth = 1;
3729
+// // aConstraints.gridheight = 3;
3730
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3731
+// bigThree.add(XYZPanel, aWindowConstraints);
3732
+// bigThree.validate();
3733
+// scenePanel.setVisible(false);
3734
+// centralPanel.setVisible(true);
3735
+// XYZPanel.setVisible(true);
3736
+ bigThree.ClearUI();
3737
+ bigThree.add(scenePanel);
3738
+ bigThree.add(centralPanel);
3739
+ bigThree.FlushUI();
3740
+
3741
+ cameraView.requestFocusInWindow();
27393742 } else
2740
- if (event.getSource() == fourButton)
3743
+ if (source == fourButton)
27413744 {
27423745 radio.layout = fourButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aWindowConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2751
- aWindowConstraints.weightx = 1;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- //bigThree.add(cameraPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aWindowConstraints);
2766
- bigThree.revalidate();
3746
+
3747
+ if (CameraPane.FULLSCREEN)
3748
+ fullscreenLayout = radio.layout;
3749
+
3750
+// bigThree.remove(scenePanel);
3751
+// bigThree.remove(centralPanel);
3752
+// bigThree.remove(XYZPanel);
3753
+// aWindowConstraints.gridx = 0;
3754
+// aWindowConstraints.gridy = 0;
3755
+// aWindowConstraints.gridwidth = 1;
3756
+// // aWindowConstraints.gridheight = 3;
3757
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3758
+// aWindowConstraints.weightx = 1;
3759
+// aWindowConstraints.weighty = 1;
3760
+// bigThree.add(scenePanel, aWindowConstraints);
3761
+// aWindowConstraints.weightx = 1;
3762
+// aWindowConstraints.gridwidth = 3;
3763
+// // aConstraints.gridheight = 3;
3764
+// aWindowConstraints.gridx = 1;
3765
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3766
+// //bigThree.add(cameraPanel, aWindowConstraints);
3767
+// aWindowConstraints.weightx = 0;
3768
+// aWindowConstraints.gridx = 4;
3769
+// aWindowConstraints.gridwidth = 1;
3770
+// // aWindowConstraints.gridheight = 3;
3771
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3772
+// //bigThree.add(XYZPanel, aWindowConstraints);
3773
+// bigThree.validate();
3774
+// scenePanel.setVisible(true);
3775
+// centralPanel.setVisible(false);
3776
+// XYZPanel.setVisible(false);
3777
+ bigThree.ClearUI();
3778
+ bigThree.add(scenePanel);
3779
+ bigThree.FlushUI();
3780
+
3781
+ cameraView.requestFocusInWindow();
27673782 } else
2768
- if (event.getSource() == sixButton)
3783
+ if (source == sixButton)
27693784 {
27703785 radio.layout = sixButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aWindowConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- //bigThree.add(XYZPanel, aConstraints);
2794
- bigThree.revalidate();
3786
+
3787
+ if (CameraPane.FULLSCREEN)
3788
+ fullscreenLayout = radio.layout;
3789
+
3790
+// bigThree.remove(scenePanel);
3791
+// bigThree.remove(centralPanel);
3792
+// bigThree.remove(XYZPanel);
3793
+// aWindowConstraints.gridx = 0;
3794
+// aWindowConstraints.gridy = 0;
3795
+// aWindowConstraints.gridwidth = 1;
3796
+// // aConstraints.gridheight = 3;
3797
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3798
+// aWindowConstraints.weightx = 0;
3799
+// aWindowConstraints.weighty = 1;
3800
+// bigThree.add(scenePanel, aWindowConstraints);
3801
+// aWindowConstraints.weightx = 1;
3802
+// aWindowConstraints.gridwidth = 3;
3803
+// // aWindowConstraints.gridheight = 3;
3804
+// aWindowConstraints.gridx = 1;
3805
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3806
+// bigThree.add(centralPanel, aWindowConstraints);
3807
+// aWindowConstraints.weightx = 0;
3808
+// aWindowConstraints.gridx = 4;
3809
+// aWindowConstraints.gridwidth = 1;
3810
+// // aWindowConstraints.gridheight = 3;
3811
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3812
+// //bigThree.add(XYZPanel, aConstraints);
3813
+// bigThree.validate();
3814
+// scenePanel.setVisible(true);
3815
+// centralPanel.setVisible(true);
3816
+// XYZPanel.setVisible(false);
3817
+ bigThree.ClearUI();
3818
+ bigThree.add(centralPanel);
3819
+ bigThree.add(scenePanel);
3820
+ bigThree.FlushUI();
3821
+
3822
+ cameraView.requestFocusInWindow();
27953823 } else
2796
- if (event.getSource() == sevenButton)
3824
+ if (source == sevenButton)
27973825 {
27983826 radio.layout = sevenButton;
2799
- bigThree.remove(scenePanel);
2800
- bigThree.remove(centralPanel);
2801
- bigThree.remove(XYZPanel);
2802
- aWindowConstraints.gridx = 0;
2803
- aWindowConstraints.gridy = 0;
2804
- aWindowConstraints.gridwidth = 1;
2805
- // aWindowConstraints.gridheight = 3;
2806
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2807
- aWindowConstraints.weightx = 0;
2808
- aWindowConstraints.weighty = 1;
2809
- bigThree.add(scenePanel, aWindowConstraints);
2810
- aWindowConstraints.weightx = 1;
2811
- aWindowConstraints.gridwidth = 3;
2812
- // aWindowConstraints.gridheight = 3;
2813
- aWindowConstraints.gridx = 1;
2814
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2815
- bigThree.add(centralPanel, aWindowConstraints);
2816
- aWindowConstraints.weightx = 0;
2817
- aWindowConstraints.gridx = 4;
2818
- aWindowConstraints.gridwidth = 1;
2819
- // aConstraints.gridheight = 3;
2820
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2821
- bigThree.add(XYZPanel, aWindowConstraints);
2822
- bigThree.revalidate();
3827
+
3828
+ if (CameraPane.FULLSCREEN)
3829
+ fullscreenLayout = radio.layout;
3830
+
3831
+// bigThree.remove(scenePanel);
3832
+// bigThree.remove(centralPanel);
3833
+// bigThree.remove(XYZPanel);
3834
+// aWindowConstraints.gridx = 0;
3835
+// aWindowConstraints.gridy = 0;
3836
+// aWindowConstraints.gridwidth = 1;
3837
+// // aWindowConstraints.gridheight = 3;
3838
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3839
+// aWindowConstraints.weightx = 0;
3840
+// aWindowConstraints.weighty = 1;
3841
+// bigThree.add(scenePanel, aWindowConstraints);
3842
+// aWindowConstraints.weightx = 1;
3843
+// aWindowConstraints.gridwidth = 3;
3844
+// // aWindowConstraints.gridheight = 3;
3845
+// aWindowConstraints.gridx = 1;
3846
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3847
+// bigThree.add(centralPanel, aWindowConstraints);
3848
+// aWindowConstraints.weightx = 0;
3849
+// aWindowConstraints.gridx = 4;
3850
+// aWindowConstraints.gridwidth = 1;
3851
+// // aConstraints.gridheight = 3;
3852
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3853
+// bigThree.add(XYZPanel, aWindowConstraints);
3854
+// bigThree.validate();
3855
+// scenePanel.setVisible(true);
3856
+// centralPanel.setVisible(true);
3857
+// XYZPanel.setVisible(true);
3858
+ bigThree.ClearUI();
3859
+ bigThree.add(scenePanel);
3860
+ bigThree.add(centralPanel);
3861
+ bigThree.add(XYZPanel);
3862
+ bigThree.FlushUI();
3863
+
3864
+ cameraView.requestFocusInWindow();
28233865 } else
2824
- if (event.getSource() == rootButton)
3866
+ if (source == rootButton)
28253867 {
28263868 Object3D obj;
28273869 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2831,66 +3873,85 @@
28313873 EditObject(obj);
28323874 }
28333875
3876
+ cameraView.requestFocusInWindow();
28343877 refreshContents(true);
28353878 } else
2836
- if (event.getSource() == closeButton)
3879
+ if (source == closeButton)
28373880 {
28383881 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28393882 cRadio ab;
28403883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28413884 {
28423885 ab = (cRadio)e.nextElement();
2843
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28443887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
28453894 buttonGroup.remove(ab);
28463895 radioPanel.remove(ab);
28473896
2848
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
28493899 // ab.GetObject().objectUI = null; // ?????????
28503900
28513901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28523902 break;
28533903 }
28543904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
28553907 refreshContents(true);
28563908 } else
2857
- if (event.getSource() == editItem || event.getSource() == editButton)
3909
+ if (source == editItem || source == editButton)
28583910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
28593917 EditSelection(false);
28603918 } else
2861
- if (event.getSource() == uneditButton)
3919
+ if (source == uneditButton)
28623920 {
28633921 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28643922 {
28653923 Object3D child = (Object3D)e.nextElement();
28663924 if(child.editWindow != null)
2867
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
28683926 child.CloseUI();
28693927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28703929
2871
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
28723931 }
2873
- objEditor.ctrlPanel.revalidate();
3932
+ objEditor.ctrlPanel.FlushUI();
28743933 //objEditor.jTree.clearSelection();
28753934 //objEditor.ResetSliders();
28763935 refreshContents(true);
28773936 } else
2878
- if (event.getSource() == clearPanelButton)
3937
+ if (source == clearPanelButton)
28793938 {
28803939 assert(copy == group);
28813940 //copy.ClearUI();
28823941 for (Object3D obj : listUI)
28833942 {
3943
+ obj.pinned = false;
28843944 obj.CloseUI();
28853945 }
28863946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
28873948 refreshContents(true);
28883949 } else
2889
- if (event.getSource() == allParamsButton)
3950
+ if (source == allParamsButton)
28903951 {
28913952 assert(copy == group);
28923953
2893
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28943955
28953956 for (Object3D obj : listUI)
28963957 {
....@@ -2907,19 +3968,19 @@
29073968
29083969 refreshContents(true);
29093970 } else
2910
- if (event.getSource() == unselectButton)
3971
+ if (source == unselectButton)
29113972 {
29123973 objEditor.jTree.clearSelection();
29133974 // ?? oct 2012 GrafreeD.clipboard.clear();
29143975 objEditor.ResetSliders();
29153976 refreshContents(true);
29163977 } else
2917
- if(event.getSource() instanceof cRadio)
3978
+ if(source instanceof cRadio)
29183979 {
29193980 group.parent = keepparent;
29203981 group.attributes = 0;
29213982 //group.editWindow = null;
2922
- /*cRadio*/ radio = (cRadio)event.getSource();
3983
+ /*cRadio*/ radio = (cRadio)source;
29233984 Object3D obj = radio.GetObject();
29243985 System.out.println("Edit " + obj);
29253986 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2939,6 +4000,9 @@
29394000 }
29404001
29414002 copy = group;
4003
+
4004
+ SetUndoStates();
4005
+
29424006 //Globals.theRenderer.object = group;
29434007 if(!useclient)
29444008 {
....@@ -2954,20 +4018,49 @@
29544018 frontView.object = group;
29554019 sideView.object = group;
29564020 }
2957
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
29584026 /*
29594027 currentLayout = radio.layout;
29604028 if (currentLayout == null)
29614029 currentLayout = sevenButton;
29624030 */
29634031 radio.layout.doClick();
4032
+
4033
+ ClearUnpinned();
4034
+
4035
+ //Grafreed.Assert(group != null);
4036
+ //Grafreed.Assert(group.selection != null);
4037
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4038
+ if (group.selection == null || group.selection.size() == 1)
4039
+ EditSelection(false);
29644040 keepparent = group.parent;
29654041 // PARENT = NULL or not???
29664042 //group.parent = null; // ROOT
29674043 //group.attributes = -1;
29684044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
29694047 refreshContents(true);
2970
- }
4048
+ } else if (event.getSource() == editCameraItem)
4049
+ {
4050
+ cameraView.ProtectCamera();
4051
+ cameraView.requestFocusInWindow();
4052
+ cameraView.repaint();
4053
+ return;
4054
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4055
+ {
4056
+ cameraView.RevertCamera();
4057
+ cameraView.requestFocusInWindow();
4058
+ cameraView.repaint();
4059
+ return;
4060
+ // } else if (event.getSource() == textureButton)
4061
+ // {
4062
+ // return; // true;
4063
+ }
29714064 else
29724065 {
29734066 //return super.action(event, arg);
....@@ -2976,7 +4069,6 @@
29764069 }
29774070
29784071 boolean useclient = false;
2979
- cRadio radio;
29804072
29814073 void ToggleRoot()
29824074 {
....@@ -3028,6 +4120,28 @@
30284120 refreshContents();
30294121 }
30304122
4123
+ void TransformChildren()
4124
+ {
4125
+ Object3D obj;
4126
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4127
+ {
4128
+ obj = (Object3D)e.nextElement();
4129
+ obj.KeepTextureMatrices();
4130
+ obj.TransformChildren();
4131
+ obj.RestoreTextureMatrices();
4132
+
4133
+// if (obj.parent == null)
4134
+// {
4135
+// System.out.println("NULL PARENT!");
4136
+// new Exception().printStackTrace();
4137
+// }
4138
+// else
4139
+// TouchTransform(obj);
4140
+// //obj.parent.Touch();
4141
+ }
4142
+
4143
+ refreshContents();
4144
+ }
30314145
30324146 void ResetTransform()
30334147 {
....@@ -3140,7 +4254,7 @@
31404254 refreshContents();
31414255 }
31424256
3143
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
31444258 {
31454259 Object3D obj;
31464260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3155,12 +4269,16 @@
31554269 LA.matIdentity(Object3D.mat);
31564270 obj.getBounds(minima, maxima, false);
31574271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3158
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31594274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31604275 obj.TransformMesh(Object3D.mat);
4276
+
31614277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3162
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31634280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
31644282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31654283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31664284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3189,7 +4307,8 @@
31894307
31904308 int size = obj.MemorySize();
31914309
3192
- System.err.println((size/1024) + " KB is the size of " + obj);
4310
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4311
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31934312 }
31944313 }
31954314 catch (Exception e)
....@@ -3226,9 +4345,9 @@
32264345 obj = (Object3D)e.nextElement();
32274346
32284347 System.out.println("Object is: " + obj);
3229
- GrafreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
32304349 System.out.println("Boundary rep: " + obj.bRep);
3231
- GrafreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
32324351
32334352 // System.err.println((size/1024) + " KB is the size of " + obj);
32344353 }
....@@ -3270,6 +4389,13 @@
32704389 void GenNormals(boolean crease)
32714390 {
32724391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
32734399
32744400 refreshContents();
32754401 }
....@@ -3442,8 +4568,8 @@
34424568
34434569 void ParseVertices()
34444570 {
3445
- boolean epsequal = GrafreeD.epsequal;
3446
- GrafreeD.epsequal = true;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
34474573
34484574 for (int i=0; i<group.selection.size(); i++)
34494575 {
....@@ -3468,7 +4594,7 @@
34684594 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34694595 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34704596
3471
- g.add(GrafreeD.clipboard);
4597
+ g.add(Grafreed.clipboard);
34724598
34734599 buffer.add(g);
34744600 }
....@@ -3483,7 +4609,7 @@
34834609 makeSomething(buffer, i==group.selection.size()-1);
34844610 }
34854611
3486
- GrafreeD.epsequal = epsequal;
4612
+ Grafreed.epsequal = epsequal;
34874613
34884614 refreshContents();
34894615 }
....@@ -3501,7 +4627,16 @@
35014627 String pigment = Object3D.GetPigment(tex);
35024628 //String bump = Object3D.GetBump(tex);
35034629
3504
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4630
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4631
+
4632
+ try
4633
+ {
4634
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4635
+ }
4636
+ catch (Exception e)
4637
+ {
4638
+ System.err.println("FAIL: " + node);
4639
+ }
35054640
35064641 double s = v.s;
35074642
....@@ -3589,11 +4724,11 @@
35894724
35904725 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35914726
3592
- boolean random = CameraPane.RANDOM;
3593
- CameraPane.RANDOM = false; // parse all random nodes
4727
+ boolean random = CameraPane.SWITCH;
4728
+ CameraPane.SWITCH = false; // parse all random nodes
35944729 lowres.linkVerticesThis(null);
35954730 lowres.linkVerticesThis(sn);
3596
- CameraPane.RANDOM = random;
4731
+ CameraPane.SWITCH = random;
35974732
35984733 System.err.flush();
35994734
....@@ -3633,7 +4768,7 @@
36334768 return;
36344769
36354770 Object3D poses = group.selection.get(0);
3636
- Object3D ref = GrafreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
36374772
36384773 Object3D newgroup = new Object3D("Po:" + poses.name);
36394774
....@@ -3827,9 +4962,9 @@
38274962
38284963 void ClipMesh()
38294964 {
3830
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38314966 {
3832
- Object3D content = GrafreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
38334968
38344969 if (content instanceof cGroup && ((cGroup)content).transientlink )
38354970 content = ((cGroup)content).get(0);
....@@ -3838,7 +4973,7 @@
38384973 // {
38394974 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38404975 // }
3841
- group.selection.ClipMesh(GrafreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
38424977 }
38434978 // group.selection.ClipMesh(GrafreeD.clipboard);
38444979 System.out.println("DONE.");
....@@ -3885,6 +5020,18 @@
38855020 void MarkLeaves(boolean hide)
38865021 {
38875022 group.selection.MarkLeaves(hide);
5023
+ refreshContents();
5024
+ }
5025
+
5026
+ void RewindLeaves(boolean hide)
5027
+ {
5028
+ group.selection.RewindLeaves(hide);
5029
+ refreshContents();
5030
+ }
5031
+
5032
+ void RandomLeaves(boolean hide)
5033
+ {
5034
+ group.selection.RandomLeaves(hide);
38885035 refreshContents();
38895036 }
38905037
....@@ -3959,28 +5106,25 @@
39595106 // }
39605107 // }
39615108
3962
- static boolean allparams = true;
3963
-
3964
- static Vector<Object3D> listUI = new Vector<Object3D>();
3965
-
39665109 void EditSelection(boolean newWindow)
39675110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
39685117 // aConstraints.gridy = 0;
39695118 for (int i=0; i<group.selection.size(); i++)
39705119 {
39715120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39725121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3973
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39745123
39755124 Object3D elem = (Object3D)group.selection.elementAt(i);
3976
- if(elem != group)
5125
+ if(elem != group || !newWindow)
39775126 {
3978
- // if (!(elem instanceof Composite))
3979
- // newWindow = false;
3980
- listUI.add(elem);
3981
- elem.openEditWindow(this, newWindow); //, false);
3982
- System.out.println("edit : " + elem);
3983
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
39845128 }
39855129 }
39865130 }
....@@ -4043,9 +5187,7 @@
40435187
40445188 freezemodel = false;
40455189 }
4046
-
4047
- boolean flashIt = true;
4048
-
5190
+
40495191 public void valueChanged(TreeSelectionEvent e)
40505192 //public boolean handleEvent(Event event)
40515193 {
....@@ -4055,7 +5197,8 @@
40555197 //new Exception().printStackTrace();
40565198
40575199 freezemodel = true;
4058
-
5200
+ ClearUnpinned();
5201
+
40595202 /**/
40605203 //switch (event.id)
40615204 {
....@@ -4063,7 +5206,6 @@
40635206 //case 702: // Event.LIST_DESELECT
40645207 group.deselectAll();
40655208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4066
- objEditor.ClearInfo(); // .GetMaterial());
40675209 if (tps != null)
40685210 {
40695211 for (int i=0; i < tps.length; i++)
....@@ -4072,33 +5214,39 @@
40725214
40735215 //if (child.parent != null)
40745216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
40755218 group.addSelectee(child);
4076
- objEditor.SetMaterial(child); // .GetMaterial());
4077
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4078
- System.err.println("info : " + child.GetPath());
40795219 }
40805220 }
4081
- else
4082
- {
4083
- objEditor.SetMaterial(group); // .GetMaterial());
4084
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4085
- System.err.println("info : " + group.GetPath());
4086
- }
5221
+// else
5222
+// {
5223
+// objEditor.SetMaterial(group); // .GetMaterial());
5224
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5225
+// System.err.println("info : " + group.GetPath());
5226
+// }
40875227
4088
- objEditor.SetText(); // jan 2014
4089
-
4090
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5228
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40915229 CameraPane.flash = true;
40925230
4093
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40945232 // a camera
40955233 {
4096
- CameraPane.camerachangeframe = 0; // don't refuse it
4097
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5234
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5235
+ {
5236
+ CameraPane.camerachangeframe = 0; // don't refuse it
5237
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5238
+ }
40985239 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
40995240 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41005241 }
41015242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
41025250 refreshContents();
41035251 //return true;
41045252 }
....@@ -4107,6 +5255,37 @@
41075255
41085256 freezemodel = false;
41095257 }
5258
+
5259
+ void SetPinStates(boolean enabled)
5260
+ {
5261
+ editButton.setEnabled(enabled);
5262
+ uneditButton.setEnabled(enabled);
5263
+ //unselectButton.setEnabled(enabled);
5264
+ flashSelectionButton.setEnabled(enabled);
5265
+
5266
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5267
+ }
5268
+
5269
+ void refreshContents(boolean cp)
5270
+ {
5271
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5272
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5273
+ {
5274
+ objEditor.ClearInfo(); // .GetMaterial());
5275
+
5276
+ for (int i=0; i < group.selection.Size(); i++)
5277
+ {
5278
+ Object3D child = (Object3D) group.selection.get(i);
5279
+
5280
+ objEditor.AddInfo(child, this, true);
5281
+ System.err.println("info : " + child.GetPath());
5282
+ }
5283
+
5284
+ objEditor.SetText(); // jan 2014
5285
+ }
5286
+
5287
+ super.refreshContents(cp);
5288
+ }
41105289
41115290 void linkSomething(Object3D thing)
41125291 {
....@@ -4178,16 +5357,19 @@
41785357 {
41795358 if (group.selection.isEmpty())
41805359 return;
4181
- GrafreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
41825362 Composite tGroup = null;
41835363 if (group.selection.size() > 0) // 1)
41845364 {
41855365 tGroup = new cGroup();
4186
- GrafreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
41875367 }
41885368
41895369 if (cut)
41905370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
41915373 //int indices[] = jList.getSelectedIndices();
41925374 //for (int i = indices.length - 1; i >= 0; i--)
41935375 //jList.remove(indices[i]);
....@@ -4223,16 +5405,16 @@
42235405 //System.out.println("cut " + child);
42245406 //System.out.println("parent = " + child.parent);
42255407 // tmp.addChild(child);
4226
- if (GrafreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
42275409 tGroup.add/*Child*/(tmp);
42285410 else
4229
- GrafreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
42305412 }
42315413 else
4232
- if (GrafreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
42335415 tGroup.add/*Child*/(child);
42345416 else
4235
- GrafreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
42365418 }
42375419
42385420 //ResetModel();
....@@ -4264,21 +5446,23 @@
42645446 //System.out.println("cut " + elem);
42655447 //System.out.println("parent = " + elem.parent);
42665448 // tmp.addChild(elem);
4267
- if (GrafreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
42685450 tGroup.add/*Child*/(tmp);
42695451 else
4270
- GrafreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
42715453 }
42725454 else
4273
- if (GrafreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
42745456 tGroup.add/*Child*/(child);
42755457 else
4276
- GrafreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
42775459 }
42785460
42795461 }
4280
- if (GrafreeD.clipboardIsTempGroup)
4281
- GrafreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
42825466 if (cut)
42835467 {
42845468 ResetModel();
....@@ -4288,11 +5472,15 @@
42885472
42895473 void paste(boolean expand)
42905474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
42915479 // if (GrafreeD.clipboard == null)
42925480 // return;
42935481 boolean first = true;
42945482
4295
- if (GrafreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
42965484 {
42975485 Composite temp;
42985486
....@@ -4303,7 +5491,7 @@
43035491 temp = (Composite)Applet3D.clipboard.deepCopy();
43045492 */
43055493 Object3D elem;
4306
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5494
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43075495 {
43085496 Object3D child = (Object3D)e.nextElement();
43095497
....@@ -4337,21 +5525,22 @@
43375525 //Object3D cb = Applet3D.clipboard;
43385526 //temp.addChild(cb);
43395527 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4340
- assert(GrafreeD.clipboard.parent == null);
4341
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4342
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4343
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4344
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5528
+ assert(Grafreed.clipboard.parent == null);
5529
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5530
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5531
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5532
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43455533 else
4346
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4347
- GrafreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
43485536 }
43495537
5538
+ Globals.REPLACEONMAKE = keep;
43505539 ResetModel();
43515540 refreshContents();
43525541 }
43535542
4354
- void pasteInto(boolean copyit)
5543
+ void pasteInto(boolean copyit, boolean clone)
43555544 {
43565545 // if (GrafreeD.clipboard == null)
43575546 // return;
....@@ -4380,15 +5569,22 @@
43805569 if (copyit)
43815570 {
43825571 // paste(false);
4383
- CloneClipboard(false); // sept 2014
5572
+ if (clone)
5573
+ {
5574
+ CloneClipboard(false); // sept 2014
5575
+ }
5576
+ else
5577
+ {
5578
+ paste(false);
5579
+ }
43845580 }
43855581 else
43865582 {
43875583 boolean first = true;
43885584
4389
- if (GrafreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
43905586 {
4391
- Composite temp = (Composite)GrafreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
43925588 Object3D copy;
43935589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43945590 {
....@@ -4398,7 +5594,7 @@
43985594 }
43995595 } else
44005596 {
4401
- linkSomething(GrafreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
44025598 }
44035599 }
44045600 }
....@@ -4475,6 +5671,10 @@
44755671
44765672 void group(Object3D csg, boolean grab)
44775673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
44785678 if (//false) // why??
44795679 !group.selection.isEmpty())
44805680 {
....@@ -4588,10 +5788,15 @@
45885788 //node.add(csg);
45895789 //makeSomething(node);
45905790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
45915792 }
45925793
45935794 void Ungroup(Object3D g)
45945795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
45955800 if (g instanceof HiddenObject)
45965801 {
45975802 HiddenObject h = (HiddenObject) g;
....@@ -4608,6 +5813,7 @@
46085813 objEditor.makeSomething(g.get(i), false);
46095814 }
46105815 }
5816
+ Globals.REPLACEONMAKE = keep;
46115817 }
46125818
46135819 void ungroup()
....@@ -4803,21 +6009,6 @@
48036009 }
48046010 */
48056011
4806
- void ImportGFD()
4807
- {
4808
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4809
- browser.show();
4810
- String filename = browser.getFile();
4811
- if (filename != null && filename.length() > 0)
4812
- {
4813
- String fullname = browser.getDirectory() + filename;
4814
-
4815
- //Object3D readobj =
4816
- objEditor.ReadGFD(fullname, objEditor);
4817
- //makeSomething(readobj);
4818
- }
4819
- }
4820
-
48216012 /*
48226013 public void Callback(Object obj)
48236014 {
....@@ -4841,26 +6032,9 @@
48416032 }
48426033 */
48436034
4844
- void ImportVRMLX3D()
4845
- {
4846
- if (GrafreeD.standAlone)
4847
- {
4848
- /**/
4849
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4850
- browser.show();
4851
- String filename = browser.getFile();
4852
- if (filename != null && filename.length() > 0)
4853
- {
4854
- String fullname = browser.getDirectory() + filename;
4855
- LoadVRMLX3D(fullname);
4856
- }
4857
- /**/
4858
- }
4859
- }
4860
-
48616035 String GetFile(String dialogName)
48626036 {
4863
- if (GrafreeD.standAlone)
6037
+ if (Grafreed.standAlone)
48646038 {
48656039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48666040 browser.show();
....@@ -4924,10 +6098,48 @@
49246098 cButton flashSelectionButton;
49256099 cButton editButton;
49266100 cButton uneditButton;
6101
+ JCheckBox allParamsButton;
49276102 cButton clearpanelButton;
4928
- cButton allParamsButton;
49296103 cButton unselectButton;
49306104
6105
+ cButton restoreCameraButton;
6106
+
6107
+ cButton oneStepButton;
6108
+
6109
+ cButton groupButton;
6110
+ cButton ungroupButton;
6111
+ cButton compositeButton;
6112
+ cButton switchButton;
6113
+ cButton loopButton;
6114
+ cButton textureButton;
6115
+
6116
+ cButton skybox1Button;
6117
+ cButton skybox2Button;
6118
+ cButton skybox3Button;
6119
+ cButton skybox4Button;
6120
+ cButton skybox5Button;
6121
+ cButton skybox6Button;
6122
+ cButton skybox7Button;
6123
+
6124
+ cButton skybox11Button;
6125
+ cButton skybox12Button;
6126
+ cButton skybox13Button;
6127
+ cButton skybox14Button;
6128
+ cButton skybox15Button;
6129
+ cButton skybox16Button;
6130
+ cButton skybox17Button;
6131
+
6132
+ cButton gridButton;
6133
+ cButton boxButton;
6134
+ cButton sphereButton;
6135
+ cButton coneButton;
6136
+ cButton torusButton;
6137
+ cButton superButton;
6138
+ cButton kleinButton;
6139
+ cButton particlesButton;
6140
+ cButton overlayButton;
6141
+ cButton lightButton;
6142
+
49316143 cButton screenfitButton;
49326144 cButton screenfitpointButton;
49336145 cButton snapobjectButton;
....@@ -4939,14 +6151,6 @@
49396151
49406152 cButton setsupportButton;
49416153
4942
- cButton twoButton;
4943
- cButton sixButton;
4944
- cButton threeButton;
4945
- cButton sevenButton;
4946
- cButton fourButton; // full panel
4947
- cButton oneButton; // full XYZ
4948
- //cButton currentLayout;
4949
-
49506154 //
49516155 //Composite
49526156 Object3D // to do !!
....@@ -4956,9 +6160,11 @@
49566160 //JTree jTree;
49576161 private MenuItem lookAtItem;
49586162 private MenuItem lookFromItem;
4959
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
49606164 private MenuItem cutItem;
4961
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
49626168 private MenuItem cloneItem;
49636169 private MenuItem cloneSupportItem;
49646170 private MenuItem overwriteGeoItem;
....@@ -4971,7 +6177,7 @@
49716177 private MenuItem linkverticesItem;
49726178 private MenuItem relinkverticesItem;
49736179 private MenuItem setMasterItem;
4974
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
49756181 private MenuItem stepAllItem;
49766182 private MenuItem revertMeshItem;
49776183 private MenuItem poseMeshItem;
....@@ -4982,10 +6188,11 @@
49826188 private MenuItem mergeGeometriesItem;
49836189 private MenuItem copyItem;
49846190 private MenuItem pasteItem;
6191
+ private MenuItem pasteIntoItem;
49856192 private MenuItem pasteLinkItem;
49866193 private MenuItem pasteCloneItem;
49876194 private MenuItem pasteExpandItem;
4988
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
49896196 private MenuItem clearAllItem;
49906197 private MenuItem genUVItem;
49916198 private MenuItem genNormalsMESHItem;
....@@ -5020,6 +6227,10 @@
50206227 private MenuItem showleavesItem;
50216228 private MenuItem markleavesItem;
50226229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
50236234
50246235 private MenuItem flipVItem;
50256236 private MenuItem unflipVItem;
....@@ -5031,15 +6242,17 @@
50316242 private MenuItem panoTexturesItem;
50326243
50336244 private MenuItem resetCentroidItem;
5034
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
50356246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
50366249 private MenuItem hideItem;
50376250 private MenuItem grabItem;
50386251 private MenuItem backItem;
50396252 private MenuItem frontItem;
50406253 private MenuItem cameraItem;
50416254 private MenuItem compositeItem;
5042
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
50436256 private MenuItem physicsItem;
50446257 private MenuItem frameselectorItem;
50456258 private MenuItem scriptNodeItem;
....@@ -5063,6 +6276,8 @@
50636276 private MenuItem attachBumpItem;
50646277 private MenuItem detachBumpItem;
50656278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
50666281
50676282 private MenuItem particleItem;
50686283 private MenuItem ragdollItem;
....@@ -5079,7 +6294,7 @@
50796294 private MenuItem blobItem;
50806295 private MenuItem latheItem;
50816296 private MenuItem bezierItem;
5082
- private MenuItem checkerItem;
6297
+ private MenuItem overlayItem;
50836298 private MenuItem meshItem;
50846299 // private MenuItem meshGroupItem;
50856300 private MenuItem springItem;
....@@ -5101,11 +6316,6 @@
51016316 private MenuItem doubleItem;
51026317 private MenuItem tripleItem;
51036318
5104
- private MenuItem importGFDItem;
5105
- private MenuItem importVRMLX3DItem;
5106
- private MenuItem import3DSItem;
5107
- private MenuItem importOBJItem;
5108
-
51096319 private MenuItem computeAOItem;
51106320 private MenuItem recompileItem;
51116321 private MenuItem editScriptItem;
....@@ -5115,4 +6325,8 @@
51156325 private MenuItem analyzeItem;
51166326 private MenuItem dumpItem;
51176327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
51186332 }