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);
....@@ -1129,6 +1970,7 @@
11291970 menu.add("-");
11301971 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11311972 editScriptItem.addActionListener(this);
1973
+ }
11321974 }
11331975
11341976 void ScreenFit()
....@@ -1251,9 +2093,34 @@
12512093 shadow.material = new cMaterial(obj.material);
12522094 shadow.material.diffuse = 0.0001f;
12532095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
12542097
12552098 makeSomething(shadow);
12562099 }
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
+ }
12572124
12582125 /**
12592126 * applyExample
....@@ -1457,9 +2324,9 @@
14572324
14582325 void Overwrite(int mask)
14592326 {
1460
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14612328 {
1462
- Object3D content = GrafreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
14632330
14642331 if (content instanceof cGroup && ((cGroup)content).transientlink )
14652332 content = ((cGroup)content).get(0);
....@@ -1482,6 +2349,7 @@
14822349 //
14832350 public void actionPerformed(ActionEvent event) // , Object arg)
14842351 {
2352
+ Object source = event.getSource();
14852353 /*
14862354 if (event.getSource() == nameField)
14872355 {
....@@ -1493,11 +2361,11 @@
14932361 }
14942362 else
14952363 */
1496
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2364
+ if (source == lookAtItem || source == lookFromItem)
14972365 {
14982366 ScreenFit();
14992367 } else
1500
- if (event.getSource() == switchItem)
2368
+ if (source == switchViewItem)
15012369 {
15022370 cVector v1 = new cVector();
15032371 cVector v2 = new cVector();
....@@ -1506,11 +2374,11 @@
15062374 objEditor.cameraView.renderCamera.setAim(v2, v1);
15072375 objEditor.cameraView.repaint();
15082376 } else
1509
- if (event.getSource() == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
15102378 {
15112379 makeSomething(new Box());
15122380 } else
1513
- if (event.getSource() == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
15142382 {
15152383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15162384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1531,9 +2399,9 @@
15312399 applyExample(particleGeom, "SMOKE");
15322400 makeSomething(particleGeom);
15332401 } else
1534
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2402
+ if (source == ragdollItem || source == ragdoll2Item)
15352403 {
1536
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2404
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15372405
15382406 ragdoll.toParent = LA.newMatrix();
15392407 ragdoll.fromParent = LA.newMatrix();
....@@ -1551,7 +2419,7 @@
15512419 } else
15522420 /*
15532421 */
1554
- if (event.getSource() == heightFieldItem)
2422
+ if (source == heightFieldItem)
15552423 {
15562424 Object3D obj = new Object3D();
15572425
....@@ -1589,31 +2457,31 @@
15892457
15902458 makeSomething(obj);
15912459 } else
1592
- if (event.getSource() == gridItem)
2460
+ if (source == gridItem || source == gridButton)
15932461 {
15942462 makeSomething(new Grid());
15952463 } else
1596
- if (event.getSource() == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
15972465 {
15982466 makeSomething(new Sphere());
15992467 } else
1600
- if (event.getSource() == coneItem)
2468
+ if (source == coneItem || source == coneButton)
16012469 {
16022470 makeSomething(new Cone());
16032471 } else
1604
- if (event.getSource() == torusItem)
2472
+ if (source == torusItem || source == torusButton)
16052473 {
16062474 makeSomething(new Torus());
16072475 } else
1608
- if (event.getSource() == superItem)
2476
+ if (source == superItem || source == superButton)
16092477 {
16102478 makeSomething(new Superellipsoid());
16112479 } else
1612
- if (event.getSource() == kleinItem)
2480
+ if (source == kleinItem || source == kleinButton)
16132481 {
16142482 makeSomething(new Klein());
16152483 } else
1616
- if (event.getSource() == blobItem)
2484
+ if (source == blobItem)
16172485 {
16182486 Blob blob = new Blob();
16192487 BlobComponent comp = new BlobComponent();
....@@ -1621,15 +2489,15 @@
16212489 //blob.retile();
16222490 makeSomething(blob);
16232491 } else
1624
- if (event.getSource() == latheItem)
2492
+ if (source == latheItem)
16252493 {
16262494 makeSomething(new Lathe());
16272495 } else
1628
- if (event.getSource() == bezierItem)
2496
+ if (source == bezierItem)
16292497 {
16302498 makeSomething(new BezierSurface());
16312499 } else
1632
- if (event.getSource() == checkerItem)
2500
+ if (source == overlayItem || source == overlayButton)
16332501 {
16342502 /*
16352503 Object3D obj = new BezierSurface(5,8);
....@@ -1644,7 +2512,7 @@
16442512 */
16452513 makeSomething(new Checker());
16462514 } else
1647
- if (event.getSource() == meshItem)
2515
+ if (source == meshItem)
16482516 {
16492517 Object3D itemtomake = new Object3D();
16502518 Object3D child;
....@@ -1665,35 +2533,52 @@
16652533 makeSomething(child);
16662534 }
16672535 } else
1668
- if (event.getSource() == springItem)
2536
+ if (source == springItem)
16692537 {
16702538 cSpring s = new cSpring();
16712539 s.setup();
16722540 makeSomething(s);
16732541 } else
1674
- if (event.getSource() == flagItem)
2542
+ if (source == flagItem)
16752543 {
16762544 cSpring s = new cFlag();
16772545 s.setup();
16782546 makeSomething(s);
16792547 } else
1680
- if (event.getSource() == lightItem)
2548
+ if (source == lightItem || source == lightButton)
16812549 {
16822550 makeSomething(new Light());
16832551 } else
1684
- 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)
16852570 {
16862571 group(new CSG());
16872572 } else
1688
- if (event.getSource() == templateItem)
2573
+ if (source == templateItem)
16892574 {
16902575 group(new cTemplate());
16912576 } else
1692
- if (event.getSource() == attributeItem)
2577
+ if (source == attributeItem)
16932578 {
16942579 makeSomething(new Attribute());
16952580 } else
1696
- if (event.getSource() == pointflowItem)
2581
+ if (source == pointflowItem)
16972582 {
16982583 makeSomething(new PointFlow());
16992584 } else
....@@ -1705,7 +2590,7 @@
17052590 } else
17062591 */
17072592
1708
- if (event.getSource() == superLoopItem)
2593
+ if (source == superLoopItem)
17092594 {
17102595 Composite g = new cGroup();
17112596 for (int i=0; i<15; i++)
....@@ -1727,30 +2612,30 @@
17272612
17282613 group(g);
17292614 } else
1730
- if (event.getSource() == loopItem)
2615
+ if (source == loopItem || source == loopButton)
17312616 {
17322617 Composite csg = new GroupLeaf();
17332618 csg.count = 5;
17342619 group(csg);
1735
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
17362621 csg.addChild(child);
17372622 child.addChild(csg);
17382623 } else
1739
- if (event.getSource() == doubleItem)
2624
+ if (source == doubleItem)
17402625 {
1741
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
17422627 csg.count = 5;
17432628 group(csg);
1744
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
17452630 csg.addChild(child);
17462631 child.addChild(csg);
1747
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
17482633 csg.addChild(child);
17492634 child.addChild(csg);
17502635 } else
1751
- if (event.getSource() == tripleItem)
2636
+ if (source == tripleItem)
17522637 {
1753
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
17542639 csg.count = 4;
17552640 group(csg);
17562641 Composite child = new cGroup();
....@@ -1763,73 +2648,105 @@
17632648 csg.addChild(child);
17642649 child.addChild(csg);
17652650 } else
1766
-
1767
- if (event.getSource() == importGFDItem)
2651
+ if (source == computeAOItem)
17682652 {
1769
- ImportGFD();
2653
+ Globals.drawMode = CameraPane.OCCLUSION;
2654
+ cameraView.repaint();
17702655 } else
1771
- if (event.getSource() == importVRMLX3DItem)
1772
- {
1773
- ImportVRMLX3D();
1774
- } else
1775
- if (event.getSource() == import3DSItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1778
- } else
1779
- if (event.getSource() == importOBJItem)
1780
- {
1781
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1782
- } else
1783
- if (event.getSource() == computeAOItem)
1784
- {
1785
- CameraPane.drawMode = CameraPane.OCCLUSION;
1786
- CameraPane.theRenderer.repaint();
1787
- } else
1788
- if (event.getSource() == recompileItem)
2656
+ if (source == recompileItem)
17892657 {
17902658 Recompile();
17912659 refreshContents();
17922660 } else
1793
- if (event.getSource() == editScriptItem)
2661
+ if (source == editScriptItem)
17942662 {
17952663 OpenDialog();
17962664 refreshContents();
17972665 } else
1798
- if (event.getSource() == invariantsItem)
2666
+ if (source == invariantsItem)
17992667 {
18002668 System.out.println("Invariants:");
1801
- GrafreeD.grafreeD.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
18022670 } else
1803
- if (event.getSource() == memoryItem)
2671
+ if (source == memoryItem)
18042672 {
18052673 //System.out.println("Invariants:");
18062674 PrintMemory();
18072675 } else
1808
- if (event.getSource() == pathItem)
2676
+ if (source == pathItem)
18092677 {
18102678 PrintPath();
18112679 } else
1812
- if (event.getSource() == analyzeItem)
2680
+ if (source == analyzeItem)
18132681 {
18142682 AnalyzeObject();
18152683 } else
1816
- if (event.getSource() == dumpItem)
2684
+ if (source == dumpItem)
18172685 {
18182686 DumpObject();
18192687 } else
1820
- if (event.getSource() == screenfitButton)
2688
+ if (source == minButton)
18212689 {
1822
- //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
+ {
18232742 ScreenFit();
18242743 } else
1825
- if (event.getSource() == screenfitpointButton)
2744
+ if (source == screenfitpointButton)
18262745 {
1827
- //Reload(lastConverter, lastFilename, true);
18282746 ScreenFitPoint();
18292747 } else
1830
- if (event.getSource() == snapobjectButton)
2748
+ if (source == snapobjectButton)
18312749 {
1832
- //Reload(lastConverter, lastFilename, true);
18332750 SnapObject();
18342751 } else
18352752 // if (event.getSource() == recompileButton)
....@@ -1838,13 +2755,13 @@
18382755 // Recompile();
18392756 // refreshContents();
18402757 // } else
1841
- if (event.getSource() == gcButton)
2758
+ if (source == gcButton)
18422759 {
18432760 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442761 System.gc();
18452762 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18462763 } else
1847
- if (event.getSource() == editLeafItem)
2764
+ if (source == editLeafItem)
18482765 {
18492766 Object3D obj;
18502767 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1858,62 +2775,74 @@
18582775 }
18592776 refreshContents(true);
18602777 } else
1861
- if (event.getSource() == openWindowItem)
2778
+ if (source == openWindowItem)
18622779 {
18632780 EditSelection(true);
18642781 } else
1865
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2782
+ if (source == cutItem || source == clearButton)
18662783 {
18672784 loadClipboard(true);
18682785 } else
1869
- if (event.getSource() == duplicateItem)
2786
+ if (source == undoItem)
18702787 {
1871
- 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;
18722797 loadClipboard(false);
18732798 paste(false);
1874
- GrafreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
18752800 } else
1876
- if (event.getSource() == cloneItem)
2801
+ if (source == cloneItem)
18772802 {
18782803 CloneSelection(false);
18792804 } else
1880
- if (event.getSource() == cloneSupportItem)
2805
+ if (source == cloneSupportItem)
18812806 {
18822807 CloneSelection(true);
18832808 } else
1884
- if (event.getSource() == copyItem)
2809
+ if (source == copyItem)
18852810 {
18862811 loadClipboard(false);
18872812 } else
1888
- if (event.getSource() == pasteItem)
2813
+ if (source == pasteItem)
18892814 {
18902815 paste(false);
18912816 } else
1892
- if (event.getSource() == pasteLinkItem)
2817
+ if (source == pasteIntoItem)
18932818 {
1894
- pasteInto(false);
2819
+ pasteInto(true, false);
18952820 } else
1896
- if (event.getSource() == pasteCloneItem)
2821
+ if (source == pasteLinkItem)
18972822 {
1898
- pasteInto(true);
2823
+ pasteInto(false, false);
18992824 } else
1900
- if (event.getSource() == pasteExpandItem)
2825
+ if (source == pasteCloneItem)
2826
+ {
2827
+ pasteInto(true, true);
2828
+ } else
2829
+ if (source == pasteExpandItem)
19012830 {
19022831 paste(true);
19032832 } else
1904
- if (event.getSource() == synchronizeItem)
2833
+ if (source == synchronizeItem)
19052834 {
19062835 Overwrite(Object3D.TRANSFORM);
19072836 } else
1908
- if (event.getSource() == overwriteNameItem)
2837
+ if (source == overwriteNameItem)
19092838 {
19102839 Overwrite(Object3D.NAME);
19112840 } else
1912
- if (event.getSource() == overwriteUVItem)
2841
+ if (source == overwriteUVItem)
19132842 {
19142843 Overwrite(Object3D.UV);
19152844 } else
1916
- if (event.getSource() == overwriteMatItem)
2845
+ if (source == overwriteMatItem)
19172846 {
19182847 /* july 2015
19192848 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1933,7 +2862,7 @@
19332862
19342863 Overwrite(dropAttributes);
19352864 }
1936
- if (event.getSource() == overwriteGeoItem)
2865
+ if (source == overwriteGeoItem)
19372866 {
19382867 Overwrite(Object3D.GEOMETRY);
19392868 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1950,7 +2879,7 @@
19502879 // refreshContents();
19512880 // }
19522881 } else
1953
- if (event.getSource() == generateMeshItem)
2882
+ if (source == generateMeshItem)
19542883 {
19552884 //if (group.selection.size() == 1)
19562885 // for (int i=0; i<group.selection.size(); i++)
....@@ -1961,7 +2890,7 @@
19612890 ResetModel();
19622891 refreshContents();
19632892 } else
1964
- if (event.getSource() == extractGeometriesItem)
2893
+ if (source == extractGeometriesItem)
19652894 {
19662895 boolean one = false;
19672896
....@@ -1988,7 +2917,7 @@
19882917 ResetModel();
19892918 refreshContents();
19902919 } else
1991
- if (event.getSource() == cloneGeometriesItem)
2920
+ if (source == cloneGeometriesItem)
19922921 {
19932922 boolean one = false;
19942923
....@@ -2014,7 +2943,7 @@
20142943 ResetModel();
20152944 refreshContents();
20162945 } else
2017
- if (event.getSource() == shareGeometriesItem)
2946
+ if (source == shareGeometriesItem)
20182947 {
20192948 boolean one = false;
20202949
....@@ -2044,7 +2973,7 @@
20442973 refreshContents();
20452974 }
20462975 } else
2047
- if (event.getSource() == mergeGeometriesItem)
2976
+ if (source == mergeGeometriesItem)
20482977 {
20492978 boolean one = false;
20502979
....@@ -2074,7 +3003,7 @@
20743003 ResetModel();
20753004 refreshContents();
20763005 } else
2077
- if (event.getSource() == linkverticesItem)
3006
+ if (source == linkverticesItem)
20783007 {
20793008 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20803009 // {
....@@ -2087,48 +3016,48 @@
20873016 // group.selection.get(0).setMasterThis(content); // should be identity
20883017 // refreshContents();
20893018 // }
2090
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20913020 {
2092
- Object3D content = GrafreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
20933022
20943023 if (content instanceof cGroup && ((cGroup)content).transientlink )
20953024 content = ((cGroup)content).get(0);
20963025
2097
- 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));
20983027 for (int i=0; i<group.selection.size(); i++)
20993028 {
2100
- boolean random = CameraPane.RANDOM;
2101
- CameraPane.RANDOM = false; // parse all random nodes
3029
+ boolean random = CameraPane.SWITCH;
3030
+ CameraPane.SWITCH = false; // parse all random nodes
21023031 group.selection.get(i).linkVerticesThis(content);
21033032 // group.selection.get(i).setMasterThis(content); // should be identity
2104
- CameraPane.RANDOM = random;
3033
+ CameraPane.SWITCH = random;
21053034 }
2106
- 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));
21073036 refreshContents();
21083037 }
21093038 } else
2110
- if (event.getSource() == resetsupportItem)
3039
+ if (source == resetsupportItem)
21113040 {
21123041 for (int i=0; i<group.selection.size(); i++)
21133042 {
2114
- boolean random = CameraPane.RANDOM;
2115
- CameraPane.RANDOM = false; // parse all random nodes
3043
+ boolean random = CameraPane.SWITCH;
3044
+ CameraPane.SWITCH = false; // parse all random nodes
21163045 group.selection.get(i).linkVerticesThis(null);
2117
- CameraPane.RANDOM = random;
3046
+ CameraPane.SWITCH = random;
21183047 }
21193048
21203049 refreshContents();
21213050 } else
2122
- if (event.getSource() == relinkverticesItem)
3051
+ if (source == relinkverticesItem)
21233052 {
2124
- boolean random = CameraPane.RANDOM;
2125
- CameraPane.RANDOM = false; // parse all random nodes
3053
+ boolean random = CameraPane.SWITCH;
3054
+ CameraPane.SWITCH = false; // parse all random nodes
21263055 group.selection.RelinkToSupport();
2127
- CameraPane.RANDOM = random;
3056
+ CameraPane.SWITCH = random;
21283057
21293058 refreshContents();
21303059 } else
2131
- if (event.getSource() == resetreferencesItem)
3060
+ if (source == resetreferencesItem)
21323061 {
21333062 for (int i=0; i<group.selection.size(); i++)
21343063 {
....@@ -2137,11 +3066,11 @@
21373066
21383067 refreshContents();
21393068 } else
2140
- if (event.getSource() == setMasterItem)
3069
+ if (source == setMasterItem)
21413070 {
2142
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21433072 {
2144
- Object3D content = GrafreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
21453074
21463075 if (content instanceof cGroup && ((cGroup)content).transientlink )
21473076 content = ((cGroup)content).get(0);
....@@ -2150,13 +3079,13 @@
21503079 refreshContents();
21513080 }
21523081 } else
2153
- if (event.getSource() == poseMeshItem)
3082
+ if (source == poseMeshItem)
21543083 {
21553084 if (group.selection.size() == 1)
21563085 {
2157
- if (GrafreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
21583087 {
2159
- Object3D content = GrafreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
21603089
21613090 if (content instanceof cGroup && ((cGroup)content).transientlink )
21623091 content = ((cGroup)content).get(0);
....@@ -2169,19 +3098,19 @@
21693098 }
21703099
21713100 } else
2172
- if (event.getSource() == revertMeshItem)
3101
+ if (source == revertMeshItem)
21733102 {
21743103 RevertMeshes();
21753104 } else
2176
- if (event.getSource() == resetMeshItem)
3105
+ if (source == resetAllItem)
21773106 {
21783107 ResetAll();
21793108 } else
2180
- if (event.getSource() == stepAllItem)
3109
+ if (source == stepAllItem)
21813110 {
21823111 StepAll();
21833112 } else
2184
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
21853114 {
21863115 //int indices[] = jList.getSelectedIndices();
21873116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2189,46 +3118,46 @@
21893118
21903119 ClearSelection(false);
21913120 } else
2192
- if (event.getSource() == clearAllItem)
3121
+ if (source == clearAllItem)
21933122 {
21943123 ClearSelection(true);
21953124 } else
2196
- if (event.getSource() == grabItem)
3125
+ if (source == grabItem || source == groupButton)
21973126 {
2198
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
21993128 } else
2200
- if (event.getSource() == hideItem)
3129
+ if (source == hideItem)
22013130 {
22023131 group(new HiddenObject());
22033132 } else
2204
- if (event.getSource() == frontItem)
3133
+ if (source == frontItem)
22053134 {
22063135 front();
22073136 } else
2208
- if (event.getSource() == backItem)
3137
+ if (source == backItem)
22093138 {
22103139 back();
22113140 } else
2212
- if (event.getSource() == cameraItem)
3141
+ if (source == cameraItem)
22133142 {
22143143 makeSomething(new Camera());
22153144 } else
2216
- if (event.getSource() == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
22173146 {
22183147 group(new Composite());
22193148 } else
2220
- if (event.getSource() == randomItem)
3149
+ if (source == switchItem || source == switchButton)
22213150 {
22223151 RandomNode random = new RandomNode();
22233152 group(random);
22243153 if (random.size() > 0)
2225
- random.name = random.get(0).name + "Rnd";
3154
+ random.name = random.get(0).name + "Switch";
22263155 } else
2227
- if (event.getSource() == physicsItem)
3156
+ if (source == physicsItem)
22283157 {
22293158 group(new PhysicsNode());
22303159 } else
2231
- if (event.getSource() == frameselectorItem)
3160
+ if (source == frameselectorItem)
22323161 {
22333162 for (int i=0; i<group.selection.size(); i++)
22343163 {
....@@ -2240,7 +3169,7 @@
22403169 ResetModel();
22413170 refreshContents();
22423171 } else
2243
- if (event.getSource() == switchGeoItem)
3172
+ if (source == switchGeoItem)
22443173 {
22453174 for (int i=0; i<group.selection.size(); i++)
22463175 {
....@@ -2252,7 +3181,7 @@
22523181 ResetModel();
22533182 refreshContents();
22543183 } else
2255
- if (event.getSource() == switchTransfoItem)
3184
+ if (source == switchTransfoItem)
22563185 {
22573186 for (int i=0; i<group.selection.size(); i++)
22583187 {
....@@ -2264,7 +3193,7 @@
22643193 ResetModel();
22653194 refreshContents();
22663195 } else
2267
- if (event.getSource() == morphItem)
3196
+ if (source == morphItem)
22683197 {
22693198 for (int i=0; i<group.selection.size(); i++)
22703199 {
....@@ -2276,7 +3205,7 @@
22763205 ResetModel();
22773206 refreshContents();
22783207 } else
2279
- if (event.getSource() == scriptNodeItem)
3208
+ if (source == scriptNodeItem)
22803209 {
22813210 boolean atleastone = false;
22823211
....@@ -2315,215 +3244,252 @@
23153244 }
23163245 }
23173246 } else
2318
- if (event.getSource() == linkerItem)
3247
+ if (source == linkerItem)
23193248 {
23203249 group(new cLinker());
23213250 } else
2322
- if (event.getSource() == textureItem)
3251
+ if (source == textureItem || source == textureButton)
23233252 {
23243253 group(new TextureNode());
23253254 } else
2326
- if (event.getSource() == billboardItem)
3255
+ if (source == billboardItem)
23273256 {
23283257 group(new BillboardNode());
23293258 } else
2330
- if (event.getSource() == shadowXItem)
3259
+ if (source == shadowXItem)
23313260 {
23323261 CastShadow(0);
23333262 } else
2334
- if (event.getSource() == shadowYItem)
3263
+ if (source == shadowYItem)
23353264 {
23363265 CastShadow(1);
23373266 } else
2338
- if (event.getSource() == shadowZItem)
3267
+ if (source == shadowZItem)
23393268 {
23403269 CastShadow(2);
23413270 } else
2342
- if (event.getSource() == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
23433272 {
2344
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
23453275 for (int i=0; i<group.selection.size(); i++)
23463276 {
2347
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
23483282 }
23493283
2350
- ClearSelection(false);
2351
-
2352
- 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
+ }
23533295 } else
2354
- if (event.getSource() == genUVItem)
3296
+ if (source == genUVItem)
23553297 {
23563298 GenUV();
23573299 } else
2358
- if (event.getSource() == genNormalsCADItem)
3300
+ if (source == genNormalsCADItem)
23593301 {
23603302 GenNormals(true);
23613303 } else
2362
- if (event.getSource() == genNormalsMESHItem)
3304
+ if (source == genNormalsMESHItem)
23633305 {
2364
- GenNormals(true); // TODO
3306
+ GenNormalsMESH();
23653307 } else
2366
- if (event.getSource() == genNormalsORGANItem)
3308
+ if (source == genNormalsORGANItem)
23673309 {
23683310 GenNormals(false);
23693311 } else
2370
- if (event.getSource() == genNormalsMINEItem)
3312
+ if (source == genNormalsMINEItem)
23713313 {
23723314 GenNormalsMINE();
23733315 } else
2374
- if (event.getSource() == stripifyItem)
3316
+ if (source == stripifyItem)
23753317 {
23763318 Stripify();
23773319 } else
2378
- if (event.getSource() == unstripifyItem)
3320
+ if (source == unstripifyItem)
23793321 {
23803322 Unstripify();
23813323 } else
2382
- if (event.getSource() == trimItem)
3324
+ if (source == trimItem)
23833325 {
23843326 Trim();
23853327 } else
2386
- if (event.getSource() == untrimItem)
3328
+ if (source == untrimItem)
23873329 {
23883330 Untrim();
23893331 } else
2390
- if (event.getSource() == clearColorsItem)
3332
+ if (source == clearColorsItem)
23913333 {
23923334 ClearColors();
23933335 } else
2394
- if (event.getSource() == clearMaterialsItem)
3336
+ if (source == clearMaterialsItem)
23953337 {
23963338 ClearMaterials();
23973339 } else
2398
- if (event.getSource() == liveleavesItem)
3340
+ if (source == liveleavesItem)
23993341 {
24003342 LiveLeaves(true);
24013343 } else
2402
- if (event.getSource() == unliveleavesItem)
3344
+ if (source == unliveleavesItem)
24033345 {
24043346 LiveLeaves(false);
24053347 } else
2406
- if (event.getSource() == supportleavesItem)
3348
+ if (source == supportleavesItem)
24073349 {
24083350 SupportLeaves(true);
24093351 } else
2410
- if (event.getSource() == unsupportleavesItem)
3352
+ if (source == unsupportleavesItem)
24113353 {
24123354 SupportLeaves(false);
24133355 } else
2414
- if (event.getSource() == hideleavesItem)
3356
+ if (source == hideleavesItem)
24153357 {
24163358 HideLeaves(true);
24173359 } else
2418
- if (event.getSource() == showleavesItem)
3360
+ if (source == showleavesItem)
24193361 {
24203362 HideLeaves(false);
24213363 } else
2422
- if (event.getSource() == markleavesItem)
3364
+ if (source == markleavesItem)
24233365 {
24243366 MarkLeaves(true);
24253367 } else
2426
- if (event.getSource() == unmarkleavesItem)
3368
+ if (source == unmarkleavesItem)
24273369 {
24283370 MarkLeaves(false);
24293371 } else
2430
- 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)
24313389 {
24323390 FlipV(true);
24333391 } else
2434
- if (event.getSource() == unflipVItem)
3392
+ if (source == unflipVItem)
24353393 {
24363394 FlipV(false);
24373395 } else
2438
- if (event.getSource() == lowTexturesItem)
3396
+ if (source == lowTexturesItem)
24393397 {
24403398 SetTexRes(0);
24413399 } else
2442
- if (event.getSource() == normalTexturesItem)
3400
+ if (source == normalTexturesItem)
24433401 {
24443402 SetTexRes(1);
24453403 } else
2446
- if (event.getSource() == highTexturesItem)
3404
+ if (source == highTexturesItem)
24473405 {
24483406 SetTexRes(2);
24493407 } else
2450
- if (event.getSource() == veryhighTexturesItem)
3408
+ if (source == veryhighTexturesItem)
24513409 {
24523410 SetTexRes(3);
24533411 } else
2454
- if (event.getSource() == maxTexturesItem)
3412
+ if (source == maxTexturesItem)
24553413 {
24563414 SetTexRes(4);
24573415 } else
2458
- if (event.getSource() == panoTexturesItem)
3416
+ if (source == panoTexturesItem)
24593417 {
24603418 SetTexRes(5);
24613419 } else
2462
- if (event.getSource() == reverseNormalsItem)
3420
+ if (source == reverseNormalsItem)
24633421 {
24643422 ReverseNormals();
24653423 } else
2466
- if (event.getSource() == parseverticesItem)
3424
+ if (source == parseverticesItem)
24673425 {
24683426 ParseVertices();
24693427 } else
2470
- if (event.getSource() == textureFieldItem)
3428
+ if (source == textureFieldItem)
24713429 {
24723430 TextureVertices();
24733431 } else
2474
- if (event.getSource() == alignItem)
3432
+ if (source == alignItem)
24753433 {
24763434 Align();
24773435 } else
2478
- if (event.getSource() == mirrorItem)
3436
+ if (source == mirrorItem)
24793437 {
24803438 MirrorPoses();
24813439 } else
2482
- if (event.getSource() == reduceMorphItem)
3440
+ if (source == reduceMorphItem)
24833441 {
24843442 MeshReduction(false);
24853443 } else
2486
- if (event.getSource() == reduce34MorphItem)
3444
+ if (source == reduce34MorphItem)
24873445 {
24883446 MeshReduction(true);
24893447 } else
2490
- if (event.getSource() == reverseTrianglesItem)
3448
+ if (source == reverseTrianglesItem)
24913449 {
24923450 ReverseTriangles();
24933451 } else
2494
- if (event.getSource() == reduceMeshItem)
3452
+ if (source == reduceMeshItem)
24953453 {
24963454 ReduceMesh(false);
24973455 } else
2498
- if (event.getSource() == reduce34MeshItem)
3456
+ if (source == reduce34MeshItem)
24993457 {
25003458 ReduceMesh(true);
25013459 } else
2502
- if (event.getSource() == increaseMeshItem)
3460
+ if (source == increaseMeshItem)
25033461 {
25043462 IncreaseMesh();
25053463 } else
2506
- if (event.getSource() == clipMeshItem)
3464
+ if (source == clipMeshItem)
25073465 {
25083466 ClipMesh();
25093467 } else
2510
- if (event.getSource() == smoothMeshItem)
3468
+ if (source == smoothMeshItem)
25113469 {
25123470 SmoothMesh();
25133471 } else
2514
- if (event.getSource() == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
25153473 {
25163474 TransformGeometry();
25173475 } else
2518
- if (event.getSource() == resetTransformItem)
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
3479
+ } else
3480
+ if (source == resetTransformItem)
25193481 {
25203482 ResetTransform();
25213483 } else
2522
- if (event.getSource() == resetCentroidItem)
3484
+ if (source == resetCentroidItem)
25233485 {
2524
- ResetCentroid();
3486
+ ResetCentroid(true);
25253487 } else
2526
- if (event.getSource() == resetParentItem)
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
3491
+ } else
3492
+ if (source == resetParentItem)
25273493 {
25283494 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25293495 {
....@@ -2533,7 +3499,7 @@
25333499
25343500 refreshContents();
25353501 } else
2536
- if (event.getSource() == repairParentItem)
3502
+ if (source == repairParentItem)
25373503 {
25383504 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25393505 {
....@@ -2547,7 +3513,7 @@
25473513
25483514 refreshContents();
25493515 } else
2550
- if (event.getSource() == repairShadowItem)
3516
+ if (source == repairShadowItem)
25513517 {
25523518 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25533519 {
....@@ -2561,7 +3527,7 @@
25613527
25623528 refreshContents();
25633529 } else
2564
- if (event.getSource() == sortbysizeItem)
3530
+ if (source == sortbysizeItem)
25653531 {
25663532 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673533 {
....@@ -2573,7 +3539,7 @@
25733539 ResetModel();
25743540 refreshContents();
25753541 } else
2576
- if (event.getSource() == sortbynameItem)
3542
+ if (source == sortbynameItem)
25773543 {
25783544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25793545 {
....@@ -2585,7 +3551,7 @@
25853551 ResetModel();
25863552 refreshContents();
25873553 } else
2588
- if (event.getSource() == attachPigmentItem)
3554
+ if (source == attachPigmentItem)
25893555 {
25903556 String texture = GetFile("Attach pigment");
25913557 Object3D obj;
....@@ -2597,7 +3563,7 @@
25973563
25983564 refreshContents();
25993565 } else
2600
- if (event.getSource() == detachPigmentItem)
3566
+ if (source == detachPigmentItem)
26013567 {
26023568 Object3D obj;
26033569 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2608,7 +3574,7 @@
26083574
26093575 refreshContents();
26103576 } else
2611
- if (event.getSource() == attachBumpItem)
3577
+ if (source == attachBumpItem)
26123578 {
26133579 String texture = GetFile("Attach bump");
26143580 Object3D obj;
....@@ -2620,18 +3586,18 @@
26203586
26213587 refreshContents();
26223588 } else
2623
- if (event.getSource() == detachBumpItem)
3589
+ if (source == detachBumpItem)
26243590 {
26253591 Object3D obj;
26263592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26273593 {
26283594 obj = (Object3D)e.nextElement();
2629
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
26303596 }
26313597
26323598 refreshContents();
26333599 } else
2634
- if (event.getSource() == pigmentBumpItem)
3600
+ if (source == pigmentBumpItem)
26353601 {
26363602 Object3D obj;
26373603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2642,158 +3608,262 @@
26423608
26433609 refreshContents();
26443610 } else
2645
- 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)
26463637 {
26473638 CameraPane.flash = true;
26483639 refreshContents();
26493640 } else
2650
- if (event.getSource() == oneButton)
3641
+ if (source == oneButton)
26513642 {
26523643 } else
2653
- if (event.getSource() == twoButton)
3644
+ if (source == twoButton)
26543645 {
26553646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
26563651 // bug
26573652 //gridPanel.setDividerLocation(1.0);
26583653 //bigPanel.setDividerLocation(0.0);
2659
- bigThree.remove(scenePanel);
2660
- bigThree.remove(centralPanel);
2661
- bigThree.remove(XYZPanel);
2662
- aWindowConstraints.gridx = 0;
2663
- aWindowConstraints.gridy = 0;
2664
- aWindowConstraints.gridwidth = 1;
2665
- // aConstraints.gridheight = 3;
2666
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2667
- aWindowConstraints.weightx = 0;
2668
- aWindowConstraints.weighty = 1;
2669
- //bigThree.add(jtp, aWindowConstraints);
2670
- aWindowConstraints.weightx = 1;
2671
- aWindowConstraints.gridwidth = 3;
2672
- // aConstraints.gridheight = 3;
2673
- aWindowConstraints.gridx = 1;
2674
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2675
- bigThree.add(centralPanel, aWindowConstraints);
2676
- aWindowConstraints.weightx = 0;
2677
- aWindowConstraints.gridx = 4;
2678
- aWindowConstraints.gridwidth = 1;
2679
- // aConstraints.gridheight = 3;
2680
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2681
- //bigThree.add(XYZPanel, aWindowConstraints);
2682
- 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
+
26833701 } else
2684
- if (event.getSource() == threeButton)
3702
+ if (source == threeButton)
26853703 {
26863704 radio.layout = threeButton;
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aConstraints.fill = GridBagConstraints.VERTICAL;
2709
- bigThree.add(XYZPanel, aWindowConstraints);
2710
- 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();
27113742 } else
2712
- if (event.getSource() == fourButton)
3743
+ if (source == fourButton)
27133744 {
27143745 radio.layout = fourButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aWindowConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2723
- aWindowConstraints.weightx = 1;
2724
- aWindowConstraints.weighty = 1;
2725
- bigThree.add(scenePanel, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- //bigThree.add(cameraPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aWindowConstraints.gridheight = 3;
2736
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2737
- //bigThree.add(XYZPanel, aWindowConstraints);
2738
- 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();
27393782 } else
2740
- if (event.getSource() == sixButton)
3783
+ if (source == sixButton)
27413784 {
27423785 radio.layout = sixButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2751
- aWindowConstraints.weightx = 0;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aWindowConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- bigThree.add(centralPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aConstraints);
2766
- 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();
27673823 } else
2768
- if (event.getSource() == sevenButton)
3824
+ if (source == sevenButton)
27693825 {
27703826 radio.layout = sevenButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aWindowConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- bigThree.add(XYZPanel, aWindowConstraints);
2794
- 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();
27953865 } else
2796
- if (event.getSource() == rootButton)
3866
+ if (source == rootButton)
27973867 {
27983868 Object3D obj;
27993869 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2803,66 +3873,85 @@
28033873 EditObject(obj);
28043874 }
28053875
3876
+ cameraView.requestFocusInWindow();
28063877 refreshContents(true);
28073878 } else
2808
- if (event.getSource() == closeButton)
3879
+ if (source == closeButton)
28093880 {
28103881 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28113882 cRadio ab;
28123883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28133884 {
28143885 ab = (cRadio)e.nextElement();
2815
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28163887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
28173894 buttonGroup.remove(ab);
28183895 radioPanel.remove(ab);
28193896
2820
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
28213899 // ab.GetObject().objectUI = null; // ?????????
28223900
28233901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28243902 break;
28253903 }
28263904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
28273907 refreshContents(true);
28283908 } else
2829
- if (event.getSource() == editItem || event.getSource() == editButton)
3909
+ if (source == editItem || source == editButton)
28303910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
28313917 EditSelection(false);
28323918 } else
2833
- if (event.getSource() == uneditButton)
3919
+ if (source == uneditButton)
28343920 {
28353921 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28363922 {
28373923 Object3D child = (Object3D)e.nextElement();
28383924 if(child.editWindow != null)
2839
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
28403926 child.CloseUI();
28413927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28423929
2843
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
28443931 }
2845
- objEditor.ctrlPanel.revalidate();
3932
+ objEditor.ctrlPanel.FlushUI();
28463933 //objEditor.jTree.clearSelection();
28473934 //objEditor.ResetSliders();
28483935 refreshContents(true);
28493936 } else
2850
- if (event.getSource() == clearPanelButton)
3937
+ if (source == clearPanelButton)
28513938 {
28523939 assert(copy == group);
28533940 //copy.ClearUI();
28543941 for (Object3D obj : listUI)
28553942 {
3943
+ obj.pinned = false;
28563944 obj.CloseUI();
28573945 }
28583946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
28593948 refreshContents(true);
28603949 } else
2861
- if (event.getSource() == allParamsButton)
3950
+ if (source == allParamsButton)
28623951 {
28633952 assert(copy == group);
28643953
2865
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28663955
28673956 for (Object3D obj : listUI)
28683957 {
....@@ -2879,19 +3968,19 @@
28793968
28803969 refreshContents(true);
28813970 } else
2882
- if (event.getSource() == unselectButton)
3971
+ if (source == unselectButton)
28833972 {
28843973 objEditor.jTree.clearSelection();
28853974 // ?? oct 2012 GrafreeD.clipboard.clear();
28863975 objEditor.ResetSliders();
28873976 refreshContents(true);
28883977 } else
2889
- if(event.getSource() instanceof cRadio)
3978
+ if(source instanceof cRadio)
28903979 {
28913980 group.parent = keepparent;
28923981 group.attributes = 0;
28933982 //group.editWindow = null;
2894
- /*cRadio*/ radio = (cRadio)event.getSource();
3983
+ /*cRadio*/ radio = (cRadio)source;
28953984 Object3D obj = radio.GetObject();
28963985 System.out.println("Edit " + obj);
28973986 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2911,7 +4000,10 @@
29114000 }
29124001
29134002 copy = group;
2914
- //CameraPane.theRenderer.object = group;
4003
+
4004
+ SetUndoStates();
4005
+
4006
+ //Globals.theRenderer.object = group;
29154007 if(!useclient)
29164008 {
29174009 cameraView.renderCamera = radio.camera;
....@@ -2920,25 +4012,55 @@
29204012 cameraView.cameras[cameraView.cameracount] = radio.camera;
29214013 cameraView.targetLookAt.set(radio.camera.lookAt);
29224014 cameraView.object = group;
2923
- cameraView.lighttouched = true;
4015
+ //cameraView.lighttouched = true;
4016
+ Globals.lighttouched = true;
29244017 topView.object = group;
29254018 frontView.object = group;
29264019 sideView.object = group;
29274020 }
2928
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
29294026 /*
29304027 currentLayout = radio.layout;
29314028 if (currentLayout == null)
29324029 currentLayout = sevenButton;
29334030 */
29344031 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);
29354040 keepparent = group.parent;
29364041 // PARENT = NULL or not???
29374042 //group.parent = null; // ROOT
29384043 //group.attributes = -1;
29394044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
29404047 refreshContents(true);
2941
- }
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
+ }
29424064 else
29434065 {
29444066 //return super.action(event, arg);
....@@ -2947,7 +4069,6 @@
29474069 }
29484070
29494071 boolean useclient = false;
2950
- cRadio radio;
29514072
29524073 void ToggleRoot()
29534074 {
....@@ -2956,7 +4077,7 @@
29564077 if (useclient)
29574078 {
29584079 cameraView.object = client;
2959
- cameraView.lighttouched = true;
4080
+ Globals.lighttouched = true;
29604081 //topView.object = client;
29614082 //frontView.object = client;
29624083 //sideView.object = client;
....@@ -2964,7 +4085,7 @@
29644085 else
29654086 {
29664087 cameraView.object = group;
2967
- cameraView.lighttouched = true;
4088
+ Globals.lighttouched = true;
29684089 //topView.object = group;
29694090 //frontView.object = group;
29704091 //sideView.object = group;
....@@ -2999,6 +4120,28 @@
29994120 refreshContents();
30004121 }
30014122
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
+ }
30024145
30034146 void ResetTransform()
30044147 {
....@@ -3111,7 +4254,7 @@
31114254 refreshContents();
31124255 }
31134256
3114
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
31154258 {
31164259 Object3D obj;
31174260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3126,12 +4269,16 @@
31264269 LA.matIdentity(Object3D.mat);
31274270 obj.getBounds(minima, maxima, false);
31284271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3129
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31304274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31314275 obj.TransformMesh(Object3D.mat);
4276
+
31324277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3133
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31344280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
31354282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31364283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31374284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3160,7 +4307,8 @@
31604307
31614308 int size = obj.MemorySize();
31624309
3163
- 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)");
31644312 }
31654313 }
31664314 catch (Exception e)
....@@ -3197,9 +4345,9 @@
31974345 obj = (Object3D)e.nextElement();
31984346
31994347 System.out.println("Object is: " + obj);
3200
- GrafreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
32014349 System.out.println("Boundary rep: " + obj.bRep);
3202
- GrafreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
32034351
32044352 // System.err.println((size/1024) + " KB is the size of " + obj);
32054353 }
....@@ -3241,6 +4389,13 @@
32414389 void GenNormals(boolean crease)
32424390 {
32434391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
32444399
32454400 refreshContents();
32464401 }
....@@ -3413,8 +4568,8 @@
34134568
34144569 void ParseVertices()
34154570 {
3416
- boolean epsequal = GrafreeD.epsequal;
3417
- GrafreeD.epsequal = true;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
34184573
34194574 for (int i=0; i<group.selection.size(); i++)
34204575 {
....@@ -3439,7 +4594,7 @@
34394594 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34404595 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34414596
3442
- g.add(GrafreeD.clipboard);
4597
+ g.add(Grafreed.clipboard);
34434598
34444599 buffer.add(g);
34454600 }
....@@ -3454,7 +4609,7 @@
34544609 makeSomething(buffer, i==group.selection.size()-1);
34554610 }
34564611
3457
- GrafreeD.epsequal = epsequal;
4612
+ Grafreed.epsequal = epsequal;
34584613
34594614 refreshContents();
34604615 }
....@@ -3472,7 +4627,16 @@
34724627 String pigment = Object3D.GetPigment(tex);
34734628 //String bump = Object3D.GetBump(tex);
34744629
3475
- 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
+ }
34764640
34774641 double s = v.s;
34784642
....@@ -3560,11 +4724,11 @@
35604724
35614725 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35624726
3563
- boolean random = CameraPane.RANDOM;
3564
- CameraPane.RANDOM = false; // parse all random nodes
4727
+ boolean random = CameraPane.SWITCH;
4728
+ CameraPane.SWITCH = false; // parse all random nodes
35654729 lowres.linkVerticesThis(null);
35664730 lowres.linkVerticesThis(sn);
3567
- CameraPane.RANDOM = random;
4731
+ CameraPane.SWITCH = random;
35684732
35694733 System.err.flush();
35704734
....@@ -3604,7 +4768,7 @@
36044768 return;
36054769
36064770 Object3D poses = group.selection.get(0);
3607
- Object3D ref = GrafreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
36084772
36094773 Object3D newgroup = new Object3D("Po:" + poses.name);
36104774
....@@ -3773,7 +4937,7 @@
37734937 group.selection.RelinkToSupport(); // july 2014
37744938 System.out.println("DONE.");
37754939 refreshContents();
3776
- 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));
37774941 }
37784942
37794943 void ReduceMesh(boolean reduction34)
....@@ -3798,9 +4962,9 @@
37984962
37994963 void ClipMesh()
38004964 {
3801
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38024966 {
3803
- Object3D content = GrafreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
38044968
38054969 if (content instanceof cGroup && ((cGroup)content).transientlink )
38064970 content = ((cGroup)content).get(0);
....@@ -3809,7 +4973,7 @@
38094973 // {
38104974 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38114975 // }
3812
- group.selection.ClipMesh(GrafreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
38134977 }
38144978 // group.selection.ClipMesh(GrafreeD.clipboard);
38154979 System.out.println("DONE.");
....@@ -3856,6 +5020,18 @@
38565020 void MarkLeaves(boolean hide)
38575021 {
38585022 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);
38595035 refreshContents();
38605036 }
38615037
....@@ -3930,28 +5106,25 @@
39305106 // }
39315107 // }
39325108
3933
- static boolean allparams = true;
3934
-
3935
- static Vector<Object3D> listUI = new Vector<Object3D>();
3936
-
39375109 void EditSelection(boolean newWindow)
39385110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
39395117 // aConstraints.gridy = 0;
39405118 for (int i=0; i<group.selection.size(); i++)
39415119 {
39425120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39435121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3944
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39455123
39465124 Object3D elem = (Object3D)group.selection.elementAt(i);
3947
- if(elem != group)
5125
+ if(elem != group || !newWindow)
39485126 {
3949
- // if (!(elem instanceof Composite))
3950
- // newWindow = false;
3951
- listUI.add(elem);
3952
- elem.openEditWindow(this, newWindow); //, false);
3953
- System.out.println("edit : " + elem);
3954
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
39555128 }
39565129 }
39575130 }
....@@ -4014,9 +5187,7 @@
40145187
40155188 freezemodel = false;
40165189 }
4017
-
4018
- boolean flashIt = true;
4019
-
5190
+
40205191 public void valueChanged(TreeSelectionEvent e)
40215192 //public boolean handleEvent(Event event)
40225193 {
....@@ -4026,7 +5197,8 @@
40265197 //new Exception().printStackTrace();
40275198
40285199 freezemodel = true;
4029
-
5200
+ ClearUnpinned();
5201
+
40305202 /**/
40315203 //switch (event.id)
40325204 {
....@@ -4034,7 +5206,6 @@
40345206 //case 702: // Event.LIST_DESELECT
40355207 group.deselectAll();
40365208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4037
- objEditor.ClearInfo(); // .GetMaterial());
40385209 if (tps != null)
40395210 {
40405211 for (int i=0; i < tps.length; i++)
....@@ -4043,33 +5214,39 @@
40435214
40445215 //if (child.parent != null)
40455216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
40465218 group.addSelectee(child);
4047
- objEditor.SetMaterial(child); // .GetMaterial());
4048
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4049
- System.err.println("info : " + child.GetPath());
40505219 }
40515220 }
4052
- else
4053
- {
4054
- objEditor.SetMaterial(group); // .GetMaterial());
4055
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4056
- System.err.println("info : " + group.GetPath());
4057
- }
5221
+// else
5222
+// {
5223
+// objEditor.SetMaterial(group); // .GetMaterial());
5224
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5225
+// System.err.println("info : " + group.GetPath());
5226
+// }
40585227
4059
- objEditor.SetText(); // jan 2014
4060
-
4061
- 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))
40625229 CameraPane.flash = true;
40635230
4064
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40655232 // a camera
40665233 {
4067
- CameraPane.camerachangeframe = 0; // don't refuse it
4068
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4069
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4070
- // 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;
40715241 }
40725242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
40735250 refreshContents();
40745251 //return true;
40755252 }
....@@ -4078,6 +5255,37 @@
40785255
40795256 freezemodel = false;
40805257 }
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
+ }
40815289
40825290 void linkSomething(Object3D thing)
40835291 {
....@@ -4149,16 +5357,19 @@
41495357 {
41505358 if (group.selection.isEmpty())
41515359 return;
4152
- GrafreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
41535362 Composite tGroup = null;
41545363 if (group.selection.size() > 0) // 1)
41555364 {
41565365 tGroup = new cGroup();
4157
- GrafreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
41585367 }
41595368
41605369 if (cut)
41615370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
41625373 //int indices[] = jList.getSelectedIndices();
41635374 //for (int i = indices.length - 1; i >= 0; i--)
41645375 //jList.remove(indices[i]);
....@@ -4194,16 +5405,16 @@
41945405 //System.out.println("cut " + child);
41955406 //System.out.println("parent = " + child.parent);
41965407 // tmp.addChild(child);
4197
- if (GrafreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
41985409 tGroup.add/*Child*/(tmp);
41995410 else
4200
- GrafreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
42015412 }
42025413 else
4203
- if (GrafreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
42045415 tGroup.add/*Child*/(child);
42055416 else
4206
- GrafreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
42075418 }
42085419
42095420 //ResetModel();
....@@ -4235,21 +5446,23 @@
42355446 //System.out.println("cut " + elem);
42365447 //System.out.println("parent = " + elem.parent);
42375448 // tmp.addChild(elem);
4238
- if (GrafreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
42395450 tGroup.add/*Child*/(tmp);
42405451 else
4241
- GrafreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
42425453 }
42435454 else
4244
- if (GrafreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
42455456 tGroup.add/*Child*/(child);
42465457 else
4247
- GrafreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
42485459 }
42495460
42505461 }
4251
- if (GrafreeD.clipboardIsTempGroup)
4252
- GrafreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
42535466 if (cut)
42545467 {
42555468 ResetModel();
....@@ -4259,11 +5472,15 @@
42595472
42605473 void paste(boolean expand)
42615474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
42625479 // if (GrafreeD.clipboard == null)
42635480 // return;
42645481 boolean first = true;
42655482
4266
- if (GrafreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
42675484 {
42685485 Composite temp;
42695486
....@@ -4274,7 +5491,7 @@
42745491 temp = (Composite)Applet3D.clipboard.deepCopy();
42755492 */
42765493 Object3D elem;
4277
- 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))
42785495 {
42795496 Object3D child = (Object3D)e.nextElement();
42805497
....@@ -4308,21 +5525,22 @@
43085525 //Object3D cb = Applet3D.clipboard;
43095526 //temp.addChild(cb);
43105527 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4311
- assert(GrafreeD.clipboard.parent == null);
4312
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4313
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4314
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4315
- 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());
43165533 else
4317
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4318
- GrafreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
43195536 }
43205537
5538
+ Globals.REPLACEONMAKE = keep;
43215539 ResetModel();
43225540 refreshContents();
43235541 }
43245542
4325
- void pasteInto(boolean copyit)
5543
+ void pasteInto(boolean copyit, boolean clone)
43265544 {
43275545 // if (GrafreeD.clipboard == null)
43285546 // return;
....@@ -4351,15 +5569,22 @@
43515569 if (copyit)
43525570 {
43535571 // paste(false);
4354
- CloneClipboard(false); // sept 2014
5572
+ if (clone)
5573
+ {
5574
+ CloneClipboard(false); // sept 2014
5575
+ }
5576
+ else
5577
+ {
5578
+ paste(false);
5579
+ }
43555580 }
43565581 else
43575582 {
43585583 boolean first = true;
43595584
4360
- if (GrafreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
43615586 {
4362
- Composite temp = (Composite)GrafreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
43635588 Object3D copy;
43645589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43655590 {
....@@ -4369,7 +5594,7 @@
43695594 }
43705595 } else
43715596 {
4372
- linkSomething(GrafreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
43735598 }
43745599 }
43755600 }
....@@ -4446,6 +5671,10 @@
44465671
44475672 void group(Object3D csg, boolean grab)
44485673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
44495678 if (//false) // why??
44505679 !group.selection.isEmpty())
44515680 {
....@@ -4559,10 +5788,15 @@
45595788 //node.add(csg);
45605789 //makeSomething(node);
45615790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
45625792 }
45635793
45645794 void Ungroup(Object3D g)
45655795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
45665800 if (g instanceof HiddenObject)
45675801 {
45685802 HiddenObject h = (HiddenObject) g;
....@@ -4579,6 +5813,7 @@
45795813 objEditor.makeSomething(g.get(i), false);
45805814 }
45815815 }
5816
+ Globals.REPLACEONMAKE = keep;
45825817 }
45835818
45845819 void ungroup()
....@@ -4774,21 +6009,6 @@
47746009 }
47756010 */
47766011
4777
- void ImportGFD()
4778
- {
4779
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4780
- browser.show();
4781
- String filename = browser.getFile();
4782
- if (filename != null && filename.length() > 0)
4783
- {
4784
- String fullname = browser.getDirectory() + filename;
4785
-
4786
- //Object3D readobj =
4787
- objEditor.ReadGFD(fullname, objEditor);
4788
- //makeSomething(readobj);
4789
- }
4790
- }
4791
-
47926012 /*
47936013 public void Callback(Object obj)
47946014 {
....@@ -4812,26 +6032,9 @@
48126032 }
48136033 */
48146034
4815
- void ImportVRMLX3D()
4816
- {
4817
- if (GrafreeD.standAlone)
4818
- {
4819
- /**/
4820
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4821
- browser.show();
4822
- String filename = browser.getFile();
4823
- if (filename != null && filename.length() > 0)
4824
- {
4825
- String fullname = browser.getDirectory() + filename;
4826
- LoadVRMLX3D(fullname);
4827
- }
4828
- /**/
4829
- }
4830
- }
4831
-
48326035 String GetFile(String dialogName)
48336036 {
4834
- if (GrafreeD.standAlone)
6037
+ if (Grafreed.standAlone)
48356038 {
48366039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48376040 browser.show();
....@@ -4895,10 +6098,48 @@
48956098 cButton flashSelectionButton;
48966099 cButton editButton;
48976100 cButton uneditButton;
6101
+ JCheckBox allParamsButton;
48986102 cButton clearpanelButton;
4899
- cButton allParamsButton;
49006103 cButton unselectButton;
49016104
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
+
49026143 cButton screenfitButton;
49036144 cButton screenfitpointButton;
49046145 cButton snapobjectButton;
....@@ -4910,14 +6151,6 @@
49106151
49116152 cButton setsupportButton;
49126153
4913
- cButton twoButton;
4914
- cButton sixButton;
4915
- cButton threeButton;
4916
- cButton sevenButton;
4917
- cButton fourButton; // full panel
4918
- cButton oneButton; // full XYZ
4919
- //cButton currentLayout;
4920
-
49216154 //
49226155 //Composite
49236156 Object3D // to do !!
....@@ -4927,9 +6160,11 @@
49276160 //JTree jTree;
49286161 private MenuItem lookAtItem;
49296162 private MenuItem lookFromItem;
4930
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
49316164 private MenuItem cutItem;
4932
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
49336168 private MenuItem cloneItem;
49346169 private MenuItem cloneSupportItem;
49356170 private MenuItem overwriteGeoItem;
....@@ -4942,7 +6177,7 @@
49426177 private MenuItem linkverticesItem;
49436178 private MenuItem relinkverticesItem;
49446179 private MenuItem setMasterItem;
4945
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
49466181 private MenuItem stepAllItem;
49476182 private MenuItem revertMeshItem;
49486183 private MenuItem poseMeshItem;
....@@ -4953,10 +6188,11 @@
49536188 private MenuItem mergeGeometriesItem;
49546189 private MenuItem copyItem;
49556190 private MenuItem pasteItem;
6191
+ private MenuItem pasteIntoItem;
49566192 private MenuItem pasteLinkItem;
49576193 private MenuItem pasteCloneItem;
49586194 private MenuItem pasteExpandItem;
4959
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
49606196 private MenuItem clearAllItem;
49616197 private MenuItem genUVItem;
49626198 private MenuItem genNormalsMESHItem;
....@@ -4991,6 +6227,10 @@
49916227 private MenuItem showleavesItem;
49926228 private MenuItem markleavesItem;
49936229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
49946234
49956235 private MenuItem flipVItem;
49966236 private MenuItem unflipVItem;
....@@ -5002,15 +6242,17 @@
50026242 private MenuItem panoTexturesItem;
50036243
50046244 private MenuItem resetCentroidItem;
5005
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
50066246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
50076249 private MenuItem hideItem;
50086250 private MenuItem grabItem;
50096251 private MenuItem backItem;
50106252 private MenuItem frontItem;
50116253 private MenuItem cameraItem;
50126254 private MenuItem compositeItem;
5013
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
50146256 private MenuItem physicsItem;
50156257 private MenuItem frameselectorItem;
50166258 private MenuItem scriptNodeItem;
....@@ -5034,6 +6276,8 @@
50346276 private MenuItem attachBumpItem;
50356277 private MenuItem detachBumpItem;
50366278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
50376281
50386282 private MenuItem particleItem;
50396283 private MenuItem ragdollItem;
....@@ -5050,7 +6294,7 @@
50506294 private MenuItem blobItem;
50516295 private MenuItem latheItem;
50526296 private MenuItem bezierItem;
5053
- private MenuItem checkerItem;
6297
+ private MenuItem overlayItem;
50546298 private MenuItem meshItem;
50556299 // private MenuItem meshGroupItem;
50566300 private MenuItem springItem;
....@@ -5072,11 +6316,6 @@
50726316 private MenuItem doubleItem;
50736317 private MenuItem tripleItem;
50746318
5075
- private MenuItem importGFDItem;
5076
- private MenuItem importVRMLX3DItem;
5077
- private MenuItem import3DSItem;
5078
- private MenuItem importOBJItem;
5079
-
50806319 private MenuItem computeAOItem;
50816320 private MenuItem recompileItem;
50826321 private MenuItem editScriptItem;
....@@ -5086,4 +6325,8 @@
50866325 private MenuItem analyzeItem;
50876326 private MenuItem dumpItem;
50886327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
50896332 }