Normand Briere
2019-08-06 4ec7130da08861dc4aff0232dbce38f3471696a4
GroupEditor.java
....@@ -12,6 +12,7 @@
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,
....@@ -22,6 +23,302 @@
2223 DragGestureListener, DragSourceListener, DropTargetListener,
2324 ItemListener // ListSelectionListener
2425 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("penguins", "yonder", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
25322 //ObjEditor objEditor;
26323 public void closeUI2()
27324 {
....@@ -59,6 +356,12 @@
59356 this.copy = this.group = group;
60357 //selectees = this.group.selectees;
61358
359
+ if (copy.versionlist == null)
360
+ {
361
+ copy.versionlist = new Object3D[100];
362
+ copy.versionindex = -1;
363
+ }
364
+
62365 if(ui)
63366 SetupUI(objEditor);
64367 }
....@@ -73,16 +376,28 @@
73376 this.copy = this.group = copy;
74377 //selectees = this.group.selectees;
75378
76
- SetupMenu2(objEditor);
379
+ SetupMenu2(this); //objEditor);
77380 SetupUI2(objEditor);
78381 objEditor.SetupUI(true);
79382 SetupViews(objEditor);
80383
81384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versionlist == null)
387
+ {
388
+ copy.versionlist = new Object3D[100];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
82393 }
83394
84395 void CloneSelection(boolean supports)
85396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
86401 // Object3D keep = GrafreeD.clipboard;
87402 //Object3D obj;
88403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +408,19 @@
93408
94409 makeSomething(clone, i==group.selection.size()-1);
95410 }
411
+ Globals.REPLACEONMAKE = keep;
96412 }
97413
98414 void CloneClipboard(boolean supports)
99415 {
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));
416
+ assert(Grafreed.clipboard.parent == null);
417
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
418
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
419
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
420
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105421 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
422
+ makeSomething(CloneObject(Grafreed.clipboard, false));
423
+ Grafreed.clipboard.get(0).parent = keepparent;
108424 }
109425
110426 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +434,7 @@
118434 // obj.support = null;
119435 if (!supports)
120436 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
437
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122438 obj.parent = parent;
123439 // obj.support = support;
124440 // clone.support = support; // aout 2013
....@@ -147,30 +463,29 @@
147463
148464 //JTextField nameField;
149465
150
- void SetupMenu2(ObjEditor oe)
466
+ void SetupMenu2(GroupEditor oe)
151467 {
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);
468
+ oe.jTree = new cTree();
469
+
163470 Menu menu;
164471 oe.menuBar.add(menu = new Menu("Edit"));
165472 //editItem = menu.add(new MenuItem("Edit"));
166473 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
474
+
475
+// undoItem = menu.add(new MenuItem("Undo"));
476
+// undoItem.addActionListener(this);
477
+// redoItem = menu.add(new MenuItem("Redo"));
478
+// redoItem.addActionListener(this);
479
+// menu.add("-");
480
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168481 duplicateItem.addActionListener(this);
169
- menu.add("-");
170482 cloneItem = menu.add(new MenuItem("Clone"));
171483 cloneItem.addActionListener(this);
484
+ if (Globals.ADVANCED)
485
+ {
172486 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173487 cloneSupportItem.addActionListener(this);
488
+ }
174489 menu.add("-");
175490 cutItem = menu.add(new MenuItem("Cut"));
176491 cutItem.addActionListener(this);
....@@ -178,27 +493,123 @@
178493 copyItem.addActionListener(this);
179494 pasteItem = menu.add(new MenuItem("Paste"));
180495 pasteItem.addActionListener(this);
496
+
497
+ menu.add("-");
498
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
499
+ pasteIntoItem.addActionListener(this);
181500 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182501 pasteLinkItem.addActionListener(this);
183502 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184503 pasteCloneItem.addActionListener(this);
185504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186505 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
506
+ menu.add("-");
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
509
+
510
+ if (Globals.ADVANCED)
511
+ {
512
+ // Deletes the cameras...
189513 clearAllItem = menu.add(new MenuItem("Clear All"));
190514 clearAllItem.addActionListener(this);
515
+ }
516
+
517
+ menuBar.add(cameraMenu = new Menu("View"));
518
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
519
+ //zBufferItem.addActionListener(this);
520
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
521
+ //normalLensItem.addActionListener(this);
522
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
523
+ restoreCameraItem.addActionListener(this);
524
+
525
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
526
+// toggleFullScreenItem.addItemListener(this);
527
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
528
+// cameraMenu.add("-");
529
+//
530
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
531
+// toggleTextureItem.addItemListener(this);
532
+// toggleTextureItem.setState(CameraPane.textureon);
533
+//
534
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
535
+// toggleSwitchItem.addItemListener(this);
536
+// toggleSwitchItem.setState(CameraPane.SWITCH);
537
+
538
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
539
+ toggleHandleItem.addItemListener(this);
540
+ toggleHandleItem.setState(CameraPane.HANDLES);
541
+
542
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
543
+ togglePaintItem.addItemListener(this);
544
+ togglePaintItem.setState(CameraPane.PAINTMODE);
545
+
546
+ if (Globals.ADVANCED)
547
+ {
548
+ cameraMenu.add("-");
549
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
550
+ toggleLiveItem.addItemListener(this);
551
+ toggleLiveItem.setState(Globals.isLIVE());
191552
553
+ cameraMenu.add(stepItem = new MenuItem("Step"));
554
+ stepItem.addActionListener(this);
555
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
556
+ // toggleDLItem.addItemListener(this);
557
+ // toggleDLItem.setState(false);
558
+
559
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
560
+ toggleRenderItem.addItemListener(this);
561
+ toggleRenderItem.setState(!CameraPane.frozen);
562
+
563
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
564
+ toggleDebugItem.addItemListener(this);
565
+ toggleDebugItem.setState(Globals.DEBUG);
566
+
567
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
568
+ toggleFrustumItem.addItemListener(this);
569
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
570
+
571
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
572
+ toggleFootContactItem.addItemListener(this);
573
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
574
+
575
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
576
+ toggleTimelineItem.addItemListener(this);
577
+ }
578
+
579
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
580
+// toggleRootItem.addItemListener(this);
581
+// toggleRootItem.setState(false);
582
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
583
+// animationItem.addItemListener(this);
584
+// animationItem.setState(CameraPane.ANIMATION);
585
+ cameraMenu.add("-");
586
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
587
+ editCameraItem.addActionListener(this);
588
+
589
+ if (Globals.ADVANCED)
590
+ {
591
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595
+ oe.cameraMenu.add("-");
596
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597
+ openWindowItem.addActionListener(this);
598
+ editLeafItem.addActionListener(this);
599
+ lookAtItem.addActionListener(this);
600
+ //lookFromItem.addActinoListener(this);
601
+ //switchViewItem.addActionListener(this);
602
+ }
603
+
192604 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);
605
+ if (Globals.ADVANCED)
606
+ {
197607 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198608 revertMeshItem.addActionListener(this);
199609 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200610 resetreferencesItem.addActionListener(this);
201611 menu.add("-");
612
+ }
202613 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203614 overwriteGeoItem.addActionListener(this);
204615 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +621,104 @@
210621 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211622 overwriteUVItem.addActionListener(this);
212623 menu.add("-");
624
+ if (Globals.ADVANCED)
625
+ {
213626 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214627 generateMeshItem.addActionListener(this);
215628 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216629 poseMeshItem.addActionListener(this);
217630 menu.add("-");
631
+ }
218632 resetsupportItem = menu.add(new MenuItem("Reset support"));
219633 resetsupportItem.addActionListener(this);
220634 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221635 linkverticesItem.addActionListener(this);
636
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
637
+ relinkverticesItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
222641 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223642 setMasterItem.addActionListener(this);
643
+ }
224644
225645 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
228648 backItem = menu.add(new MenuItem("Back"));
229649 backItem.addActionListener(this);
230650 frontItem = menu.add(new MenuItem("Front"));
231651 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);
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
657
+ hideItem = menu.add(new MenuItem("Hidden Group"));
658
+ hideItem.addActionListener(this);
659
+ }
660
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
661
+ ungroupItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
241669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242670 switchGeoItem.addActionListener(this);
243671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244672 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
246674 morphItem.addActionListener(this);
675
+
676
+ menu.add("-");
677
+ physicsItem = menu.add(new MenuItem("Physics"));
678
+ physicsItem.addActionListener(this);
679
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
680
+ frameselectorItem.addActionListener(this);
247681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248682 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
683
+ }
251684
252685 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
688
+ billboardItem = menu.add(new MenuItem("Billboard"));
689
+ billboardItem.addActionListener(this);
255690 csgItem = menu.add(new MenuItem("CSG"));
256691 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258693 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260695 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
701
+ if (Globals.ADVANCED)
702
+ {
703
+ menu.add("-");
263704 linkerItem = menu.add(new MenuItem("Linker"));
264705 linkerItem.addActionListener(this);
265706 templateItem = menu.add(new MenuItem("Template"));
266707 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269708 pointflowItem = menu.add(new MenuItem("Point Flow"));
270709 pointflowItem.addActionListener(this);
710
+ }
271711 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274712 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275713 resetTransformItem.addActionListener(this);
276714 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277715 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
716
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
717
+ resetCentroidXZItem.addActionListener(this);
718
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
719
+ transformGeometryItem.addActionListener(this);
720
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
721
+ transformChildrenItem.addActionListener(this);
280722
281723 oe.menuBar.add(menu = new Menu("Geometry"));
282724 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -287,6 +729,11 @@
287729 genNormalsCADItem.addActionListener(this);
288730 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289731 genNormalsMESHItem.addActionListener(this);
732
+ if (Globals.ADVANCED)
733
+ {
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
735
+ genNormalsMINEItem.addActionListener(this);
736
+ }
290737 stripifyItem = menu.add(new MenuItem("Stripify"));
291738 stripifyItem.addActionListener(this);
292739 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +755,34 @@
308755 reduce34MeshItem.addActionListener(this);
309756 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310757 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313758 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314759 clipMeshItem.addActionListener(this);
760
+
761
+ if (Globals.ADVANCED)
762
+ {
763
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
764
+ smoothMeshItem.addActionListener(this);
765
+ }
315766
316767 oe.menuBar.add(menu = new Menu("Attributes"));
317768 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318769 clearMaterialsItem.addActionListener(this);
770
+ resetAllItem = menu.add(new MenuItem("Reset All"));
771
+ resetAllItem.addActionListener(this);
772
+ stepAllItem = menu.add(new MenuItem("Step All"));
773
+ stepAllItem.addActionListener(this);
319774 menu.add("-");
320775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321776 liveleavesItem.addActionListener(this);
322777 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323778 unliveleavesItem.addActionListener(this);
779
+ if (Globals.ADVANCED)
780
+ {
324781 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325782 supportleavesItem.addActionListener(this);
326783 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327784 unsupportleavesItem.addActionListener(this);
785
+ }
328786 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329787 hideleavesItem.addActionListener(this);
330788 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +791,14 @@
333791 markleavesItem.addActionListener(this);
334792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335793 unmarkleavesItem.addActionListener(this);
794
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795
+ rewindleavesItem.addActionListener(this);
796
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
797
+ unrewindleavesItem.addActionListener(this);
798
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
799
+ randomleavesItem.addActionListener(this);
800
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
801
+ unrandomleavesItem.addActionListener(this);
336802 menu.add("-");
337803 flipVItem = menu.add(new MenuItem("Flip V"));
338804 flipVItem.addActionListener(this);
....@@ -358,45 +824,56 @@
358824 attachBumpItem.addActionListener(this);
359825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
360826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
361828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
362829 detachPigmentItem.addActionListener(this);
363830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
364831 detachBumpItem.addActionListener(this);
832
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
833
+ embedTexturesItem.addActionListener(this);
834
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
835
+ deEmbedTexturesItem.addActionListener(this);
365836 menu.add("-");
366837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
367838 sortbysizeItem.addActionListener(this);
368839 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369840 sortbynameItem.addActionListener(this);
370841 menu.add("-");
842
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
843
+ shareGeometriesItem.addActionListener(this);
844
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845
+ mergeGeometriesItem.addActionListener(this);
846
+ if (Globals.ADVANCED)
847
+ {
848
+ // Pretty much the same as duplicate and clone.
371849 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372850 extractGeometriesItem.addActionListener(this);
373851 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374852 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
853
+ }
379854
380855 oe.menuBar.add(menu = new Menu("Insert"));
381856 buildCreateMenu(menu);
382857
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394858 oe.menuBar.add(menu = new Menu("Tools"));
395859 buildToolsMenu(menu);
396860 }
397861
862
+
398863 void SetupUI2(ObjEditor oe)
399864 {
865
+ // June 2019
866
+ if (oe == null)
867
+ {
868
+ //super.SetupUI2(this);
869
+ //return;
870
+ }
871
+
872
+ if (copy != group)
873
+ {
874
+ //super.SetupUI2(this);
875
+ }
876
+
400877 //new Exception().printStackTrace();
401878
402879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +902,243 @@
425902 oe.radioPanel.add(dummyButton);
426903 oe.buttonGroup.add(dummyButton);
427904 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
431908
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
909
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
910
+
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
914
+
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
921
+
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ screenfitButton.setToolTipText("Screen fit");
928
+ screenfitButton.addActionListener(this);
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveVersionButton.setToolTipText("Duplicate current version");
936
+ saveVersionButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ deleteVersionButton.setToolTipText("Delete current version");
940
+ deleteVersionButton.addActionListener(this);
941
+
942
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
943
+ previousVersionButton.setToolTipText("Previous version");
944
+ previousVersionButton.addActionListener(this);
945
+ previousVersionButton.setEnabled(false);
946
+
947
+ cGridBag updown = new cGridBag().setVertical(true);
948
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
949
+ restoreButton.setToolTipText("Undo (restore current version)");
950
+ restoreButton.addActionListener(this);
951
+ //restoreButton.setEnabled(false);
952
+
953
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
954
+ replaceButton.setToolTipText("Save (replace current version)");
955
+ replaceButton.addActionListener(this);
956
+ //replaceButton.setEnabled(false);
957
+
958
+ copyOptionsPanel.add(updown);
959
+
960
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
961
+ nextVersionButton.setToolTipText("Next version");
962
+ nextVersionButton.addActionListener(this);
963
+ nextVersionButton.setEnabled(false);
964
+
965
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
966
+ liveCB.setToolTipText("Enable animation");
433967 liveCB.addItemListener(this);
434968
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
969
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
970
+ oneStepButton.setToolTipText("Animate one step forward");
971
+ oneStepButton.addActionListener(this);
972
+
973
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
974
+ fastCB.setToolTipText("Fast mode");
453975 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
976
+
977
+ //oe.toolboxPanel.Return();
978
+
979
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
980
+// trackCB.setToolTipText("Enable tracking");
981
+// trackCB.addItemListener(this);
460982
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
495
- trackCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
499
- screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
501983 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502984 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507985
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
514
- flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518
-
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
521
- twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
986
+ if (Globals.ADVANCED)
987
+ {
988
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ snapobjectButton.addActionListener(this);
990
+ snapobjectButton.setToolTipText("Snap Object");
991
+
992
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523993 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
525
- sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
994
+ fourButton.setToolTipText("Show control panel only");
995
+ }
996
+
997
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
998
+
999
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
+ twoButton.setToolTipText("Show 3D view only");
1001
+ twoButton.addActionListener(this);
1002
+ this.fullscreenLayout = twoButton;
1003
+
1004
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
+ threeButton.setToolTipText("Show controls and 3D view");
5271006 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
529
- sevenButton.addActionListener(this);
1007
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
+ sixButton.setToolTipText("Show 3D view and controls");
1009
+ sixButton.addActionListener(this);
1010
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+// sevenButton.setToolTipText("3-column layout");
1012
+// sevenButton.addActionListener(this);
5301013 //
5311014
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1015
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1016
+ rootButton.setToolTipText("Open selection in new tab");
5331017 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1018
+
1019
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1020
+ closeButton.setToolTipText("Close tab");
5361021 closeButton.addActionListener(this);
5371022 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5381023 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540
-
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
543
- editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
5471024
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1025
+ cGridBag row1 = new cGridBag();
1026
+
1027
+ // INSERT
1028
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ gridButton.setToolTipText("Create grid");
1030
+ gridButton.addActionListener(this);
1031
+
1032
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ boxButton.setToolTipText("Create box");
1034
+ boxButton.addActionListener(this);
1035
+
1036
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ sphereButton.setToolTipText("Create sphere");
1038
+ sphereButton.addActionListener(this);
1039
+
1040
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ coneButton.setToolTipText("Create cone");
1042
+ coneButton.addActionListener(this);
1043
+
1044
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ torusButton.setToolTipText("Create torus");
1046
+ torusButton.addActionListener(this);
1047
+
1048
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ superButton.setToolTipText("Create superellipsoid");
1050
+ superButton.addActionListener(this);
1051
+
1052
+ if (Globals.ADVANCED)
1053
+ {
1054
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ kleinButton.setToolTipText("Create Klein bottle");
1056
+ kleinButton.addActionListener(this);
1057
+ }
1058
+
1059
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1060
+ particlesButton.setToolTipText("Create particle system");
1061
+ particlesButton.addActionListener(this);
1062
+
1063
+ oe.toolboxPanel.add(row1);
1064
+
1065
+ cGridBag row2 = new cGridBag();
1066
+
1067
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ groupButton.setToolTipText("Create group");
1069
+ groupButton.addActionListener(this);
1070
+
1071
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ compositeButton.setToolTipText("Create composite");
1073
+ compositeButton.addActionListener(this);
1074
+
1075
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ switchButton.setToolTipText("Create item switcher");
1077
+ switchButton.addActionListener(this);
1078
+
1079
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ loopButton.setToolTipText("Create loop");
1081
+ loopButton.addActionListener(this);
1082
+
1083
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ textureButton.setToolTipText("Create texture");
1085
+ textureButton.addActionListener(this);
1086
+
1087
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ overlayButton.setToolTipText("Create overlay");
1089
+ overlayButton.addActionListener(this);
1090
+
1091
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ lightButton.setToolTipText("Create light");
1093
+ lightButton.addActionListener(this);
1094
+
1095
+ oe.toolboxPanel.add(row2);
1096
+
1097
+ // ENVYMAPS
1098
+ cGridBag skyboxpane = new cGridBag();
1099
+ skyboxpane.preferredHeight = 100;
1100
+
1101
+ oe.toolboxPanel.add(skyboxpane);
1102
+
1103
+ JTabbedPane skyboxpanel = new JTabbedPane();
1104
+ skyboxpane.add(skyboxpanel);
1105
+
1106
+ AddSkyboxTab0(skyboxpanel);
1107
+ AddSkyboxTab1(skyboxpanel);
1108
+ AddSkyboxTab2(skyboxpanel);
1109
+ AddSkyboxTab3(skyboxpanel);
1110
+
1111
+ // EDIT panel
1112
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ editButton.setToolTipText("Pin selection controls");
1114
+ editButton.addActionListener(this);
1115
+
1116
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5491118 uneditButton.addActionListener(this);
5501119
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1120
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
+ allParamsButton.setToolTipText("Show all controle");
5631122 allParamsButton.addActionListener(this);
5641123
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1124
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ clearPanelButton.setToolTipText("Clear edit panel");
1126
+ clearPanelButton.addActionListener(this);
1127
+
1128
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ unselectButton.setToolTipText("Unselect");
5701130 unselectButton.addActionListener(this);
5711131
1132
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ flashSelectionButton.setToolTipText("Highlight selection");
1134
+ flashSelectionButton.addActionListener(this);
1135
+
1136
+ editCommandsPanel.preferredHeight = 1;
1137
+
1138
+ SetPinStates(false);
1139
+// oe.treePanel.add(commandsPanel);
1140
+// oe.treePanel.Return();
1141
+
5721142 // oe.aConstraints.gridx += 1;
5731143 // oe.aConstraints.weighty = 0;
5741144 // oe.aConstraints.gridwidth = 1;
....@@ -580,47 +1150,32 @@
5801150 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5811151 // gcButton.addActionListener(this);
5821152
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
1153
+ cGridBag jSPPanel = new cGridBag();
1154
+
1155
+ JScrollPane jSP;
5941156 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1157
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5961158 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
601
-
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
- colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
609
- materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
612
- textureCB.addItemListener(this);
613
-
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
6161159
1160
+ oe.treePanel.add(jSPPanel);
1161
+ oe.treePanel.Return();
1162
+
1163
+ oe.treePanel.add(copyOptionsPanel);
1164
+ oe.treePanel.Return();
1165
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
+ sliderPane.preferredHeight = 1;
1168
+
1169
+// mainPanel.setDividerLocation(0.1); //1.0);
1170
+ mainPanel.setResizeWeight(0.4);
1171
+
6171172 //jList.addListSelectionListener(this);
6181173 oe.jTree.addTreeSelectionListener(this);
6191174 //jTree.setRootVisible(false);
6201175 //jTree.setEditable(true);
6211176 oe.jTree.setDragEnabled(true);
6221177 //jTree.setPreferredSize(new Dimension(10,10));
623
- jSP.setPreferredSize(new Dimension(100,200));
1178
+ //jSP.setPreferredSize(new Dimension(100,200));
6241179
6251180 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6261181
....@@ -632,23 +1187,163 @@
6321187 dgr.addDragGestureListener(this);
6331188 }catch(Exception e) {}
6341189 */
635
- radio.layout = sevenButton;
1190
+ radio.layout = threeButton; // sixButton;
6361191 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6371192 }
1193
+
1194
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1195
+ {
1196
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1197
+ colorCB.setToolTipText("Copy color when dropped");
1198
+ colorCB.addItemListener(this);
1199
+
1200
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1201
+ materialCB.setToolTipText("Copy material when dropped");
1202
+ materialCB.addItemListener(this);
1203
+
1204
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1205
+ textureCB.setToolTipText("Copy texture when dropped");
1206
+ textureCB.addItemListener(this);
1207
+
1208
+ panel.Return();
1209
+
1210
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1211
+ boxCB.setToolTipText("Display bounding boxes");
1212
+ boxCB.addItemListener(this);
1213
+
1214
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1215
+ zoomBoxCB.setToolTipText("Display only for wheel");
1216
+ zoomBoxCB.addItemListener(this);
1217
+
1218
+ if (true) // Globals.ADVANCED)
1219
+ {
1220
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1221
+// supportCB.setToolTipText("Enable rigging");
1222
+// supportCB.addItemListener(this);
1223
+
1224
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1225
+ freezeCB.setToolTipText("Fast moving camera");
1226
+ freezeCB.addItemListener(this);
1227
+
1228
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1229
+ // localCB.addItemListener(this);
1230
+
1231
+ panel.Return();
1232
+
1233
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1234
+ crowdCB.setToolTipText("Used for crowds");
1235
+ crowdCB.addItemListener(this);
1236
+
1237
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1238
+ smoothCB.setToolTipText("Snapping delay");
1239
+ smoothCB.addItemListener(this);
1240
+
1241
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1242
+// slowCB.setToolTipText("Smooth interpolation");
1243
+// slowCB.addItemListener(this);
1244
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1245
+ minshaderCB.setToolTipText("Minimal fast shader");
1246
+ minshaderCB.addItemListener(this);
1247
+
1248
+// constraints.gridy += 1;
1249
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1250
+// speakerMocapCB.addItemListener(this);
1251
+
1252
+ panel.Return();
1253
+
1254
+ if (false)
1255
+ {
1256
+ // handled in scripts
1257
+ //constraints.gridy += 1;
1258
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1259
+ speakerCameraCB.addItemListener(this);
1260
+
1261
+ //constraints.gridy += 1;
1262
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1263
+ speakerFocusCB.addItemListener(this);
1264
+
1265
+ //constraints.gridy += 1;
1266
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1267
+ smoothfocusCB.addItemListener(this);
1268
+ panel.Return();
1269
+ }
1270
+
1271
+//constraints.gridx += 1;
1272
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1273
+// debugCB.addItemListener(this);
1274
+
1275
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1276
+ trackCB.setToolTipText("Enable tracking target");
1277
+ trackCB.addItemListener(this);
1278
+
1279
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1280
+ oeilCB.setToolTipText("Move camera when tracking");
1281
+ oeilCB.addItemListener(this);
1282
+
1283
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1284
+ shadowCB.setToolTipText("When live compute shadows");
1285
+ shadowCB.addItemListener(this);
1286
+
1287
+ panel.Return();
1288
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1289
+ toggleTextureCB.setToolTipText("Load textures");
1290
+ toggleTextureCB.addItemListener(this);
1291
+
1292
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1293
+ toggleSwitchCB.setToolTipText("Choose a single item");
1294
+ toggleSwitchCB.addItemListener(this);
1295
+
1296
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1297
+ autokeepCB.setToolTipText("On structure change");
1298
+ autokeepCB.addItemListener(this);
1299
+
1300
+ panel.Return();
1301
+ if (Globals.ADVANCED)
1302
+ {
1303
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1304
+ lookAtCB.setToolTipText("Look-at target");
1305
+ lookAtCB.addItemListener(this);
1306
+ }
1307
+
1308
+ }
1309
+
1310
+ cGridBag fill = new cGridBag();
1311
+ fill.preferredHeight = 200;
1312
+ cGridBag fill2 = new cGridBag();
1313
+ fill2.preferredHeight = 200;
1314
+ cGridBag fill3 = new cGridBag();
1315
+ fill3.preferredHeight = 200;
1316
+
1317
+ panel.add(fill);
1318
+ panel.add(fill2);
1319
+ panel.add(fill3);
1320
+
1321
+ }
6381322
6391323 void EditObject(Object3D obj)
6401324 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
1325
+ cRadio radioButton = new cRadio(obj.name);
1326
+
1327
+ // June 2019. Patch to avoid bug with transparency.
1328
+ radioButton.hadMaterial = obj.material != null;
1329
+ if (!radioButton.hadMaterial)
1330
+ {
1331
+ obj.material = new cMaterial();
1332
+ }
1333
+
1334
+ radioButton.SetObject(obj);
1335
+ radioButton.layout = threeButton; // sixButton;
1336
+ radioButton.SetCamera(cameraView.renderCamera, false);
1337
+ radioButton.addActionListener(this);
1338
+ radioPanel.add(radioButton);
1339
+ buttonGroup.add(radioButton);
1340
+ radioButton.doClick();
6491341 }
1342
+
6501343 void SetupViews(ObjEditor oe)
6511344 {
1345
+ theFrame = this;
1346
+
6521347 oe.SetupViews();
6531348
6541349 System.out.println("SetupViews");
....@@ -657,22 +1352,30 @@
6571352 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6581353 }
6591354
660
- JCheckBox liveCB;
661
- JCheckBox supportCB;
662
- JCheckBox localCB;
663
- JCheckBox crowdCB;
664
- JCheckBox smoothCB;
665
- JCheckBox fastCB;
666
- JCheckBox slowCB;
667
- JCheckBox boxCB;
668
- JCheckBox trackCB;
669
- JCheckBox smoothfocusCB;
1355
+ cToggleButton liveCB;
1356
+ cCheckBox supportCB;
1357
+ cCheckBox localCB;
1358
+ cCheckBox crowdCB;
1359
+ cCheckBox smoothCB;
1360
+ cCheckBox minshaderCB;
1361
+
1362
+ cToggleButton fastCB;
1363
+ cCheckBox slowCB;
1364
+ cCheckBox boxCB;
1365
+ cCheckBox zoomBoxCB;
1366
+ cCheckBox freezeCB;
1367
+ //cToggleButton trackCB;
1368
+ cCheckBox trackCB;
1369
+ cCheckBox smoothfocusCB;
6701370 // JCheckBox speakerMocapCB;
671
- JCheckBox speakerCameraCB;
672
- JCheckBox speakerFocusCB;
673
- JCheckBox debugCB;
674
- JCheckBox oeilCB;
675
- JCheckBox lookAtCB;
1371
+ cCheckBox speakerCameraCB;
1372
+ cCheckBox speakerFocusCB;
1373
+ cCheckBox debugCB;
1374
+
1375
+ cCheckBox oeilCB;
1376
+ cCheckBox shadowCB;
1377
+ cCheckBox autokeepCB;
1378
+ cCheckBox lookAtCB;
6761379
6771380 // static int COLOR = 1;
6781381 // static int MATERIAL = 2;
....@@ -680,9 +1383,9 @@
6801383
6811384 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6821385
683
- JCheckBox colorCB;
684
- JCheckBox materialCB;
685
- JCheckBox textureCB;
1386
+ cCheckBox colorCB;
1387
+ cCheckBox materialCB;
1388
+ cCheckBox textureCB;
6861389
6871390 public void itemStateChanged(ItemEvent e)
6881391 {
....@@ -707,10 +1410,10 @@
7071410 dropAttributes |= Object3D.TEXTURE;
7081411 else
7091412 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
1413
+ } else if(e.getSource() == liveCB)
7121414 {
7131415 cameraView.ToggleLive();
1416
+ refreshContents(false);
7141417 }
7151418 else if(e.getSource() == supportCB)
7161419 {
....@@ -726,6 +1429,12 @@
7261429 {
7271430 cameraView.ToggleInertia();
7281431 cameraView.repaint();
1432
+ }
1433
+ else if(e.getSource() == minshaderCB)
1434
+ {
1435
+ Globals.MINSHADER ^= true;
1436
+ cameraView.programInitialized = false;
1437
+ cameraView.repaint();
7291438 }
7301439 else if(e.getSource() == localCB)
7311440 {
....@@ -745,6 +1454,10 @@
7451454 Recompile();
7461455 cameraView.repaint();
7471456 // refreshContents();
1457
+ }
1458
+ else if(e.getSource() == zoomBoxCB)
1459
+ {
1460
+ cameraView.ToggleZoomBoxMode();
7481461 }
7491462 else if(e.getSource() == smoothfocusCB)
7501463 {
....@@ -771,6 +1484,18 @@
7711484 {
7721485 cameraView.ToggleOeil();
7731486 }
1487
+ else if(e.getSource() == shadowCB)
1488
+ {
1489
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1490
+ }
1491
+ else if(e.getSource() == freezeCB)
1492
+ {
1493
+ Globals.FREEZEONMOVE ^= true;
1494
+ }
1495
+ else if(e.getSource() == autokeepCB)
1496
+ {
1497
+ Globals.REPLACEONMAKE ^= true;
1498
+ }
7741499 else if(e.getSource() == lookAtCB)
7751500 {
7761501 cameraView.ToggleLookAt();
....@@ -787,7 +1512,8 @@
7871512
7881513 /**/
7891514 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
790
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1515
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1516
+ TreePath path = objEditor.jTree.getSelectionPath();
7911517 if ((path == null) || (path.getPathCount() <= 1)) {
7921518 // We can't move the root node or an empty selection
7931519 return;
....@@ -850,8 +1576,6 @@
8501576 }
8511577 }
8521578
853
- String string = (String) object;
854
-
8551579 System.out.println("Transfer = " + object + "; drop : " + target);
8561580 // if( object instanceof java.io.File[])
8571581 // {
....@@ -859,7 +1583,11 @@
8591583 // objEditor.DropFile((java.io.File[]) object, true);
8601584 // return;
8611585 // }
862
- if (string.charAt(0) == '/')
1586
+
1587
+ String string = object.toString();
1588
+
1589
+ // File path for Mac and Windows
1590
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631591 {
8641592 // file(s)
8651593 String[] names = string.split("\n");
....@@ -886,7 +1614,7 @@
8861614
8871615 flashIt = false;
8881616 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1617
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901618 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911619
8921620 if (group.selection.size() == 1)
....@@ -902,23 +1630,33 @@
9021630
9031631 assert target == objEditor.jTree;
9041632 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1633
+ Object3D destinationLeaf;
9051634 try {
906
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1635
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9071636 } catch (Exception e) {
9081637 System.out.println("destinationPath : " + destinationPath);
9091638 return;
9101639 }
9111640
912
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1641
+ for (int i=group.selection.size(); --i>=0;)
9131642 {
1643
+ Object3D child = (Object3D)group.selection.elementAt(i);
1644
+
1645
+ // Cannot move into itself
1646
+ if (child == destinationLeaf)
1647
+ return;
1648
+ }
1649
+
1650
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1651
+// {
9141652 loadClipboard(true);
9151653 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
917
- } else {
918
- loadClipboard(false);
919
- objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
921
- }
1654
+ pasteInto(false, false);
1655
+// } else {
1656
+// loadClipboard(false);
1657
+// objEditor.jTree.setSelectionPath(destinationPath);
1658
+// pasteInto(false, false); // true); // ???
1659
+// }
9221660 }
9231661 public void dropActionChanged(DropTargetDragEvent dtde)
9241662 // Called if the user has modified the current drop gesture
....@@ -1023,83 +1761,107 @@
10231761 {
10241762 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10251763 //heightFieldItem.addActionListener(this);
1026
- gridItem = menu.add(new MenuItem("Grid"));
1027
- gridItem.addActionListener(this);
1028
- rectoidItem = menu.add(new MenuItem("Box"));
1029
- rectoidItem.addActionListener(this);
1030
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1031
- ellipsoidItem.addActionListener(this);
1032
- coneItem = menu.add(new MenuItem("Cone"));
1033
- coneItem.addActionListener(this);
1034
- torusItem = menu.add(new MenuItem("Torus"));
1035
- torusItem.addActionListener(this);
1036
- superItem = menu.add(new MenuItem("Superellipsoid"));
1037
- superItem.addActionListener(this);
1038
- particleItem = menu.add(new MenuItem("Particle system"));
1039
- particleItem.addActionListener(this);
1764
+// gridItem = menu.add(new MenuItem("Grid"));
1765
+// gridItem.addActionListener(this);
1766
+// rectoidItem = menu.add(new MenuItem("Box"));
1767
+// rectoidItem.addActionListener(this);
1768
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1769
+// ellipsoidItem.addActionListener(this);
1770
+// coneItem = menu.add(new MenuItem("Cone"));
1771
+// coneItem.addActionListener(this);
1772
+// torusItem = menu.add(new MenuItem("Torus"));
1773
+// torusItem.addActionListener(this);
1774
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1775
+// superItem.addActionListener(this);
1776
+
1777
+ cameraItem = menu.add(new MenuItem("Camera"));
1778
+ cameraItem.addActionListener(this);
1779
+
1780
+ if (!Globals.ADVANCED)
1781
+ {
1782
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1783
+ kleinItem.addActionListener(this);
1784
+ }
1785
+
1786
+// particleItem = menu.add(new MenuItem("Particle system"));
1787
+// particleItem.addActionListener(this);
1788
+ if (Globals.ADVANCED)
1789
+ {
10401790 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411791 ragdollItem.addActionListener(this);
10421792 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431793 ragdoll2Item.addActionListener(this);
1794
+ }
10441795 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1796
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461797 meshItem.addActionListener(this);
10471798 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481799 // meshGroupItem.addActionListener(this);
1800
+ if (Globals.ADVANCED)
1801
+ {
10491802 springItem = menu.add(new MenuItem("Spring"));
10501803 springItem.addActionListener(this);
10511804 flagItem = menu.add(new MenuItem("Flag"));
10521805 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571806 blobItem = menu.add(new MenuItem("Blob"));
10581807 blobItem.addActionListener(this);
10591808 latheItem = menu.add(new MenuItem("Lathe"));
10601809 latheItem.addActionListener(this);
1061
- lightItem = menu.add(new MenuItem("Light"));
1062
- lightItem.addActionListener(this);
1810
+ }
1811
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1812
+ bezierItem.addActionListener(this);
1813
+// overlayItem = menu.add(new MenuItem("Overlay"));
1814
+// overlayItem.addActionListener(this);
1815
+// lightItem = menu.add(new MenuItem("Light"));
1816
+// lightItem.addActionListener(this);
10631817 menu.add("-");
10641818 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10651819 //superLoopItem.addActionListener(this);
1066
- loopItem = menu.add(new MenuItem("Loop"));
1067
- loopItem.addActionListener(this);
1820
+// loopItem = menu.add(new MenuItem("Loop"));
1821
+// loopItem.addActionListener(this);
10681822 doubleItem = menu.add(new MenuItem("Fork"));
10691823 doubleItem.addActionListener(this);
1824
+ if (Globals.ADVANCED)
1825
+ {
10701826 tripleItem = menu.add(new MenuItem("Trident"));
10711827 tripleItem.addActionListener(this);
1828
+ }
10721829 }
10731830
10741831 void buildToolsMenu(Menu menu)
10751832 {
10761833 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771834 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1835
+ animationItem.setState(Globals.ANIMATION);
1836
+
1837
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1838
+ archiveItem.addActionListener(this);
10791839
10801840 menu.add("-");
10811841 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821842 parseverticesItem.addActionListener(this);
10831843 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841844 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1845
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861846 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891847 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901848 reduceMorphItem.addActionListener(this);
10911849 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921850 reduce34MorphItem.addActionListener(this);
1093
-
1094
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1095
- computeAOItem.addActionListener(this);
10961851 menu.add("-");
1097
-
10981852 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991853 memoryItem.addActionListener(this);
1854
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1855
+ computeAOItem.addActionListener(this);
1856
+
1857
+ if (Globals.ADVANCED)
1858
+ {
1859
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1860
+ mirrorItem.addActionListener(this);
1861
+ menu.add("-");
11001862 menu.add(analyzeItem = new MenuItem("Analyze"));
11011863 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1864
+ menu.add(dumpItem = new MenuItem("Print"));
11031865 dumpItem.addActionListener(this);
11041866 // menu.add(pathItem = new MenuItem("From-to path"));
11051867 // pathItem.addActionListener(this);
....@@ -1108,6 +1870,8 @@
11081870 resetParentItem.addActionListener(this);
11091871 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101872 repairParentItem.addActionListener(this);
1873
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1874
+ repairShadowItem.addActionListener(this);
11111875 menu.add(invariantsItem = new MenuItem("Invariants"));
11121876 invariantsItem.addActionListener(this);
11131877 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1879,7 @@
11151879 menu.add("-");
11161880 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171881 editScriptItem.addActionListener(this);
1882
+ }
11181883 }
11191884
11201885 void ScreenFit()
....@@ -1237,9 +2002,34 @@
12372002 shadow.material = new cMaterial(obj.material);
12382003 shadow.material.diffuse = 0.0001f;
12392004 shadow.material.specular = 0.0001f;
2005
+ //shadow.projectedVertices[1].x = 300;
12402006
12412007 makeSomething(shadow);
12422008 }
2009
+
2010
+ private void ClearUnpinned()
2011
+ {
2012
+ //for (Object3D obj : listUI)
2013
+ for (int i=listUI.size(); --i>=0;)
2014
+ {
2015
+ Object3D obj = listUI.elementAt(i);
2016
+ if (!obj.pinned)
2017
+ {
2018
+ obj.CloseUI();
2019
+ listUI.remove(i);
2020
+ }
2021
+ }
2022
+ }
2023
+
2024
+ private void EditElement(Object3D elem, boolean newWindow)
2025
+ {
2026
+ // if (!(elem instanceof Composite))
2027
+ // newWindow = false;
2028
+ listUI.add(elem);
2029
+ elem.openEditWindow(this, newWindow); //, false);
2030
+ System.out.println("edit : " + elem);
2031
+ elem.editWindow.refreshContents(true); // ? new
2032
+ }
12432033
12442034 /**
12452035 * applyExample
....@@ -1443,9 +2233,9 @@
14432233
14442234 void Overwrite(int mask)
14452235 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2236
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14472237 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
2238
+ Object3D content = Grafreed.clipboard.get(0);
14492239
14502240 if (content instanceof cGroup && ((cGroup)content).transientlink )
14512241 content = ((cGroup)content).get(0);
....@@ -1468,6 +2258,7 @@
14682258 //
14692259 public void actionPerformed(ActionEvent event) // , Object arg)
14702260 {
2261
+ Object source = event.getSource();
14712262 /*
14722263 if (event.getSource() == nameField)
14732264 {
....@@ -1479,11 +2270,11 @@
14792270 }
14802271 else
14812272 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2273
+ if (source == lookAtItem || source == lookFromItem)
14832274 {
14842275 ScreenFit();
14852276 } else
1486
- if (event.getSource() == switchItem)
2277
+ if (source == switchViewItem)
14872278 {
14882279 cVector v1 = new cVector();
14892280 cVector v2 = new cVector();
....@@ -1492,11 +2283,11 @@
14922283 objEditor.cameraView.renderCamera.setAim(v2, v1);
14932284 objEditor.cameraView.repaint();
14942285 } else
1495
- if (event.getSource() == rectoidItem)
2286
+ if (source == rectoidItem || source == boxButton)
14962287 {
14972288 makeSomething(new Box());
14982289 } else
1499
- if (event.getSource() == particleItem)
2290
+ if (source == particleItem || source == particlesButton)
15002291 {
15012292 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15022293 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +2308,9 @@
15172308 applyExample(particleGeom, "SMOKE");
15182309 makeSomething(particleGeom);
15192310 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2311
+ if (source == ragdollItem || source == ragdoll2Item)
15212312 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2313
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15232314
15242315 ragdoll.toParent = LA.newMatrix();
15252316 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +2328,7 @@
15372328 } else
15382329 /*
15392330 */
1540
- if (event.getSource() == heightFieldItem)
2331
+ if (source == heightFieldItem)
15412332 {
15422333 Object3D obj = new Object3D();
15432334
....@@ -1575,27 +2366,31 @@
15752366
15762367 makeSomething(obj);
15772368 } else
1578
- if (event.getSource() == gridItem)
2369
+ if (source == gridItem || source == gridButton)
15792370 {
15802371 makeSomething(new Grid());
15812372 } else
1582
- if (event.getSource() == ellipsoidItem)
2373
+ if (source == ellipsoidItem || source == sphereButton)
15832374 {
15842375 makeSomething(new Sphere());
15852376 } else
1586
- if (event.getSource() == coneItem)
2377
+ if (source == coneItem || source == coneButton)
15872378 {
15882379 makeSomething(new Cone());
15892380 } else
1590
- if (event.getSource() == torusItem)
2381
+ if (source == torusItem || source == torusButton)
15912382 {
15922383 makeSomething(new Torus());
15932384 } else
1594
- if (event.getSource() == superItem)
2385
+ if (source == superItem || source == superButton)
15952386 {
15962387 makeSomething(new Superellipsoid());
15972388 } else
1598
- if (event.getSource() == blobItem)
2389
+ if (source == kleinItem || source == kleinButton)
2390
+ {
2391
+ makeSomething(new Klein());
2392
+ } else
2393
+ if (source == blobItem)
15992394 {
16002395 Blob blob = new Blob();
16012396 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2398,15 @@
16032398 //blob.retile();
16042399 makeSomething(blob);
16052400 } else
1606
- if (event.getSource() == latheItem)
2401
+ if (source == latheItem)
16072402 {
16082403 makeSomething(new Lathe());
16092404 } else
1610
- if (event.getSource() == bezierItem)
2405
+ if (source == bezierItem)
16112406 {
16122407 makeSomething(new BezierSurface());
16132408 } else
1614
- if (event.getSource() == checkerItem)
2409
+ if (source == overlayItem || source == overlayButton)
16152410 {
16162411 /*
16172412 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2421,7 @@
16262421 */
16272422 makeSomething(new Checker());
16282423 } else
1629
- if (event.getSource() == meshItem)
2424
+ if (source == meshItem)
16302425 {
16312426 Object3D itemtomake = new Object3D();
16322427 Object3D child;
....@@ -1647,35 +2442,52 @@
16472442 makeSomething(child);
16482443 }
16492444 } else
1650
- if (event.getSource() == springItem)
2445
+ if (source == springItem)
16512446 {
16522447 cSpring s = new cSpring();
16532448 s.setup();
16542449 makeSomething(s);
16552450 } else
1656
- if (event.getSource() == flagItem)
2451
+ if (source == flagItem)
16572452 {
16582453 cSpring s = new cFlag();
16592454 s.setup();
16602455 makeSomething(s);
16612456 } else
1662
- if (event.getSource() == lightItem)
2457
+ if (source == lightItem || source == lightButton)
16632458 {
16642459 makeSomething(new Light());
16652460 } else
1666
- if (event.getSource() == csgItem)
2461
+// if (source == skybox1Button ||
2462
+// source == skybox2Button ||
2463
+// source == skybox3Button ||
2464
+// source == skybox4Button ||
2465
+// source == skybox5Button ||
2466
+// source == skybox6Button ||
2467
+// source == skybox7Button ||
2468
+// source == skybox11Button ||
2469
+// source == skybox12Button ||
2470
+// source == skybox13Button ||
2471
+// source == skybox14Button ||
2472
+// source == skybox15Button ||
2473
+// source == skybox16Button ||
2474
+// source == skybox17Button)
2475
+// {
2476
+// ChangeSkybox(source);
2477
+// } else
2478
+ if (source == csgItem)
16672479 {
16682480 group(new CSG());
16692481 } else
1670
- if (event.getSource() == templateItem)
2482
+ if (source == templateItem)
16712483 {
16722484 group(new cTemplate());
16732485 } else
1674
- if (event.getSource() == attributeItem)
2486
+ if (source == attributeItem)
16752487 {
16762488 makeSomething(new Attribute());
16772489 } else
1678
- if (event.getSource() == pointflowItem)
2490
+ if (source == pointflowItem)
16792491 {
16802492 makeSomething(new PointFlow());
16812493 } else
....@@ -1687,7 +2499,7 @@
16872499 } else
16882500 */
16892501
1690
- if (event.getSource() == superLoopItem)
2502
+ if (source == superLoopItem)
16912503 {
16922504 Composite g = new cGroup();
16932505 for (int i=0; i<15; i++)
....@@ -1709,30 +2521,30 @@
17092521
17102522 group(g);
17112523 } else
1712
- if (event.getSource() == loopItem)
2524
+ if (source == loopItem || source == loopButton)
17132525 {
17142526 Composite csg = new GroupLeaf();
17152527 csg.count = 5;
17162528 group(csg);
1717
- Composite child = new cGroup();
2529
+ Composite child = new cGroup("Branch");
17182530 csg.addChild(child);
17192531 child.addChild(csg);
17202532 } else
1721
- if (event.getSource() == doubleItem)
2533
+ if (source == doubleItem)
17222534 {
1723
- Composite csg = new GroupLeaf();
2535
+ Composite csg = new GroupLeaf("Fork");
17242536 csg.count = 5;
17252537 group(csg);
1726
- Composite child = new cGroup();
2538
+ Composite child = new cGroup("Branch A");
17272539 csg.addChild(child);
17282540 child.addChild(csg);
1729
- child = new cGroup();
2541
+ child = new cGroup("Branch B");
17302542 csg.addChild(child);
17312543 child.addChild(csg);
17322544 } else
1733
- if (event.getSource() == tripleItem)
2545
+ if (source == tripleItem)
17342546 {
1735
- Composite csg = new GroupLeaf();
2547
+ Composite csg = new GroupLeaf("Trident");
17362548 csg.count = 4;
17372549 group(csg);
17382550 Composite child = new cGroup();
....@@ -1745,73 +2557,105 @@
17452557 csg.addChild(child);
17462558 child.addChild(csg);
17472559 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2560
+ if (source == computeAOItem)
17502561 {
1751
- ImportGFD();
2562
+ Globals.drawMode = CameraPane.OCCLUSION;
2563
+ cameraView.repaint();
17522564 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
2565
+ if (source == recompileItem)
17712566 {
17722567 Recompile();
17732568 refreshContents();
17742569 } else
1775
- if (event.getSource() == editScriptItem)
2570
+ if (source == editScriptItem)
17762571 {
17772572 OpenDialog();
17782573 refreshContents();
17792574 } else
1780
- if (event.getSource() == invariantsItem)
2575
+ if (source == invariantsItem)
17812576 {
17822577 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2578
+ Grafreed.grafreed.universe.invariants();
17842579 } else
1785
- if (event.getSource() == memoryItem)
2580
+ if (source == memoryItem)
17862581 {
17872582 //System.out.println("Invariants:");
17882583 PrintMemory();
17892584 } else
1790
- if (event.getSource() == pathItem)
2585
+ if (source == pathItem)
17912586 {
17922587 PrintPath();
17932588 } else
1794
- if (event.getSource() == analyzeItem)
2589
+ if (source == analyzeItem)
17952590 {
17962591 AnalyzeObject();
17972592 } else
1798
- if (event.getSource() == dumpItem)
2593
+ if (source == dumpItem)
17992594 {
18002595 DumpObject();
18012596 } else
1802
- if (event.getSource() == screenfitButton)
2597
+ if (source == minButton)
18032598 {
1804
- //Reload(lastConverter, lastFilename, true);
2599
+ Minimize();
2600
+ } else
2601
+ if (source == maxButton)
2602
+ {
2603
+ Maximize();
2604
+ } else
2605
+ if (source == fullButton)
2606
+ {
2607
+ ToggleFullScreen();
2608
+ } else
2609
+ if (source == previousVersionButton)
2610
+ {
2611
+ // Go to previous version
2612
+ //if (!Undo())
2613
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2614
+ PreviousVersion();
2615
+ } else
2616
+ if (source == restoreButton)
2617
+ {
2618
+ // Restore current version
2619
+ Restore();
2620
+ //restoreButton.setEnabled(false);
2621
+ } else
2622
+ if (source == replaceButton)
2623
+ {
2624
+ // Overwrite current version
2625
+ Replace();
2626
+ //replaceButton.setEnabled(false);
2627
+ } else
2628
+ if (source == nextVersionButton)
2629
+ {
2630
+ // Go to next version
2631
+ NextVersion();
2632
+ } else
2633
+ if (source == saveVersionButton)
2634
+ {
2635
+ // Save a new version
2636
+ if (!Save(true))
2637
+ java.awt.Toolkit.getDefaultToolkit().beep();
2638
+ } else
2639
+ if (source == deleteVersionButton)
2640
+ {
2641
+ // Delete a new version
2642
+ DeleteVersion();
2643
+ } else
2644
+ if (source == oneStepButton)
2645
+ {
2646
+ Globals.ONESTEP = true;
2647
+ cameraView.repaint();
2648
+ } else
2649
+ if (source == screenfitButton)
2650
+ {
18052651 ScreenFit();
18062652 } else
1807
- if (event.getSource() == screenfitpointButton)
2653
+ if (source == screenfitpointButton)
18082654 {
1809
- //Reload(lastConverter, lastFilename, true);
18102655 ScreenFitPoint();
18112656 } else
1812
- if (event.getSource() == snapobjectButton)
2657
+ if (source == snapobjectButton)
18132658 {
1814
- //Reload(lastConverter, lastFilename, true);
18152659 SnapObject();
18162660 } else
18172661 // if (event.getSource() == recompileButton)
....@@ -1820,13 +2664,13 @@
18202664 // Recompile();
18212665 // refreshContents();
18222666 // } else
1823
- if (event.getSource() == gcButton)
2667
+ if (source == gcButton)
18242668 {
18252669 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262670 System.gc();
18272671 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282672 } else
1829
- if (event.getSource() == editLeafItem)
2673
+ if (source == editLeafItem)
18302674 {
18312675 Object3D obj;
18322676 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2684,74 @@
18402684 }
18412685 refreshContents(true);
18422686 } else
1843
- if (event.getSource() == openWindowItem)
2687
+ if (source == openWindowItem)
18442688 {
18452689 EditSelection(true);
18462690 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2691
+ if (source == cutItem || source == clearButton)
18482692 {
18492693 loadClipboard(true);
18502694 } else
1851
- if (event.getSource() == duplicateItem)
2695
+ if (source == undoItem)
18522696 {
1853
- Object3D keep = GrafreeD.clipboard;
2697
+ PreviousVersion();
2698
+ } else
2699
+ if (source == redoItem)
2700
+ {
2701
+ NextVersion();
2702
+ } else
2703
+ if (source == duplicateItem)
2704
+ {
2705
+ Object3D keep = Grafreed.clipboard;
18542706 loadClipboard(false);
18552707 paste(false);
1856
- GrafreeD.clipboard = keep;
2708
+ Grafreed.clipboard = keep;
18572709 } else
1858
- if (event.getSource() == cloneItem)
2710
+ if (source == cloneItem)
18592711 {
18602712 CloneSelection(false);
18612713 } else
1862
- if (event.getSource() == cloneSupportItem)
2714
+ if (source == cloneSupportItem)
18632715 {
18642716 CloneSelection(true);
18652717 } else
1866
- if (event.getSource() == copyItem)
2718
+ if (source == copyItem)
18672719 {
18682720 loadClipboard(false);
18692721 } else
1870
- if (event.getSource() == pasteItem)
2722
+ if (source == pasteItem)
18712723 {
18722724 paste(false);
18732725 } else
1874
- if (event.getSource() == pasteLinkItem)
2726
+ if (source == pasteIntoItem)
18752727 {
1876
- pasteInto(false);
2728
+ pasteInto(true, false);
18772729 } else
1878
- if (event.getSource() == pasteCloneItem)
2730
+ if (source == pasteLinkItem)
18792731 {
1880
- pasteInto(true);
2732
+ pasteInto(false, false);
18812733 } else
1882
- if (event.getSource() == pasteExpandItem)
2734
+ if (source == pasteCloneItem)
2735
+ {
2736
+ pasteInto(true, true);
2737
+ } else
2738
+ if (source == pasteExpandItem)
18832739 {
18842740 paste(true);
18852741 } else
1886
- if (event.getSource() == synchronizeItem)
2742
+ if (source == synchronizeItem)
18872743 {
18882744 Overwrite(Object3D.TRANSFORM);
18892745 } else
1890
- if (event.getSource() == overwriteNameItem)
2746
+ if (source == overwriteNameItem)
18912747 {
18922748 Overwrite(Object3D.NAME);
18932749 } else
1894
- if (event.getSource() == overwriteUVItem)
2750
+ if (source == overwriteUVItem)
18952751 {
18962752 Overwrite(Object3D.UV);
18972753 } else
1898
- if (event.getSource() == overwriteMatItem)
2754
+ if (source == overwriteMatItem)
18992755 {
19002756 /* july 2015
19012757 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2771,7 @@
19152771
19162772 Overwrite(dropAttributes);
19172773 }
1918
- if (event.getSource() == overwriteGeoItem)
2774
+ if (source == overwriteGeoItem)
19192775 {
19202776 Overwrite(Object3D.GEOMETRY);
19212777 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2788,7 @@
19322788 // refreshContents();
19332789 // }
19342790 } else
1935
- if (event.getSource() == generateMeshItem)
2791
+ if (source == generateMeshItem)
19362792 {
19372793 //if (group.selection.size() == 1)
19382794 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2799,7 @@
19432799 ResetModel();
19442800 refreshContents();
19452801 } else
1946
- if (event.getSource() == extractGeometriesItem)
2802
+ if (source == extractGeometriesItem)
19472803 {
19482804 boolean one = false;
19492805
....@@ -1970,7 +2826,7 @@
19702826 ResetModel();
19712827 refreshContents();
19722828 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2829
+ if (source == cloneGeometriesItem)
19742830 {
19752831 boolean one = false;
19762832
....@@ -1996,32 +2852,37 @@
19962852 ResetModel();
19972853 refreshContents();
19982854 } else
1999
- if (event.getSource() == shareGeometriesItem)
2855
+ if (source == shareGeometriesItem)
20002856 {
20012857 boolean one = false;
20022858
20032859 if (group.selection.size() == 1)
20042860 one = true;
20052861
2862
+ Object3D merge = null;
2863
+
20062864 Object3D content = new cGroup();
20072865
20082866 for (int i=0; i<group.selection.size(); i++)
20092867 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2868
+ merge = new Merge(group.selection.get(i));
20112869
20122870 if (one)
2013
- makeSomething(sel, false);
2871
+ makeSomething(merge, false);
20142872 else
2015
- content.addChild(sel);
2873
+ content.addChild(merge);
20162874 }
20172875
20182876 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2877
+ makeSomething(content, true);
2878
+ else
2879
+ {
2880
+ ResetModel();
2881
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2882
+ refreshContents();
2883
+ }
20232884 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2885
+ if (source == mergeGeometriesItem)
20252886 {
20262887 boolean one = false;
20272888
....@@ -2051,7 +2912,7 @@
20512912 ResetModel();
20522913 refreshContents();
20532914 } else
2054
- if (event.getSource() == linkverticesItem)
2915
+ if (source == linkverticesItem)
20552916 {
20562917 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572918 // {
....@@ -2064,39 +2925,48 @@
20642925 // group.selection.get(0).setMasterThis(content); // should be identity
20652926 // refreshContents();
20662927 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2928
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682929 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2930
+ Object3D content = Grafreed.clipboard.get(0);
20702931
20712932 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722933 content = ((cGroup)content).get(0);
20732934
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2935
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752936 for (int i=0; i<group.selection.size(); i++)
20762937 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2938
+ boolean random = CameraPane.SWITCH;
2939
+ CameraPane.SWITCH = false; // parse all random nodes
20792940 group.selection.get(i).linkVerticesThis(content);
20802941 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2942
+ CameraPane.SWITCH = random;
20822943 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2944
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842945 refreshContents();
20852946 }
20862947 } else
2087
- if (event.getSource() == resetsupportItem)
2948
+ if (source == resetsupportItem)
20882949 {
20892950 for (int i=0; i<group.selection.size(); i++)
20902951 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2952
+ boolean random = CameraPane.SWITCH;
2953
+ CameraPane.SWITCH = false; // parse all random nodes
20932954 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2955
+ CameraPane.SWITCH = random;
20952956 }
20962957
20972958 refreshContents();
20982959 } else
2099
- if (event.getSource() == resetreferencesItem)
2960
+ if (source == relinkverticesItem)
2961
+ {
2962
+ boolean random = CameraPane.SWITCH;
2963
+ CameraPane.SWITCH = false; // parse all random nodes
2964
+ group.selection.RelinkToSupport();
2965
+ CameraPane.SWITCH = random;
2966
+
2967
+ refreshContents();
2968
+ } else
2969
+ if (source == resetreferencesItem)
21002970 {
21012971 for (int i=0; i<group.selection.size(); i++)
21022972 {
....@@ -2105,11 +2975,11 @@
21052975
21062976 refreshContents();
21072977 } else
2108
- if (event.getSource() == setMasterItem)
2978
+ if (source == setMasterItem)
21092979 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2980
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112981 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2982
+ Object3D content = Grafreed.clipboard.get(0);
21132983
21142984 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152985 content = ((cGroup)content).get(0);
....@@ -2118,13 +2988,13 @@
21182988 refreshContents();
21192989 }
21202990 } else
2121
- if (event.getSource() == poseMeshItem)
2991
+ if (source == poseMeshItem)
21222992 {
21232993 if (group.selection.size() == 1)
21242994 {
2125
- if (GrafreeD.clipboard.size() == 1)
2995
+ if (Grafreed.clipboard.size() == 1)
21262996 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2997
+ Object3D content = Grafreed.clipboard.get(0);
21282998
21292999 if (content instanceof cGroup && ((cGroup)content).transientlink )
21303000 content = ((cGroup)content).get(0);
....@@ -2137,19 +3007,19 @@
21373007 }
21383008
21393009 } else
2140
- if (event.getSource() == revertMeshItem)
3010
+ if (source == revertMeshItem)
21413011 {
21423012 RevertMeshes();
21433013 } else
2144
- if (event.getSource() == resetMeshItem)
3014
+ if (source == resetAllItem)
21453015 {
21463016 ResetAll();
21473017 } else
2148
- if (event.getSource() == stepAllItem)
3018
+ if (source == stepAllItem)
21493019 {
21503020 StepAll();
21513021 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3022
+ if (source == deleteItem) // || event.getSource() == clearButton)
21533023 {
21543024 //int indices[] = jList.getSelectedIndices();
21553025 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +3027,46 @@
21573027
21583028 ClearSelection(false);
21593029 } else
2160
- if (event.getSource() == clearAllItem)
3030
+ if (source == clearAllItem)
21613031 {
21623032 ClearSelection(true);
21633033 } else
2164
- if (event.getSource() == grabItem)
3034
+ if (source == grabItem || source == groupButton)
21653035 {
2166
- group(new cGroup(), true);
3036
+ group(new cGroup(), false); // true);
21673037 } else
2168
- if (event.getSource() == frontItem)
3038
+ if (source == hideItem)
3039
+ {
3040
+ group(new HiddenObject());
3041
+ } else
3042
+ if (source == frontItem)
21693043 {
21703044 front();
21713045 } else
2172
- if (event.getSource() == backItem)
3046
+ if (source == backItem)
21733047 {
21743048 back();
21753049 } else
2176
- if (event.getSource() == cameraItem)
3050
+ if (source == cameraItem)
21773051 {
21783052 makeSomething(new Camera());
21793053 } else
2180
- if (event.getSource() == compositeItem)
3054
+ if (source == compositeItem || source == compositeButton)
21813055 {
21823056 group(new Composite());
21833057 } else
2184
- if (event.getSource() == randomItem)
3058
+ if (source == switchItem || source == switchButton)
21853059 {
21863060 RandomNode random = new RandomNode();
21873061 group(random);
21883062 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
3063
+ random.name = random.get(0).name + "Switch";
21903064 } else
2191
- if (event.getSource() == physicsItem)
3065
+ if (source == physicsItem)
21923066 {
21933067 group(new PhysicsNode());
21943068 } else
2195
- if (event.getSource() == frameselectorItem)
3069
+ if (source == frameselectorItem)
21963070 {
21973071 for (int i=0; i<group.selection.size(); i++)
21983072 {
....@@ -2204,7 +3078,7 @@
22043078 ResetModel();
22053079 refreshContents();
22063080 } else
2207
- if (event.getSource() == switchGeoItem)
3081
+ if (source == switchGeoItem)
22083082 {
22093083 for (int i=0; i<group.selection.size(); i++)
22103084 {
....@@ -2216,7 +3090,7 @@
22163090 ResetModel();
22173091 refreshContents();
22183092 } else
2219
- if (event.getSource() == switchTransfoItem)
3093
+ if (source == switchTransfoItem)
22203094 {
22213095 for (int i=0; i<group.selection.size(); i++)
22223096 {
....@@ -2228,7 +3102,7 @@
22283102 ResetModel();
22293103 refreshContents();
22303104 } else
2231
- if (event.getSource() == morphItem)
3105
+ if (source == morphItem)
22323106 {
22333107 for (int i=0; i<group.selection.size(); i++)
22343108 {
....@@ -2240,7 +3114,7 @@
22403114 ResetModel();
22413115 refreshContents();
22423116 } else
2243
- if (event.getSource() == scriptNodeItem)
3117
+ if (source == scriptNodeItem)
22443118 {
22453119 boolean atleastone = false;
22463120
....@@ -2279,199 +3153,252 @@
22793153 }
22803154 }
22813155 } else
2282
- if (event.getSource() == linkerItem)
3156
+ if (source == linkerItem)
22833157 {
22843158 group(new cLinker());
22853159 } else
2286
- if (event.getSource() == textureItem)
3160
+ if (source == textureItem || source == textureButton)
22873161 {
22883162 group(new TextureNode());
22893163 } else
2290
- if (event.getSource() == shadowXItem)
3164
+ if (source == billboardItem)
3165
+ {
3166
+ group(new BillboardNode());
3167
+ } else
3168
+ if (source == shadowXItem)
22913169 {
22923170 CastShadow(0);
22933171 } else
2294
- if (event.getSource() == shadowYItem)
3172
+ if (source == shadowYItem)
22953173 {
22963174 CastShadow(1);
22973175 } else
2298
- if (event.getSource() == shadowZItem)
3176
+ if (source == shadowZItem)
22993177 {
23003178 CastShadow(2);
23013179 } else
2302
- if (event.getSource() == ungroupItem)
3180
+ if (source == ungroupItem || source == ungroupButton)
23033181 {
2304
- ungroup();
3182
+ boolean hasRoot = false;
3183
+
3184
+ for (int i=0; i<group.selection.size(); i++)
3185
+ {
3186
+ if (group.selection.get(i) == group)
3187
+ {
3188
+ hasRoot = true;
3189
+ break;
3190
+ }
3191
+ }
3192
+
3193
+ if (!hasRoot)
3194
+ {
3195
+ for (int i=0; i<group.selection.size(); i++)
3196
+ {
3197
+ Ungroup(group.selection.get(i));
3198
+ }
3199
+
3200
+ ClearSelection(false);
3201
+
3202
+ refreshContents();
3203
+ }
23053204 } else
2306
- if (event.getSource() == genUVItem)
3205
+ if (source == genUVItem)
23073206 {
23083207 GenUV();
23093208 } else
2310
- if (event.getSource() == genNormalsCADItem)
3209
+ if (source == genNormalsCADItem)
23113210 {
23123211 GenNormals(true);
23133212 } else
2314
- if (event.getSource() == genNormalsMESHItem)
3213
+ if (source == genNormalsMESHItem)
23153214 {
2316
- GenNormals(true); // TODO
3215
+ GenNormalsMESH();
23173216 } else
2318
- if (event.getSource() == genNormalsORGANItem)
3217
+ if (source == genNormalsORGANItem)
23193218 {
23203219 GenNormals(false);
23213220 } else
2322
- if (event.getSource() == stripifyItem)
3221
+ if (source == genNormalsMINEItem)
3222
+ {
3223
+ GenNormalsMINE();
3224
+ } else
3225
+ if (source == stripifyItem)
23233226 {
23243227 Stripify();
23253228 } else
2326
- if (event.getSource() == unstripifyItem)
3229
+ if (source == unstripifyItem)
23273230 {
23283231 Unstripify();
23293232 } else
2330
- if (event.getSource() == trimItem)
3233
+ if (source == trimItem)
23313234 {
23323235 Trim();
23333236 } else
2334
- if (event.getSource() == untrimItem)
3237
+ if (source == untrimItem)
23353238 {
23363239 Untrim();
23373240 } else
2338
- if (event.getSource() == clearColorsItem)
3241
+ if (source == clearColorsItem)
23393242 {
23403243 ClearColors();
23413244 } else
2342
- if (event.getSource() == clearMaterialsItem)
3245
+ if (source == clearMaterialsItem)
23433246 {
23443247 ClearMaterials();
23453248 } else
2346
- if (event.getSource() == liveleavesItem)
3249
+ if (source == liveleavesItem)
23473250 {
23483251 LiveLeaves(true);
23493252 } else
2350
- if (event.getSource() == unliveleavesItem)
3253
+ if (source == unliveleavesItem)
23513254 {
23523255 LiveLeaves(false);
23533256 } else
2354
- if (event.getSource() == supportleavesItem)
3257
+ if (source == supportleavesItem)
23553258 {
23563259 SupportLeaves(true);
23573260 } else
2358
- if (event.getSource() == unsupportleavesItem)
3261
+ if (source == unsupportleavesItem)
23593262 {
23603263 SupportLeaves(false);
23613264 } else
2362
- if (event.getSource() == hideleavesItem)
3265
+ if (source == hideleavesItem)
23633266 {
23643267 HideLeaves(true);
23653268 } else
2366
- if (event.getSource() == showleavesItem)
3269
+ if (source == showleavesItem)
23673270 {
23683271 HideLeaves(false);
23693272 } else
2370
- if (event.getSource() == markleavesItem)
3273
+ if (source == markleavesItem)
23713274 {
23723275 MarkLeaves(true);
23733276 } else
2374
- if (event.getSource() == unmarkleavesItem)
3277
+ if (source == unmarkleavesItem)
23753278 {
23763279 MarkLeaves(false);
23773280 } else
2378
- if (event.getSource() == flipVItem)
3281
+ if (source == rewindleavesItem)
3282
+ {
3283
+ RewindLeaves(true);
3284
+ } else
3285
+ if (source == unrewindleavesItem)
3286
+ {
3287
+ RewindLeaves(false);
3288
+ } else
3289
+ if (source == randomleavesItem)
3290
+ {
3291
+ RandomLeaves(true);
3292
+ } else
3293
+ if (source == unrandomleavesItem)
3294
+ {
3295
+ RandomLeaves(false);
3296
+ } else
3297
+ if (source == flipVItem)
23793298 {
23803299 FlipV(true);
23813300 } else
2382
- if (event.getSource() == unflipVItem)
3301
+ if (source == unflipVItem)
23833302 {
23843303 FlipV(false);
23853304 } else
2386
- if (event.getSource() == lowTexturesItem)
3305
+ if (source == lowTexturesItem)
23873306 {
23883307 SetTexRes(0);
23893308 } else
2390
- if (event.getSource() == normalTexturesItem)
3309
+ if (source == normalTexturesItem)
23913310 {
23923311 SetTexRes(1);
23933312 } else
2394
- if (event.getSource() == highTexturesItem)
3313
+ if (source == highTexturesItem)
23953314 {
23963315 SetTexRes(2);
23973316 } else
2398
- if (event.getSource() == veryhighTexturesItem)
3317
+ if (source == veryhighTexturesItem)
23993318 {
24003319 SetTexRes(3);
24013320 } else
2402
- if (event.getSource() == maxTexturesItem)
3321
+ if (source == maxTexturesItem)
24033322 {
24043323 SetTexRes(4);
24053324 } else
2406
- if (event.getSource() == panoTexturesItem)
3325
+ if (source == panoTexturesItem)
24073326 {
24083327 SetTexRes(5);
24093328 } else
2410
- if (event.getSource() == reverseNormalsItem)
3329
+ if (source == reverseNormalsItem)
24113330 {
24123331 ReverseNormals();
24133332 } else
2414
- if (event.getSource() == parseverticesItem)
3333
+ if (source == parseverticesItem)
24153334 {
24163335 ParseVertices();
24173336 } else
2418
- if (event.getSource() == textureFieldItem)
3337
+ if (source == textureFieldItem)
24193338 {
24203339 TextureVertices();
24213340 } else
2422
- if (event.getSource() == alignItem)
3341
+ if (source == alignItem)
24233342 {
24243343 Align();
24253344 } else
2426
- if (event.getSource() == mirrorItem)
3345
+ if (source == mirrorItem)
24273346 {
24283347 MirrorPoses();
24293348 } else
2430
- if (event.getSource() == reduceMorphItem)
3349
+ if (source == reduceMorphItem)
24313350 {
24323351 MeshReduction(false);
24333352 } else
2434
- if (event.getSource() == reduce34MorphItem)
3353
+ if (source == reduce34MorphItem)
24353354 {
24363355 MeshReduction(true);
24373356 } else
2438
- if (event.getSource() == reverseTrianglesItem)
3357
+ if (source == reverseTrianglesItem)
24393358 {
24403359 ReverseTriangles();
24413360 } else
2442
- if (event.getSource() == reduceMeshItem)
3361
+ if (source == reduceMeshItem)
24433362 {
24443363 ReduceMesh(false);
24453364 } else
2446
- if (event.getSource() == reduce34MeshItem)
3365
+ if (source == reduce34MeshItem)
24473366 {
24483367 ReduceMesh(true);
24493368 } else
2450
- if (event.getSource() == increaseMeshItem)
3369
+ if (source == increaseMeshItem)
24513370 {
24523371 IncreaseMesh();
24533372 } else
2454
- if (event.getSource() == clipMeshItem)
3373
+ if (source == clipMeshItem)
24553374 {
24563375 ClipMesh();
24573376 } else
2458
- if (event.getSource() == smoothMeshItem)
3377
+ if (source == smoothMeshItem)
24593378 {
24603379 SmoothMesh();
24613380 } else
2462
- if (event.getSource() == transformgeometryItem)
3381
+ if (source == transformGeometryItem)
24633382 {
24643383 TransformGeometry();
24653384 } else
2466
- if (event.getSource() == resetTransformItem)
3385
+ if (source == transformChildrenItem)
3386
+ {
3387
+ TransformChildren();
3388
+ } else
3389
+ if (source == resetTransformItem)
24673390 {
24683391 ResetTransform();
24693392 } else
2470
- if (event.getSource() == resetCentroidItem)
3393
+ if (source == resetCentroidItem)
24713394 {
2472
- ResetCentroid();
3395
+ ResetCentroid(true);
24733396 } else
2474
- if (event.getSource() == resetParentItem)
3397
+ if (source == resetCentroidXZItem)
3398
+ {
3399
+ ResetCentroid(false);
3400
+ } else
3401
+ if (source == resetParentItem)
24753402 {
24763403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773404 {
....@@ -2481,7 +3408,7 @@
24813408
24823409 refreshContents();
24833410 } else
2484
- if (event.getSource() == repairParentItem)
3411
+ if (source == repairParentItem)
24853412 {
24863413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873414 {
....@@ -2495,7 +3422,21 @@
24953422
24963423 refreshContents();
24973424 } else
2498
- if (event.getSource() == sortbysizeItem)
3425
+ if (source == repairShadowItem)
3426
+ {
3427
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3428
+ {
3429
+ Object3D obj = (Object3D)e.nextElement();
3430
+ obj.RepairShadow();
3431
+// for (int i=0; i<obj.size(); i++)
3432
+// {
3433
+// obj.get(i).parent = obj;
3434
+// }
3435
+ }
3436
+
3437
+ refreshContents();
3438
+ } else
3439
+ if (source == sortbysizeItem)
24993440 {
25003441 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013442 {
....@@ -2507,7 +3448,7 @@
25073448 ResetModel();
25083449 refreshContents();
25093450 } else
2510
- if (event.getSource() == sortbynameItem)
3451
+ if (source == sortbynameItem)
25113452 {
25123453 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133454 {
....@@ -2519,7 +3460,7 @@
25193460 ResetModel();
25203461 refreshContents();
25213462 } else
2522
- if (event.getSource() == attachPigmentItem)
3463
+ if (source == attachPigmentItem)
25233464 {
25243465 String texture = GetFile("Attach pigment");
25253466 Object3D obj;
....@@ -2531,7 +3472,7 @@
25313472
25323473 refreshContents();
25333474 } else
2534
- if (event.getSource() == detachPigmentItem)
3475
+ if (source == detachPigmentItem)
25353476 {
25363477 Object3D obj;
25373478 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3483,7 @@
25423483
25433484 refreshContents();
25443485 } else
2545
- if (event.getSource() == attachBumpItem)
3486
+ if (source == attachBumpItem)
25463487 {
25473488 String texture = GetFile("Attach bump");
25483489 Object3D obj;
....@@ -2554,18 +3495,18 @@
25543495
25553496 refreshContents();
25563497 } else
2557
- if (event.getSource() == detachBumpItem)
3498
+ if (source == detachBumpItem)
25583499 {
25593500 Object3D obj;
25603501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25613502 {
25623503 obj = (Object3D)e.nextElement();
2563
- obj.SetBumpTexture(null);
3504
+ obj.ResetBumpTexture();
25643505 }
25653506
25663507 refreshContents();
25673508 } else
2568
- if (event.getSource() == pigmentBumpItem)
3509
+ if (source == pigmentBumpItem)
25693510 {
25703511 Object3D obj;
25713512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3517,262 @@
25763517
25773518 refreshContents();
25783519 } else
2579
- if (event.getSource() == flashSelectionButton)
3520
+ if (source == embedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(true);
3527
+ }
3528
+
3529
+ refreshContents();
3530
+ } else
3531
+ if (source == deEmbedTexturesItem)
3532
+ {
3533
+ Object3D obj;
3534
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3535
+ {
3536
+ obj = (Object3D)e.nextElement();
3537
+ obj.EmbedTextures(false);
3538
+ }
3539
+
3540
+ CameraPane.texturepigment.clear();
3541
+ CameraPane.texturebump.clear();
3542
+
3543
+ refreshContents();
3544
+ } else
3545
+ if (source == flashSelectionButton)
25803546 {
25813547 CameraPane.flash = true;
25823548 refreshContents();
25833549 } else
2584
- if (event.getSource() == oneButton)
3550
+ if (source == oneButton)
25853551 {
25863552 } else
2587
- if (event.getSource() == twoButton)
3553
+ if (source == twoButton)
25883554 {
25893555 radio.layout = twoButton;
3556
+
3557
+ if (CameraPane.FULLSCREEN)
3558
+ fullscreenLayout = radio.layout;
3559
+
25903560 // bug
25913561 //gridPanel.setDividerLocation(1.0);
25923562 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
3563
+// bigThree.remove(scenePanel);
3564
+// bigThree.remove(centralPanel);
3565
+// bigThree.remove(XYZPanel);
3566
+// aWindowConstraints.gridx = 0;
3567
+// aWindowConstraints.gridy = 0;
3568
+// aWindowConstraints.gridwidth = 1;
3569
+// // aConstraints.gridheight = 3;
3570
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3571
+// aWindowConstraints.weightx = 0;
3572
+// aWindowConstraints.weighty = 1;
3573
+// //bigThree.add(jtp, aWindowConstraints);
3574
+// aWindowConstraints.weightx = 1;
3575
+// aWindowConstraints.gridwidth = 3;
3576
+// // aConstraints.gridheight = 3;
3577
+// aWindowConstraints.gridx = 1;
3578
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3579
+// bigThree.add(centralPanel, aWindowConstraints);
3580
+// aWindowConstraints.weightx = 0;
3581
+// aWindowConstraints.gridx = 4;
3582
+// aWindowConstraints.gridwidth = 1;
3583
+// // aConstraints.gridheight = 3;
3584
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3585
+// //bigThree.add(XYZPanel, aWindowConstraints);
3586
+// scenePanel.setVisible(false);
3587
+// centralPanel.setVisible(true);
3588
+// XYZPanel.setVisible(false);
3589
+ bigThree.ClearUI();
3590
+ bigThree.add(centralPanel);
3591
+ bigThree.FlushUI();
3592
+
3593
+ cameraView.requestFocusInWindow();
3594
+
3595
+// refreshContents(true);
3596
+//
3597
+// try
3598
+// {
3599
+// java.awt.Robot bot = new java.awt.Robot();
3600
+// int mask = InputEvent.BUTTON1_MASK;
3601
+// bot.mouseMove(100, 100);
3602
+// bot.mousePress(mask);
3603
+// bot.mouseRelease(mask);
3604
+// }
3605
+// catch (Exception e)
3606
+// {
3607
+//
3608
+// }
3609
+
26173610 } else
2618
- if (event.getSource() == threeButton)
3611
+ if (source == threeButton)
26193612 {
26203613 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
3614
+
3615
+ if (CameraPane.FULLSCREEN)
3616
+ fullscreenLayout = radio.layout;
3617
+
3618
+// bigThree.remove(scenePanel);
3619
+// bigThree.remove(centralPanel);
3620
+// bigThree.remove(XYZPanel);
3621
+// aWindowConstraints.gridx = 0;
3622
+// aWindowConstraints.gridy = 0;
3623
+// aWindowConstraints.gridwidth = 1;
3624
+// // aConstraints.gridheight = 3;
3625
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3626
+// aWindowConstraints.weightx = 0;
3627
+// aWindowConstraints.weighty = 1;
3628
+// //bigThree.add(jtp, aWindowConstraints);
3629
+// aWindowConstraints.weightx = 1;
3630
+// aWindowConstraints.gridwidth = 3;
3631
+// // aConstraints.gridheight = 3;
3632
+// aWindowConstraints.gridx = 1;
3633
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3634
+// bigThree.add(centralPanel, aWindowConstraints);
3635
+// aWindowConstraints.weightx = 0;
3636
+// aWindowConstraints.gridx = 4;
3637
+// aWindowConstraints.gridwidth = 1;
3638
+// // aConstraints.gridheight = 3;
3639
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3640
+// bigThree.add(XYZPanel, aWindowConstraints);
3641
+// bigThree.validate();
3642
+// scenePanel.setVisible(false);
3643
+// centralPanel.setVisible(true);
3644
+// XYZPanel.setVisible(true);
3645
+ bigThree.ClearUI();
3646
+ bigThree.add(scenePanel);
3647
+ bigThree.add(centralPanel);
3648
+ bigThree.FlushUI();
3649
+
3650
+ cameraView.requestFocusInWindow();
26453651 } else
2646
- if (event.getSource() == fourButton)
3652
+ if (source == fourButton)
26473653 {
26483654 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
3655
+
3656
+ if (CameraPane.FULLSCREEN)
3657
+ fullscreenLayout = radio.layout;
3658
+
3659
+// bigThree.remove(scenePanel);
3660
+// bigThree.remove(centralPanel);
3661
+// bigThree.remove(XYZPanel);
3662
+// aWindowConstraints.gridx = 0;
3663
+// aWindowConstraints.gridy = 0;
3664
+// aWindowConstraints.gridwidth = 1;
3665
+// // aWindowConstraints.gridheight = 3;
3666
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3667
+// aWindowConstraints.weightx = 1;
3668
+// aWindowConstraints.weighty = 1;
3669
+// bigThree.add(scenePanel, aWindowConstraints);
3670
+// aWindowConstraints.weightx = 1;
3671
+// aWindowConstraints.gridwidth = 3;
3672
+// // aConstraints.gridheight = 3;
3673
+// aWindowConstraints.gridx = 1;
3674
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3675
+// //bigThree.add(cameraPanel, aWindowConstraints);
3676
+// aWindowConstraints.weightx = 0;
3677
+// aWindowConstraints.gridx = 4;
3678
+// aWindowConstraints.gridwidth = 1;
3679
+// // aWindowConstraints.gridheight = 3;
3680
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3681
+// //bigThree.add(XYZPanel, aWindowConstraints);
3682
+// bigThree.validate();
3683
+// scenePanel.setVisible(true);
3684
+// centralPanel.setVisible(false);
3685
+// XYZPanel.setVisible(false);
3686
+ bigThree.ClearUI();
3687
+ bigThree.add(scenePanel);
3688
+ bigThree.FlushUI();
3689
+
3690
+ cameraView.requestFocusInWindow();
26733691 } else
2674
- if (event.getSource() == sixButton)
3692
+ if (source == sixButton)
26753693 {
26763694 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
3695
+
3696
+ if (CameraPane.FULLSCREEN)
3697
+ fullscreenLayout = radio.layout;
3698
+
3699
+// bigThree.remove(scenePanel);
3700
+// bigThree.remove(centralPanel);
3701
+// bigThree.remove(XYZPanel);
3702
+// aWindowConstraints.gridx = 0;
3703
+// aWindowConstraints.gridy = 0;
3704
+// aWindowConstraints.gridwidth = 1;
3705
+// // aConstraints.gridheight = 3;
3706
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3707
+// aWindowConstraints.weightx = 0;
3708
+// aWindowConstraints.weighty = 1;
3709
+// bigThree.add(scenePanel, aWindowConstraints);
3710
+// aWindowConstraints.weightx = 1;
3711
+// aWindowConstraints.gridwidth = 3;
3712
+// // aWindowConstraints.gridheight = 3;
3713
+// aWindowConstraints.gridx = 1;
3714
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3715
+// bigThree.add(centralPanel, aWindowConstraints);
3716
+// aWindowConstraints.weightx = 0;
3717
+// aWindowConstraints.gridx = 4;
3718
+// aWindowConstraints.gridwidth = 1;
3719
+// // aWindowConstraints.gridheight = 3;
3720
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3721
+// //bigThree.add(XYZPanel, aConstraints);
3722
+// bigThree.validate();
3723
+// scenePanel.setVisible(true);
3724
+// centralPanel.setVisible(true);
3725
+// XYZPanel.setVisible(false);
3726
+ bigThree.ClearUI();
3727
+ bigThree.add(centralPanel);
3728
+ bigThree.add(scenePanel);
3729
+ bigThree.FlushUI();
3730
+
3731
+ cameraView.requestFocusInWindow();
27013732 } else
2702
- if (event.getSource() == sevenButton)
3733
+ if (source == sevenButton)
27033734 {
27043735 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
3736
+
3737
+ if (CameraPane.FULLSCREEN)
3738
+ fullscreenLayout = radio.layout;
3739
+
3740
+// bigThree.remove(scenePanel);
3741
+// bigThree.remove(centralPanel);
3742
+// bigThree.remove(XYZPanel);
3743
+// aWindowConstraints.gridx = 0;
3744
+// aWindowConstraints.gridy = 0;
3745
+// aWindowConstraints.gridwidth = 1;
3746
+// // aWindowConstraints.gridheight = 3;
3747
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3748
+// aWindowConstraints.weightx = 0;
3749
+// aWindowConstraints.weighty = 1;
3750
+// bigThree.add(scenePanel, aWindowConstraints);
3751
+// aWindowConstraints.weightx = 1;
3752
+// aWindowConstraints.gridwidth = 3;
3753
+// // aWindowConstraints.gridheight = 3;
3754
+// aWindowConstraints.gridx = 1;
3755
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3756
+// bigThree.add(centralPanel, aWindowConstraints);
3757
+// aWindowConstraints.weightx = 0;
3758
+// aWindowConstraints.gridx = 4;
3759
+// aWindowConstraints.gridwidth = 1;
3760
+// // aConstraints.gridheight = 3;
3761
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3762
+// bigThree.add(XYZPanel, aWindowConstraints);
3763
+// bigThree.validate();
3764
+// scenePanel.setVisible(true);
3765
+// centralPanel.setVisible(true);
3766
+// XYZPanel.setVisible(true);
3767
+ bigThree.ClearUI();
3768
+ bigThree.add(scenePanel);
3769
+ bigThree.add(centralPanel);
3770
+ bigThree.add(XYZPanel);
3771
+ bigThree.FlushUI();
3772
+
3773
+ cameraView.requestFocusInWindow();
27293774 } else
2730
- if (event.getSource() == rootButton)
3775
+ if (source == rootButton)
27313776 {
27323777 Object3D obj;
27333778 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3782,85 @@
27373782 EditObject(obj);
27383783 }
27393784
3785
+ cameraView.requestFocusInWindow();
27403786 refreshContents(true);
27413787 } else
2742
- if (event.getSource() == closeButton)
3788
+ if (source == closeButton)
27433789 {
27443790 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453791 cRadio ab;
27463792 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473793 {
27483794 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3795
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503796 {
3797
+ // Patch to avoid bug with transparency.
3798
+ if (!ab.hadMaterial)
3799
+ {
3800
+ ab.object.material = null;
3801
+ }
3802
+
27513803 buttonGroup.remove(ab);
27523804 radioPanel.remove(ab);
27533805
2754
- ab.GetObject().editWindow = null;
3806
+ //ab.GetObject().editWindow = null;
3807
+ ab.GetObject().manipWindow = null;
27553808 // ab.GetObject().objectUI = null; // ?????????
27563809
27573810 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583811 break;
27593812 }
27603813 }
3814
+
3815
+ cameraView.requestFocusInWindow();
27613816 refreshContents(true);
27623817 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3818
+ if (source == editItem || source == editButton)
27643819 {
3820
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3821
+ {
3822
+ Object3D child = (Object3D)e.nextElement();
3823
+ child.pinned = true;
3824
+ }
3825
+
27653826 EditSelection(false);
27663827 } else
2767
- if (event.getSource() == uneditButton)
3828
+ if (source == uneditButton)
27683829 {
27693830 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703831 {
27713832 Object3D child = (Object3D)e.nextElement();
27723833 if(child.editWindow != null)
2773
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3834
+ child.pinned = false;
27743835 child.CloseUI();
27753836 listUI.remove(child);
3837
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27763838
2777
- child.editWindow = null; // ???????????
3839
+ //child.editWindow = null; // ???????????
27783840 }
2779
- objEditor.ctrlPanel.revalidate();
3841
+ objEditor.ctrlPanel.FlushUI();
27803842 //objEditor.jTree.clearSelection();
27813843 //objEditor.ResetSliders();
27823844 refreshContents(true);
27833845 } else
2784
- if (event.getSource() == clearPanelButton)
3846
+ if (source == clearPanelButton)
27853847 {
27863848 assert(copy == group);
27873849 //copy.ClearUI();
27883850 for (Object3D obj : listUI)
27893851 {
3852
+ obj.pinned = false;
27903853 obj.CloseUI();
27913854 }
27923855 listUI.clear();
3856
+ SetPinStates(group.selection.size() > 0);
27933857 refreshContents(true);
27943858 } else
2795
- if (event.getSource() == allParamsButton)
3859
+ if (source == allParamsButton)
27963860 {
27973861 assert(copy == group);
27983862
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3863
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003864
28013865 for (Object3D obj : listUI)
28023866 {
....@@ -2813,19 +3877,19 @@
28133877
28143878 refreshContents(true);
28153879 } else
2816
- if (event.getSource() == unselectButton)
3880
+ if (source == unselectButton)
28173881 {
28183882 objEditor.jTree.clearSelection();
28193883 // ?? oct 2012 GrafreeD.clipboard.clear();
28203884 objEditor.ResetSliders();
28213885 refreshContents(true);
28223886 } else
2823
- if(event.getSource() instanceof cRadio)
3887
+ if(source instanceof cRadio)
28243888 {
28253889 group.parent = keepparent;
28263890 group.attributes = 0;
28273891 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3892
+ /*cRadio*/ radio = (cRadio)source;
28293893 Object3D obj = radio.GetObject();
28303894 System.out.println("Edit " + obj);
28313895 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3909,10 @@
28453909 }
28463910
28473911 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3912
+
3913
+ SetUndoStates();
3914
+
3915
+ //Globals.theRenderer.object = group;
28493916 if(!useclient)
28503917 {
28513918 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3921,55 @@
28543921 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553922 cameraView.targetLookAt.set(radio.camera.lookAt);
28563923 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3924
+ //cameraView.lighttouched = true;
3925
+ Globals.lighttouched = true;
28583926 topView.object = group;
28593927 frontView.object = group;
28603928 sideView.object = group;
28613929 }
2862
- group.editWindow = this;
3930
+
3931
+// fix "+" issue
3932
+ //group.editWindow = this;
3933
+ group.manipWindow = this;
3934
+
28633935 /*
28643936 currentLayout = radio.layout;
28653937 if (currentLayout == null)
28663938 currentLayout = sevenButton;
28673939 */
28683940 radio.layout.doClick();
3941
+
3942
+ ClearUnpinned();
3943
+
3944
+ //Grafreed.Assert(group != null);
3945
+ //Grafreed.Assert(group.selection != null);
3946
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3947
+ if (group.selection == null || group.selection.size() == 1)
3948
+ EditSelection(false);
28693949 keepparent = group.parent;
28703950 // PARENT = NULL or not???
28713951 //group.parent = null; // ROOT
28723952 //group.attributes = -1;
28733953 ResetModel();
3954
+
3955
+ cameraView.requestFocusInWindow();
28743956 refreshContents(true);
2875
- }
3957
+ } else if (event.getSource() == editCameraItem)
3958
+ {
3959
+ cameraView.ProtectCamera();
3960
+ cameraView.requestFocusInWindow();
3961
+ cameraView.repaint();
3962
+ return;
3963
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3964
+ {
3965
+ cameraView.RevertCamera();
3966
+ cameraView.requestFocusInWindow();
3967
+ cameraView.repaint();
3968
+ return;
3969
+ // } else if (event.getSource() == textureButton)
3970
+ // {
3971
+ // return; // true;
3972
+ }
28763973 else
28773974 {
28783975 //return super.action(event, arg);
....@@ -2881,7 +3978,6 @@
28813978 }
28823979
28833980 boolean useclient = false;
2884
- cRadio radio;
28853981
28863982 void ToggleRoot()
28873983 {
....@@ -2890,7 +3986,7 @@
28903986 if (useclient)
28913987 {
28923988 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3989
+ Globals.lighttouched = true;
28943990 //topView.object = client;
28953991 //frontView.object = client;
28963992 //sideView.object = client;
....@@ -2898,7 +3994,7 @@
28983994 else
28993995 {
29003996 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3997
+ Globals.lighttouched = true;
29023998 //topView.object = group;
29033999 //frontView.object = group;
29044000 //sideView.object = group;
....@@ -2933,6 +4029,28 @@
29334029 refreshContents();
29344030 }
29354031
4032
+ void TransformChildren()
4033
+ {
4034
+ Object3D obj;
4035
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4036
+ {
4037
+ obj = (Object3D)e.nextElement();
4038
+ obj.KeepTextureMatrices();
4039
+ obj.TransformChildren();
4040
+ obj.RestoreTextureMatrices();
4041
+
4042
+// if (obj.parent == null)
4043
+// {
4044
+// System.out.println("NULL PARENT!");
4045
+// new Exception().printStackTrace();
4046
+// }
4047
+// else
4048
+// TouchTransform(obj);
4049
+// //obj.parent.Touch();
4050
+ }
4051
+
4052
+ refreshContents();
4053
+ }
29364054
29374055 void ResetTransform()
29384056 {
....@@ -3045,7 +4163,7 @@
30454163 refreshContents();
30464164 }
30474165
3048
- void ResetCentroid()
4166
+ void ResetCentroid(boolean full)
30494167 {
30504168 Object3D obj;
30514169 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +4178,16 @@
30604178 LA.matIdentity(Object3D.mat);
30614179 obj.getBounds(minima, maxima, false);
30624180 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4181
+ if (full)
4182
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30644183 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30654184 obj.TransformMesh(Object3D.mat);
4185
+
30664186 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4187
+ if (full)
4188
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30684189 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4190
+
30694191 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30704192 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30714193 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +4216,8 @@
30944216
30954217 int size = obj.MemorySize();
30964218
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
4219
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4220
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30984221 }
30994222 }
31004223 catch (Exception e)
....@@ -3131,9 +4254,9 @@
31314254 obj = (Object3D)e.nextElement();
31324255
31334256 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
4257
+ Grafreed.AnalyzeObject(obj);
31354258 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
4259
+ Grafreed.AnalyzeObject(obj.bRep);
31374260
31384261 // System.err.println((size/1024) + " KB is the size of " + obj);
31394262 }
....@@ -3175,6 +4298,20 @@
31754298 void GenNormals(boolean crease)
31764299 {
31774300 group.GenNormalsS(crease);
4301
+
4302
+ refreshContents();
4303
+ }
4304
+
4305
+ void GenNormalsMESH()
4306
+ {
4307
+ group.GenNormalsMeshS();
4308
+
4309
+ refreshContents();
4310
+ }
4311
+
4312
+ void GenNormalsMINE()
4313
+ {
4314
+ group.selection.GenNormalsMINE();
31784315
31794316 refreshContents();
31804317 }
....@@ -3340,8 +4477,8 @@
33404477
33414478 void ParseVertices()
33424479 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4480
+ boolean epsequal = Grafreed.epsequal;
4481
+ Grafreed.epsequal = true;
33454482
33464483 for (int i=0; i<group.selection.size(); i++)
33474484 {
....@@ -3366,7 +4503,7 @@
33664503 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674504 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684505
3369
- g.add(GrafreeD.clipboard);
4506
+ g.add(Grafreed.clipboard);
33704507
33714508 buffer.add(g);
33724509 }
....@@ -3381,7 +4518,7 @@
33814518 makeSomething(buffer, i==group.selection.size()-1);
33824519 }
33834520
3384
- GrafreeD.epsequal = epsequal;
4521
+ Grafreed.epsequal = epsequal;
33854522
33864523 refreshContents();
33874524 }
....@@ -3399,7 +4536,16 @@
33994536 String pigment = Object3D.GetPigment(tex);
34004537 //String bump = Object3D.GetBump(tex);
34014538
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4539
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4540
+
4541
+ try
4542
+ {
4543
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4544
+ }
4545
+ catch (Exception e)
4546
+ {
4547
+ System.err.println("FAIL: " + node);
4548
+ }
34034549
34044550 double s = v.s;
34054551
....@@ -3447,12 +4593,26 @@
34474593
34484594 void Align()
34494595 {
4596
+ if (group.selection.size() == 0)
4597
+ return;
4598
+
4599
+ cVector bbmin = new cVector();
4600
+ cVector bbmax = new cVector();
4601
+
4602
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4603
+
4604
+ double dx = bbmax.x - bbmin.x;
4605
+ double dy = bbmax.y - bbmin.y;
4606
+ double dz = bbmax.z - bbmin.z;
4607
+
4608
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4609
+
34504610 for (int i=0; i<group.selection.size(); i++)
34514611 {
34524612 Object3D obj = group.selection.get(i);
34534613
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4614
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4615
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564616 }
34574617
34584618 refreshContents();
....@@ -3473,11 +4633,11 @@
34734633
34744634 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754635
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4636
+ boolean random = CameraPane.SWITCH;
4637
+ CameraPane.SWITCH = false; // parse all random nodes
34784638 lowres.linkVerticesThis(null);
34794639 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4640
+ CameraPane.SWITCH = random;
34814641
34824642 System.err.flush();
34834643
....@@ -3517,7 +4677,7 @@
35174677 return;
35184678
35194679 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4680
+ Object3D ref = Grafreed.clipboard.get(0);
35214681
35224682 Object3D newgroup = new Object3D("Po:" + poses.name);
35234683
....@@ -3686,7 +4846,7 @@
36864846 group.selection.RelinkToSupport(); // july 2014
36874847 System.out.println("DONE.");
36884848 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4849
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904850 }
36914851
36924852 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4871,9 @@
37114871
37124872 void ClipMesh()
37134873 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4874
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154875 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4876
+ Object3D content = Grafreed.clipboard.get(0);
37174877
37184878 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194879 content = ((cGroup)content).get(0);
....@@ -3722,7 +4882,7 @@
37224882 // {
37234883 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244884 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4885
+ group.selection.ClipMesh(Grafreed.clipboard);
37264886 }
37274887 // group.selection.ClipMesh(GrafreeD.clipboard);
37284888 System.out.println("DONE.");
....@@ -3769,6 +4929,18 @@
37694929 void MarkLeaves(boolean hide)
37704930 {
37714931 group.selection.MarkLeaves(hide);
4932
+ refreshContents();
4933
+ }
4934
+
4935
+ void RewindLeaves(boolean hide)
4936
+ {
4937
+ group.selection.RewindLeaves(hide);
4938
+ refreshContents();
4939
+ }
4940
+
4941
+ void RandomLeaves(boolean hide)
4942
+ {
4943
+ group.selection.RandomLeaves(hide);
37724944 refreshContents();
37734945 }
37744946
....@@ -3843,28 +5015,25 @@
38435015 // }
38445016 // }
38455017
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38505018 void EditSelection(boolean newWindow)
38515019 {
5020
+ if (group.selection == null)
5021
+ {
5022
+ EditElement(group, newWindow); // ? new
5023
+ return;
5024
+ }
5025
+
38525026 // aConstraints.gridy = 0;
38535027 for (int i=0; i<group.selection.size(); i++)
38545028 {
38555029 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38565030 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5031
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38585032
38595033 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
5034
+ if(elem != group || !newWindow)
38615035 {
3862
- // if (!(elem instanceof Composite))
3863
- // newWindow = false;
3864
- listUI.add(elem);
3865
- elem.openEditWindow(this, newWindow); //, false);
3866
- System.out.println("edit : " + elem);
3867
- elem.editWindow.refreshContents(true); // ? new
5036
+ EditElement(elem, newWindow); // ? new
38685037 }
38695038 }
38705039 }
....@@ -3927,9 +5096,7 @@
39275096
39285097 freezemodel = false;
39295098 }
3930
-
3931
- boolean flashIt = true;
3932
-
5099
+
39335100 public void valueChanged(TreeSelectionEvent e)
39345101 //public boolean handleEvent(Event event)
39355102 {
....@@ -3939,7 +5106,8 @@
39395106 //new Exception().printStackTrace();
39405107
39415108 freezemodel = true;
3942
-
5109
+ ClearUnpinned();
5110
+
39435111 /**/
39445112 //switch (event.id)
39455113 {
....@@ -3947,7 +5115,6 @@
39475115 //case 702: // Event.LIST_DESELECT
39485116 group.deselectAll();
39495117 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39515118 if (tps != null)
39525119 {
39535120 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +5123,39 @@
39565123
39575124 //if (child.parent != null)
39585125 //child.parent.addSelectee(child);
5126
+ objEditor.SetMaterial(child);
39595127 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39635128 }
39645129 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
5130
+// else
5131
+// {
5132
+// objEditor.SetMaterial(group); // .GetMaterial());
5133
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5134
+// System.err.println("info : " + group.GetPath());
5135
+// }
39715136
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5137
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39755138 CameraPane.flash = true;
39765139
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5140
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39785141 // a camera
39795142 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5143
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5144
+ {
5145
+ CameraPane.camerachangeframe = 0; // don't refuse it
5146
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5147
+ }
5148
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5149
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39845150 }
39855151
5152
+ if (tps != null && tps.length == 1)
5153
+ {
5154
+ EditSelection(false);
5155
+ }
5156
+
5157
+ SetPinStates(tps != null && tps.length > 0);
5158
+
39865159 refreshContents();
39875160 //return true;
39885161 }
....@@ -3991,6 +5164,37 @@
39915164
39925165 freezemodel = false;
39935166 }
5167
+
5168
+ void SetPinStates(boolean enabled)
5169
+ {
5170
+ editButton.setEnabled(enabled);
5171
+ uneditButton.setEnabled(enabled);
5172
+ unselectButton.setEnabled(enabled);
5173
+ flashSelectionButton.setEnabled(enabled);
5174
+
5175
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5176
+ }
5177
+
5178
+ void refreshContents(boolean cp)
5179
+ {
5180
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5181
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5182
+ {
5183
+ objEditor.ClearInfo(); // .GetMaterial());
5184
+
5185
+ for (int i=0; i < group.selection.Size(); i++)
5186
+ {
5187
+ Object3D child = (Object3D) group.selection.get(i);
5188
+
5189
+ objEditor.AddInfo(child, this, true);
5190
+ System.err.println("info : " + child.GetPath());
5191
+ }
5192
+
5193
+ objEditor.SetText(); // jan 2014
5194
+ }
5195
+
5196
+ super.refreshContents(cp);
5197
+ }
39945198
39955199 void linkSomething(Object3D thing)
39965200 {
....@@ -4062,16 +5266,19 @@
40625266 {
40635267 if (group.selection.isEmpty())
40645268 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
5269
+
5270
+ Grafreed.clipboardIsTempGroup = false;
40665271 Composite tGroup = null;
40675272 if (group.selection.size() > 0) // 1)
40685273 {
40695274 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
5275
+ Grafreed.clipboardIsTempGroup = true;
40715276 }
40725277
40735278 if (cut)
40745279 {
5280
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5281
+// Save();
40755282 //int indices[] = jList.getSelectedIndices();
40765283 //for (int i = indices.length - 1; i >= 0; i--)
40775284 //jList.remove(indices[i]);
....@@ -4107,16 +5314,16 @@
41075314 //System.out.println("cut " + child);
41085315 //System.out.println("parent = " + child.parent);
41095316 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
5317
+ if (Grafreed.clipboardIsTempGroup)
41115318 tGroup.add/*Child*/(tmp);
41125319 else
4113
- GrafreeD.clipboard = tmp;
5320
+ Grafreed.clipboard = tmp;
41145321 }
41155322 else
4116
- if (GrafreeD.clipboardIsTempGroup)
5323
+ if (Grafreed.clipboardIsTempGroup)
41175324 tGroup.add/*Child*/(child);
41185325 else
4119
- GrafreeD.clipboard = child;
5326
+ Grafreed.clipboard = child;
41205327 }
41215328
41225329 //ResetModel();
....@@ -4148,21 +5355,23 @@
41485355 //System.out.println("cut " + elem);
41495356 //System.out.println("parent = " + elem.parent);
41505357 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
5358
+ if (Grafreed.clipboardIsTempGroup)
41525359 tGroup.add/*Child*/(tmp);
41535360 else
4154
- GrafreeD.clipboard = tmp;
5361
+ Grafreed.clipboard = tmp;
41555362 }
41565363 else
4157
- if (GrafreeD.clipboardIsTempGroup)
5364
+ if (Grafreed.clipboardIsTempGroup)
41585365 tGroup.add/*Child*/(child);
41595366 else
4160
- GrafreeD.clipboard = child;
5367
+ Grafreed.clipboard = child;
41615368 }
41625369
41635370 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
5371
+
5372
+ if (Grafreed.clipboardIsTempGroup)
5373
+ Grafreed.clipboard = tGroup;
5374
+
41665375 if (cut)
41675376 {
41685377 ResetModel();
....@@ -4172,11 +5381,15 @@
41725381
41735382 void paste(boolean expand)
41745383 {
5384
+ if (Globals.REPLACEONMAKE)
5385
+ Save();
5386
+ boolean keep = Globals.REPLACEONMAKE;
5387
+ Globals.REPLACEONMAKE = false;
41755388 // if (GrafreeD.clipboard == null)
41765389 // return;
41775390 boolean first = true;
41785391
4179
- if (GrafreeD.clipboardIsTempGroup)
5392
+ if (Grafreed.clipboardIsTempGroup)
41805393 {
41815394 Composite temp;
41825395
....@@ -4187,7 +5400,7 @@
41875400 temp = (Composite)Applet3D.clipboard.deepCopy();
41885401 */
41895402 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5403
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41915404 {
41925405 Object3D child = (Object3D)e.nextElement();
41935406
....@@ -4221,21 +5434,22 @@
42215434 //Object3D cb = Applet3D.clipboard;
42225435 //temp.addChild(cb);
42235436 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5437
+ assert(Grafreed.clipboard.parent == null);
5438
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5439
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5440
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5441
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42295442 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
5443
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5444
+ Grafreed.clipboard.get(0).parent = keepparent;
42325445 }
42335446
5447
+ Globals.REPLACEONMAKE = keep;
42345448 ResetModel();
42355449 refreshContents();
42365450 }
42375451
4238
- void pasteInto(boolean copyit)
5452
+ void pasteInto(boolean copyit, boolean clone)
42395453 {
42405454 // if (GrafreeD.clipboard == null)
42415455 // return;
....@@ -4264,15 +5478,22 @@
42645478 if (copyit)
42655479 {
42665480 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5481
+ if (clone)
5482
+ {
5483
+ CloneClipboard(false); // sept 2014
5484
+ }
5485
+ else
5486
+ {
5487
+ paste(false);
5488
+ }
42685489 }
42695490 else
42705491 {
42715492 boolean first = true;
42725493
4273
- if (GrafreeD.clipboardIsTempGroup)
5494
+ if (Grafreed.clipboardIsTempGroup)
42745495 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5496
+ Composite temp = (Composite)Grafreed.clipboard;
42765497 Object3D copy;
42775498 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785499 {
....@@ -4282,7 +5503,7 @@
42825503 }
42835504 } else
42845505 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5506
+ linkSomething(Grafreed.clipboard); //.get(0));
42865507 }
42875508 }
42885509 }
....@@ -4359,6 +5580,10 @@
43595580
43605581 void group(Object3D csg, boolean grab)
43615582 {
5583
+ if (Globals.REPLACEONMAKE)
5584
+ Save();
5585
+ boolean keep = Globals.REPLACEONMAKE;
5586
+ Globals.REPLACEONMAKE = false;
43625587 if (//false) // why??
43635588 !group.selection.isEmpty())
43645589 {
....@@ -4472,8 +5697,34 @@
44725697 //node.add(csg);
44735698 //makeSomething(node);
44745699 makeSomething(csg);
5700
+ Globals.REPLACEONMAKE = keep;
44755701 }
44765702
5703
+ void Ungroup(Object3D g)
5704
+ {
5705
+ if (Globals.REPLACEONMAKE)
5706
+ Save();
5707
+ boolean keep = Globals.REPLACEONMAKE;
5708
+ Globals.REPLACEONMAKE = false;
5709
+ if (g instanceof HiddenObject)
5710
+ {
5711
+ HiddenObject h = (HiddenObject) g;
5712
+
5713
+ for (int i=0; i<h.ActualSize(); i++)
5714
+ {
5715
+ objEditor.makeSomething(h.get(i), false);
5716
+ }
5717
+ }
5718
+ else
5719
+ {
5720
+ for (int i=0; i<g.Size(); i++)
5721
+ {
5722
+ objEditor.makeSomething(g.get(i), false);
5723
+ }
5724
+ }
5725
+ Globals.REPLACEONMAKE = keep;
5726
+ }
5727
+
44775728 void ungroup()
44785729 {
44795730 /*
....@@ -4667,21 +5918,6 @@
46675918 }
46685919 */
46695920
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855921 /*
46865922 public void Callback(Object obj)
46875923 {
....@@ -4705,26 +5941,9 @@
47055941 }
47065942 */
47075943
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255944 String GetFile(String dialogName)
47265945 {
4727
- if (GrafreeD.standAlone)
5946
+ if (Grafreed.standAlone)
47285947 {
47295948 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305949 browser.show();
....@@ -4788,10 +6007,48 @@
47886007 cButton flashSelectionButton;
47896008 cButton editButton;
47906009 cButton uneditButton;
6010
+ JCheckBox allParamsButton;
47916011 cButton clearpanelButton;
4792
- cButton allParamsButton;
47936012 cButton unselectButton;
47946013
6014
+ cButton restoreCameraButton;
6015
+
6016
+ cButton oneStepButton;
6017
+
6018
+ cButton groupButton;
6019
+ cButton ungroupButton;
6020
+ cButton compositeButton;
6021
+ cButton switchButton;
6022
+ cButton loopButton;
6023
+ cButton textureButton;
6024
+
6025
+ cButton skybox1Button;
6026
+ cButton skybox2Button;
6027
+ cButton skybox3Button;
6028
+ cButton skybox4Button;
6029
+ cButton skybox5Button;
6030
+ cButton skybox6Button;
6031
+ cButton skybox7Button;
6032
+
6033
+ cButton skybox11Button;
6034
+ cButton skybox12Button;
6035
+ cButton skybox13Button;
6036
+ cButton skybox14Button;
6037
+ cButton skybox15Button;
6038
+ cButton skybox16Button;
6039
+ cButton skybox17Button;
6040
+
6041
+ cButton gridButton;
6042
+ cButton boxButton;
6043
+ cButton sphereButton;
6044
+ cButton coneButton;
6045
+ cButton torusButton;
6046
+ cButton superButton;
6047
+ cButton kleinButton;
6048
+ cButton particlesButton;
6049
+ cButton overlayButton;
6050
+ cButton lightButton;
6051
+
47956052 cButton screenfitButton;
47966053 cButton screenfitpointButton;
47976054 cButton snapobjectButton;
....@@ -4803,14 +6060,6 @@
48036060
48046061 cButton setsupportButton;
48056062
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
4813
-
48146063 //
48156064 //Composite
48166065 Object3D // to do !!
....@@ -4820,9 +6069,11 @@
48206069 //JTree jTree;
48216070 private MenuItem lookAtItem;
48226071 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
6072
+ private MenuItem switchViewItem;
48246073 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
6074
+ private MenuItem undoItem;
6075
+ private MenuItem redoItem;
6076
+ private JMenuItem duplicateItem;
48266077 private MenuItem cloneItem;
48276078 private MenuItem cloneSupportItem;
48286079 private MenuItem overwriteGeoItem;
....@@ -4833,8 +6084,9 @@
48336084 private MenuItem resetsupportItem;
48346085 private MenuItem resetreferencesItem;
48356086 private MenuItem linkverticesItem;
6087
+ private MenuItem relinkverticesItem;
48366088 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
6089
+ private MenuItem resetAllItem;
48386090 private MenuItem stepAllItem;
48396091 private MenuItem revertMeshItem;
48406092 private MenuItem poseMeshItem;
....@@ -4845,15 +6097,17 @@
48456097 private MenuItem mergeGeometriesItem;
48466098 private MenuItem copyItem;
48476099 private MenuItem pasteItem;
6100
+ private MenuItem pasteIntoItem;
48486101 private MenuItem pasteLinkItem;
48496102 private MenuItem pasteCloneItem;
48506103 private MenuItem pasteExpandItem;
4851
- private MenuItem clearItem;
6104
+ private MenuItem deleteItem;
48526105 private MenuItem clearAllItem;
48536106 private MenuItem genUVItem;
48546107 private MenuItem genNormalsMESHItem;
48556108 private MenuItem genNormalsCADItem;
48566109 private MenuItem genNormalsORGANItem;
6110
+ private MenuItem genNormalsMINEItem;
48576111 private MenuItem stripifyItem;
48586112 private MenuItem unstripifyItem;
48596113 private MenuItem trimItem;
....@@ -4882,6 +6136,10 @@
48826136 private MenuItem showleavesItem;
48836137 private MenuItem markleavesItem;
48846138 private MenuItem unmarkleavesItem;
6139
+ private MenuItem rewindleavesItem;
6140
+ private MenuItem unrewindleavesItem;
6141
+ private MenuItem randomleavesItem;
6142
+ private MenuItem unrandomleavesItem;
48856143
48866144 private MenuItem flipVItem;
48876145 private MenuItem unflipVItem;
....@@ -4893,14 +6151,17 @@
48936151 private MenuItem panoTexturesItem;
48946152
48956153 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
6154
+ private MenuItem resetCentroidXZItem;
48976155 private MenuItem resetTransformItem;
6156
+ private MenuItem transformGeometryItem;
6157
+ private MenuItem transformChildrenItem;
6158
+ private MenuItem hideItem;
48986159 private MenuItem grabItem;
48996160 private MenuItem backItem;
49006161 private MenuItem frontItem;
49016162 private MenuItem cameraItem;
49026163 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
6164
+ private MenuItem switchItem;
49046165 private MenuItem physicsItem;
49056166 private MenuItem frameselectorItem;
49066167 private MenuItem scriptNodeItem;
....@@ -4915,6 +6176,7 @@
49156176
49166177 private MenuItem resetParentItem;
49176178 private MenuItem repairParentItem;
6179
+ private MenuItem repairShadowItem;
49186180 private MenuItem sortbysizeItem;
49196181 private MenuItem sortbynameItem;
49206182
....@@ -4923,6 +6185,8 @@
49236185 private MenuItem attachBumpItem;
49246186 private MenuItem detachBumpItem;
49256187 private MenuItem pigmentBumpItem;
6188
+ private MenuItem embedTexturesItem;
6189
+ private MenuItem deEmbedTexturesItem;
49266190
49276191 private MenuItem particleItem;
49286192 private MenuItem ragdollItem;
....@@ -4935,10 +6199,11 @@
49356199 private MenuItem coneItem;
49366200 private MenuItem torusItem;
49376201 private MenuItem superItem;
6202
+ private MenuItem kleinItem;
49386203 private MenuItem blobItem;
49396204 private MenuItem latheItem;
49406205 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
6206
+ private MenuItem overlayItem;
49426207 private MenuItem meshItem;
49436208 // private MenuItem meshGroupItem;
49446209 private MenuItem springItem;
....@@ -4947,6 +6212,7 @@
49476212 private MenuItem csgItem;
49486213 private MenuItem templateItem;
49496214 private MenuItem textureItem;
6215
+ private MenuItem billboardItem;
49506216 private MenuItem shadowXItem;
49516217 private MenuItem shadowYItem;
49526218 private MenuItem shadowZItem;
....@@ -4959,11 +6225,6 @@
49596225 private MenuItem doubleItem;
49606226 private MenuItem tripleItem;
49616227
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49676228 private MenuItem computeAOItem;
49686229 private MenuItem recompileItem;
49696230 private MenuItem editScriptItem;
....@@ -4973,4 +6234,8 @@
49736234 private MenuItem analyzeItem;
49746235 private MenuItem dumpItem;
49756236 //boolean freezemodel = false;
6237
+
6238
+ Menu cameraMenu;
6239
+ MenuItem editCameraItem;
6240
+ MenuItem restoreCameraItem;
49766241 }