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,73 +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);
670
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
671
+ relinkverticesItem.addActionListener(this);
672
+
673
+ if (Globals.ADVANCED)
674
+ {
222675 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223676 setMasterItem.addActionListener(this);
677
+ }
224678
225679 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
228682 backItem = menu.add(new MenuItem("Back"));
229683 backItem.addActionListener(this);
230684 frontItem = menu.add(new MenuItem("Front"));
231685 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
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"));
692
+ hideItem.addActionListener(this);
693
+ }
694
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
695
+ ungroupItem.addActionListener(this);
696
+
697
+// menu.add("-");
698
+//
699
+// switchItem = menu.add(new MenuItem("Switch node"));
700
+// switchItem.addActionListener(this);
701
+ if (Globals.ADVANCED)
702
+ {
241703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242704 switchGeoItem.addActionListener(this);
243705 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244706 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
707
+ morphItem = menu.add(new MenuItem("Morph Group"));
246708 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);
247715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248716 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
717
+ }
251718
252719 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
722
+ billboardItem = menu.add(new MenuItem("Billboard"));
723
+ billboardItem.addActionListener(this);
255724 csgItem = menu.add(new MenuItem("CSG"));
256725 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
726
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258727 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
728
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260729 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
730
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262731 shadowZItem.addActionListener(this);
732
+ attributeItem = menu.add(new MenuItem("Attribute"));
733
+ attributeItem.addActionListener(this);
734
+
735
+ if (Globals.ADVANCED)
736
+ {
737
+ menu.add("-");
263738 linkerItem = menu.add(new MenuItem("Linker"));
264739 linkerItem.addActionListener(this);
265740 templateItem = menu.add(new MenuItem("Template"));
266741 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269742 pointflowItem = menu.add(new MenuItem("Point Flow"));
270743 pointflowItem.addActionListener(this);
744
+ }
271745 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274746 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275747 resetTransformItem.addActionListener(this);
276748 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277749 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.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);
280756
281757 oe.menuBar.add(menu = new Menu("Geometry"));
282758 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +761,13 @@
285761 genNormalsORGANItem.addActionListener(this);
286762 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287763 genNormalsCADItem.addActionListener(this);
764
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
765
+ genNormalsMESHItem.addActionListener(this);
766
+ if (Globals.ADVANCED)
767
+ {
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
769
+ genNormalsMINEItem.addActionListener(this);
770
+ }
288771 stripifyItem = menu.add(new MenuItem("Stripify"));
289772 stripifyItem.addActionListener(this);
290773 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +789,34 @@
306789 reduce34MeshItem.addActionListener(this);
307790 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308791 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311792 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312793 clipMeshItem.addActionListener(this);
794
+
795
+ if (Globals.ADVANCED)
796
+ {
797
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
798
+ smoothMeshItem.addActionListener(this);
799
+ }
313800
314801 oe.menuBar.add(menu = new Menu("Attributes"));
315802 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316803 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);
317808 menu.add("-");
318809 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319810 liveleavesItem.addActionListener(this);
320811 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321812 unliveleavesItem.addActionListener(this);
813
+ if (Globals.ADVANCED)
814
+ {
322815 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323816 supportleavesItem.addActionListener(this);
324817 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325818 unsupportleavesItem.addActionListener(this);
819
+ }
326820 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327821 hideleavesItem.addActionListener(this);
328822 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +825,14 @@
331825 markleavesItem.addActionListener(this);
332826 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333827 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);
334836 menu.add("-");
335837 flipVItem = menu.add(new MenuItem("Flip V"));
336838 flipVItem.addActionListener(this);
....@@ -356,45 +858,117 @@
356858 attachBumpItem.addActionListener(this);
357859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
358860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
359862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
360863 detachPigmentItem.addActionListener(this);
361864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
362865 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);
363870 menu.add("-");
364871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
365872 sortbysizeItem.addActionListener(this);
366873 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367874 sortbynameItem.addActionListener(this);
368875 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.
369883 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370884 extractGeometriesItem.addActionListener(this);
371885 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372886 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
887
+ }
377888
378889 oe.menuBar.add(menu = new Menu("Insert"));
379890 buildCreateMenu(menu);
380891
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392892 oe.menuBar.add(menu = new Menu("Tools"));
393893 buildToolsMenu(menu);
394894 }
395895
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
+
396958 void SetupUI2(ObjEditor oe)
397959 {
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
+
398972 //new Exception().printStackTrace();
399973
400974 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +997,239 @@
423997 oe.radioPanel.add(dummyButton);
424998 oe.buttonGroup.add(dummyButton);
425999 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
4291003
430
- 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");
4311062 liveCB.addItemListener(this);
4321063
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- 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");
4511070 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- 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);
4581077
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
493
- trackCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
497
- screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
4991078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5001079 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
5051080
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
512
- flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516
-
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
519
- twoButton.addActionListener(this);
520
- 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);
5211088 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
523
- sixButton.addActionListener(this);
524
- 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");
5251101 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
527
- 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);
5281108 //
5291109
530
- 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");
5311112 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- 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");
5341116 closeButton.addActionListener(this);
5351117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5361118 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538
-
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
541
- editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
5451119
546
- 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");
5471209 uneditButton.addActionListener(this);
5481210
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- 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");
5611213 allParamsButton.addActionListener(this);
5621214
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
568
- 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);
5691218
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
+
5701233 // oe.aConstraints.gridx += 1;
5711234 // oe.aConstraints.weighty = 0;
5721235 // oe.aConstraints.gridwidth = 1;
....@@ -578,47 +1241,32 @@
5781241 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5791242 // gcButton.addActionListener(this);
5801243
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
1244
+ cGridBag jSPPanel = new cGridBag();
1245
+
1246
+ JScrollPane jSP;
5921247 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5941249 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
599
-
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
604
- colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
607
- materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
- textureCB.addItemListener(this);
611
-
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
6141250
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
+
6151263 //jList.addListSelectionListener(this);
6161264 oe.jTree.addTreeSelectionListener(this);
6171265 //jTree.setRootVisible(false);
6181266 //jTree.setEditable(true);
6191267 oe.jTree.setDragEnabled(true);
6201268 //jTree.setPreferredSize(new Dimension(10,10));
621
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6221270
6231271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6241272
....@@ -630,23 +1278,163 @@
6301278 dgr.addDragGestureListener(this);
6311279 }catch(Exception e) {}
6321280 */
633
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6341282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6351283 }
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
+ }
6361413
6371414 void EditObject(Object3D obj)
6381415 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
1416
+ 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
+
1425
+ radioButton.SetObject(obj);
1426
+ radioButton.layout = threeButton; // sixButton;
1427
+ radioButton.SetCamera(cameraView.renderCamera, false);
1428
+ radioButton.addActionListener(this);
1429
+ radioPanel.add(radioButton);
1430
+ buttonGroup.add(radioButton);
1431
+ radioButton.doClick();
6471432 }
1433
+
6481434 void SetupViews(ObjEditor oe)
6491435 {
1436
+ theFrame = this;
1437
+
6501438 oe.SetupViews();
6511439
6521440 System.out.println("SetupViews");
....@@ -655,22 +1443,30 @@
6551443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6561444 }
6571445
658
- JCheckBox liveCB;
659
- JCheckBox supportCB;
660
- JCheckBox localCB;
661
- JCheckBox crowdCB;
662
- JCheckBox smoothCB;
663
- JCheckBox fastCB;
664
- JCheckBox slowCB;
665
- JCheckBox boxCB;
666
- JCheckBox trackCB;
667
- 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;
6681461 // JCheckBox speakerMocapCB;
669
- JCheckBox speakerCameraCB;
670
- JCheckBox speakerFocusCB;
671
- JCheckBox debugCB;
672
- JCheckBox oeilCB;
673
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
6741470
6751471 // static int COLOR = 1;
6761472 // static int MATERIAL = 2;
....@@ -678,9 +1474,9 @@
6781474
6791475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6801476
681
- JCheckBox colorCB;
682
- JCheckBox materialCB;
683
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
6841480
6851481 public void itemStateChanged(ItemEvent e)
6861482 {
....@@ -705,10 +1501,10 @@
7051501 dropAttributes |= Object3D.TEXTURE;
7061502 else
7071503 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
1504
+ } else if(e.getSource() == liveCB)
7101505 {
7111506 cameraView.ToggleLive();
1507
+ refreshContents(false);
7121508 }
7131509 else if(e.getSource() == supportCB)
7141510 {
....@@ -724,6 +1520,12 @@
7241520 {
7251521 cameraView.ToggleInertia();
7261522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
7271529 }
7281530 else if(e.getSource() == localCB)
7291531 {
....@@ -743,6 +1545,10 @@
7431545 Recompile();
7441546 cameraView.repaint();
7451547 // refreshContents();
1548
+ }
1549
+ else if(e.getSource() == zoomBoxCB)
1550
+ {
1551
+ cameraView.ToggleZoomBoxMode();
7461552 }
7471553 else if(e.getSource() == smoothfocusCB)
7481554 {
....@@ -769,6 +1575,18 @@
7691575 {
7701576 cameraView.ToggleOeil();
7711577 }
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
+ }
7721590 else if(e.getSource() == lookAtCB)
7731591 {
7741592 cameraView.ToggleLookAt();
....@@ -785,7 +1603,8 @@
7851603
7861604 /**/
7871605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
788
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
7891608 if ((path == null) || (path.getPathCount() <= 1)) {
7901609 // We can't move the root node or an empty selection
7911610 return;
....@@ -848,8 +1667,6 @@
8481667 }
8491668 }
8501669
851
- String string = (String) object;
852
-
8531670 System.out.println("Transfer = " + object + "; drop : " + target);
8541671 // if( object instanceof java.io.File[])
8551672 // {
....@@ -857,7 +1674,11 @@
8571674 // objEditor.DropFile((java.io.File[]) object, true);
8581675 // return;
8591676 // }
860
- 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) == ':')
8611682 {
8621683 // file(s)
8631684 String[] names = string.split("\n");
....@@ -884,7 +1705,7 @@
8841705
8851706 flashIt = false;
8861707 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1708
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881709 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891710
8901711 if (group.selection.size() == 1)
....@@ -900,23 +1721,33 @@
9001721
9011722 assert target == objEditor.jTree;
9021723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
9031725 try {
904
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9051727 } catch (Exception e) {
9061728 System.out.println("destinationPath : " + destinationPath);
9071729 return;
9081730 }
9091731
910
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
9111733 {
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
+// {
9121743 loadClipboard(true);
9131744 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
915
- } else {
916
- loadClipboard(false);
917
- objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
919
- }
1745
+ pasteInto(false, false);
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
9201751 }
9211752 public void dropActionChanged(DropTargetDragEvent dtde)
9221753 // Called if the user has modified the current drop gesture
....@@ -1021,83 +1852,107 @@
10211852 {
10221853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10231854 //heightFieldItem.addActionListener(this);
1024
- gridItem = menu.add(new MenuItem("Grid"));
1025
- gridItem.addActionListener(this);
1026
- rectoidItem = menu.add(new MenuItem("Box"));
1027
- rectoidItem.addActionListener(this);
1028
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1029
- ellipsoidItem.addActionListener(this);
1030
- coneItem = menu.add(new MenuItem("Cone"));
1031
- coneItem.addActionListener(this);
1032
- torusItem = menu.add(new MenuItem("Torus"));
1033
- torusItem.addActionListener(this);
1034
- superItem = menu.add(new MenuItem("Superellipsoid"));
1035
- superItem.addActionListener(this);
1036
- particleItem = menu.add(new MenuItem("Particle system"));
1037
- particleItem.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
+ {
1873
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1874
+ kleinItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
1879
+ if (Globals.ADVANCED)
1880
+ {
10381881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391882 ragdollItem.addActionListener(this);
10401883 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411884 ragdoll2Item.addActionListener(this);
1885
+ }
10421886 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1887
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441888 meshItem.addActionListener(this);
10451889 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461890 // meshGroupItem.addActionListener(this);
1891
+ if (Globals.ADVANCED)
1892
+ {
10471893 springItem = menu.add(new MenuItem("Spring"));
10481894 springItem.addActionListener(this);
10491895 flagItem = menu.add(new MenuItem("Flag"));
10501896 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551897 blobItem = menu.add(new MenuItem("Blob"));
10561898 blobItem.addActionListener(this);
10571899 latheItem = menu.add(new MenuItem("Lathe"));
10581900 latheItem.addActionListener(this);
1059
- lightItem = menu.add(new MenuItem("Light"));
1060
- 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);
10611908 menu.add("-");
10621909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10631910 //superLoopItem.addActionListener(this);
1064
- loopItem = menu.add(new MenuItem("Loop"));
1065
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
10661913 doubleItem = menu.add(new MenuItem("Fork"));
10671914 doubleItem.addActionListener(this);
1915
+ if (Globals.ADVANCED)
1916
+ {
10681917 tripleItem = menu.add(new MenuItem("Trident"));
10691918 tripleItem.addActionListener(this);
1919
+ }
10701920 }
10711921
10721922 void buildToolsMenu(Menu menu)
10731923 {
10741924 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751925 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1926
+ animationItem.setState(Globals.ANIMATION);
1927
+
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
10771930
10781931 menu.add("-");
10791932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801933 parseverticesItem.addActionListener(this);
10811934 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821935 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1936
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841937 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871938 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881939 reduceMorphItem.addActionListener(this);
10891940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901941 reduce34MorphItem.addActionListener(this);
1091
-
1092
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1093
- computeAOItem.addActionListener(this);
10941942 menu.add("-");
1095
-
10961943 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971944 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("-");
10981953 menu.add(analyzeItem = new MenuItem("Analyze"));
10991954 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
11011956 dumpItem.addActionListener(this);
11021957 // menu.add(pathItem = new MenuItem("From-to path"));
11031958 // pathItem.addActionListener(this);
....@@ -1106,6 +1961,8 @@
11061961 resetParentItem.addActionListener(this);
11071962 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081963 repairParentItem.addActionListener(this);
1964
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1965
+ repairShadowItem.addActionListener(this);
11091966 menu.add(invariantsItem = new MenuItem("Invariants"));
11101967 invariantsItem.addActionListener(this);
11111968 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1970,7 @@
11131970 menu.add("-");
11141971 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151972 editScriptItem.addActionListener(this);
1973
+ }
11161974 }
11171975
11181976 void ScreenFit()
....@@ -1235,9 +2093,34 @@
12352093 shadow.material = new cMaterial(obj.material);
12362094 shadow.material.diffuse = 0.0001f;
12372095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
12382097
12392098 makeSomething(shadow);
12402099 }
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
+ }
12412124
12422125 /**
12432126 * applyExample
....@@ -1441,9 +2324,9 @@
14412324
14422325 void Overwrite(int mask)
14432326 {
1444
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14452328 {
1446
- Object3D content = GrafreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
14472330
14482331 if (content instanceof cGroup && ((cGroup)content).transientlink )
14492332 content = ((cGroup)content).get(0);
....@@ -1466,6 +2349,7 @@
14662349 //
14672350 public void actionPerformed(ActionEvent event) // , Object arg)
14682351 {
2352
+ Object source = event.getSource();
14692353 /*
14702354 if (event.getSource() == nameField)
14712355 {
....@@ -1477,11 +2361,11 @@
14772361 }
14782362 else
14792363 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2364
+ if (source == lookAtItem || source == lookFromItem)
14812365 {
14822366 ScreenFit();
14832367 } else
1484
- if (event.getSource() == switchItem)
2368
+ if (source == switchViewItem)
14852369 {
14862370 cVector v1 = new cVector();
14872371 cVector v2 = new cVector();
....@@ -1490,11 +2374,11 @@
14902374 objEditor.cameraView.renderCamera.setAim(v2, v1);
14912375 objEditor.cameraView.repaint();
14922376 } else
1493
- if (event.getSource() == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
14942378 {
14952379 makeSomething(new Box());
14962380 } else
1497
- if (event.getSource() == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
14982382 {
14992383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15002384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +2399,9 @@
15152399 applyExample(particleGeom, "SMOKE");
15162400 makeSomething(particleGeom);
15172401 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2402
+ if (source == ragdollItem || source == ragdoll2Item)
15192403 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2404
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15212405
15222406 ragdoll.toParent = LA.newMatrix();
15232407 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +2419,7 @@
15352419 } else
15362420 /*
15372421 */
1538
- if (event.getSource() == heightFieldItem)
2422
+ if (source == heightFieldItem)
15392423 {
15402424 Object3D obj = new Object3D();
15412425
....@@ -1573,27 +2457,31 @@
15732457
15742458 makeSomething(obj);
15752459 } else
1576
- if (event.getSource() == gridItem)
2460
+ if (source == gridItem || source == gridButton)
15772461 {
15782462 makeSomething(new Grid());
15792463 } else
1580
- if (event.getSource() == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
15812465 {
15822466 makeSomething(new Sphere());
15832467 } else
1584
- if (event.getSource() == coneItem)
2468
+ if (source == coneItem || source == coneButton)
15852469 {
15862470 makeSomething(new Cone());
15872471 } else
1588
- if (event.getSource() == torusItem)
2472
+ if (source == torusItem || source == torusButton)
15892473 {
15902474 makeSomething(new Torus());
15912475 } else
1592
- if (event.getSource() == superItem)
2476
+ if (source == superItem || source == superButton)
15932477 {
15942478 makeSomething(new Superellipsoid());
15952479 } else
1596
- if (event.getSource() == blobItem)
2480
+ if (source == kleinItem || source == kleinButton)
2481
+ {
2482
+ makeSomething(new Klein());
2483
+ } else
2484
+ if (source == blobItem)
15972485 {
15982486 Blob blob = new Blob();
15992487 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +2489,15 @@
16012489 //blob.retile();
16022490 makeSomething(blob);
16032491 } else
1604
- if (event.getSource() == latheItem)
2492
+ if (source == latheItem)
16052493 {
16062494 makeSomething(new Lathe());
16072495 } else
1608
- if (event.getSource() == bezierItem)
2496
+ if (source == bezierItem)
16092497 {
16102498 makeSomething(new BezierSurface());
16112499 } else
1612
- if (event.getSource() == checkerItem)
2500
+ if (source == overlayItem || source == overlayButton)
16132501 {
16142502 /*
16152503 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +2512,7 @@
16242512 */
16252513 makeSomething(new Checker());
16262514 } else
1627
- if (event.getSource() == meshItem)
2515
+ if (source == meshItem)
16282516 {
16292517 Object3D itemtomake = new Object3D();
16302518 Object3D child;
....@@ -1645,35 +2533,52 @@
16452533 makeSomething(child);
16462534 }
16472535 } else
1648
- if (event.getSource() == springItem)
2536
+ if (source == springItem)
16492537 {
16502538 cSpring s = new cSpring();
16512539 s.setup();
16522540 makeSomething(s);
16532541 } else
1654
- if (event.getSource() == flagItem)
2542
+ if (source == flagItem)
16552543 {
16562544 cSpring s = new cFlag();
16572545 s.setup();
16582546 makeSomething(s);
16592547 } else
1660
- if (event.getSource() == lightItem)
2548
+ if (source == lightItem || source == lightButton)
16612549 {
16622550 makeSomething(new Light());
16632551 } else
1664
- 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)
16652570 {
16662571 group(new CSG());
16672572 } else
1668
- if (event.getSource() == templateItem)
2573
+ if (source == templateItem)
16692574 {
16702575 group(new cTemplate());
16712576 } else
1672
- if (event.getSource() == attributeItem)
2577
+ if (source == attributeItem)
16732578 {
16742579 makeSomething(new Attribute());
16752580 } else
1676
- if (event.getSource() == pointflowItem)
2581
+ if (source == pointflowItem)
16772582 {
16782583 makeSomething(new PointFlow());
16792584 } else
....@@ -1685,7 +2590,7 @@
16852590 } else
16862591 */
16872592
1688
- if (event.getSource() == superLoopItem)
2593
+ if (source == superLoopItem)
16892594 {
16902595 Composite g = new cGroup();
16912596 for (int i=0; i<15; i++)
....@@ -1707,30 +2612,30 @@
17072612
17082613 group(g);
17092614 } else
1710
- if (event.getSource() == loopItem)
2615
+ if (source == loopItem || source == loopButton)
17112616 {
17122617 Composite csg = new GroupLeaf();
17132618 csg.count = 5;
17142619 group(csg);
1715
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
17162621 csg.addChild(child);
17172622 child.addChild(csg);
17182623 } else
1719
- if (event.getSource() == doubleItem)
2624
+ if (source == doubleItem)
17202625 {
1721
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
17222627 csg.count = 5;
17232628 group(csg);
1724
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
17252630 csg.addChild(child);
17262631 child.addChild(csg);
1727
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
17282633 csg.addChild(child);
17292634 child.addChild(csg);
17302635 } else
1731
- if (event.getSource() == tripleItem)
2636
+ if (source == tripleItem)
17322637 {
1733
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
17342639 csg.count = 4;
17352640 group(csg);
17362641 Composite child = new cGroup();
....@@ -1743,73 +2648,105 @@
17432648 csg.addChild(child);
17442649 child.addChild(csg);
17452650 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
2651
+ if (source == computeAOItem)
17482652 {
1749
- ImportGFD();
2653
+ Globals.drawMode = CameraPane.OCCLUSION;
2654
+ cameraView.repaint();
17502655 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
2656
+ if (source == recompileItem)
17692657 {
17702658 Recompile();
17712659 refreshContents();
17722660 } else
1773
- if (event.getSource() == editScriptItem)
2661
+ if (source == editScriptItem)
17742662 {
17752663 OpenDialog();
17762664 refreshContents();
17772665 } else
1778
- if (event.getSource() == invariantsItem)
2666
+ if (source == invariantsItem)
17792667 {
17802668 System.out.println("Invariants:");
1781
- GrafreeD.theApplet3D.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
17822670 } else
1783
- if (event.getSource() == memoryItem)
2671
+ if (source == memoryItem)
17842672 {
17852673 //System.out.println("Invariants:");
17862674 PrintMemory();
17872675 } else
1788
- if (event.getSource() == pathItem)
2676
+ if (source == pathItem)
17892677 {
17902678 PrintPath();
17912679 } else
1792
- if (event.getSource() == analyzeItem)
2680
+ if (source == analyzeItem)
17932681 {
17942682 AnalyzeObject();
17952683 } else
1796
- if (event.getSource() == dumpItem)
2684
+ if (source == dumpItem)
17972685 {
17982686 DumpObject();
17992687 } else
1800
- if (event.getSource() == screenfitButton)
2688
+ if (source == minButton)
18012689 {
1802
- //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
+ {
18032742 ScreenFit();
18042743 } else
1805
- if (event.getSource() == screenfitpointButton)
2744
+ if (source == screenfitpointButton)
18062745 {
1807
- //Reload(lastConverter, lastFilename, true);
18082746 ScreenFitPoint();
18092747 } else
1810
- if (event.getSource() == snapobjectButton)
2748
+ if (source == snapobjectButton)
18112749 {
1812
- //Reload(lastConverter, lastFilename, true);
18132750 SnapObject();
18142751 } else
18152752 // if (event.getSource() == recompileButton)
....@@ -1818,13 +2755,13 @@
18182755 // Recompile();
18192756 // refreshContents();
18202757 // } else
1821
- if (event.getSource() == gcButton)
2758
+ if (source == gcButton)
18222759 {
18232760 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242761 System.gc();
18252762 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262763 } else
1827
- if (event.getSource() == editLeafItem)
2764
+ if (source == editLeafItem)
18282765 {
18292766 Object3D obj;
18302767 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,62 +2775,74 @@
18382775 }
18392776 refreshContents(true);
18402777 } else
1841
- if (event.getSource() == openWindowItem)
2778
+ if (source == openWindowItem)
18422779 {
18432780 EditSelection(true);
18442781 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2782
+ if (source == cutItem || source == clearButton)
18462783 {
18472784 loadClipboard(true);
18482785 } else
1849
- if (event.getSource() == duplicateItem)
2786
+ if (source == undoItem)
18502787 {
1851
- 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;
18522797 loadClipboard(false);
18532798 paste(false);
1854
- GrafreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
18552800 } else
1856
- if (event.getSource() == cloneItem)
2801
+ if (source == cloneItem)
18572802 {
18582803 CloneSelection(false);
18592804 } else
1860
- if (event.getSource() == cloneSupportItem)
2805
+ if (source == cloneSupportItem)
18612806 {
18622807 CloneSelection(true);
18632808 } else
1864
- if (event.getSource() == copyItem)
2809
+ if (source == copyItem)
18652810 {
18662811 loadClipboard(false);
18672812 } else
1868
- if (event.getSource() == pasteItem)
2813
+ if (source == pasteItem)
18692814 {
18702815 paste(false);
18712816 } else
1872
- if (event.getSource() == pasteLinkItem)
2817
+ if (source == pasteIntoItem)
18732818 {
1874
- pasteInto(false);
2819
+ pasteInto(true, false);
18752820 } else
1876
- if (event.getSource() == pasteCloneItem)
2821
+ if (source == pasteLinkItem)
18772822 {
1878
- pasteInto(true);
2823
+ pasteInto(false, false);
18792824 } else
1880
- if (event.getSource() == pasteExpandItem)
2825
+ if (source == pasteCloneItem)
2826
+ {
2827
+ pasteInto(true, true);
2828
+ } else
2829
+ if (source == pasteExpandItem)
18812830 {
18822831 paste(true);
18832832 } else
1884
- if (event.getSource() == synchronizeItem)
2833
+ if (source == synchronizeItem)
18852834 {
18862835 Overwrite(Object3D.TRANSFORM);
18872836 } else
1888
- if (event.getSource() == overwriteNameItem)
2837
+ if (source == overwriteNameItem)
18892838 {
18902839 Overwrite(Object3D.NAME);
18912840 } else
1892
- if (event.getSource() == overwriteUVItem)
2841
+ if (source == overwriteUVItem)
18932842 {
18942843 Overwrite(Object3D.UV);
18952844 } else
1896
- if (event.getSource() == overwriteMatItem)
2845
+ if (source == overwriteMatItem)
18972846 {
18982847 /* july 2015
18992848 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1913,7 +2862,7 @@
19132862
19142863 Overwrite(dropAttributes);
19152864 }
1916
- if (event.getSource() == overwriteGeoItem)
2865
+ if (source == overwriteGeoItem)
19172866 {
19182867 Overwrite(Object3D.GEOMETRY);
19192868 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1930,7 +2879,7 @@
19302879 // refreshContents();
19312880 // }
19322881 } else
1933
- if (event.getSource() == generateMeshItem)
2882
+ if (source == generateMeshItem)
19342883 {
19352884 //if (group.selection.size() == 1)
19362885 // for (int i=0; i<group.selection.size(); i++)
....@@ -1941,7 +2890,7 @@
19412890 ResetModel();
19422891 refreshContents();
19432892 } else
1944
- if (event.getSource() == extractGeometriesItem)
2893
+ if (source == extractGeometriesItem)
19452894 {
19462895 boolean one = false;
19472896
....@@ -1968,7 +2917,7 @@
19682917 ResetModel();
19692918 refreshContents();
19702919 } else
1971
- if (event.getSource() == cloneGeometriesItem)
2920
+ if (source == cloneGeometriesItem)
19722921 {
19732922 boolean one = false;
19742923
....@@ -1994,32 +2943,37 @@
19942943 ResetModel();
19952944 refreshContents();
19962945 } else
1997
- if (event.getSource() == shareGeometriesItem)
2946
+ if (source == shareGeometriesItem)
19982947 {
19992948 boolean one = false;
20002949
20012950 if (group.selection.size() == 1)
20022951 one = true;
20032952
2953
+ Object3D merge = null;
2954
+
20042955 Object3D content = new cGroup();
20052956
20062957 for (int i=0; i<group.selection.size(); i++)
20072958 {
2008
- Object3D sel = new Merge(group.selection.get(i));
2959
+ merge = new Merge(group.selection.get(i));
20092960
20102961 if (one)
2011
- makeSomething(sel, false);
2962
+ makeSomething(merge, false);
20122963 else
2013
- content.addChild(sel);
2964
+ content.addChild(merge);
20142965 }
20152966
20162967 if (!one)
2017
- makeSomething(content, false);
2018
-
2019
- ResetModel();
2020
- refreshContents();
2968
+ makeSomething(content, true);
2969
+ else
2970
+ {
2971
+ ResetModel();
2972
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2973
+ refreshContents();
2974
+ }
20212975 } else
2022
- if (event.getSource() == mergeGeometriesItem)
2976
+ if (source == mergeGeometriesItem)
20232977 {
20242978 boolean one = false;
20252979
....@@ -2049,7 +3003,7 @@
20493003 ResetModel();
20503004 refreshContents();
20513005 } else
2052
- if (event.getSource() == linkverticesItem)
3006
+ if (source == linkverticesItem)
20533007 {
20543008 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20553009 // {
....@@ -2062,39 +3016,48 @@
20623016 // group.selection.get(0).setMasterThis(content); // should be identity
20633017 // refreshContents();
20643018 // }
2065
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20663020 {
2067
- Object3D content = GrafreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
20683022
20693023 if (content instanceof cGroup && ((cGroup)content).transientlink )
20703024 content = ((cGroup)content).get(0);
20713025
2072
- 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));
20733027 for (int i=0; i<group.selection.size(); i++)
20743028 {
2075
- boolean random = CameraPane.RANDOM;
2076
- CameraPane.RANDOM = false; // parse all random nodes
3029
+ boolean random = CameraPane.SWITCH;
3030
+ CameraPane.SWITCH = false; // parse all random nodes
20773031 group.selection.get(i).linkVerticesThis(content);
20783032 // group.selection.get(i).setMasterThis(content); // should be identity
2079
- CameraPane.RANDOM = random;
3033
+ CameraPane.SWITCH = random;
20803034 }
2081
- 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));
20823036 refreshContents();
20833037 }
20843038 } else
2085
- if (event.getSource() == resetsupportItem)
3039
+ if (source == resetsupportItem)
20863040 {
20873041 for (int i=0; i<group.selection.size(); i++)
20883042 {
2089
- boolean random = CameraPane.RANDOM;
2090
- CameraPane.RANDOM = false; // parse all random nodes
3043
+ boolean random = CameraPane.SWITCH;
3044
+ CameraPane.SWITCH = false; // parse all random nodes
20913045 group.selection.get(i).linkVerticesThis(null);
2092
- CameraPane.RANDOM = random;
3046
+ CameraPane.SWITCH = random;
20933047 }
20943048
20953049 refreshContents();
20963050 } else
2097
- if (event.getSource() == resetreferencesItem)
3051
+ if (source == relinkverticesItem)
3052
+ {
3053
+ boolean random = CameraPane.SWITCH;
3054
+ CameraPane.SWITCH = false; // parse all random nodes
3055
+ group.selection.RelinkToSupport();
3056
+ CameraPane.SWITCH = random;
3057
+
3058
+ refreshContents();
3059
+ } else
3060
+ if (source == resetreferencesItem)
20983061 {
20993062 for (int i=0; i<group.selection.size(); i++)
21003063 {
....@@ -2103,11 +3066,11 @@
21033066
21043067 refreshContents();
21053068 } else
2106
- if (event.getSource() == setMasterItem)
3069
+ if (source == setMasterItem)
21073070 {
2108
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21093072 {
2110
- Object3D content = GrafreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
21113074
21123075 if (content instanceof cGroup && ((cGroup)content).transientlink )
21133076 content = ((cGroup)content).get(0);
....@@ -2116,13 +3079,13 @@
21163079 refreshContents();
21173080 }
21183081 } else
2119
- if (event.getSource() == poseMeshItem)
3082
+ if (source == poseMeshItem)
21203083 {
21213084 if (group.selection.size() == 1)
21223085 {
2123
- if (GrafreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
21243087 {
2125
- Object3D content = GrafreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
21263089
21273090 if (content instanceof cGroup && ((cGroup)content).transientlink )
21283091 content = ((cGroup)content).get(0);
....@@ -2135,19 +3098,19 @@
21353098 }
21363099
21373100 } else
2138
- if (event.getSource() == revertMeshItem)
3101
+ if (source == revertMeshItem)
21393102 {
21403103 RevertMeshes();
21413104 } else
2142
- if (event.getSource() == resetMeshItem)
3105
+ if (source == resetAllItem)
21433106 {
21443107 ResetAll();
21453108 } else
2146
- if (event.getSource() == stepAllItem)
3109
+ if (source == stepAllItem)
21473110 {
21483111 StepAll();
21493112 } else
2150
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
21513114 {
21523115 //int indices[] = jList.getSelectedIndices();
21533116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2155,42 +3118,46 @@
21553118
21563119 ClearSelection(false);
21573120 } else
2158
- if (event.getSource() == clearAllItem)
3121
+ if (source == clearAllItem)
21593122 {
21603123 ClearSelection(true);
21613124 } else
2162
- if (event.getSource() == grabItem)
3125
+ if (source == grabItem || source == groupButton)
21633126 {
2164
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
21653128 } else
2166
- if (event.getSource() == frontItem)
3129
+ if (source == hideItem)
3130
+ {
3131
+ group(new HiddenObject());
3132
+ } else
3133
+ if (source == frontItem)
21673134 {
21683135 front();
21693136 } else
2170
- if (event.getSource() == backItem)
3137
+ if (source == backItem)
21713138 {
21723139 back();
21733140 } else
2174
- if (event.getSource() == cameraItem)
3141
+ if (source == cameraItem)
21753142 {
21763143 makeSomething(new Camera());
21773144 } else
2178
- if (event.getSource() == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
21793146 {
21803147 group(new Composite());
21813148 } else
2182
- if (event.getSource() == randomItem)
3149
+ if (source == switchItem || source == switchButton)
21833150 {
21843151 RandomNode random = new RandomNode();
21853152 group(random);
21863153 if (random.size() > 0)
2187
- random.name = random.get(0).name + "Rnd";
3154
+ random.name = random.get(0).name + "Switch";
21883155 } else
2189
- if (event.getSource() == physicsItem)
3156
+ if (source == physicsItem)
21903157 {
21913158 group(new PhysicsNode());
21923159 } else
2193
- if (event.getSource() == frameselectorItem)
3160
+ if (source == frameselectorItem)
21943161 {
21953162 for (int i=0; i<group.selection.size(); i++)
21963163 {
....@@ -2202,7 +3169,7 @@
22023169 ResetModel();
22033170 refreshContents();
22043171 } else
2205
- if (event.getSource() == switchGeoItem)
3172
+ if (source == switchGeoItem)
22063173 {
22073174 for (int i=0; i<group.selection.size(); i++)
22083175 {
....@@ -2214,7 +3181,7 @@
22143181 ResetModel();
22153182 refreshContents();
22163183 } else
2217
- if (event.getSource() == switchTransfoItem)
3184
+ if (source == switchTransfoItem)
22183185 {
22193186 for (int i=0; i<group.selection.size(); i++)
22203187 {
....@@ -2226,7 +3193,7 @@
22263193 ResetModel();
22273194 refreshContents();
22283195 } else
2229
- if (event.getSource() == morphItem)
3196
+ if (source == morphItem)
22303197 {
22313198 for (int i=0; i<group.selection.size(); i++)
22323199 {
....@@ -2238,7 +3205,7 @@
22383205 ResetModel();
22393206 refreshContents();
22403207 } else
2241
- if (event.getSource() == scriptNodeItem)
3208
+ if (source == scriptNodeItem)
22423209 {
22433210 boolean atleastone = false;
22443211
....@@ -2277,195 +3244,252 @@
22773244 }
22783245 }
22793246 } else
2280
- if (event.getSource() == linkerItem)
3247
+ if (source == linkerItem)
22813248 {
22823249 group(new cLinker());
22833250 } else
2284
- if (event.getSource() == textureItem)
3251
+ if (source == textureItem || source == textureButton)
22853252 {
22863253 group(new TextureNode());
22873254 } else
2288
- if (event.getSource() == shadowXItem)
3255
+ if (source == billboardItem)
3256
+ {
3257
+ group(new BillboardNode());
3258
+ } else
3259
+ if (source == shadowXItem)
22893260 {
22903261 CastShadow(0);
22913262 } else
2292
- if (event.getSource() == shadowYItem)
3263
+ if (source == shadowYItem)
22933264 {
22943265 CastShadow(1);
22953266 } else
2296
- if (event.getSource() == shadowZItem)
3267
+ if (source == shadowZItem)
22973268 {
22983269 CastShadow(2);
22993270 } else
2300
- if (event.getSource() == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
23013272 {
2302
- ungroup();
3273
+ boolean hasRoot = false;
3274
+
3275
+ for (int i=0; i<group.selection.size(); i++)
3276
+ {
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
3282
+ }
3283
+
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
+ }
23033295 } else
2304
- if (event.getSource() == genUVItem)
3296
+ if (source == genUVItem)
23053297 {
23063298 GenUV();
23073299 } else
2308
- if (event.getSource() == genNormalsCADItem)
3300
+ if (source == genNormalsCADItem)
23093301 {
23103302 GenNormals(true);
23113303 } else
2312
- if (event.getSource() == genNormalsORGANItem)
3304
+ if (source == genNormalsMESHItem)
3305
+ {
3306
+ GenNormalsMESH();
3307
+ } else
3308
+ if (source == genNormalsORGANItem)
23133309 {
23143310 GenNormals(false);
23153311 } else
2316
- if (event.getSource() == stripifyItem)
3312
+ if (source == genNormalsMINEItem)
3313
+ {
3314
+ GenNormalsMINE();
3315
+ } else
3316
+ if (source == stripifyItem)
23173317 {
23183318 Stripify();
23193319 } else
2320
- if (event.getSource() == unstripifyItem)
3320
+ if (source == unstripifyItem)
23213321 {
23223322 Unstripify();
23233323 } else
2324
- if (event.getSource() == trimItem)
3324
+ if (source == trimItem)
23253325 {
23263326 Trim();
23273327 } else
2328
- if (event.getSource() == untrimItem)
3328
+ if (source == untrimItem)
23293329 {
23303330 Untrim();
23313331 } else
2332
- if (event.getSource() == clearColorsItem)
3332
+ if (source == clearColorsItem)
23333333 {
23343334 ClearColors();
23353335 } else
2336
- if (event.getSource() == clearMaterialsItem)
3336
+ if (source == clearMaterialsItem)
23373337 {
23383338 ClearMaterials();
23393339 } else
2340
- if (event.getSource() == liveleavesItem)
3340
+ if (source == liveleavesItem)
23413341 {
23423342 LiveLeaves(true);
23433343 } else
2344
- if (event.getSource() == unliveleavesItem)
3344
+ if (source == unliveleavesItem)
23453345 {
23463346 LiveLeaves(false);
23473347 } else
2348
- if (event.getSource() == supportleavesItem)
3348
+ if (source == supportleavesItem)
23493349 {
23503350 SupportLeaves(true);
23513351 } else
2352
- if (event.getSource() == unsupportleavesItem)
3352
+ if (source == unsupportleavesItem)
23533353 {
23543354 SupportLeaves(false);
23553355 } else
2356
- if (event.getSource() == hideleavesItem)
3356
+ if (source == hideleavesItem)
23573357 {
23583358 HideLeaves(true);
23593359 } else
2360
- if (event.getSource() == showleavesItem)
3360
+ if (source == showleavesItem)
23613361 {
23623362 HideLeaves(false);
23633363 } else
2364
- if (event.getSource() == markleavesItem)
3364
+ if (source == markleavesItem)
23653365 {
23663366 MarkLeaves(true);
23673367 } else
2368
- if (event.getSource() == unmarkleavesItem)
3368
+ if (source == unmarkleavesItem)
23693369 {
23703370 MarkLeaves(false);
23713371 } else
2372
- 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)
23733389 {
23743390 FlipV(true);
23753391 } else
2376
- if (event.getSource() == unflipVItem)
3392
+ if (source == unflipVItem)
23773393 {
23783394 FlipV(false);
23793395 } else
2380
- if (event.getSource() == lowTexturesItem)
3396
+ if (source == lowTexturesItem)
23813397 {
23823398 SetTexRes(0);
23833399 } else
2384
- if (event.getSource() == normalTexturesItem)
3400
+ if (source == normalTexturesItem)
23853401 {
23863402 SetTexRes(1);
23873403 } else
2388
- if (event.getSource() == highTexturesItem)
3404
+ if (source == highTexturesItem)
23893405 {
23903406 SetTexRes(2);
23913407 } else
2392
- if (event.getSource() == veryhighTexturesItem)
3408
+ if (source == veryhighTexturesItem)
23933409 {
23943410 SetTexRes(3);
23953411 } else
2396
- if (event.getSource() == maxTexturesItem)
3412
+ if (source == maxTexturesItem)
23973413 {
23983414 SetTexRes(4);
23993415 } else
2400
- if (event.getSource() == panoTexturesItem)
3416
+ if (source == panoTexturesItem)
24013417 {
24023418 SetTexRes(5);
24033419 } else
2404
- if (event.getSource() == reverseNormalsItem)
3420
+ if (source == reverseNormalsItem)
24053421 {
24063422 ReverseNormals();
24073423 } else
2408
- if (event.getSource() == parseverticesItem)
3424
+ if (source == parseverticesItem)
24093425 {
24103426 ParseVertices();
24113427 } else
2412
- if (event.getSource() == textureFieldItem)
3428
+ if (source == textureFieldItem)
24133429 {
24143430 TextureVertices();
24153431 } else
2416
- if (event.getSource() == alignItem)
3432
+ if (source == alignItem)
24173433 {
24183434 Align();
24193435 } else
2420
- if (event.getSource() == mirrorItem)
3436
+ if (source == mirrorItem)
24213437 {
24223438 MirrorPoses();
24233439 } else
2424
- if (event.getSource() == reduceMorphItem)
3440
+ if (source == reduceMorphItem)
24253441 {
24263442 MeshReduction(false);
24273443 } else
2428
- if (event.getSource() == reduce34MorphItem)
3444
+ if (source == reduce34MorphItem)
24293445 {
24303446 MeshReduction(true);
24313447 } else
2432
- if (event.getSource() == reverseTrianglesItem)
3448
+ if (source == reverseTrianglesItem)
24333449 {
24343450 ReverseTriangles();
24353451 } else
2436
- if (event.getSource() == reduceMeshItem)
3452
+ if (source == reduceMeshItem)
24373453 {
24383454 ReduceMesh(false);
24393455 } else
2440
- if (event.getSource() == reduce34MeshItem)
3456
+ if (source == reduce34MeshItem)
24413457 {
24423458 ReduceMesh(true);
24433459 } else
2444
- if (event.getSource() == increaseMeshItem)
3460
+ if (source == increaseMeshItem)
24453461 {
24463462 IncreaseMesh();
24473463 } else
2448
- if (event.getSource() == clipMeshItem)
3464
+ if (source == clipMeshItem)
24493465 {
24503466 ClipMesh();
24513467 } else
2452
- if (event.getSource() == smoothMeshItem)
3468
+ if (source == smoothMeshItem)
24533469 {
24543470 SmoothMesh();
24553471 } else
2456
- if (event.getSource() == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
24573473 {
24583474 TransformGeometry();
24593475 } else
2460
- if (event.getSource() == resetTransformItem)
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
3479
+ } else
3480
+ if (source == resetTransformItem)
24613481 {
24623482 ResetTransform();
24633483 } else
2464
- if (event.getSource() == resetCentroidItem)
3484
+ if (source == resetCentroidItem)
24653485 {
2466
- ResetCentroid();
3486
+ ResetCentroid(true);
24673487 } else
2468
- if (event.getSource() == resetParentItem)
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
3491
+ } else
3492
+ if (source == resetParentItem)
24693493 {
24703494 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24713495 {
....@@ -2475,7 +3499,7 @@
24753499
24763500 refreshContents();
24773501 } else
2478
- if (event.getSource() == repairParentItem)
3502
+ if (source == repairParentItem)
24793503 {
24803504 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24813505 {
....@@ -2489,7 +3513,21 @@
24893513
24903514 refreshContents();
24913515 } else
2492
- if (event.getSource() == sortbysizeItem)
3516
+ if (source == repairShadowItem)
3517
+ {
3518
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3519
+ {
3520
+ Object3D obj = (Object3D)e.nextElement();
3521
+ obj.RepairShadow();
3522
+// for (int i=0; i<obj.size(); i++)
3523
+// {
3524
+// obj.get(i).parent = obj;
3525
+// }
3526
+ }
3527
+
3528
+ refreshContents();
3529
+ } else
3530
+ if (source == sortbysizeItem)
24933531 {
24943532 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953533 {
....@@ -2501,7 +3539,7 @@
25013539 ResetModel();
25023540 refreshContents();
25033541 } else
2504
- if (event.getSource() == sortbynameItem)
3542
+ if (source == sortbynameItem)
25053543 {
25063544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25073545 {
....@@ -2513,7 +3551,7 @@
25133551 ResetModel();
25143552 refreshContents();
25153553 } else
2516
- if (event.getSource() == attachPigmentItem)
3554
+ if (source == attachPigmentItem)
25173555 {
25183556 String texture = GetFile("Attach pigment");
25193557 Object3D obj;
....@@ -2525,7 +3563,7 @@
25253563
25263564 refreshContents();
25273565 } else
2528
- if (event.getSource() == detachPigmentItem)
3566
+ if (source == detachPigmentItem)
25293567 {
25303568 Object3D obj;
25313569 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2536,7 +3574,7 @@
25363574
25373575 refreshContents();
25383576 } else
2539
- if (event.getSource() == attachBumpItem)
3577
+ if (source == attachBumpItem)
25403578 {
25413579 String texture = GetFile("Attach bump");
25423580 Object3D obj;
....@@ -2548,18 +3586,18 @@
25483586
25493587 refreshContents();
25503588 } else
2551
- if (event.getSource() == detachBumpItem)
3589
+ if (source == detachBumpItem)
25523590 {
25533591 Object3D obj;
25543592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25553593 {
25563594 obj = (Object3D)e.nextElement();
2557
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
25583596 }
25593597
25603598 refreshContents();
25613599 } else
2562
- if (event.getSource() == pigmentBumpItem)
3600
+ if (source == pigmentBumpItem)
25633601 {
25643602 Object3D obj;
25653603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2570,158 +3608,262 @@
25703608
25713609 refreshContents();
25723610 } else
2573
- 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)
25743637 {
25753638 CameraPane.flash = true;
25763639 refreshContents();
25773640 } else
2578
- if (event.getSource() == oneButton)
3641
+ if (source == oneButton)
25793642 {
25803643 } else
2581
- if (event.getSource() == twoButton)
3644
+ if (source == twoButton)
25823645 {
25833646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
25843651 // bug
25853652 //gridPanel.setDividerLocation(1.0);
25863653 //bigPanel.setDividerLocation(0.0);
2587
- bigThree.remove(jtp);
2588
- bigThree.remove(cameraPanel);
2589
- bigThree.remove(XYZPanel);
2590
- aWindowConstraints.gridx = 0;
2591
- aWindowConstraints.gridy = 0;
2592
- aWindowConstraints.gridwidth = 1;
2593
- // aConstraints.gridheight = 3;
2594
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2595
- aWindowConstraints.weightx = 0;
2596
- aWindowConstraints.weighty = 1;
2597
- //bigThree.add(jtp, aWindowConstraints);
2598
- aWindowConstraints.weightx = 1;
2599
- aWindowConstraints.gridwidth = 3;
2600
- // aConstraints.gridheight = 3;
2601
- aWindowConstraints.gridx = 1;
2602
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2603
- bigThree.add(cameraPanel, aWindowConstraints);
2604
- aWindowConstraints.weightx = 0;
2605
- aWindowConstraints.gridx = 4;
2606
- aWindowConstraints.gridwidth = 1;
2607
- // aConstraints.gridheight = 3;
2608
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2609
- //bigThree.add(XYZPanel, aWindowConstraints);
2610
- 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
+
26113701 } else
2612
- if (event.getSource() == threeButton)
3702
+ if (source == threeButton)
26133703 {
26143704 radio.layout = threeButton;
2615
- bigThree.remove(jtp);
2616
- bigThree.remove(cameraPanel);
2617
- bigThree.remove(XYZPanel);
2618
- aWindowConstraints.gridx = 0;
2619
- aWindowConstraints.gridy = 0;
2620
- aWindowConstraints.gridwidth = 1;
2621
- // aConstraints.gridheight = 3;
2622
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2623
- aWindowConstraints.weightx = 0;
2624
- aWindowConstraints.weighty = 1;
2625
- //bigThree.add(jtp, aWindowConstraints);
2626
- aWindowConstraints.weightx = 1;
2627
- aWindowConstraints.gridwidth = 3;
2628
- // aConstraints.gridheight = 3;
2629
- aWindowConstraints.gridx = 1;
2630
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2631
- bigThree.add(cameraPanel, aWindowConstraints);
2632
- aWindowConstraints.weightx = 0;
2633
- aWindowConstraints.gridx = 4;
2634
- aWindowConstraints.gridwidth = 1;
2635
- // aConstraints.gridheight = 3;
2636
- aConstraints.fill = GridBagConstraints.VERTICAL;
2637
- bigThree.add(XYZPanel, aWindowConstraints);
2638
- 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();
26393742 } else
2640
- if (event.getSource() == fourButton)
3743
+ if (source == fourButton)
26413744 {
26423745 radio.layout = fourButton;
2643
- bigThree.remove(jtp);
2644
- bigThree.remove(cameraPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aWindowConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2651
- aWindowConstraints.weightx = 1;
2652
- aWindowConstraints.weighty = 1;
2653
- bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- //bigThree.add(cameraPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aWindowConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- 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();
26673782 } else
2668
- if (event.getSource() == sixButton)
3783
+ if (source == sixButton)
26693784 {
26703785 radio.layout = sixButton;
2671
- bigThree.remove(jtp);
2672
- bigThree.remove(cameraPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aWindowConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(cameraPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aWindowConstraints.gridheight = 3;
2692
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2693
- //bigThree.add(XYZPanel, aConstraints);
2694
- 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();
26953823 } else
2696
- if (event.getSource() == sevenButton)
3824
+ if (source == sevenButton)
26973825 {
26983826 radio.layout = sevenButton;
2699
- bigThree.remove(jtp);
2700
- bigThree.remove(cameraPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2707
- aWindowConstraints.weightx = 0;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(jtp, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aWindowConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- bigThree.add(XYZPanel, aWindowConstraints);
2722
- 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();
27233865 } else
2724
- if (event.getSource() == rootButton)
3866
+ if (source == rootButton)
27253867 {
27263868 Object3D obj;
27273869 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2731,66 +3873,85 @@
27313873 EditObject(obj);
27323874 }
27333875
3876
+ cameraView.requestFocusInWindow();
27343877 refreshContents(true);
27353878 } else
2736
- if (event.getSource() == closeButton)
3879
+ if (source == closeButton)
27373880 {
27383881 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27393882 cRadio ab;
27403883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27413884 {
27423885 ab = (cRadio)e.nextElement();
2743
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27443887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
27453894 buttonGroup.remove(ab);
27463895 radioPanel.remove(ab);
27473896
2748
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
27493899 // ab.GetObject().objectUI = null; // ?????????
27503900
27513901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27523902 break;
27533903 }
27543904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
27553907 refreshContents(true);
27563908 } else
2757
- if (event.getSource() == editItem || event.getSource() == editButton)
3909
+ if (source == editItem || source == editButton)
27583910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
27593917 EditSelection(false);
27603918 } else
2761
- if (event.getSource() == uneditButton)
3919
+ if (source == uneditButton)
27623920 {
27633921 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27643922 {
27653923 Object3D child = (Object3D)e.nextElement();
27663924 if(child.editWindow != null)
2767
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
27683926 child.CloseUI();
27693927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27703929
2771
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
27723931 }
2773
- objEditor.ctrlPanel.revalidate();
3932
+ objEditor.ctrlPanel.FlushUI();
27743933 //objEditor.jTree.clearSelection();
27753934 //objEditor.ResetSliders();
27763935 refreshContents(true);
27773936 } else
2778
- if (event.getSource() == clearPanelButton)
3937
+ if (source == clearPanelButton)
27793938 {
27803939 assert(copy == group);
27813940 //copy.ClearUI();
27823941 for (Object3D obj : listUI)
27833942 {
3943
+ obj.pinned = false;
27843944 obj.CloseUI();
27853945 }
27863946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
27873948 refreshContents(true);
27883949 } else
2789
- if (event.getSource() == allParamsButton)
3950
+ if (source == allParamsButton)
27903951 {
27913952 assert(copy == group);
27923953
2793
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27943955
27953956 for (Object3D obj : listUI)
27963957 {
....@@ -2807,19 +3968,19 @@
28073968
28083969 refreshContents(true);
28093970 } else
2810
- if (event.getSource() == unselectButton)
3971
+ if (source == unselectButton)
28113972 {
28123973 objEditor.jTree.clearSelection();
28133974 // ?? oct 2012 GrafreeD.clipboard.clear();
28143975 objEditor.ResetSliders();
28153976 refreshContents(true);
28163977 } else
2817
- if(event.getSource() instanceof cRadio)
3978
+ if(source instanceof cRadio)
28183979 {
28193980 group.parent = keepparent;
28203981 group.attributes = 0;
28213982 //group.editWindow = null;
2822
- /*cRadio*/ radio = (cRadio)event.getSource();
3983
+ /*cRadio*/ radio = (cRadio)source;
28233984 Object3D obj = radio.GetObject();
28243985 System.out.println("Edit " + obj);
28253986 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2839,7 +4000,10 @@
28394000 }
28404001
28414002 copy = group;
2842
- //CameraPane.theRenderer.object = group;
4003
+
4004
+ SetUndoStates();
4005
+
4006
+ //Globals.theRenderer.object = group;
28434007 if(!useclient)
28444008 {
28454009 cameraView.renderCamera = radio.camera;
....@@ -2848,25 +4012,55 @@
28484012 cameraView.cameras[cameraView.cameracount] = radio.camera;
28494013 cameraView.targetLookAt.set(radio.camera.lookAt);
28504014 cameraView.object = group;
2851
- cameraView.lighttouched = true;
4015
+ //cameraView.lighttouched = true;
4016
+ Globals.lighttouched = true;
28524017 topView.object = group;
28534018 frontView.object = group;
28544019 sideView.object = group;
28554020 }
2856
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
28574026 /*
28584027 currentLayout = radio.layout;
28594028 if (currentLayout == null)
28604029 currentLayout = sevenButton;
28614030 */
28624031 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);
28634040 keepparent = group.parent;
28644041 // PARENT = NULL or not???
28654042 //group.parent = null; // ROOT
28664043 //group.attributes = -1;
28674044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
28684047 refreshContents(true);
2869
- }
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
+ }
28704064 else
28714065 {
28724066 //return super.action(event, arg);
....@@ -2875,7 +4069,6 @@
28754069 }
28764070
28774071 boolean useclient = false;
2878
- cRadio radio;
28794072
28804073 void ToggleRoot()
28814074 {
....@@ -2884,7 +4077,7 @@
28844077 if (useclient)
28854078 {
28864079 cameraView.object = client;
2887
- cameraView.lighttouched = true;
4080
+ Globals.lighttouched = true;
28884081 //topView.object = client;
28894082 //frontView.object = client;
28904083 //sideView.object = client;
....@@ -2892,7 +4085,7 @@
28924085 else
28934086 {
28944087 cameraView.object = group;
2895
- cameraView.lighttouched = true;
4088
+ Globals.lighttouched = true;
28964089 //topView.object = group;
28974090 //frontView.object = group;
28984091 //sideView.object = group;
....@@ -2927,6 +4120,28 @@
29274120 refreshContents();
29284121 }
29294122
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
+ }
29304145
29314146 void ResetTransform()
29324147 {
....@@ -3039,7 +4254,7 @@
30394254 refreshContents();
30404255 }
30414256
3042
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
30434258 {
30444259 Object3D obj;
30454260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3054,12 +4269,16 @@
30544269 LA.matIdentity(Object3D.mat);
30554270 obj.getBounds(minima, maxima, false);
30564271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30584274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30594275 obj.TransformMesh(Object3D.mat);
4276
+
30604277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3061
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30624280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
30634282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30644283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30654284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3088,7 +4307,8 @@
30884307
30894308 int size = obj.MemorySize();
30904309
3091
- 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)");
30924312 }
30934313 }
30944314 catch (Exception e)
....@@ -3125,9 +4345,9 @@
31254345 obj = (Object3D)e.nextElement();
31264346
31274347 System.out.println("Object is: " + obj);
3128
- GrafreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
31294349 System.out.println("Boundary rep: " + obj.bRep);
3130
- GrafreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
31314351
31324352 // System.err.println((size/1024) + " KB is the size of " + obj);
31334353 }
....@@ -3169,6 +4389,20 @@
31694389 void GenNormals(boolean crease)
31704390 {
31714391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
4399
+
4400
+ refreshContents();
4401
+ }
4402
+
4403
+ void GenNormalsMINE()
4404
+ {
4405
+ group.selection.GenNormalsMINE();
31724406
31734407 refreshContents();
31744408 }
....@@ -3334,8 +4568,8 @@
33344568
33354569 void ParseVertices()
33364570 {
3337
- boolean epsequal = GrafreeD.epsequal;
3338
- GrafreeD.epsequal = true;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
33394573
33404574 for (int i=0; i<group.selection.size(); i++)
33414575 {
....@@ -3360,7 +4594,7 @@
33604594 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33614595 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33624596
3363
- g.add(GrafreeD.clipboard);
4597
+ g.add(Grafreed.clipboard);
33644598
33654599 buffer.add(g);
33664600 }
....@@ -3375,7 +4609,7 @@
33754609 makeSomething(buffer, i==group.selection.size()-1);
33764610 }
33774611
3378
- GrafreeD.epsequal = epsequal;
4612
+ Grafreed.epsequal = epsequal;
33794613
33804614 refreshContents();
33814615 }
....@@ -3393,7 +4627,16 @@
33934627 String pigment = Object3D.GetPigment(tex);
33944628 //String bump = Object3D.GetBump(tex);
33954629
3396
- 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
+ }
33974640
33984641 double s = v.s;
33994642
....@@ -3441,12 +4684,26 @@
34414684
34424685 void Align()
34434686 {
4687
+ if (group.selection.size() == 0)
4688
+ return;
4689
+
4690
+ cVector bbmin = new cVector();
4691
+ cVector bbmax = new cVector();
4692
+
4693
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4694
+
4695
+ double dx = bbmax.x - bbmin.x;
4696
+ double dy = bbmax.y - bbmin.y;
4697
+ double dz = bbmax.z - bbmin.z;
4698
+
4699
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4700
+
34444701 for (int i=0; i<group.selection.size(); i++)
34454702 {
34464703 Object3D obj = group.selection.get(i);
34474704
3448
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3449
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4705
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4706
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34504707 }
34514708
34524709 refreshContents();
....@@ -3467,11 +4724,11 @@
34674724
34684725 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34694726
3470
- boolean random = CameraPane.RANDOM;
3471
- CameraPane.RANDOM = false; // parse all random nodes
4727
+ boolean random = CameraPane.SWITCH;
4728
+ CameraPane.SWITCH = false; // parse all random nodes
34724729 lowres.linkVerticesThis(null);
34734730 lowres.linkVerticesThis(sn);
3474
- CameraPane.RANDOM = random;
4731
+ CameraPane.SWITCH = random;
34754732
34764733 System.err.flush();
34774734
....@@ -3511,7 +4768,7 @@
35114768 return;
35124769
35134770 Object3D poses = group.selection.get(0);
3514
- Object3D ref = GrafreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
35154772
35164773 Object3D newgroup = new Object3D("Po:" + poses.name);
35174774
....@@ -3680,7 +4937,7 @@
36804937 group.selection.RelinkToSupport(); // july 2014
36814938 System.out.println("DONE.");
36824939 refreshContents();
3683
- 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));
36844941 }
36854942
36864943 void ReduceMesh(boolean reduction34)
....@@ -3705,9 +4962,9 @@
37054962
37064963 void ClipMesh()
37074964 {
3708
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37094966 {
3710
- Object3D content = GrafreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
37114968
37124969 if (content instanceof cGroup && ((cGroup)content).transientlink )
37134970 content = ((cGroup)content).get(0);
....@@ -3716,7 +4973,7 @@
37164973 // {
37174974 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37184975 // }
3719
- group.selection.ClipMesh(GrafreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
37204977 }
37214978 // group.selection.ClipMesh(GrafreeD.clipboard);
37224979 System.out.println("DONE.");
....@@ -3763,6 +5020,18 @@
37635020 void MarkLeaves(boolean hide)
37645021 {
37655022 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);
37665035 refreshContents();
37675036 }
37685037
....@@ -3837,28 +5106,25 @@
38375106 // }
38385107 // }
38395108
3840
- static boolean allparams = true;
3841
-
3842
- static Vector<Object3D> listUI = new Vector<Object3D>();
3843
-
38445109 void EditSelection(boolean newWindow)
38455110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
38465117 // aConstraints.gridy = 0;
38475118 for (int i=0; i<group.selection.size(); i++)
38485119 {
38495120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38505121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3851
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38525123
38535124 Object3D elem = (Object3D)group.selection.elementAt(i);
3854
- if(elem != group)
5125
+ if(elem != group || !newWindow)
38555126 {
3856
- // if (!(elem instanceof Composite))
3857
- // newWindow = false;
3858
- listUI.add(elem);
3859
- elem.openEditWindow(this, newWindow); //, false);
3860
- System.out.println("edit : " + elem);
3861
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
38625128 }
38635129 }
38645130 }
....@@ -3921,9 +5187,7 @@
39215187
39225188 freezemodel = false;
39235189 }
3924
-
3925
- boolean flashIt = true;
3926
-
5190
+
39275191 public void valueChanged(TreeSelectionEvent e)
39285192 //public boolean handleEvent(Event event)
39295193 {
....@@ -3933,7 +5197,8 @@
39335197 //new Exception().printStackTrace();
39345198
39355199 freezemodel = true;
3936
-
5200
+ ClearUnpinned();
5201
+
39375202 /**/
39385203 //switch (event.id)
39395204 {
....@@ -3941,7 +5206,6 @@
39415206 //case 702: // Event.LIST_DESELECT
39425207 group.deselectAll();
39435208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3944
- objEditor.ClearInfo(); // .GetMaterial());
39455209 if (tps != null)
39465210 {
39475211 for (int i=0; i < tps.length; i++)
....@@ -3950,33 +5214,39 @@
39505214
39515215 //if (child.parent != null)
39525216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
39535218 group.addSelectee(child);
3954
- objEditor.SetMaterial(child); // .GetMaterial());
3955
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3956
- System.err.println("info : " + child.GetPath());
39575219 }
39585220 }
3959
- else
3960
- {
3961
- objEditor.SetMaterial(group); // .GetMaterial());
3962
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3963
- System.err.println("info : " + group.GetPath());
3964
- }
5221
+// else
5222
+// {
5223
+// objEditor.SetMaterial(group); // .GetMaterial());
5224
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5225
+// System.err.println("info : " + group.GetPath());
5226
+// }
39655227
3966
- objEditor.SetText(); // jan 2014
3967
-
3968
- 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))
39695229 CameraPane.flash = true;
39705230
3971
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39725232 // a camera
39735233 {
3974
- CameraPane.camerachangeframe = 0; // don't refuse it
3975
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3976
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3977
- // 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;
39785241 }
39795242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
39805250 refreshContents();
39815251 //return true;
39825252 }
....@@ -3985,6 +5255,37 @@
39855255
39865256 freezemodel = false;
39875257 }
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
+ }
39885289
39895290 void linkSomething(Object3D thing)
39905291 {
....@@ -4056,16 +5357,19 @@
40565357 {
40575358 if (group.selection.isEmpty())
40585359 return;
4059
- GrafreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
40605362 Composite tGroup = null;
40615363 if (group.selection.size() > 0) // 1)
40625364 {
40635365 tGroup = new cGroup();
4064
- GrafreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
40655367 }
40665368
40675369 if (cut)
40685370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
40695373 //int indices[] = jList.getSelectedIndices();
40705374 //for (int i = indices.length - 1; i >= 0; i--)
40715375 //jList.remove(indices[i]);
....@@ -4101,16 +5405,16 @@
41015405 //System.out.println("cut " + child);
41025406 //System.out.println("parent = " + child.parent);
41035407 // tmp.addChild(child);
4104
- if (GrafreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
41055409 tGroup.add/*Child*/(tmp);
41065410 else
4107
- GrafreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
41085412 }
41095413 else
4110
- if (GrafreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
41115415 tGroup.add/*Child*/(child);
41125416 else
4113
- GrafreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
41145418 }
41155419
41165420 //ResetModel();
....@@ -4142,21 +5446,23 @@
41425446 //System.out.println("cut " + elem);
41435447 //System.out.println("parent = " + elem.parent);
41445448 // tmp.addChild(elem);
4145
- if (GrafreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
41465450 tGroup.add/*Child*/(tmp);
41475451 else
4148
- GrafreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
41495453 }
41505454 else
4151
- if (GrafreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
41525456 tGroup.add/*Child*/(child);
41535457 else
4154
- GrafreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
41555459 }
41565460
41575461 }
4158
- if (GrafreeD.clipboardIsTempGroup)
4159
- GrafreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
41605466 if (cut)
41615467 {
41625468 ResetModel();
....@@ -4166,11 +5472,15 @@
41665472
41675473 void paste(boolean expand)
41685474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
41695479 // if (GrafreeD.clipboard == null)
41705480 // return;
41715481 boolean first = true;
41725482
4173
- if (GrafreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
41745484 {
41755485 Composite temp;
41765486
....@@ -4181,7 +5491,7 @@
41815491 temp = (Composite)Applet3D.clipboard.deepCopy();
41825492 */
41835493 Object3D elem;
4184
- 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))
41855495 {
41865496 Object3D child = (Object3D)e.nextElement();
41875497
....@@ -4215,21 +5525,22 @@
42155525 //Object3D cb = Applet3D.clipboard;
42165526 //temp.addChild(cb);
42175527 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4218
- assert(GrafreeD.clipboard.parent == null);
4219
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4220
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4221
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4222
- 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());
42235533 else
4224
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4225
- GrafreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
42265536 }
42275537
5538
+ Globals.REPLACEONMAKE = keep;
42285539 ResetModel();
42295540 refreshContents();
42305541 }
42315542
4232
- void pasteInto(boolean copyit)
5543
+ void pasteInto(boolean copyit, boolean clone)
42335544 {
42345545 // if (GrafreeD.clipboard == null)
42355546 // return;
....@@ -4258,15 +5569,22 @@
42585569 if (copyit)
42595570 {
42605571 // paste(false);
4261
- CloneClipboard(false); // sept 2014
5572
+ if (clone)
5573
+ {
5574
+ CloneClipboard(false); // sept 2014
5575
+ }
5576
+ else
5577
+ {
5578
+ paste(false);
5579
+ }
42625580 }
42635581 else
42645582 {
42655583 boolean first = true;
42665584
4267
- if (GrafreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
42685586 {
4269
- Composite temp = (Composite)GrafreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
42705588 Object3D copy;
42715589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42725590 {
....@@ -4276,7 +5594,7 @@
42765594 }
42775595 } else
42785596 {
4279
- linkSomething(GrafreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
42805598 }
42815599 }
42825600 }
....@@ -4353,6 +5671,10 @@
43535671
43545672 void group(Object3D csg, boolean grab)
43555673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
43565678 if (//false) // why??
43575679 !group.selection.isEmpty())
43585680 {
....@@ -4466,8 +5788,34 @@
44665788 //node.add(csg);
44675789 //makeSomething(node);
44685790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
44695792 }
44705793
5794
+ void Ungroup(Object3D g)
5795
+ {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
5800
+ if (g instanceof HiddenObject)
5801
+ {
5802
+ HiddenObject h = (HiddenObject) g;
5803
+
5804
+ for (int i=0; i<h.ActualSize(); i++)
5805
+ {
5806
+ objEditor.makeSomething(h.get(i), false);
5807
+ }
5808
+ }
5809
+ else
5810
+ {
5811
+ for (int i=0; i<g.Size(); i++)
5812
+ {
5813
+ objEditor.makeSomething(g.get(i), false);
5814
+ }
5815
+ }
5816
+ Globals.REPLACEONMAKE = keep;
5817
+ }
5818
+
44715819 void ungroup()
44725820 {
44735821 /*
....@@ -4661,21 +6009,6 @@
46616009 }
46626010 */
46636011
4664
- void ImportGFD()
4665
- {
4666
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4667
- browser.show();
4668
- String filename = browser.getFile();
4669
- if (filename != null && filename.length() > 0)
4670
- {
4671
- String fullname = browser.getDirectory() + filename;
4672
-
4673
- //Object3D readobj =
4674
- objEditor.ReadGFD(fullname, objEditor);
4675
- //makeSomething(readobj);
4676
- }
4677
- }
4678
-
46796012 /*
46806013 public void Callback(Object obj)
46816014 {
....@@ -4699,26 +6032,9 @@
46996032 }
47006033 */
47016034
4702
- void ImportVRMLX3D()
4703
- {
4704
- if (GrafreeD.standAlone)
4705
- {
4706
- /**/
4707
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4708
- browser.show();
4709
- String filename = browser.getFile();
4710
- if (filename != null && filename.length() > 0)
4711
- {
4712
- String fullname = browser.getDirectory() + filename;
4713
- LoadVRMLX3D(fullname);
4714
- }
4715
- /**/
4716
- }
4717
- }
4718
-
47196035 String GetFile(String dialogName)
47206036 {
4721
- if (GrafreeD.standAlone)
6037
+ if (Grafreed.standAlone)
47226038 {
47236039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47246040 browser.show();
....@@ -4782,10 +6098,48 @@
47826098 cButton flashSelectionButton;
47836099 cButton editButton;
47846100 cButton uneditButton;
6101
+ JCheckBox allParamsButton;
47856102 cButton clearpanelButton;
4786
- cButton allParamsButton;
47876103 cButton unselectButton;
47886104
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
+
47896143 cButton screenfitButton;
47906144 cButton screenfitpointButton;
47916145 cButton snapobjectButton;
....@@ -4797,14 +6151,6 @@
47976151
47986152 cButton setsupportButton;
47996153
4800
- cButton twoButton;
4801
- cButton sixButton;
4802
- cButton threeButton;
4803
- cButton sevenButton;
4804
- cButton fourButton; // full panel
4805
- cButton oneButton; // full XYZ
4806
- //cButton currentLayout;
4807
-
48086154 //
48096155 //Composite
48106156 Object3D // to do !!
....@@ -4814,9 +6160,11 @@
48146160 //JTree jTree;
48156161 private MenuItem lookAtItem;
48166162 private MenuItem lookFromItem;
4817
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
48186164 private MenuItem cutItem;
4819
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
48206168 private MenuItem cloneItem;
48216169 private MenuItem cloneSupportItem;
48226170 private MenuItem overwriteGeoItem;
....@@ -4827,8 +6175,9 @@
48276175 private MenuItem resetsupportItem;
48286176 private MenuItem resetreferencesItem;
48296177 private MenuItem linkverticesItem;
6178
+ private MenuItem relinkverticesItem;
48306179 private MenuItem setMasterItem;
4831
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
48326181 private MenuItem stepAllItem;
48336182 private MenuItem revertMeshItem;
48346183 private MenuItem poseMeshItem;
....@@ -4839,14 +6188,17 @@
48396188 private MenuItem mergeGeometriesItem;
48406189 private MenuItem copyItem;
48416190 private MenuItem pasteItem;
6191
+ private MenuItem pasteIntoItem;
48426192 private MenuItem pasteLinkItem;
48436193 private MenuItem pasteCloneItem;
48446194 private MenuItem pasteExpandItem;
4845
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
48466196 private MenuItem clearAllItem;
48476197 private MenuItem genUVItem;
6198
+ private MenuItem genNormalsMESHItem;
48486199 private MenuItem genNormalsCADItem;
48496200 private MenuItem genNormalsORGANItem;
6201
+ private MenuItem genNormalsMINEItem;
48506202 private MenuItem stripifyItem;
48516203 private MenuItem unstripifyItem;
48526204 private MenuItem trimItem;
....@@ -4875,6 +6227,10 @@
48756227 private MenuItem showleavesItem;
48766228 private MenuItem markleavesItem;
48776229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
48786234
48796235 private MenuItem flipVItem;
48806236 private MenuItem unflipVItem;
....@@ -4886,14 +6242,17 @@
48866242 private MenuItem panoTexturesItem;
48876243
48886244 private MenuItem resetCentroidItem;
4889
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
48906246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
6249
+ private MenuItem hideItem;
48916250 private MenuItem grabItem;
48926251 private MenuItem backItem;
48936252 private MenuItem frontItem;
48946253 private MenuItem cameraItem;
48956254 private MenuItem compositeItem;
4896
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
48976256 private MenuItem physicsItem;
48986257 private MenuItem frameselectorItem;
48996258 private MenuItem scriptNodeItem;
....@@ -4908,6 +6267,7 @@
49086267
49096268 private MenuItem resetParentItem;
49106269 private MenuItem repairParentItem;
6270
+ private MenuItem repairShadowItem;
49116271 private MenuItem sortbysizeItem;
49126272 private MenuItem sortbynameItem;
49136273
....@@ -4916,6 +6276,8 @@
49166276 private MenuItem attachBumpItem;
49176277 private MenuItem detachBumpItem;
49186278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
49196281
49206282 private MenuItem particleItem;
49216283 private MenuItem ragdollItem;
....@@ -4928,10 +6290,11 @@
49286290 private MenuItem coneItem;
49296291 private MenuItem torusItem;
49306292 private MenuItem superItem;
6293
+ private MenuItem kleinItem;
49316294 private MenuItem blobItem;
49326295 private MenuItem latheItem;
49336296 private MenuItem bezierItem;
4934
- private MenuItem checkerItem;
6297
+ private MenuItem overlayItem;
49356298 private MenuItem meshItem;
49366299 // private MenuItem meshGroupItem;
49376300 private MenuItem springItem;
....@@ -4940,6 +6303,7 @@
49406303 private MenuItem csgItem;
49416304 private MenuItem templateItem;
49426305 private MenuItem textureItem;
6306
+ private MenuItem billboardItem;
49436307 private MenuItem shadowXItem;
49446308 private MenuItem shadowYItem;
49456309 private MenuItem shadowZItem;
....@@ -4952,11 +6316,6 @@
49526316 private MenuItem doubleItem;
49536317 private MenuItem tripleItem;
49546318
4955
- private MenuItem importGFDItem;
4956
- private MenuItem importVRMLX3DItem;
4957
- private MenuItem import3DSItem;
4958
- private MenuItem importOBJItem;
4959
-
49606319 private MenuItem computeAOItem;
49616320 private MenuItem recompileItem;
49626321 private MenuItem editScriptItem;
....@@ -4966,4 +6325,8 @@
49666325 private MenuItem analyzeItem;
49676326 private MenuItem dumpItem;
49686327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
49696332 }