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,153 +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", CameraPane.isLIVE()), 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);
1022
+ screenfitButton.setToolTipText("Screen fit");
1023
+ screenfitButton.addActionListener(this);
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");
4411062 liveCB.addItemListener(this);
4421063
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
4611070 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.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);
4681077
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
5091078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5101079 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
5151080
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
523
-
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
532
- twoButton.addActionListener(this);
533
- 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);
5341088 fourButton.addActionListener(this);
535
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
536
- sixButton.addActionListener(this);
537
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
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");
5381101 threeButton.addActionListener(this);
539
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
540
- 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);
5411108 //
5421109
543
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1110
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ rootButton.setToolTipText("Open selection in new tab");
5441112 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1113
+
1114
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ closeButton.setToolTipText("Close tab");
5471116 closeButton.addActionListener(this);
5481117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5491118 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
5581119
559
- 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");
5601209 uneditButton.addActionListener(this);
5611210
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- 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");
5741213 allParamsButton.addActionListener(this);
5751214
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
581
- 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);
5821218
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
+
5831233 // oe.aConstraints.gridx += 1;
5841234 // oe.aConstraints.weighty = 0;
5851235 // oe.aConstraints.gridwidth = 1;
....@@ -591,47 +1241,32 @@
5911241 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5921242 // gcButton.addActionListener(this);
5931243
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
1244
+ cGridBag jSPPanel = new cGridBag();
1245
+
1246
+ JScrollPane jSP;
6051247 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6071249 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
6271250
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
+
6281263 //jList.addListSelectionListener(this);
6291264 oe.jTree.addTreeSelectionListener(this);
6301265 //jTree.setRootVisible(false);
6311266 //jTree.setEditable(true);
6321267 oe.jTree.setDragEnabled(true);
6331268 //jTree.setPreferredSize(new Dimension(10,10));
634
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6351270
6361271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6371272
....@@ -643,23 +1278,163 @@
6431278 dgr.addDragGestureListener(this);
6441279 }catch(Exception e) {}
6451280 */
646
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6471282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6481283 }
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
+ }
6491413
6501414 void EditObject(Object3D obj)
6511415 {
6521416 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
+
6531425 radioButton.SetObject(obj);
654
- radioButton.layout = sevenButton;
1426
+ radioButton.layout = threeButton; // sixButton;
6551427 radioButton.SetCamera(cameraView.renderCamera, false);
6561428 radioButton.addActionListener(this);
6571429 radioPanel.add(radioButton);
6581430 buttonGroup.add(radioButton);
6591431 radioButton.doClick();
6601432 }
1433
+
6611434 void SetupViews(ObjEditor oe)
6621435 {
1436
+ theFrame = this;
1437
+
6631438 oe.SetupViews();
6641439
6651440 System.out.println("SetupViews");
....@@ -668,22 +1443,30 @@
6681443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691444 }
6701445
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- 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;
6811461 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
6871470
6881471 // static int COLOR = 1;
6891472 // static int MATERIAL = 2;
....@@ -691,9 +1474,9 @@
6911474
6921475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931476
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
6971480
6981481 public void itemStateChanged(ItemEvent e)
6991482 {
....@@ -721,6 +1504,7 @@
7211504 } else if(e.getSource() == liveCB)
7221505 {
7231506 cameraView.ToggleLive();
1507
+ refreshContents(false);
7241508 }
7251509 else if(e.getSource() == supportCB)
7261510 {
....@@ -736,6 +1520,12 @@
7361520 {
7371521 cameraView.ToggleInertia();
7381522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
7391529 }
7401530 else if(e.getSource() == localCB)
7411531 {
....@@ -755,6 +1545,10 @@
7551545 Recompile();
7561546 cameraView.repaint();
7571547 // refreshContents();
1548
+ }
1549
+ else if(e.getSource() == zoomBoxCB)
1550
+ {
1551
+ cameraView.ToggleZoomBoxMode();
7581552 }
7591553 else if(e.getSource() == smoothfocusCB)
7601554 {
....@@ -781,6 +1575,18 @@
7811575 {
7821576 cameraView.ToggleOeil();
7831577 }
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
+ }
7841590 else if(e.getSource() == lookAtCB)
7851591 {
7861592 cameraView.ToggleLookAt();
....@@ -797,7 +1603,8 @@
7971603
7981604 /**/
7991605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
8011608 if ((path == null) || (path.getPathCount() <= 1)) {
8021609 // We can't move the root node or an empty selection
8031610 return;
....@@ -860,8 +1667,6 @@
8601667 }
8611668 }
8621669
863
- String string = (String) object;
864
-
8651670 System.out.println("Transfer = " + object + "; drop : " + target);
8661671 // if( object instanceof java.io.File[])
8671672 // {
....@@ -869,7 +1674,11 @@
8691674 // objEditor.DropFile((java.io.File[]) object, true);
8701675 // return;
8711676 // }
872
- 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) == ':')
8731682 {
8741683 // file(s)
8751684 String[] names = string.split("\n");
....@@ -896,7 +1705,7 @@
8961705
8971706 flashIt = false;
8981707 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1708
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001709 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011710
9021711 if (group.selection.size() == 1)
....@@ -912,23 +1721,33 @@
9121721
9131722 assert target == objEditor.jTree;
9141723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
9151725 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171727 } catch (Exception e) {
9181728 System.out.println("destinationPath : " + destinationPath);
9191729 return;
9201730 }
9211731
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
9231733 {
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
+// {
9241743 loadClipboard(true);
9251744 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1745
+ pasteInto(false, false);
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
9321751 }
9331752 public void dropActionChanged(DropTargetDragEvent dtde)
9341753 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1852,107 @@
10331852 {
10341853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351854 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- 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
+ {
10481873 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491874 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
1879
+ if (Globals.ADVANCED)
1880
+ {
10521881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531882 ragdollItem.addActionListener(this);
10541883 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551884 ragdoll2Item.addActionListener(this);
1885
+ }
10561886 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1887
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581888 meshItem.addActionListener(this);
10591889 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601890 // meshGroupItem.addActionListener(this);
1891
+ if (Globals.ADVANCED)
1892
+ {
10611893 springItem = menu.add(new MenuItem("Spring"));
10621894 springItem.addActionListener(this);
10631895 flagItem = menu.add(new MenuItem("Flag"));
10641896 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691897 blobItem = menu.add(new MenuItem("Blob"));
10701898 blobItem.addActionListener(this);
10711899 latheItem = menu.add(new MenuItem("Lathe"));
10721900 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- 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);
10751908 menu.add("-");
10761909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771910 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
10801913 doubleItem = menu.add(new MenuItem("Fork"));
10811914 doubleItem.addActionListener(this);
1915
+ if (Globals.ADVANCED)
1916
+ {
10821917 tripleItem = menu.add(new MenuItem("Trident"));
10831918 tripleItem.addActionListener(this);
1919
+ }
10841920 }
10851921
10861922 void buildToolsMenu(Menu menu)
10871923 {
10881924 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891925 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1926
+ animationItem.setState(Globals.ANIMATION);
1927
+
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
10911930
10921931 menu.add("-");
10931932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941933 parseverticesItem.addActionListener(this);
10951934 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961935 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1936
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981937 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011938 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021939 reduceMorphItem.addActionListener(this);
11031940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041941 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081942 menu.add("-");
1109
-
11101943 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111944 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("-");
11121953 menu.add(analyzeItem = new MenuItem("Analyze"));
11131954 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
11151956 dumpItem.addActionListener(this);
11161957 // menu.add(pathItem = new MenuItem("From-to path"));
11171958 // pathItem.addActionListener(this);
....@@ -1120,6 +1961,8 @@
11201961 resetParentItem.addActionListener(this);
11211962 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11221963 repairParentItem.addActionListener(this);
1964
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1965
+ repairShadowItem.addActionListener(this);
11231966 menu.add(invariantsItem = new MenuItem("Invariants"));
11241967 invariantsItem.addActionListener(this);
11251968 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1127,6 +1970,7 @@
11271970 menu.add("-");
11281971 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11291972 editScriptItem.addActionListener(this);
1973
+ }
11301974 }
11311975
11321976 void ScreenFit()
....@@ -1249,9 +2093,34 @@
12492093 shadow.material = new cMaterial(obj.material);
12502094 shadow.material.diffuse = 0.0001f;
12512095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
12522097
12532098 makeSomething(shadow);
12542099 }
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
+ }
12552124
12562125 /**
12572126 * applyExample
....@@ -1455,9 +2324,9 @@
14552324
14562325 void Overwrite(int mask)
14572326 {
1458
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14592328 {
1460
- Object3D content = GrafreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
14612330
14622331 if (content instanceof cGroup && ((cGroup)content).transientlink )
14632332 content = ((cGroup)content).get(0);
....@@ -1480,6 +2349,7 @@
14802349 //
14812350 public void actionPerformed(ActionEvent event) // , Object arg)
14822351 {
2352
+ Object source = event.getSource();
14832353 /*
14842354 if (event.getSource() == nameField)
14852355 {
....@@ -1491,11 +2361,11 @@
14912361 }
14922362 else
14932363 */
1494
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2364
+ if (source == lookAtItem || source == lookFromItem)
14952365 {
14962366 ScreenFit();
14972367 } else
1498
- if (event.getSource() == switchItem)
2368
+ if (source == switchViewItem)
14992369 {
15002370 cVector v1 = new cVector();
15012371 cVector v2 = new cVector();
....@@ -1504,11 +2374,11 @@
15042374 objEditor.cameraView.renderCamera.setAim(v2, v1);
15052375 objEditor.cameraView.repaint();
15062376 } else
1507
- if (event.getSource() == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
15082378 {
15092379 makeSomething(new Box());
15102380 } else
1511
- if (event.getSource() == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
15122382 {
15132383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15142384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1529,9 +2399,9 @@
15292399 applyExample(particleGeom, "SMOKE");
15302400 makeSomething(particleGeom);
15312401 } else
1532
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2402
+ if (source == ragdollItem || source == ragdoll2Item)
15332403 {
1534
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2404
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15352405
15362406 ragdoll.toParent = LA.newMatrix();
15372407 ragdoll.fromParent = LA.newMatrix();
....@@ -1549,7 +2419,7 @@
15492419 } else
15502420 /*
15512421 */
1552
- if (event.getSource() == heightFieldItem)
2422
+ if (source == heightFieldItem)
15532423 {
15542424 Object3D obj = new Object3D();
15552425
....@@ -1587,31 +2457,31 @@
15872457
15882458 makeSomething(obj);
15892459 } else
1590
- if (event.getSource() == gridItem)
2460
+ if (source == gridItem || source == gridButton)
15912461 {
15922462 makeSomething(new Grid());
15932463 } else
1594
- if (event.getSource() == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
15952465 {
15962466 makeSomething(new Sphere());
15972467 } else
1598
- if (event.getSource() == coneItem)
2468
+ if (source == coneItem || source == coneButton)
15992469 {
16002470 makeSomething(new Cone());
16012471 } else
1602
- if (event.getSource() == torusItem)
2472
+ if (source == torusItem || source == torusButton)
16032473 {
16042474 makeSomething(new Torus());
16052475 } else
1606
- if (event.getSource() == superItem)
2476
+ if (source == superItem || source == superButton)
16072477 {
16082478 makeSomething(new Superellipsoid());
16092479 } else
1610
- if (event.getSource() == kleinItem)
2480
+ if (source == kleinItem || source == kleinButton)
16112481 {
16122482 makeSomething(new Klein());
16132483 } else
1614
- if (event.getSource() == blobItem)
2484
+ if (source == blobItem)
16152485 {
16162486 Blob blob = new Blob();
16172487 BlobComponent comp = new BlobComponent();
....@@ -1619,15 +2489,15 @@
16192489 //blob.retile();
16202490 makeSomething(blob);
16212491 } else
1622
- if (event.getSource() == latheItem)
2492
+ if (source == latheItem)
16232493 {
16242494 makeSomething(new Lathe());
16252495 } else
1626
- if (event.getSource() == bezierItem)
2496
+ if (source == bezierItem)
16272497 {
16282498 makeSomething(new BezierSurface());
16292499 } else
1630
- if (event.getSource() == checkerItem)
2500
+ if (source == overlayItem || source == overlayButton)
16312501 {
16322502 /*
16332503 Object3D obj = new BezierSurface(5,8);
....@@ -1642,7 +2512,7 @@
16422512 */
16432513 makeSomething(new Checker());
16442514 } else
1645
- if (event.getSource() == meshItem)
2515
+ if (source == meshItem)
16462516 {
16472517 Object3D itemtomake = new Object3D();
16482518 Object3D child;
....@@ -1663,35 +2533,52 @@
16632533 makeSomething(child);
16642534 }
16652535 } else
1666
- if (event.getSource() == springItem)
2536
+ if (source == springItem)
16672537 {
16682538 cSpring s = new cSpring();
16692539 s.setup();
16702540 makeSomething(s);
16712541 } else
1672
- if (event.getSource() == flagItem)
2542
+ if (source == flagItem)
16732543 {
16742544 cSpring s = new cFlag();
16752545 s.setup();
16762546 makeSomething(s);
16772547 } else
1678
- if (event.getSource() == lightItem)
2548
+ if (source == lightItem || source == lightButton)
16792549 {
16802550 makeSomething(new Light());
16812551 } else
1682
- 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)
16832570 {
16842571 group(new CSG());
16852572 } else
1686
- if (event.getSource() == templateItem)
2573
+ if (source == templateItem)
16872574 {
16882575 group(new cTemplate());
16892576 } else
1690
- if (event.getSource() == attributeItem)
2577
+ if (source == attributeItem)
16912578 {
16922579 makeSomething(new Attribute());
16932580 } else
1694
- if (event.getSource() == pointflowItem)
2581
+ if (source == pointflowItem)
16952582 {
16962583 makeSomething(new PointFlow());
16972584 } else
....@@ -1703,7 +2590,7 @@
17032590 } else
17042591 */
17052592
1706
- if (event.getSource() == superLoopItem)
2593
+ if (source == superLoopItem)
17072594 {
17082595 Composite g = new cGroup();
17092596 for (int i=0; i<15; i++)
....@@ -1725,30 +2612,30 @@
17252612
17262613 group(g);
17272614 } else
1728
- if (event.getSource() == loopItem)
2615
+ if (source == loopItem || source == loopButton)
17292616 {
17302617 Composite csg = new GroupLeaf();
17312618 csg.count = 5;
17322619 group(csg);
1733
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
17342621 csg.addChild(child);
17352622 child.addChild(csg);
17362623 } else
1737
- if (event.getSource() == doubleItem)
2624
+ if (source == doubleItem)
17382625 {
1739
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
17402627 csg.count = 5;
17412628 group(csg);
1742
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
17432630 csg.addChild(child);
17442631 child.addChild(csg);
1745
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
17462633 csg.addChild(child);
17472634 child.addChild(csg);
17482635 } else
1749
- if (event.getSource() == tripleItem)
2636
+ if (source == tripleItem)
17502637 {
1751
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
17522639 csg.count = 4;
17532640 group(csg);
17542641 Composite child = new cGroup();
....@@ -1761,73 +2648,105 @@
17612648 csg.addChild(child);
17622649 child.addChild(csg);
17632650 } else
1764
-
1765
- if (event.getSource() == importGFDItem)
2651
+ if (source == computeAOItem)
17662652 {
1767
- ImportGFD();
2653
+ Globals.drawMode = CameraPane.OCCLUSION;
2654
+ cameraView.repaint();
17682655 } else
1769
- if (event.getSource() == importVRMLX3DItem)
1770
- {
1771
- ImportVRMLX3D();
1772
- } else
1773
- if (event.getSource() == import3DSItem)
1774
- {
1775
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1776
- } else
1777
- if (event.getSource() == importOBJItem)
1778
- {
1779
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1780
- } else
1781
- if (event.getSource() == computeAOItem)
1782
- {
1783
- CameraPane.drawMode = CameraPane.OCCLUSION;
1784
- CameraPane.theRenderer.repaint();
1785
- } else
1786
- if (event.getSource() == recompileItem)
2656
+ if (source == recompileItem)
17872657 {
17882658 Recompile();
17892659 refreshContents();
17902660 } else
1791
- if (event.getSource() == editScriptItem)
2661
+ if (source == editScriptItem)
17922662 {
17932663 OpenDialog();
17942664 refreshContents();
17952665 } else
1796
- if (event.getSource() == invariantsItem)
2666
+ if (source == invariantsItem)
17972667 {
17982668 System.out.println("Invariants:");
1799
- GrafreeD.grafreeD.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
18002670 } else
1801
- if (event.getSource() == memoryItem)
2671
+ if (source == memoryItem)
18022672 {
18032673 //System.out.println("Invariants:");
18042674 PrintMemory();
18052675 } else
1806
- if (event.getSource() == pathItem)
2676
+ if (source == pathItem)
18072677 {
18082678 PrintPath();
18092679 } else
1810
- if (event.getSource() == analyzeItem)
2680
+ if (source == analyzeItem)
18112681 {
18122682 AnalyzeObject();
18132683 } else
1814
- if (event.getSource() == dumpItem)
2684
+ if (source == dumpItem)
18152685 {
18162686 DumpObject();
18172687 } else
1818
- if (event.getSource() == screenfitButton)
2688
+ if (source == minButton)
18192689 {
1820
- //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
+ {
18212742 ScreenFit();
18222743 } else
1823
- if (event.getSource() == screenfitpointButton)
2744
+ if (source == screenfitpointButton)
18242745 {
1825
- //Reload(lastConverter, lastFilename, true);
18262746 ScreenFitPoint();
18272747 } else
1828
- if (event.getSource() == snapobjectButton)
2748
+ if (source == snapobjectButton)
18292749 {
1830
- //Reload(lastConverter, lastFilename, true);
18312750 SnapObject();
18322751 } else
18332752 // if (event.getSource() == recompileButton)
....@@ -1836,13 +2755,13 @@
18362755 // Recompile();
18372756 // refreshContents();
18382757 // } else
1839
- if (event.getSource() == gcButton)
2758
+ if (source == gcButton)
18402759 {
18412760 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422761 System.gc();
18432762 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442763 } else
1845
- if (event.getSource() == editLeafItem)
2764
+ if (source == editLeafItem)
18462765 {
18472766 Object3D obj;
18482767 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1856,62 +2775,74 @@
18562775 }
18572776 refreshContents(true);
18582777 } else
1859
- if (event.getSource() == openWindowItem)
2778
+ if (source == openWindowItem)
18602779 {
18612780 EditSelection(true);
18622781 } else
1863
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2782
+ if (source == cutItem || source == clearButton)
18642783 {
18652784 loadClipboard(true);
18662785 } else
1867
- if (event.getSource() == duplicateItem)
2786
+ if (source == undoItem)
18682787 {
1869
- 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;
18702797 loadClipboard(false);
18712798 paste(false);
1872
- GrafreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
18732800 } else
1874
- if (event.getSource() == cloneItem)
2801
+ if (source == cloneItem)
18752802 {
18762803 CloneSelection(false);
18772804 } else
1878
- if (event.getSource() == cloneSupportItem)
2805
+ if (source == cloneSupportItem)
18792806 {
18802807 CloneSelection(true);
18812808 } else
1882
- if (event.getSource() == copyItem)
2809
+ if (source == copyItem)
18832810 {
18842811 loadClipboard(false);
18852812 } else
1886
- if (event.getSource() == pasteItem)
2813
+ if (source == pasteItem)
18872814 {
18882815 paste(false);
18892816 } else
1890
- if (event.getSource() == pasteLinkItem)
2817
+ if (source == pasteIntoItem)
18912818 {
1892
- pasteInto(false);
2819
+ pasteInto(true, false);
18932820 } else
1894
- if (event.getSource() == pasteCloneItem)
2821
+ if (source == pasteLinkItem)
18952822 {
1896
- pasteInto(true);
2823
+ pasteInto(false, false);
18972824 } else
1898
- if (event.getSource() == pasteExpandItem)
2825
+ if (source == pasteCloneItem)
2826
+ {
2827
+ pasteInto(true, true);
2828
+ } else
2829
+ if (source == pasteExpandItem)
18992830 {
19002831 paste(true);
19012832 } else
1902
- if (event.getSource() == synchronizeItem)
2833
+ if (source == synchronizeItem)
19032834 {
19042835 Overwrite(Object3D.TRANSFORM);
19052836 } else
1906
- if (event.getSource() == overwriteNameItem)
2837
+ if (source == overwriteNameItem)
19072838 {
19082839 Overwrite(Object3D.NAME);
19092840 } else
1910
- if (event.getSource() == overwriteUVItem)
2841
+ if (source == overwriteUVItem)
19112842 {
19122843 Overwrite(Object3D.UV);
19132844 } else
1914
- if (event.getSource() == overwriteMatItem)
2845
+ if (source == overwriteMatItem)
19152846 {
19162847 /* july 2015
19172848 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1931,7 +2862,7 @@
19312862
19322863 Overwrite(dropAttributes);
19332864 }
1934
- if (event.getSource() == overwriteGeoItem)
2865
+ if (source == overwriteGeoItem)
19352866 {
19362867 Overwrite(Object3D.GEOMETRY);
19372868 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1948,7 +2879,7 @@
19482879 // refreshContents();
19492880 // }
19502881 } else
1951
- if (event.getSource() == generateMeshItem)
2882
+ if (source == generateMeshItem)
19522883 {
19532884 //if (group.selection.size() == 1)
19542885 // for (int i=0; i<group.selection.size(); i++)
....@@ -1959,7 +2890,7 @@
19592890 ResetModel();
19602891 refreshContents();
19612892 } else
1962
- if (event.getSource() == extractGeometriesItem)
2893
+ if (source == extractGeometriesItem)
19632894 {
19642895 boolean one = false;
19652896
....@@ -1986,7 +2917,7 @@
19862917 ResetModel();
19872918 refreshContents();
19882919 } else
1989
- if (event.getSource() == cloneGeometriesItem)
2920
+ if (source == cloneGeometriesItem)
19902921 {
19912922 boolean one = false;
19922923
....@@ -2012,7 +2943,7 @@
20122943 ResetModel();
20132944 refreshContents();
20142945 } else
2015
- if (event.getSource() == shareGeometriesItem)
2946
+ if (source == shareGeometriesItem)
20162947 {
20172948 boolean one = false;
20182949
....@@ -2042,7 +2973,7 @@
20422973 refreshContents();
20432974 }
20442975 } else
2045
- if (event.getSource() == mergeGeometriesItem)
2976
+ if (source == mergeGeometriesItem)
20462977 {
20472978 boolean one = false;
20482979
....@@ -2072,7 +3003,7 @@
20723003 ResetModel();
20733004 refreshContents();
20743005 } else
2075
- if (event.getSource() == linkverticesItem)
3006
+ if (source == linkverticesItem)
20763007 {
20773008 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20783009 // {
....@@ -2085,48 +3016,48 @@
20853016 // group.selection.get(0).setMasterThis(content); // should be identity
20863017 // refreshContents();
20873018 // }
2088
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20893020 {
2090
- Object3D content = GrafreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
20913022
20923023 if (content instanceof cGroup && ((cGroup)content).transientlink )
20933024 content = ((cGroup)content).get(0);
20943025
2095
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3026
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20963027 for (int i=0; i<group.selection.size(); i++)
20973028 {
2098
- boolean random = CameraPane.RANDOM;
2099
- CameraPane.RANDOM = false; // parse all random nodes
3029
+ boolean random = CameraPane.SWITCH;
3030
+ CameraPane.SWITCH = false; // parse all random nodes
21003031 group.selection.get(i).linkVerticesThis(content);
21013032 // group.selection.get(i).setMasterThis(content); // should be identity
2102
- CameraPane.RANDOM = random;
3033
+ CameraPane.SWITCH = random;
21033034 }
2104
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3035
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21053036 refreshContents();
21063037 }
21073038 } else
2108
- if (event.getSource() == resetsupportItem)
3039
+ if (source == resetsupportItem)
21093040 {
21103041 for (int i=0; i<group.selection.size(); i++)
21113042 {
2112
- boolean random = CameraPane.RANDOM;
2113
- CameraPane.RANDOM = false; // parse all random nodes
3043
+ boolean random = CameraPane.SWITCH;
3044
+ CameraPane.SWITCH = false; // parse all random nodes
21143045 group.selection.get(i).linkVerticesThis(null);
2115
- CameraPane.RANDOM = random;
3046
+ CameraPane.SWITCH = random;
21163047 }
21173048
21183049 refreshContents();
21193050 } else
2120
- if (event.getSource() == relinkverticesItem)
3051
+ if (source == relinkverticesItem)
21213052 {
2122
- boolean random = CameraPane.RANDOM;
2123
- CameraPane.RANDOM = false; // parse all random nodes
3053
+ boolean random = CameraPane.SWITCH;
3054
+ CameraPane.SWITCH = false; // parse all random nodes
21243055 group.selection.RelinkToSupport();
2125
- CameraPane.RANDOM = random;
3056
+ CameraPane.SWITCH = random;
21263057
21273058 refreshContents();
21283059 } else
2129
- if (event.getSource() == resetreferencesItem)
3060
+ if (source == resetreferencesItem)
21303061 {
21313062 for (int i=0; i<group.selection.size(); i++)
21323063 {
....@@ -2135,11 +3066,11 @@
21353066
21363067 refreshContents();
21373068 } else
2138
- if (event.getSource() == setMasterItem)
3069
+ if (source == setMasterItem)
21393070 {
2140
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21413072 {
2142
- Object3D content = GrafreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
21433074
21443075 if (content instanceof cGroup && ((cGroup)content).transientlink )
21453076 content = ((cGroup)content).get(0);
....@@ -2148,13 +3079,13 @@
21483079 refreshContents();
21493080 }
21503081 } else
2151
- if (event.getSource() == poseMeshItem)
3082
+ if (source == poseMeshItem)
21523083 {
21533084 if (group.selection.size() == 1)
21543085 {
2155
- if (GrafreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
21563087 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
21583089
21593090 if (content instanceof cGroup && ((cGroup)content).transientlink )
21603091 content = ((cGroup)content).get(0);
....@@ -2167,19 +3098,19 @@
21673098 }
21683099
21693100 } else
2170
- if (event.getSource() == revertMeshItem)
3101
+ if (source == revertMeshItem)
21713102 {
21723103 RevertMeshes();
21733104 } else
2174
- if (event.getSource() == resetMeshItem)
3105
+ if (source == resetAllItem)
21753106 {
21763107 ResetAll();
21773108 } else
2178
- if (event.getSource() == stepAllItem)
3109
+ if (source == stepAllItem)
21793110 {
21803111 StepAll();
21813112 } else
2182
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
21833114 {
21843115 //int indices[] = jList.getSelectedIndices();
21853116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2187,46 +3118,46 @@
21873118
21883119 ClearSelection(false);
21893120 } else
2190
- if (event.getSource() == clearAllItem)
3121
+ if (source == clearAllItem)
21913122 {
21923123 ClearSelection(true);
21933124 } else
2194
- if (event.getSource() == grabItem)
3125
+ if (source == grabItem || source == groupButton)
21953126 {
2196
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
21973128 } else
2198
- if (event.getSource() == hideItem)
3129
+ if (source == hideItem)
21993130 {
22003131 group(new HiddenObject());
22013132 } else
2202
- if (event.getSource() == frontItem)
3133
+ if (source == frontItem)
22033134 {
22043135 front();
22053136 } else
2206
- if (event.getSource() == backItem)
3137
+ if (source == backItem)
22073138 {
22083139 back();
22093140 } else
2210
- if (event.getSource() == cameraItem)
3141
+ if (source == cameraItem)
22113142 {
22123143 makeSomething(new Camera());
22133144 } else
2214
- if (event.getSource() == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
22153146 {
22163147 group(new Composite());
22173148 } else
2218
- if (event.getSource() == randomItem)
3149
+ if (source == switchItem || source == switchButton)
22193150 {
22203151 RandomNode random = new RandomNode();
22213152 group(random);
22223153 if (random.size() > 0)
2223
- random.name = random.get(0).name + "Rnd";
3154
+ random.name = random.get(0).name + "Switch";
22243155 } else
2225
- if (event.getSource() == physicsItem)
3156
+ if (source == physicsItem)
22263157 {
22273158 group(new PhysicsNode());
22283159 } else
2229
- if (event.getSource() == frameselectorItem)
3160
+ if (source == frameselectorItem)
22303161 {
22313162 for (int i=0; i<group.selection.size(); i++)
22323163 {
....@@ -2238,7 +3169,7 @@
22383169 ResetModel();
22393170 refreshContents();
22403171 } else
2241
- if (event.getSource() == switchGeoItem)
3172
+ if (source == switchGeoItem)
22423173 {
22433174 for (int i=0; i<group.selection.size(); i++)
22443175 {
....@@ -2250,7 +3181,7 @@
22503181 ResetModel();
22513182 refreshContents();
22523183 } else
2253
- if (event.getSource() == switchTransfoItem)
3184
+ if (source == switchTransfoItem)
22543185 {
22553186 for (int i=0; i<group.selection.size(); i++)
22563187 {
....@@ -2262,7 +3193,7 @@
22623193 ResetModel();
22633194 refreshContents();
22643195 } else
2265
- if (event.getSource() == morphItem)
3196
+ if (source == morphItem)
22663197 {
22673198 for (int i=0; i<group.selection.size(); i++)
22683199 {
....@@ -2274,7 +3205,7 @@
22743205 ResetModel();
22753206 refreshContents();
22763207 } else
2277
- if (event.getSource() == scriptNodeItem)
3208
+ if (source == scriptNodeItem)
22783209 {
22793210 boolean atleastone = false;
22803211
....@@ -2313,215 +3244,252 @@
23133244 }
23143245 }
23153246 } else
2316
- if (event.getSource() == linkerItem)
3247
+ if (source == linkerItem)
23173248 {
23183249 group(new cLinker());
23193250 } else
2320
- if (event.getSource() == textureItem)
3251
+ if (source == textureItem || source == textureButton)
23213252 {
23223253 group(new TextureNode());
23233254 } else
2324
- if (event.getSource() == billboardItem)
3255
+ if (source == billboardItem)
23253256 {
23263257 group(new BillboardNode());
23273258 } else
2328
- if (event.getSource() == shadowXItem)
3259
+ if (source == shadowXItem)
23293260 {
23303261 CastShadow(0);
23313262 } else
2332
- if (event.getSource() == shadowYItem)
3263
+ if (source == shadowYItem)
23333264 {
23343265 CastShadow(1);
23353266 } else
2336
- if (event.getSource() == shadowZItem)
3267
+ if (source == shadowZItem)
23373268 {
23383269 CastShadow(2);
23393270 } else
2340
- if (event.getSource() == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
23413272 {
2342
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
23433275 for (int i=0; i<group.selection.size(); i++)
23443276 {
2345
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
23463282 }
23473283
2348
- ClearSelection(false);
2349
-
2350
- 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
+ }
23513295 } else
2352
- if (event.getSource() == genUVItem)
3296
+ if (source == genUVItem)
23533297 {
23543298 GenUV();
23553299 } else
2356
- if (event.getSource() == genNormalsCADItem)
3300
+ if (source == genNormalsCADItem)
23573301 {
23583302 GenNormals(true);
23593303 } else
2360
- if (event.getSource() == genNormalsMESHItem)
3304
+ if (source == genNormalsMESHItem)
23613305 {
2362
- GenNormals(true); // TODO
3306
+ GenNormalsMESH();
23633307 } else
2364
- if (event.getSource() == genNormalsORGANItem)
3308
+ if (source == genNormalsORGANItem)
23653309 {
23663310 GenNormals(false);
23673311 } else
2368
- if (event.getSource() == genNormalsMINEItem)
3312
+ if (source == genNormalsMINEItem)
23693313 {
23703314 GenNormalsMINE();
23713315 } else
2372
- if (event.getSource() == stripifyItem)
3316
+ if (source == stripifyItem)
23733317 {
23743318 Stripify();
23753319 } else
2376
- if (event.getSource() == unstripifyItem)
3320
+ if (source == unstripifyItem)
23773321 {
23783322 Unstripify();
23793323 } else
2380
- if (event.getSource() == trimItem)
3324
+ if (source == trimItem)
23813325 {
23823326 Trim();
23833327 } else
2384
- if (event.getSource() == untrimItem)
3328
+ if (source == untrimItem)
23853329 {
23863330 Untrim();
23873331 } else
2388
- if (event.getSource() == clearColorsItem)
3332
+ if (source == clearColorsItem)
23893333 {
23903334 ClearColors();
23913335 } else
2392
- if (event.getSource() == clearMaterialsItem)
3336
+ if (source == clearMaterialsItem)
23933337 {
23943338 ClearMaterials();
23953339 } else
2396
- if (event.getSource() == liveleavesItem)
3340
+ if (source == liveleavesItem)
23973341 {
23983342 LiveLeaves(true);
23993343 } else
2400
- if (event.getSource() == unliveleavesItem)
3344
+ if (source == unliveleavesItem)
24013345 {
24023346 LiveLeaves(false);
24033347 } else
2404
- if (event.getSource() == supportleavesItem)
3348
+ if (source == supportleavesItem)
24053349 {
24063350 SupportLeaves(true);
24073351 } else
2408
- if (event.getSource() == unsupportleavesItem)
3352
+ if (source == unsupportleavesItem)
24093353 {
24103354 SupportLeaves(false);
24113355 } else
2412
- if (event.getSource() == hideleavesItem)
3356
+ if (source == hideleavesItem)
24133357 {
24143358 HideLeaves(true);
24153359 } else
2416
- if (event.getSource() == showleavesItem)
3360
+ if (source == showleavesItem)
24173361 {
24183362 HideLeaves(false);
24193363 } else
2420
- if (event.getSource() == markleavesItem)
3364
+ if (source == markleavesItem)
24213365 {
24223366 MarkLeaves(true);
24233367 } else
2424
- if (event.getSource() == unmarkleavesItem)
3368
+ if (source == unmarkleavesItem)
24253369 {
24263370 MarkLeaves(false);
24273371 } else
2428
- 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)
24293389 {
24303390 FlipV(true);
24313391 } else
2432
- if (event.getSource() == unflipVItem)
3392
+ if (source == unflipVItem)
24333393 {
24343394 FlipV(false);
24353395 } else
2436
- if (event.getSource() == lowTexturesItem)
3396
+ if (source == lowTexturesItem)
24373397 {
24383398 SetTexRes(0);
24393399 } else
2440
- if (event.getSource() == normalTexturesItem)
3400
+ if (source == normalTexturesItem)
24413401 {
24423402 SetTexRes(1);
24433403 } else
2444
- if (event.getSource() == highTexturesItem)
3404
+ if (source == highTexturesItem)
24453405 {
24463406 SetTexRes(2);
24473407 } else
2448
- if (event.getSource() == veryhighTexturesItem)
3408
+ if (source == veryhighTexturesItem)
24493409 {
24503410 SetTexRes(3);
24513411 } else
2452
- if (event.getSource() == maxTexturesItem)
3412
+ if (source == maxTexturesItem)
24533413 {
24543414 SetTexRes(4);
24553415 } else
2456
- if (event.getSource() == panoTexturesItem)
3416
+ if (source == panoTexturesItem)
24573417 {
24583418 SetTexRes(5);
24593419 } else
2460
- if (event.getSource() == reverseNormalsItem)
3420
+ if (source == reverseNormalsItem)
24613421 {
24623422 ReverseNormals();
24633423 } else
2464
- if (event.getSource() == parseverticesItem)
3424
+ if (source == parseverticesItem)
24653425 {
24663426 ParseVertices();
24673427 } else
2468
- if (event.getSource() == textureFieldItem)
3428
+ if (source == textureFieldItem)
24693429 {
24703430 TextureVertices();
24713431 } else
2472
- if (event.getSource() == alignItem)
3432
+ if (source == alignItem)
24733433 {
24743434 Align();
24753435 } else
2476
- if (event.getSource() == mirrorItem)
3436
+ if (source == mirrorItem)
24773437 {
24783438 MirrorPoses();
24793439 } else
2480
- if (event.getSource() == reduceMorphItem)
3440
+ if (source == reduceMorphItem)
24813441 {
24823442 MeshReduction(false);
24833443 } else
2484
- if (event.getSource() == reduce34MorphItem)
3444
+ if (source == reduce34MorphItem)
24853445 {
24863446 MeshReduction(true);
24873447 } else
2488
- if (event.getSource() == reverseTrianglesItem)
3448
+ if (source == reverseTrianglesItem)
24893449 {
24903450 ReverseTriangles();
24913451 } else
2492
- if (event.getSource() == reduceMeshItem)
3452
+ if (source == reduceMeshItem)
24933453 {
24943454 ReduceMesh(false);
24953455 } else
2496
- if (event.getSource() == reduce34MeshItem)
3456
+ if (source == reduce34MeshItem)
24973457 {
24983458 ReduceMesh(true);
24993459 } else
2500
- if (event.getSource() == increaseMeshItem)
3460
+ if (source == increaseMeshItem)
25013461 {
25023462 IncreaseMesh();
25033463 } else
2504
- if (event.getSource() == clipMeshItem)
3464
+ if (source == clipMeshItem)
25053465 {
25063466 ClipMesh();
25073467 } else
2508
- if (event.getSource() == smoothMeshItem)
3468
+ if (source == smoothMeshItem)
25093469 {
25103470 SmoothMesh();
25113471 } else
2512
- if (event.getSource() == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
25133473 {
25143474 TransformGeometry();
25153475 } else
2516
- if (event.getSource() == resetTransformItem)
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
3479
+ } else
3480
+ if (source == resetTransformItem)
25173481 {
25183482 ResetTransform();
25193483 } else
2520
- if (event.getSource() == resetCentroidItem)
3484
+ if (source == resetCentroidItem)
25213485 {
2522
- ResetCentroid();
3486
+ ResetCentroid(true);
25233487 } else
2524
- if (event.getSource() == resetParentItem)
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
3491
+ } else
3492
+ if (source == resetParentItem)
25253493 {
25263494 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25273495 {
....@@ -2531,7 +3499,7 @@
25313499
25323500 refreshContents();
25333501 } else
2534
- if (event.getSource() == repairParentItem)
3502
+ if (source == repairParentItem)
25353503 {
25363504 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25373505 {
....@@ -2545,7 +3513,21 @@
25453513
25463514 refreshContents();
25473515 } else
2548
- if (event.getSource() == sortbysizeItem)
3516
+ if (source == repairShadowItem)
3517
+ {
3518
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3519
+ {
3520
+ Object3D obj = (Object3D)e.nextElement();
3521
+ obj.RepairShadow();
3522
+// for (int i=0; i<obj.size(); i++)
3523
+// {
3524
+// obj.get(i).parent = obj;
3525
+// }
3526
+ }
3527
+
3528
+ refreshContents();
3529
+ } else
3530
+ if (source == sortbysizeItem)
25493531 {
25503532 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513533 {
....@@ -2557,7 +3539,7 @@
25573539 ResetModel();
25583540 refreshContents();
25593541 } else
2560
- if (event.getSource() == sortbynameItem)
3542
+ if (source == sortbynameItem)
25613543 {
25623544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25633545 {
....@@ -2569,7 +3551,7 @@
25693551 ResetModel();
25703552 refreshContents();
25713553 } else
2572
- if (event.getSource() == attachPigmentItem)
3554
+ if (source == attachPigmentItem)
25733555 {
25743556 String texture = GetFile("Attach pigment");
25753557 Object3D obj;
....@@ -2581,7 +3563,7 @@
25813563
25823564 refreshContents();
25833565 } else
2584
- if (event.getSource() == detachPigmentItem)
3566
+ if (source == detachPigmentItem)
25853567 {
25863568 Object3D obj;
25873569 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2592,7 +3574,7 @@
25923574
25933575 refreshContents();
25943576 } else
2595
- if (event.getSource() == attachBumpItem)
3577
+ if (source == attachBumpItem)
25963578 {
25973579 String texture = GetFile("Attach bump");
25983580 Object3D obj;
....@@ -2604,18 +3586,18 @@
26043586
26053587 refreshContents();
26063588 } else
2607
- if (event.getSource() == detachBumpItem)
3589
+ if (source == detachBumpItem)
26083590 {
26093591 Object3D obj;
26103592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26113593 {
26123594 obj = (Object3D)e.nextElement();
2613
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
26143596 }
26153597
26163598 refreshContents();
26173599 } else
2618
- if (event.getSource() == pigmentBumpItem)
3600
+ if (source == pigmentBumpItem)
26193601 {
26203602 Object3D obj;
26213603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2626,158 +3608,262 @@
26263608
26273609 refreshContents();
26283610 } else
2629
- 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)
26303637 {
26313638 CameraPane.flash = true;
26323639 refreshContents();
26333640 } else
2634
- if (event.getSource() == oneButton)
3641
+ if (source == oneButton)
26353642 {
26363643 } else
2637
- if (event.getSource() == twoButton)
3644
+ if (source == twoButton)
26383645 {
26393646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
26403651 // bug
26413652 //gridPanel.setDividerLocation(1.0);
26423653 //bigPanel.setDividerLocation(0.0);
2643
- bigThree.remove(scenePanel);
2644
- bigThree.remove(centralPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2651
- aWindowConstraints.weightx = 0;
2652
- aWindowConstraints.weighty = 1;
2653
- //bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- bigThree.add(centralPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- 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
+
26673701 } else
2668
- if (event.getSource() == threeButton)
3702
+ if (source == threeButton)
26693703 {
26703704 radio.layout = threeButton;
2671
- bigThree.remove(scenePanel);
2672
- bigThree.remove(centralPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- //bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(centralPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aConstraints.gridheight = 3;
2692
- aConstraints.fill = GridBagConstraints.VERTICAL;
2693
- bigThree.add(XYZPanel, aWindowConstraints);
2694
- 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();
26953742 } else
2696
- if (event.getSource() == fourButton)
3743
+ if (source == fourButton)
26973744 {
26983745 radio.layout = fourButton;
2699
- bigThree.remove(scenePanel);
2700
- bigThree.remove(centralPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2707
- aWindowConstraints.weightx = 1;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(scenePanel, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- //bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aWindowConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- //bigThree.add(XYZPanel, aWindowConstraints);
2722
- 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();
27233782 } else
2724
- if (event.getSource() == sixButton)
3783
+ if (source == sixButton)
27253784 {
27263785 radio.layout = sixButton;
2727
- bigThree.remove(scenePanel);
2728
- bigThree.remove(centralPanel);
2729
- bigThree.remove(XYZPanel);
2730
- aWindowConstraints.gridx = 0;
2731
- aWindowConstraints.gridy = 0;
2732
- aWindowConstraints.gridwidth = 1;
2733
- // aConstraints.gridheight = 3;
2734
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2735
- aWindowConstraints.weightx = 0;
2736
- aWindowConstraints.weighty = 1;
2737
- bigThree.add(scenePanel, aWindowConstraints);
2738
- aWindowConstraints.weightx = 1;
2739
- aWindowConstraints.gridwidth = 3;
2740
- // aWindowConstraints.gridheight = 3;
2741
- aWindowConstraints.gridx = 1;
2742
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2743
- bigThree.add(centralPanel, aWindowConstraints);
2744
- aWindowConstraints.weightx = 0;
2745
- aWindowConstraints.gridx = 4;
2746
- aWindowConstraints.gridwidth = 1;
2747
- // aWindowConstraints.gridheight = 3;
2748
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2749
- //bigThree.add(XYZPanel, aConstraints);
2750
- 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();
27513823 } else
2752
- if (event.getSource() == sevenButton)
3824
+ if (source == sevenButton)
27533825 {
27543826 radio.layout = sevenButton;
2755
- bigThree.remove(scenePanel);
2756
- bigThree.remove(centralPanel);
2757
- bigThree.remove(XYZPanel);
2758
- aWindowConstraints.gridx = 0;
2759
- aWindowConstraints.gridy = 0;
2760
- aWindowConstraints.gridwidth = 1;
2761
- // aWindowConstraints.gridheight = 3;
2762
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2763
- aWindowConstraints.weightx = 0;
2764
- aWindowConstraints.weighty = 1;
2765
- bigThree.add(scenePanel, aWindowConstraints);
2766
- aWindowConstraints.weightx = 1;
2767
- aWindowConstraints.gridwidth = 3;
2768
- // aWindowConstraints.gridheight = 3;
2769
- aWindowConstraints.gridx = 1;
2770
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2771
- bigThree.add(centralPanel, aWindowConstraints);
2772
- aWindowConstraints.weightx = 0;
2773
- aWindowConstraints.gridx = 4;
2774
- aWindowConstraints.gridwidth = 1;
2775
- // aConstraints.gridheight = 3;
2776
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2777
- bigThree.add(XYZPanel, aWindowConstraints);
2778
- 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();
27793865 } else
2780
- if (event.getSource() == rootButton)
3866
+ if (source == rootButton)
27813867 {
27823868 Object3D obj;
27833869 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2787,66 +3873,85 @@
27873873 EditObject(obj);
27883874 }
27893875
3876
+ cameraView.requestFocusInWindow();
27903877 refreshContents(true);
27913878 } else
2792
- if (event.getSource() == closeButton)
3879
+ if (source == closeButton)
27933880 {
27943881 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27953882 cRadio ab;
27963883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27973884 {
27983885 ab = (cRadio)e.nextElement();
2799
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28003887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
28013894 buttonGroup.remove(ab);
28023895 radioPanel.remove(ab);
28033896
2804
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
28053899 // ab.GetObject().objectUI = null; // ?????????
28063900
28073901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28083902 break;
28093903 }
28103904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
28113907 refreshContents(true);
28123908 } else
2813
- if (event.getSource() == editItem || event.getSource() == editButton)
3909
+ if (source == editItem || source == editButton)
28143910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
28153917 EditSelection(false);
28163918 } else
2817
- if (event.getSource() == uneditButton)
3919
+ if (source == uneditButton)
28183920 {
28193921 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28203922 {
28213923 Object3D child = (Object3D)e.nextElement();
28223924 if(child.editWindow != null)
2823
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
28243926 child.CloseUI();
28253927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28263929
2827
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
28283931 }
2829
- objEditor.ctrlPanel.revalidate();
3932
+ objEditor.ctrlPanel.FlushUI();
28303933 //objEditor.jTree.clearSelection();
28313934 //objEditor.ResetSliders();
28323935 refreshContents(true);
28333936 } else
2834
- if (event.getSource() == clearPanelButton)
3937
+ if (source == clearPanelButton)
28353938 {
28363939 assert(copy == group);
28373940 //copy.ClearUI();
28383941 for (Object3D obj : listUI)
28393942 {
3943
+ obj.pinned = false;
28403944 obj.CloseUI();
28413945 }
28423946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
28433948 refreshContents(true);
28443949 } else
2845
- if (event.getSource() == allParamsButton)
3950
+ if (source == allParamsButton)
28463951 {
28473952 assert(copy == group);
28483953
2849
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28503955
28513956 for (Object3D obj : listUI)
28523957 {
....@@ -2863,19 +3968,19 @@
28633968
28643969 refreshContents(true);
28653970 } else
2866
- if (event.getSource() == unselectButton)
3971
+ if (source == unselectButton)
28673972 {
28683973 objEditor.jTree.clearSelection();
28693974 // ?? oct 2012 GrafreeD.clipboard.clear();
28703975 objEditor.ResetSliders();
28713976 refreshContents(true);
28723977 } else
2873
- if(event.getSource() instanceof cRadio)
3978
+ if(source instanceof cRadio)
28743979 {
28753980 group.parent = keepparent;
28763981 group.attributes = 0;
28773982 //group.editWindow = null;
2878
- /*cRadio*/ radio = (cRadio)event.getSource();
3983
+ /*cRadio*/ radio = (cRadio)source;
28793984 Object3D obj = radio.GetObject();
28803985 System.out.println("Edit " + obj);
28813986 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2895,7 +4000,10 @@
28954000 }
28964001
28974002 copy = group;
2898
- //CameraPane.theRenderer.object = group;
4003
+
4004
+ SetUndoStates();
4005
+
4006
+ //Globals.theRenderer.object = group;
28994007 if(!useclient)
29004008 {
29014009 cameraView.renderCamera = radio.camera;
....@@ -2904,25 +4012,55 @@
29044012 cameraView.cameras[cameraView.cameracount] = radio.camera;
29054013 cameraView.targetLookAt.set(radio.camera.lookAt);
29064014 cameraView.object = group;
2907
- cameraView.lighttouched = true;
4015
+ //cameraView.lighttouched = true;
4016
+ Globals.lighttouched = true;
29084017 topView.object = group;
29094018 frontView.object = group;
29104019 sideView.object = group;
29114020 }
2912
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
29134026 /*
29144027 currentLayout = radio.layout;
29154028 if (currentLayout == null)
29164029 currentLayout = sevenButton;
29174030 */
29184031 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);
29194040 keepparent = group.parent;
29204041 // PARENT = NULL or not???
29214042 //group.parent = null; // ROOT
29224043 //group.attributes = -1;
29234044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
29244047 refreshContents(true);
2925
- }
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
+ }
29264064 else
29274065 {
29284066 //return super.action(event, arg);
....@@ -2931,7 +4069,6 @@
29314069 }
29324070
29334071 boolean useclient = false;
2934
- cRadio radio;
29354072
29364073 void ToggleRoot()
29374074 {
....@@ -2940,7 +4077,7 @@
29404077 if (useclient)
29414078 {
29424079 cameraView.object = client;
2943
- cameraView.lighttouched = true;
4080
+ Globals.lighttouched = true;
29444081 //topView.object = client;
29454082 //frontView.object = client;
29464083 //sideView.object = client;
....@@ -2948,7 +4085,7 @@
29484085 else
29494086 {
29504087 cameraView.object = group;
2951
- cameraView.lighttouched = true;
4088
+ Globals.lighttouched = true;
29524089 //topView.object = group;
29534090 //frontView.object = group;
29544091 //sideView.object = group;
....@@ -2983,6 +4120,28 @@
29834120 refreshContents();
29844121 }
29854122
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
+ }
29864145
29874146 void ResetTransform()
29884147 {
....@@ -3095,7 +4254,7 @@
30954254 refreshContents();
30964255 }
30974256
3098
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
30994258 {
31004259 Object3D obj;
31014260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3110,12 +4269,16 @@
31104269 LA.matIdentity(Object3D.mat);
31114270 obj.getBounds(minima, maxima, false);
31124271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3113
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31144274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31154275 obj.TransformMesh(Object3D.mat);
4276
+
31164277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3117
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31184280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
31194282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31204283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31214284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3144,7 +4307,8 @@
31444307
31454308 int size = obj.MemorySize();
31464309
3147
- 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)");
31484312 }
31494313 }
31504314 catch (Exception e)
....@@ -3181,9 +4345,9 @@
31814345 obj = (Object3D)e.nextElement();
31824346
31834347 System.out.println("Object is: " + obj);
3184
- GrafreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
31854349 System.out.println("Boundary rep: " + obj.bRep);
3186
- GrafreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
31874351
31884352 // System.err.println((size/1024) + " KB is the size of " + obj);
31894353 }
....@@ -3225,6 +4389,13 @@
32254389 void GenNormals(boolean crease)
32264390 {
32274391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
32284399
32294400 refreshContents();
32304401 }
....@@ -3397,8 +4568,8 @@
33974568
33984569 void ParseVertices()
33994570 {
3400
- boolean epsequal = GrafreeD.epsequal;
3401
- GrafreeD.epsequal = true;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
34024573
34034574 for (int i=0; i<group.selection.size(); i++)
34044575 {
....@@ -3423,7 +4594,7 @@
34234594 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34244595 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34254596
3426
- g.add(GrafreeD.clipboard);
4597
+ g.add(Grafreed.clipboard);
34274598
34284599 buffer.add(g);
34294600 }
....@@ -3438,7 +4609,7 @@
34384609 makeSomething(buffer, i==group.selection.size()-1);
34394610 }
34404611
3441
- GrafreeD.epsequal = epsequal;
4612
+ Grafreed.epsequal = epsequal;
34424613
34434614 refreshContents();
34444615 }
....@@ -3456,7 +4627,16 @@
34564627 String pigment = Object3D.GetPigment(tex);
34574628 //String bump = Object3D.GetBump(tex);
34584629
3459
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.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
+ }
34604640
34614641 double s = v.s;
34624642
....@@ -3544,11 +4724,11 @@
35444724
35454725 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35464726
3547
- boolean random = CameraPane.RANDOM;
3548
- CameraPane.RANDOM = false; // parse all random nodes
4727
+ boolean random = CameraPane.SWITCH;
4728
+ CameraPane.SWITCH = false; // parse all random nodes
35494729 lowres.linkVerticesThis(null);
35504730 lowres.linkVerticesThis(sn);
3551
- CameraPane.RANDOM = random;
4731
+ CameraPane.SWITCH = random;
35524732
35534733 System.err.flush();
35544734
....@@ -3588,7 +4768,7 @@
35884768 return;
35894769
35904770 Object3D poses = group.selection.get(0);
3591
- Object3D ref = GrafreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
35924772
35934773 Object3D newgroup = new Object3D("Po:" + poses.name);
35944774
....@@ -3757,7 +4937,7 @@
37574937 group.selection.RelinkToSupport(); // july 2014
37584938 System.out.println("DONE.");
37594939 refreshContents();
3760
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4940
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37614941 }
37624942
37634943 void ReduceMesh(boolean reduction34)
....@@ -3782,9 +4962,9 @@
37824962
37834963 void ClipMesh()
37844964 {
3785
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37864966 {
3787
- Object3D content = GrafreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
37884968
37894969 if (content instanceof cGroup && ((cGroup)content).transientlink )
37904970 content = ((cGroup)content).get(0);
....@@ -3793,7 +4973,7 @@
37934973 // {
37944974 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37954975 // }
3796
- group.selection.ClipMesh(GrafreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
37974977 }
37984978 // group.selection.ClipMesh(GrafreeD.clipboard);
37994979 System.out.println("DONE.");
....@@ -3840,6 +5020,18 @@
38405020 void MarkLeaves(boolean hide)
38415021 {
38425022 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);
38435035 refreshContents();
38445036 }
38455037
....@@ -3914,28 +5106,25 @@
39145106 // }
39155107 // }
39165108
3917
- static boolean allparams = true;
3918
-
3919
- static Vector<Object3D> listUI = new Vector<Object3D>();
3920
-
39215109 void EditSelection(boolean newWindow)
39225110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
39235117 // aConstraints.gridy = 0;
39245118 for (int i=0; i<group.selection.size(); i++)
39255119 {
39265120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39275121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39295123
39305124 Object3D elem = (Object3D)group.selection.elementAt(i);
3931
- if(elem != group)
5125
+ if(elem != group || !newWindow)
39325126 {
3933
- // if (!(elem instanceof Composite))
3934
- // newWindow = false;
3935
- listUI.add(elem);
3936
- elem.openEditWindow(this, newWindow); //, false);
3937
- System.out.println("edit : " + elem);
3938
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
39395128 }
39405129 }
39415130 }
....@@ -3998,9 +5187,7 @@
39985187
39995188 freezemodel = false;
40005189 }
4001
-
4002
- boolean flashIt = true;
4003
-
5190
+
40045191 public void valueChanged(TreeSelectionEvent e)
40055192 //public boolean handleEvent(Event event)
40065193 {
....@@ -4010,7 +5197,8 @@
40105197 //new Exception().printStackTrace();
40115198
40125199 freezemodel = true;
4013
-
5200
+ ClearUnpinned();
5201
+
40145202 /**/
40155203 //switch (event.id)
40165204 {
....@@ -4018,7 +5206,6 @@
40185206 //case 702: // Event.LIST_DESELECT
40195207 group.deselectAll();
40205208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4021
- objEditor.ClearInfo(); // .GetMaterial());
40225209 if (tps != null)
40235210 {
40245211 for (int i=0; i < tps.length; i++)
....@@ -4027,33 +5214,39 @@
40275214
40285215 //if (child.parent != null)
40295216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
40305218 group.addSelectee(child);
4031
- objEditor.SetMaterial(child); // .GetMaterial());
4032
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4033
- System.err.println("info : " + child.GetPath());
40345219 }
40355220 }
4036
- else
4037
- {
4038
- objEditor.SetMaterial(group); // .GetMaterial());
4039
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4040
- System.err.println("info : " + group.GetPath());
4041
- }
5221
+// else
5222
+// {
5223
+// objEditor.SetMaterial(group); // .GetMaterial());
5224
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5225
+// System.err.println("info : " + group.GetPath());
5226
+// }
40425227
4043
- objEditor.SetText(); // jan 2014
4044
-
4045
- if (flashIt && !CameraPane.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))
40465229 CameraPane.flash = true;
40475230
4048
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40495232 // a camera
40505233 {
4051
- CameraPane.camerachangeframe = 0; // don't refuse it
4052
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4053
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4054
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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
+ }
5239
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5240
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40555241 }
40565242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
40575250 refreshContents();
40585251 //return true;
40595252 }
....@@ -4062,6 +5255,37 @@
40625255
40635256 freezemodel = false;
40645257 }
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
+ }
40655289
40665290 void linkSomething(Object3D thing)
40675291 {
....@@ -4133,16 +5357,19 @@
41335357 {
41345358 if (group.selection.isEmpty())
41355359 return;
4136
- GrafreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
41375362 Composite tGroup = null;
41385363 if (group.selection.size() > 0) // 1)
41395364 {
41405365 tGroup = new cGroup();
4141
- GrafreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
41425367 }
41435368
41445369 if (cut)
41455370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
41465373 //int indices[] = jList.getSelectedIndices();
41475374 //for (int i = indices.length - 1; i >= 0; i--)
41485375 //jList.remove(indices[i]);
....@@ -4178,16 +5405,16 @@
41785405 //System.out.println("cut " + child);
41795406 //System.out.println("parent = " + child.parent);
41805407 // tmp.addChild(child);
4181
- if (GrafreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
41825409 tGroup.add/*Child*/(tmp);
41835410 else
4184
- GrafreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
41855412 }
41865413 else
4187
- if (GrafreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
41885415 tGroup.add/*Child*/(child);
41895416 else
4190
- GrafreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
41915418 }
41925419
41935420 //ResetModel();
....@@ -4219,21 +5446,23 @@
42195446 //System.out.println("cut " + elem);
42205447 //System.out.println("parent = " + elem.parent);
42215448 // tmp.addChild(elem);
4222
- if (GrafreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
42235450 tGroup.add/*Child*/(tmp);
42245451 else
4225
- GrafreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
42265453 }
42275454 else
4228
- if (GrafreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
42295456 tGroup.add/*Child*/(child);
42305457 else
4231
- GrafreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
42325459 }
42335460
42345461 }
4235
- if (GrafreeD.clipboardIsTempGroup)
4236
- GrafreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
42375466 if (cut)
42385467 {
42395468 ResetModel();
....@@ -4243,11 +5472,15 @@
42435472
42445473 void paste(boolean expand)
42455474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
42465479 // if (GrafreeD.clipboard == null)
42475480 // return;
42485481 boolean first = true;
42495482
4250
- if (GrafreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
42515484 {
42525485 Composite temp;
42535486
....@@ -4258,7 +5491,7 @@
42585491 temp = (Composite)Applet3D.clipboard.deepCopy();
42595492 */
42605493 Object3D elem;
4261
- 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))
42625495 {
42635496 Object3D child = (Object3D)e.nextElement();
42645497
....@@ -4292,21 +5525,22 @@
42925525 //Object3D cb = Applet3D.clipboard;
42935526 //temp.addChild(cb);
42945527 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4295
- assert(GrafreeD.clipboard.parent == null);
4296
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4297
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4298
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4299
- 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());
43005533 else
4301
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4302
- GrafreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
43035536 }
43045537
5538
+ Globals.REPLACEONMAKE = keep;
43055539 ResetModel();
43065540 refreshContents();
43075541 }
43085542
4309
- void pasteInto(boolean copyit)
5543
+ void pasteInto(boolean copyit, boolean clone)
43105544 {
43115545 // if (GrafreeD.clipboard == null)
43125546 // return;
....@@ -4335,15 +5569,22 @@
43355569 if (copyit)
43365570 {
43375571 // paste(false);
4338
- CloneClipboard(false); // sept 2014
5572
+ if (clone)
5573
+ {
5574
+ CloneClipboard(false); // sept 2014
5575
+ }
5576
+ else
5577
+ {
5578
+ paste(false);
5579
+ }
43395580 }
43405581 else
43415582 {
43425583 boolean first = true;
43435584
4344
- if (GrafreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
43455586 {
4346
- Composite temp = (Composite)GrafreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
43475588 Object3D copy;
43485589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43495590 {
....@@ -4353,7 +5594,7 @@
43535594 }
43545595 } else
43555596 {
4356
- linkSomething(GrafreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
43575598 }
43585599 }
43595600 }
....@@ -4430,6 +5671,10 @@
44305671
44315672 void group(Object3D csg, boolean grab)
44325673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
44335678 if (//false) // why??
44345679 !group.selection.isEmpty())
44355680 {
....@@ -4543,10 +5788,15 @@
45435788 //node.add(csg);
45445789 //makeSomething(node);
45455790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
45465792 }
45475793
45485794 void Ungroup(Object3D g)
45495795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
45505800 if (g instanceof HiddenObject)
45515801 {
45525802 HiddenObject h = (HiddenObject) g;
....@@ -4563,6 +5813,7 @@
45635813 objEditor.makeSomething(g.get(i), false);
45645814 }
45655815 }
5816
+ Globals.REPLACEONMAKE = keep;
45665817 }
45675818
45685819 void ungroup()
....@@ -4758,21 +6009,6 @@
47586009 }
47596010 */
47606011
4761
- void ImportGFD()
4762
- {
4763
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4764
- browser.show();
4765
- String filename = browser.getFile();
4766
- if (filename != null && filename.length() > 0)
4767
- {
4768
- String fullname = browser.getDirectory() + filename;
4769
-
4770
- //Object3D readobj =
4771
- objEditor.ReadGFD(fullname, objEditor);
4772
- //makeSomething(readobj);
4773
- }
4774
- }
4775
-
47766012 /*
47776013 public void Callback(Object obj)
47786014 {
....@@ -4796,26 +6032,9 @@
47966032 }
47976033 */
47986034
4799
- void ImportVRMLX3D()
4800
- {
4801
- if (GrafreeD.standAlone)
4802
- {
4803
- /**/
4804
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4805
- browser.show();
4806
- String filename = browser.getFile();
4807
- if (filename != null && filename.length() > 0)
4808
- {
4809
- String fullname = browser.getDirectory() + filename;
4810
- LoadVRMLX3D(fullname);
4811
- }
4812
- /**/
4813
- }
4814
- }
4815
-
48166035 String GetFile(String dialogName)
48176036 {
4818
- if (GrafreeD.standAlone)
6037
+ if (Grafreed.standAlone)
48196038 {
48206039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48216040 browser.show();
....@@ -4879,10 +6098,48 @@
48796098 cButton flashSelectionButton;
48806099 cButton editButton;
48816100 cButton uneditButton;
6101
+ JCheckBox allParamsButton;
48826102 cButton clearpanelButton;
4883
- cButton allParamsButton;
48846103 cButton unselectButton;
48856104
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
+
48866143 cButton screenfitButton;
48876144 cButton screenfitpointButton;
48886145 cButton snapobjectButton;
....@@ -4894,14 +6151,6 @@
48946151
48956152 cButton setsupportButton;
48966153
4897
- cButton twoButton;
4898
- cButton sixButton;
4899
- cButton threeButton;
4900
- cButton sevenButton;
4901
- cButton fourButton; // full panel
4902
- cButton oneButton; // full XYZ
4903
- //cButton currentLayout;
4904
-
49056154 //
49066155 //Composite
49076156 Object3D // to do !!
....@@ -4911,9 +6160,11 @@
49116160 //JTree jTree;
49126161 private MenuItem lookAtItem;
49136162 private MenuItem lookFromItem;
4914
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
49156164 private MenuItem cutItem;
4916
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
49176168 private MenuItem cloneItem;
49186169 private MenuItem cloneSupportItem;
49196170 private MenuItem overwriteGeoItem;
....@@ -4926,7 +6177,7 @@
49266177 private MenuItem linkverticesItem;
49276178 private MenuItem relinkverticesItem;
49286179 private MenuItem setMasterItem;
4929
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
49306181 private MenuItem stepAllItem;
49316182 private MenuItem revertMeshItem;
49326183 private MenuItem poseMeshItem;
....@@ -4937,10 +6188,11 @@
49376188 private MenuItem mergeGeometriesItem;
49386189 private MenuItem copyItem;
49396190 private MenuItem pasteItem;
6191
+ private MenuItem pasteIntoItem;
49406192 private MenuItem pasteLinkItem;
49416193 private MenuItem pasteCloneItem;
49426194 private MenuItem pasteExpandItem;
4943
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
49446196 private MenuItem clearAllItem;
49456197 private MenuItem genUVItem;
49466198 private MenuItem genNormalsMESHItem;
....@@ -4975,6 +6227,10 @@
49756227 private MenuItem showleavesItem;
49766228 private MenuItem markleavesItem;
49776229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
49786234
49796235 private MenuItem flipVItem;
49806236 private MenuItem unflipVItem;
....@@ -4986,15 +6242,17 @@
49866242 private MenuItem panoTexturesItem;
49876243
49886244 private MenuItem resetCentroidItem;
4989
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
49906246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
49916249 private MenuItem hideItem;
49926250 private MenuItem grabItem;
49936251 private MenuItem backItem;
49946252 private MenuItem frontItem;
49956253 private MenuItem cameraItem;
49966254 private MenuItem compositeItem;
4997
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
49986256 private MenuItem physicsItem;
49996257 private MenuItem frameselectorItem;
50006258 private MenuItem scriptNodeItem;
....@@ -5009,6 +6267,7 @@
50096267
50106268 private MenuItem resetParentItem;
50116269 private MenuItem repairParentItem;
6270
+ private MenuItem repairShadowItem;
50126271 private MenuItem sortbysizeItem;
50136272 private MenuItem sortbynameItem;
50146273
....@@ -5017,6 +6276,8 @@
50176276 private MenuItem attachBumpItem;
50186277 private MenuItem detachBumpItem;
50196278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
50206281
50216282 private MenuItem particleItem;
50226283 private MenuItem ragdollItem;
....@@ -5033,7 +6294,7 @@
50336294 private MenuItem blobItem;
50346295 private MenuItem latheItem;
50356296 private MenuItem bezierItem;
5036
- private MenuItem checkerItem;
6297
+ private MenuItem overlayItem;
50376298 private MenuItem meshItem;
50386299 // private MenuItem meshGroupItem;
50396300 private MenuItem springItem;
....@@ -5055,11 +6316,6 @@
50556316 private MenuItem doubleItem;
50566317 private MenuItem tripleItem;
50576318
5058
- private MenuItem importGFDItem;
5059
- private MenuItem importVRMLX3DItem;
5060
- private MenuItem import3DSItem;
5061
- private MenuItem importOBJItem;
5062
-
50636319 private MenuItem computeAOItem;
50646320 private MenuItem recompileItem;
50656321 private MenuItem editScriptItem;
....@@ -5069,4 +6325,8 @@
50696325 private MenuItem analyzeItem;
50706326 private MenuItem dumpItem;
50716327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
50726332 }