Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
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,79 +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);
222636 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223637 relinkverticesItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
224641 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225642 setMasterItem.addActionListener(this);
643
+ }
226644
227645 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
230648 backItem = menu.add(new MenuItem("Back"));
231649 backItem.addActionListener(this);
232650 frontItem = menu.add(new MenuItem("Front"));
233651 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
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"));
237658 hideItem.addActionListener(this);
659
+ }
238660 ungroupItem = menu.add(new MenuItem("Ungroup"));
239661 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
247669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248670 switchGeoItem.addActionListener(this);
249671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250672 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
252674 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);
253681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254682 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
683
+ }
257684
258685 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
261688 billboardItem = menu.add(new MenuItem("Billboard"));
262689 billboardItem.addActionListener(this);
263690 csgItem = menu.add(new MenuItem("CSG"));
264691 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266693 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268695 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
701
+ if (Globals.ADVANCED)
702
+ {
703
+ menu.add("-");
271704 linkerItem = menu.add(new MenuItem("Linker"));
272705 linkerItem.addActionListener(this);
273706 templateItem = menu.add(new MenuItem("Template"));
274707 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277708 pointflowItem = menu.add(new MenuItem("Point Flow"));
278709 pointflowItem.addActionListener(this);
710
+ }
279711 menu.add("-");
280712 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281713 resetTransformItem.addActionListener(this);
282714 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283715 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.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);
286722
287723 oe.menuBar.add(menu = new Menu("Geometry"));
288724 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +729,11 @@
293729 genNormalsCADItem.addActionListener(this);
294730 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295731 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
732
+ if (Globals.ADVANCED)
733
+ {
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297735 genNormalsMINEItem.addActionListener(this);
736
+ }
298737 stripifyItem = menu.add(new MenuItem("Stripify"));
299738 stripifyItem.addActionListener(this);
300739 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +755,34 @@
316755 reduce34MeshItem.addActionListener(this);
317756 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318757 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321758 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322759 clipMeshItem.addActionListener(this);
760
+
761
+ if (Globals.ADVANCED)
762
+ {
763
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
764
+ smoothMeshItem.addActionListener(this);
765
+ }
323766
324767 oe.menuBar.add(menu = new Menu("Attributes"));
325768 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326769 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);
327774 menu.add("-");
328775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329776 liveleavesItem.addActionListener(this);
330777 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331778 unliveleavesItem.addActionListener(this);
779
+ if (Globals.ADVANCED)
780
+ {
332781 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333782 supportleavesItem.addActionListener(this);
334783 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335784 unsupportleavesItem.addActionListener(this);
785
+ }
336786 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337787 hideleavesItem.addActionListener(this);
338788 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +791,14 @@
341791 markleavesItem.addActionListener(this);
342792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343793 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);
344802 menu.add("-");
345803 flipVItem = menu.add(new MenuItem("Flip V"));
346804 flipVItem.addActionListener(this);
....@@ -366,45 +824,56 @@
366824 attachBumpItem.addActionListener(this);
367825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
368826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
369828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
370829 detachPigmentItem.addActionListener(this);
371830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
372831 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);
373836 menu.add("-");
374837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
375838 sortbysizeItem.addActionListener(this);
376839 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377840 sortbynameItem.addActionListener(this);
378841 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.
379849 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380850 extractGeometriesItem.addActionListener(this);
381851 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382852 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
853
+ }
387854
388855 oe.menuBar.add(menu = new Menu("Insert"));
389856 buildCreateMenu(menu);
390857
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402858 oe.menuBar.add(menu = new Menu("Tools"));
403859 buildToolsMenu(menu);
404860 }
405861
862
+
406863 void SetupUI2(ObjEditor oe)
407864 {
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
+
408877 //new Exception().printStackTrace();
409878
410879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,153 +902,243 @@
433902 oe.radioPanel.add(dummyButton);
434903 oe.buttonGroup.add(dummyButton);
435904 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
439908
440
- 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");
441967 liveCB.addItemListener(this);
442968
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
461975 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
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);
468982
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509983 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510984 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515985
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
523
-
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
532
- twoButton.addActionListener(this);
533
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
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);
534993 fourButton.addActionListener(this);
535
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
536
- sixButton.addActionListener(this);
537
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
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");
5381006 threeButton.addActionListener(this);
539
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
540
- 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);
5411013 //
5421014
543
- 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");
5441017 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- 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");
5471021 closeButton.addActionListener(this);
5481022 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5491023 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
5581024
559
- 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");
5601118 uneditButton.addActionListener(this);
5611119
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1120
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
+ allParamsButton.setToolTipText("Show all controle");
5741122 allParamsButton.addActionListener(this);
5751123
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
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");
5811130 unselectButton.addActionListener(this);
5821131
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
+
5831142 // oe.aConstraints.gridx += 1;
5841143 // oe.aConstraints.weighty = 0;
5851144 // oe.aConstraints.gridwidth = 1;
....@@ -591,47 +1150,32 @@
5911150 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5921151 // gcButton.addActionListener(this);
5931152
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
1153
+ cGridBag jSPPanel = new cGridBag();
1154
+
1155
+ JScrollPane jSP;
6051156 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1157
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6071158 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
6271159
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
+
6281172 //jList.addListSelectionListener(this);
6291173 oe.jTree.addTreeSelectionListener(this);
6301174 //jTree.setRootVisible(false);
6311175 //jTree.setEditable(true);
6321176 oe.jTree.setDragEnabled(true);
6331177 //jTree.setPreferredSize(new Dimension(10,10));
634
- jSP.setPreferredSize(new Dimension(100,200));
1178
+ //jSP.setPreferredSize(new Dimension(100,200));
6351179
6361180 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6371181
....@@ -643,23 +1187,163 @@
6431187 dgr.addDragGestureListener(this);
6441188 }catch(Exception e) {}
6451189 */
646
- radio.layout = sevenButton;
1190
+ radio.layout = threeButton; // sixButton;
6471191 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6481192 }
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
+ }
6491322
6501323 void EditObject(Object3D obj)
6511324 {
652
- cRadio dummyButton = new cRadio(obj.name);
653
- dummyButton.SetObject(obj);
654
- dummyButton.layout = sevenButton;
655
- dummyButton.SetCamera(cameraView.renderCamera, false);
656
- dummyButton.addActionListener(this);
657
- radioPanel.add(dummyButton);
658
- buttonGroup.add(dummyButton);
659
- 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();
6601341 }
1342
+
6611343 void SetupViews(ObjEditor oe)
6621344 {
1345
+ theFrame = this;
1346
+
6631347 oe.SetupViews();
6641348
6651349 System.out.println("SetupViews");
....@@ -668,22 +1352,30 @@
6681352 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691353 }
6701354
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- JCheckBox smoothfocusCB;
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;
6811370 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1371
+ cCheckBox speakerCameraCB;
1372
+ cCheckBox speakerFocusCB;
1373
+ cCheckBox debugCB;
1374
+
1375
+ cCheckBox oeilCB;
1376
+ cCheckBox shadowCB;
1377
+ cCheckBox autokeepCB;
1378
+ cCheckBox lookAtCB;
6871379
6881380 // static int COLOR = 1;
6891381 // static int MATERIAL = 2;
....@@ -691,9 +1383,9 @@
6911383
6921384 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931385
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1386
+ cCheckBox colorCB;
1387
+ cCheckBox materialCB;
1388
+ cCheckBox textureCB;
6971389
6981390 public void itemStateChanged(ItemEvent e)
6991391 {
....@@ -721,6 +1413,7 @@
7211413 } else if(e.getSource() == liveCB)
7221414 {
7231415 cameraView.ToggleLive();
1416
+ refreshContents(false);
7241417 }
7251418 else if(e.getSource() == supportCB)
7261419 {
....@@ -736,6 +1429,12 @@
7361429 {
7371430 cameraView.ToggleInertia();
7381431 cameraView.repaint();
1432
+ }
1433
+ else if(e.getSource() == minshaderCB)
1434
+ {
1435
+ Globals.MINSHADER ^= true;
1436
+ cameraView.programInitialized = false;
1437
+ cameraView.repaint();
7391438 }
7401439 else if(e.getSource() == localCB)
7411440 {
....@@ -755,6 +1454,10 @@
7551454 Recompile();
7561455 cameraView.repaint();
7571456 // refreshContents();
1457
+ }
1458
+ else if(e.getSource() == zoomBoxCB)
1459
+ {
1460
+ cameraView.ToggleZoomBoxMode();
7581461 }
7591462 else if(e.getSource() == smoothfocusCB)
7601463 {
....@@ -781,6 +1484,18 @@
7811484 {
7821485 cameraView.ToggleOeil();
7831486 }
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
+ }
7841499 else if(e.getSource() == lookAtCB)
7851500 {
7861501 cameraView.ToggleLookAt();
....@@ -797,7 +1512,8 @@
7971512
7981513 /**/
7991514 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1515
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1516
+ TreePath path = objEditor.jTree.getSelectionPath();
8011517 if ((path == null) || (path.getPathCount() <= 1)) {
8021518 // We can't move the root node or an empty selection
8031519 return;
....@@ -860,8 +1576,6 @@
8601576 }
8611577 }
8621578
863
- String string = (String) object;
864
-
8651579 System.out.println("Transfer = " + object + "; drop : " + target);
8661580 // if( object instanceof java.io.File[])
8671581 // {
....@@ -869,7 +1583,11 @@
8691583 // objEditor.DropFile((java.io.File[]) object, true);
8701584 // return;
8711585 // }
872
- 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) == ':')
8731591 {
8741592 // file(s)
8751593 String[] names = string.split("\n");
....@@ -896,7 +1614,7 @@
8961614
8971615 flashIt = false;
8981616 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1617
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001618 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011619
9021620 if (group.selection.size() == 1)
....@@ -912,23 +1630,33 @@
9121630
9131631 assert target == objEditor.jTree;
9141632 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1633
+ Object3D destinationLeaf;
9151634 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1635
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171636 } catch (Exception e) {
9181637 System.out.println("destinationPath : " + destinationPath);
9191638 return;
9201639 }
9211640
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1641
+ for (int i=group.selection.size(); --i>=0;)
9231642 {
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
+// {
9241652 loadClipboard(true);
9251653 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1654
+ pasteInto(false, false);
1655
+// } else {
1656
+// loadClipboard(false);
1657
+// objEditor.jTree.setSelectionPath(destinationPath);
1658
+// pasteInto(false, false); // true); // ???
1659
+// }
9321660 }
9331661 public void dropActionChanged(DropTargetDragEvent dtde)
9341662 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1761,107 @@
10331761 {
10341762 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351763 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- superItem.addActionListener(this);
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
+ {
10481782 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491783 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1784
+ }
1785
+
1786
+// particleItem = menu.add(new MenuItem("Particle system"));
1787
+// particleItem.addActionListener(this);
1788
+ if (Globals.ADVANCED)
1789
+ {
10521790 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531791 ragdollItem.addActionListener(this);
10541792 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551793 ragdoll2Item.addActionListener(this);
1794
+ }
10561795 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1796
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581797 meshItem.addActionListener(this);
10591798 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601799 // meshGroupItem.addActionListener(this);
1800
+ if (Globals.ADVANCED)
1801
+ {
10611802 springItem = menu.add(new MenuItem("Spring"));
10621803 springItem.addActionListener(this);
10631804 flagItem = menu.add(new MenuItem("Flag"));
10641805 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691806 blobItem = menu.add(new MenuItem("Blob"));
10701807 blobItem.addActionListener(this);
10711808 latheItem = menu.add(new MenuItem("Lathe"));
10721809 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- 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);
10751817 menu.add("-");
10761818 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771819 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1820
+// loopItem = menu.add(new MenuItem("Loop"));
1821
+// loopItem.addActionListener(this);
10801822 doubleItem = menu.add(new MenuItem("Fork"));
10811823 doubleItem.addActionListener(this);
1824
+ if (Globals.ADVANCED)
1825
+ {
10821826 tripleItem = menu.add(new MenuItem("Trident"));
10831827 tripleItem.addActionListener(this);
1828
+ }
10841829 }
10851830
10861831 void buildToolsMenu(Menu menu)
10871832 {
10881833 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891834 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1835
+ animationItem.setState(Globals.ANIMATION);
1836
+
1837
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1838
+ archiveItem.addActionListener(this);
10911839
10921840 menu.add("-");
10931841 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941842 parseverticesItem.addActionListener(this);
10951843 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961844 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1845
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981846 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011847 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021848 reduceMorphItem.addActionListener(this);
11031849 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041850 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081851 menu.add("-");
1109
-
11101852 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111853 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("-");
11121862 menu.add(analyzeItem = new MenuItem("Analyze"));
11131863 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1864
+ menu.add(dumpItem = new MenuItem("Print"));
11151865 dumpItem.addActionListener(this);
11161866 // menu.add(pathItem = new MenuItem("From-to path"));
11171867 // pathItem.addActionListener(this);
....@@ -1120,6 +1870,8 @@
11201870 resetParentItem.addActionListener(this);
11211871 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11221872 repairParentItem.addActionListener(this);
1873
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1874
+ repairShadowItem.addActionListener(this);
11231875 menu.add(invariantsItem = new MenuItem("Invariants"));
11241876 invariantsItem.addActionListener(this);
11251877 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1127,6 +1879,7 @@
11271879 menu.add("-");
11281880 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11291881 editScriptItem.addActionListener(this);
1882
+ }
11301883 }
11311884
11321885 void ScreenFit()
....@@ -1249,9 +2002,34 @@
12492002 shadow.material = new cMaterial(obj.material);
12502003 shadow.material.diffuse = 0.0001f;
12512004 shadow.material.specular = 0.0001f;
2005
+ //shadow.projectedVertices[1].x = 300;
12522006
12532007 makeSomething(shadow);
12542008 }
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
+ }
12552033
12562034 /**
12572035 * applyExample
....@@ -1455,9 +2233,9 @@
14552233
14562234 void Overwrite(int mask)
14572235 {
1458
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2236
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14592237 {
1460
- Object3D content = GrafreeD.clipboard.get(0);
2238
+ Object3D content = Grafreed.clipboard.get(0);
14612239
14622240 if (content instanceof cGroup && ((cGroup)content).transientlink )
14632241 content = ((cGroup)content).get(0);
....@@ -1480,6 +2258,7 @@
14802258 //
14812259 public void actionPerformed(ActionEvent event) // , Object arg)
14822260 {
2261
+ Object source = event.getSource();
14832262 /*
14842263 if (event.getSource() == nameField)
14852264 {
....@@ -1491,11 +2270,11 @@
14912270 }
14922271 else
14932272 */
1494
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2273
+ if (source == lookAtItem || source == lookFromItem)
14952274 {
14962275 ScreenFit();
14972276 } else
1498
- if (event.getSource() == switchItem)
2277
+ if (source == switchViewItem)
14992278 {
15002279 cVector v1 = new cVector();
15012280 cVector v2 = new cVector();
....@@ -1504,11 +2283,11 @@
15042283 objEditor.cameraView.renderCamera.setAim(v2, v1);
15052284 objEditor.cameraView.repaint();
15062285 } else
1507
- if (event.getSource() == rectoidItem)
2286
+ if (source == rectoidItem || source == boxButton)
15082287 {
15092288 makeSomething(new Box());
15102289 } else
1511
- if (event.getSource() == particleItem)
2290
+ if (source == particleItem || source == particlesButton)
15122291 {
15132292 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15142293 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1529,9 +2308,9 @@
15292308 applyExample(particleGeom, "SMOKE");
15302309 makeSomething(particleGeom);
15312310 } else
1532
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2311
+ if (source == ragdollItem || source == ragdoll2Item)
15332312 {
1534
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2313
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15352314
15362315 ragdoll.toParent = LA.newMatrix();
15372316 ragdoll.fromParent = LA.newMatrix();
....@@ -1549,7 +2328,7 @@
15492328 } else
15502329 /*
15512330 */
1552
- if (event.getSource() == heightFieldItem)
2331
+ if (source == heightFieldItem)
15532332 {
15542333 Object3D obj = new Object3D();
15552334
....@@ -1587,31 +2366,31 @@
15872366
15882367 makeSomething(obj);
15892368 } else
1590
- if (event.getSource() == gridItem)
2369
+ if (source == gridItem || source == gridButton)
15912370 {
15922371 makeSomething(new Grid());
15932372 } else
1594
- if (event.getSource() == ellipsoidItem)
2373
+ if (source == ellipsoidItem || source == sphereButton)
15952374 {
15962375 makeSomething(new Sphere());
15972376 } else
1598
- if (event.getSource() == coneItem)
2377
+ if (source == coneItem || source == coneButton)
15992378 {
16002379 makeSomething(new Cone());
16012380 } else
1602
- if (event.getSource() == torusItem)
2381
+ if (source == torusItem || source == torusButton)
16032382 {
16042383 makeSomething(new Torus());
16052384 } else
1606
- if (event.getSource() == superItem)
2385
+ if (source == superItem || source == superButton)
16072386 {
16082387 makeSomething(new Superellipsoid());
16092388 } else
1610
- if (event.getSource() == kleinItem)
2389
+ if (source == kleinItem || source == kleinButton)
16112390 {
16122391 makeSomething(new Klein());
16132392 } else
1614
- if (event.getSource() == blobItem)
2393
+ if (source == blobItem)
16152394 {
16162395 Blob blob = new Blob();
16172396 BlobComponent comp = new BlobComponent();
....@@ -1619,15 +2398,15 @@
16192398 //blob.retile();
16202399 makeSomething(blob);
16212400 } else
1622
- if (event.getSource() == latheItem)
2401
+ if (source == latheItem)
16232402 {
16242403 makeSomething(new Lathe());
16252404 } else
1626
- if (event.getSource() == bezierItem)
2405
+ if (source == bezierItem)
16272406 {
16282407 makeSomething(new BezierSurface());
16292408 } else
1630
- if (event.getSource() == checkerItem)
2409
+ if (source == overlayItem || source == overlayButton)
16312410 {
16322411 /*
16332412 Object3D obj = new BezierSurface(5,8);
....@@ -1642,7 +2421,7 @@
16422421 */
16432422 makeSomething(new Checker());
16442423 } else
1645
- if (event.getSource() == meshItem)
2424
+ if (source == meshItem)
16462425 {
16472426 Object3D itemtomake = new Object3D();
16482427 Object3D child;
....@@ -1663,35 +2442,52 @@
16632442 makeSomething(child);
16642443 }
16652444 } else
1666
- if (event.getSource() == springItem)
2445
+ if (source == springItem)
16672446 {
16682447 cSpring s = new cSpring();
16692448 s.setup();
16702449 makeSomething(s);
16712450 } else
1672
- if (event.getSource() == flagItem)
2451
+ if (source == flagItem)
16732452 {
16742453 cSpring s = new cFlag();
16752454 s.setup();
16762455 makeSomething(s);
16772456 } else
1678
- if (event.getSource() == lightItem)
2457
+ if (source == lightItem || source == lightButton)
16792458 {
16802459 makeSomething(new Light());
16812460 } else
1682
- 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)
16832479 {
16842480 group(new CSG());
16852481 } else
1686
- if (event.getSource() == templateItem)
2482
+ if (source == templateItem)
16872483 {
16882484 group(new cTemplate());
16892485 } else
1690
- if (event.getSource() == attributeItem)
2486
+ if (source == attributeItem)
16912487 {
16922488 makeSomething(new Attribute());
16932489 } else
1694
- if (event.getSource() == pointflowItem)
2490
+ if (source == pointflowItem)
16952491 {
16962492 makeSomething(new PointFlow());
16972493 } else
....@@ -1703,7 +2499,7 @@
17032499 } else
17042500 */
17052501
1706
- if (event.getSource() == superLoopItem)
2502
+ if (source == superLoopItem)
17072503 {
17082504 Composite g = new cGroup();
17092505 for (int i=0; i<15; i++)
....@@ -1725,30 +2521,30 @@
17252521
17262522 group(g);
17272523 } else
1728
- if (event.getSource() == loopItem)
2524
+ if (source == loopItem || source == loopButton)
17292525 {
17302526 Composite csg = new GroupLeaf();
17312527 csg.count = 5;
17322528 group(csg);
1733
- Composite child = new cGroup();
2529
+ Composite child = new cGroup("Branch");
17342530 csg.addChild(child);
17352531 child.addChild(csg);
17362532 } else
1737
- if (event.getSource() == doubleItem)
2533
+ if (source == doubleItem)
17382534 {
1739
- Composite csg = new GroupLeaf();
2535
+ Composite csg = new GroupLeaf("Fork");
17402536 csg.count = 5;
17412537 group(csg);
1742
- Composite child = new cGroup();
2538
+ Composite child = new cGroup("Branch A");
17432539 csg.addChild(child);
17442540 child.addChild(csg);
1745
- child = new cGroup();
2541
+ child = new cGroup("Branch B");
17462542 csg.addChild(child);
17472543 child.addChild(csg);
17482544 } else
1749
- if (event.getSource() == tripleItem)
2545
+ if (source == tripleItem)
17502546 {
1751
- Composite csg = new GroupLeaf();
2547
+ Composite csg = new GroupLeaf("Trident");
17522548 csg.count = 4;
17532549 group(csg);
17542550 Composite child = new cGroup();
....@@ -1761,73 +2557,105 @@
17612557 csg.addChild(child);
17622558 child.addChild(csg);
17632559 } else
1764
-
1765
- if (event.getSource() == importGFDItem)
2560
+ if (source == computeAOItem)
17662561 {
1767
- ImportGFD();
2562
+ Globals.drawMode = CameraPane.OCCLUSION;
2563
+ cameraView.repaint();
17682564 } else
1769
- if (event.getSource() == importVRMLX3DItem)
1770
- {
1771
- ImportVRMLX3D();
1772
- } else
1773
- if (event.getSource() == import3DSItem)
1774
- {
1775
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1776
- } else
1777
- if (event.getSource() == importOBJItem)
1778
- {
1779
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1780
- } else
1781
- if (event.getSource() == computeAOItem)
1782
- {
1783
- CameraPane.drawMode = CameraPane.OCCLUSION;
1784
- CameraPane.theRenderer.repaint();
1785
- } else
1786
- if (event.getSource() == recompileItem)
2565
+ if (source == recompileItem)
17872566 {
17882567 Recompile();
17892568 refreshContents();
17902569 } else
1791
- if (event.getSource() == editScriptItem)
2570
+ if (source == editScriptItem)
17922571 {
17932572 OpenDialog();
17942573 refreshContents();
17952574 } else
1796
- if (event.getSource() == invariantsItem)
2575
+ if (source == invariantsItem)
17972576 {
17982577 System.out.println("Invariants:");
1799
- GrafreeD.grafreeD.universe.invariants();
2578
+ Grafreed.grafreed.universe.invariants();
18002579 } else
1801
- if (event.getSource() == memoryItem)
2580
+ if (source == memoryItem)
18022581 {
18032582 //System.out.println("Invariants:");
18042583 PrintMemory();
18052584 } else
1806
- if (event.getSource() == pathItem)
2585
+ if (source == pathItem)
18072586 {
18082587 PrintPath();
18092588 } else
1810
- if (event.getSource() == analyzeItem)
2589
+ if (source == analyzeItem)
18112590 {
18122591 AnalyzeObject();
18132592 } else
1814
- if (event.getSource() == dumpItem)
2593
+ if (source == dumpItem)
18152594 {
18162595 DumpObject();
18172596 } else
1818
- if (event.getSource() == screenfitButton)
2597
+ if (source == minButton)
18192598 {
1820
- //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
+ {
18212651 ScreenFit();
18222652 } else
1823
- if (event.getSource() == screenfitpointButton)
2653
+ if (source == screenfitpointButton)
18242654 {
1825
- //Reload(lastConverter, lastFilename, true);
18262655 ScreenFitPoint();
18272656 } else
1828
- if (event.getSource() == snapobjectButton)
2657
+ if (source == snapobjectButton)
18292658 {
1830
- //Reload(lastConverter, lastFilename, true);
18312659 SnapObject();
18322660 } else
18332661 // if (event.getSource() == recompileButton)
....@@ -1836,13 +2664,13 @@
18362664 // Recompile();
18372665 // refreshContents();
18382666 // } else
1839
- if (event.getSource() == gcButton)
2667
+ if (source == gcButton)
18402668 {
18412669 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422670 System.gc();
18432671 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442672 } else
1845
- if (event.getSource() == editLeafItem)
2673
+ if (source == editLeafItem)
18462674 {
18472675 Object3D obj;
18482676 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1856,62 +2684,74 @@
18562684 }
18572685 refreshContents(true);
18582686 } else
1859
- if (event.getSource() == openWindowItem)
2687
+ if (source == openWindowItem)
18602688 {
18612689 EditSelection(true);
18622690 } else
1863
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2691
+ if (source == cutItem || source == clearButton)
18642692 {
18652693 loadClipboard(true);
18662694 } else
1867
- if (event.getSource() == duplicateItem)
2695
+ if (source == undoItem)
18682696 {
1869
- 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;
18702706 loadClipboard(false);
18712707 paste(false);
1872
- GrafreeD.clipboard = keep;
2708
+ Grafreed.clipboard = keep;
18732709 } else
1874
- if (event.getSource() == cloneItem)
2710
+ if (source == cloneItem)
18752711 {
18762712 CloneSelection(false);
18772713 } else
1878
- if (event.getSource() == cloneSupportItem)
2714
+ if (source == cloneSupportItem)
18792715 {
18802716 CloneSelection(true);
18812717 } else
1882
- if (event.getSource() == copyItem)
2718
+ if (source == copyItem)
18832719 {
18842720 loadClipboard(false);
18852721 } else
1886
- if (event.getSource() == pasteItem)
2722
+ if (source == pasteItem)
18872723 {
18882724 paste(false);
18892725 } else
1890
- if (event.getSource() == pasteLinkItem)
2726
+ if (source == pasteIntoItem)
18912727 {
1892
- pasteInto(false);
2728
+ pasteInto(true, false);
18932729 } else
1894
- if (event.getSource() == pasteCloneItem)
2730
+ if (source == pasteLinkItem)
18952731 {
1896
- pasteInto(true);
2732
+ pasteInto(false, false);
18972733 } else
1898
- if (event.getSource() == pasteExpandItem)
2734
+ if (source == pasteCloneItem)
2735
+ {
2736
+ pasteInto(true, true);
2737
+ } else
2738
+ if (source == pasteExpandItem)
18992739 {
19002740 paste(true);
19012741 } else
1902
- if (event.getSource() == synchronizeItem)
2742
+ if (source == synchronizeItem)
19032743 {
19042744 Overwrite(Object3D.TRANSFORM);
19052745 } else
1906
- if (event.getSource() == overwriteNameItem)
2746
+ if (source == overwriteNameItem)
19072747 {
19082748 Overwrite(Object3D.NAME);
19092749 } else
1910
- if (event.getSource() == overwriteUVItem)
2750
+ if (source == overwriteUVItem)
19112751 {
19122752 Overwrite(Object3D.UV);
19132753 } else
1914
- if (event.getSource() == overwriteMatItem)
2754
+ if (source == overwriteMatItem)
19152755 {
19162756 /* july 2015
19172757 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1931,7 +2771,7 @@
19312771
19322772 Overwrite(dropAttributes);
19332773 }
1934
- if (event.getSource() == overwriteGeoItem)
2774
+ if (source == overwriteGeoItem)
19352775 {
19362776 Overwrite(Object3D.GEOMETRY);
19372777 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1948,7 +2788,7 @@
19482788 // refreshContents();
19492789 // }
19502790 } else
1951
- if (event.getSource() == generateMeshItem)
2791
+ if (source == generateMeshItem)
19522792 {
19532793 //if (group.selection.size() == 1)
19542794 // for (int i=0; i<group.selection.size(); i++)
....@@ -1959,7 +2799,7 @@
19592799 ResetModel();
19602800 refreshContents();
19612801 } else
1962
- if (event.getSource() == extractGeometriesItem)
2802
+ if (source == extractGeometriesItem)
19632803 {
19642804 boolean one = false;
19652805
....@@ -1986,7 +2826,7 @@
19862826 ResetModel();
19872827 refreshContents();
19882828 } else
1989
- if (event.getSource() == cloneGeometriesItem)
2829
+ if (source == cloneGeometriesItem)
19902830 {
19912831 boolean one = false;
19922832
....@@ -2012,7 +2852,7 @@
20122852 ResetModel();
20132853 refreshContents();
20142854 } else
2015
- if (event.getSource() == shareGeometriesItem)
2855
+ if (source == shareGeometriesItem)
20162856 {
20172857 boolean one = false;
20182858
....@@ -2042,7 +2882,7 @@
20422882 refreshContents();
20432883 }
20442884 } else
2045
- if (event.getSource() == mergeGeometriesItem)
2885
+ if (source == mergeGeometriesItem)
20462886 {
20472887 boolean one = false;
20482888
....@@ -2072,7 +2912,7 @@
20722912 ResetModel();
20732913 refreshContents();
20742914 } else
2075
- if (event.getSource() == linkverticesItem)
2915
+ if (source == linkverticesItem)
20762916 {
20772917 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20782918 // {
....@@ -2085,48 +2925,48 @@
20852925 // group.selection.get(0).setMasterThis(content); // should be identity
20862926 // refreshContents();
20872927 // }
2088
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2928
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20892929 {
2090
- Object3D content = GrafreeD.clipboard.get(0);
2930
+ Object3D content = Grafreed.clipboard.get(0);
20912931
20922932 if (content instanceof cGroup && ((cGroup)content).transientlink )
20932933 content = ((cGroup)content).get(0);
20942934
2095
- 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));
20962936 for (int i=0; i<group.selection.size(); i++)
20972937 {
2098
- boolean random = CameraPane.RANDOM;
2099
- CameraPane.RANDOM = false; // parse all random nodes
2938
+ boolean random = CameraPane.SWITCH;
2939
+ CameraPane.SWITCH = false; // parse all random nodes
21002940 group.selection.get(i).linkVerticesThis(content);
21012941 // group.selection.get(i).setMasterThis(content); // should be identity
2102
- CameraPane.RANDOM = random;
2942
+ CameraPane.SWITCH = random;
21032943 }
2104
- 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));
21052945 refreshContents();
21062946 }
21072947 } else
2108
- if (event.getSource() == resetsupportItem)
2948
+ if (source == resetsupportItem)
21092949 {
21102950 for (int i=0; i<group.selection.size(); i++)
21112951 {
2112
- boolean random = CameraPane.RANDOM;
2113
- CameraPane.RANDOM = false; // parse all random nodes
2952
+ boolean random = CameraPane.SWITCH;
2953
+ CameraPane.SWITCH = false; // parse all random nodes
21142954 group.selection.get(i).linkVerticesThis(null);
2115
- CameraPane.RANDOM = random;
2955
+ CameraPane.SWITCH = random;
21162956 }
21172957
21182958 refreshContents();
21192959 } else
2120
- if (event.getSource() == relinkverticesItem)
2960
+ if (source == relinkverticesItem)
21212961 {
2122
- boolean random = CameraPane.RANDOM;
2123
- CameraPane.RANDOM = false; // parse all random nodes
2962
+ boolean random = CameraPane.SWITCH;
2963
+ CameraPane.SWITCH = false; // parse all random nodes
21242964 group.selection.RelinkToSupport();
2125
- CameraPane.RANDOM = random;
2965
+ CameraPane.SWITCH = random;
21262966
21272967 refreshContents();
21282968 } else
2129
- if (event.getSource() == resetreferencesItem)
2969
+ if (source == resetreferencesItem)
21302970 {
21312971 for (int i=0; i<group.selection.size(); i++)
21322972 {
....@@ -2135,11 +2975,11 @@
21352975
21362976 refreshContents();
21372977 } else
2138
- if (event.getSource() == setMasterItem)
2978
+ if (source == setMasterItem)
21392979 {
2140
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2980
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21412981 {
2142
- Object3D content = GrafreeD.clipboard.get(0);
2982
+ Object3D content = Grafreed.clipboard.get(0);
21432983
21442984 if (content instanceof cGroup && ((cGroup)content).transientlink )
21452985 content = ((cGroup)content).get(0);
....@@ -2148,13 +2988,13 @@
21482988 refreshContents();
21492989 }
21502990 } else
2151
- if (event.getSource() == poseMeshItem)
2991
+ if (source == poseMeshItem)
21522992 {
21532993 if (group.selection.size() == 1)
21542994 {
2155
- if (GrafreeD.clipboard.size() == 1)
2995
+ if (Grafreed.clipboard.size() == 1)
21562996 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2997
+ Object3D content = Grafreed.clipboard.get(0);
21582998
21592999 if (content instanceof cGroup && ((cGroup)content).transientlink )
21603000 content = ((cGroup)content).get(0);
....@@ -2167,19 +3007,19 @@
21673007 }
21683008
21693009 } else
2170
- if (event.getSource() == revertMeshItem)
3010
+ if (source == revertMeshItem)
21713011 {
21723012 RevertMeshes();
21733013 } else
2174
- if (event.getSource() == resetMeshItem)
3014
+ if (source == resetAllItem)
21753015 {
21763016 ResetAll();
21773017 } else
2178
- if (event.getSource() == stepAllItem)
3018
+ if (source == stepAllItem)
21793019 {
21803020 StepAll();
21813021 } else
2182
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3022
+ if (source == deleteItem) // || event.getSource() == clearButton)
21833023 {
21843024 //int indices[] = jList.getSelectedIndices();
21853025 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2187,46 +3027,46 @@
21873027
21883028 ClearSelection(false);
21893029 } else
2190
- if (event.getSource() == clearAllItem)
3030
+ if (source == clearAllItem)
21913031 {
21923032 ClearSelection(true);
21933033 } else
2194
- if (event.getSource() == grabItem)
3034
+ if (source == grabItem || source == groupButton)
21953035 {
2196
- group(new cGroup(), true);
3036
+ group(new cGroup(), false); // true);
21973037 } else
2198
- if (event.getSource() == hideItem)
3038
+ if (source == hideItem)
21993039 {
22003040 group(new HiddenObject());
22013041 } else
2202
- if (event.getSource() == frontItem)
3042
+ if (source == frontItem)
22033043 {
22043044 front();
22053045 } else
2206
- if (event.getSource() == backItem)
3046
+ if (source == backItem)
22073047 {
22083048 back();
22093049 } else
2210
- if (event.getSource() == cameraItem)
3050
+ if (source == cameraItem)
22113051 {
22123052 makeSomething(new Camera());
22133053 } else
2214
- if (event.getSource() == compositeItem)
3054
+ if (source == compositeItem || source == compositeButton)
22153055 {
22163056 group(new Composite());
22173057 } else
2218
- if (event.getSource() == randomItem)
3058
+ if (source == switchItem || source == switchButton)
22193059 {
22203060 RandomNode random = new RandomNode();
22213061 group(random);
22223062 if (random.size() > 0)
2223
- random.name = random.get(0).name + "Rnd";
3063
+ random.name = random.get(0).name + "Switch";
22243064 } else
2225
- if (event.getSource() == physicsItem)
3065
+ if (source == physicsItem)
22263066 {
22273067 group(new PhysicsNode());
22283068 } else
2229
- if (event.getSource() == frameselectorItem)
3069
+ if (source == frameselectorItem)
22303070 {
22313071 for (int i=0; i<group.selection.size(); i++)
22323072 {
....@@ -2238,7 +3078,7 @@
22383078 ResetModel();
22393079 refreshContents();
22403080 } else
2241
- if (event.getSource() == switchGeoItem)
3081
+ if (source == switchGeoItem)
22423082 {
22433083 for (int i=0; i<group.selection.size(); i++)
22443084 {
....@@ -2250,7 +3090,7 @@
22503090 ResetModel();
22513091 refreshContents();
22523092 } else
2253
- if (event.getSource() == switchTransfoItem)
3093
+ if (source == switchTransfoItem)
22543094 {
22553095 for (int i=0; i<group.selection.size(); i++)
22563096 {
....@@ -2262,7 +3102,7 @@
22623102 ResetModel();
22633103 refreshContents();
22643104 } else
2265
- if (event.getSource() == morphItem)
3105
+ if (source == morphItem)
22663106 {
22673107 for (int i=0; i<group.selection.size(); i++)
22683108 {
....@@ -2274,7 +3114,7 @@
22743114 ResetModel();
22753115 refreshContents();
22763116 } else
2277
- if (event.getSource() == scriptNodeItem)
3117
+ if (source == scriptNodeItem)
22783118 {
22793119 boolean atleastone = false;
22803120
....@@ -2313,215 +3153,252 @@
23133153 }
23143154 }
23153155 } else
2316
- if (event.getSource() == linkerItem)
3156
+ if (source == linkerItem)
23173157 {
23183158 group(new cLinker());
23193159 } else
2320
- if (event.getSource() == textureItem)
3160
+ if (source == textureItem || source == textureButton)
23213161 {
23223162 group(new TextureNode());
23233163 } else
2324
- if (event.getSource() == billboardItem)
3164
+ if (source == billboardItem)
23253165 {
23263166 group(new BillboardNode());
23273167 } else
2328
- if (event.getSource() == shadowXItem)
3168
+ if (source == shadowXItem)
23293169 {
23303170 CastShadow(0);
23313171 } else
2332
- if (event.getSource() == shadowYItem)
3172
+ if (source == shadowYItem)
23333173 {
23343174 CastShadow(1);
23353175 } else
2336
- if (event.getSource() == shadowZItem)
3176
+ if (source == shadowZItem)
23373177 {
23383178 CastShadow(2);
23393179 } else
2340
- if (event.getSource() == ungroupItem)
3180
+ if (source == ungroupItem || source == ungroupButton)
23413181 {
2342
- //ungroup();
3182
+ boolean hasRoot = false;
3183
+
23433184 for (int i=0; i<group.selection.size(); i++)
23443185 {
2345
- Ungroup(group.selection.get(i));
3186
+ if (group.selection.get(i) == group)
3187
+ {
3188
+ hasRoot = true;
3189
+ break;
3190
+ }
23463191 }
23473192
2348
- ClearSelection(false);
2349
-
2350
- refreshContents();
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
+ }
23513204 } else
2352
- if (event.getSource() == genUVItem)
3205
+ if (source == genUVItem)
23533206 {
23543207 GenUV();
23553208 } else
2356
- if (event.getSource() == genNormalsCADItem)
3209
+ if (source == genNormalsCADItem)
23573210 {
23583211 GenNormals(true);
23593212 } else
2360
- if (event.getSource() == genNormalsMESHItem)
3213
+ if (source == genNormalsMESHItem)
23613214 {
2362
- GenNormals(true); // TODO
3215
+ GenNormalsMESH();
23633216 } else
2364
- if (event.getSource() == genNormalsORGANItem)
3217
+ if (source == genNormalsORGANItem)
23653218 {
23663219 GenNormals(false);
23673220 } else
2368
- if (event.getSource() == genNormalsMINEItem)
3221
+ if (source == genNormalsMINEItem)
23693222 {
23703223 GenNormalsMINE();
23713224 } else
2372
- if (event.getSource() == stripifyItem)
3225
+ if (source == stripifyItem)
23733226 {
23743227 Stripify();
23753228 } else
2376
- if (event.getSource() == unstripifyItem)
3229
+ if (source == unstripifyItem)
23773230 {
23783231 Unstripify();
23793232 } else
2380
- if (event.getSource() == trimItem)
3233
+ if (source == trimItem)
23813234 {
23823235 Trim();
23833236 } else
2384
- if (event.getSource() == untrimItem)
3237
+ if (source == untrimItem)
23853238 {
23863239 Untrim();
23873240 } else
2388
- if (event.getSource() == clearColorsItem)
3241
+ if (source == clearColorsItem)
23893242 {
23903243 ClearColors();
23913244 } else
2392
- if (event.getSource() == clearMaterialsItem)
3245
+ if (source == clearMaterialsItem)
23933246 {
23943247 ClearMaterials();
23953248 } else
2396
- if (event.getSource() == liveleavesItem)
3249
+ if (source == liveleavesItem)
23973250 {
23983251 LiveLeaves(true);
23993252 } else
2400
- if (event.getSource() == unliveleavesItem)
3253
+ if (source == unliveleavesItem)
24013254 {
24023255 LiveLeaves(false);
24033256 } else
2404
- if (event.getSource() == supportleavesItem)
3257
+ if (source == supportleavesItem)
24053258 {
24063259 SupportLeaves(true);
24073260 } else
2408
- if (event.getSource() == unsupportleavesItem)
3261
+ if (source == unsupportleavesItem)
24093262 {
24103263 SupportLeaves(false);
24113264 } else
2412
- if (event.getSource() == hideleavesItem)
3265
+ if (source == hideleavesItem)
24133266 {
24143267 HideLeaves(true);
24153268 } else
2416
- if (event.getSource() == showleavesItem)
3269
+ if (source == showleavesItem)
24173270 {
24183271 HideLeaves(false);
24193272 } else
2420
- if (event.getSource() == markleavesItem)
3273
+ if (source == markleavesItem)
24213274 {
24223275 MarkLeaves(true);
24233276 } else
2424
- if (event.getSource() == unmarkleavesItem)
3277
+ if (source == unmarkleavesItem)
24253278 {
24263279 MarkLeaves(false);
24273280 } else
2428
- 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)
24293298 {
24303299 FlipV(true);
24313300 } else
2432
- if (event.getSource() == unflipVItem)
3301
+ if (source == unflipVItem)
24333302 {
24343303 FlipV(false);
24353304 } else
2436
- if (event.getSource() == lowTexturesItem)
3305
+ if (source == lowTexturesItem)
24373306 {
24383307 SetTexRes(0);
24393308 } else
2440
- if (event.getSource() == normalTexturesItem)
3309
+ if (source == normalTexturesItem)
24413310 {
24423311 SetTexRes(1);
24433312 } else
2444
- if (event.getSource() == highTexturesItem)
3313
+ if (source == highTexturesItem)
24453314 {
24463315 SetTexRes(2);
24473316 } else
2448
- if (event.getSource() == veryhighTexturesItem)
3317
+ if (source == veryhighTexturesItem)
24493318 {
24503319 SetTexRes(3);
24513320 } else
2452
- if (event.getSource() == maxTexturesItem)
3321
+ if (source == maxTexturesItem)
24533322 {
24543323 SetTexRes(4);
24553324 } else
2456
- if (event.getSource() == panoTexturesItem)
3325
+ if (source == panoTexturesItem)
24573326 {
24583327 SetTexRes(5);
24593328 } else
2460
- if (event.getSource() == reverseNormalsItem)
3329
+ if (source == reverseNormalsItem)
24613330 {
24623331 ReverseNormals();
24633332 } else
2464
- if (event.getSource() == parseverticesItem)
3333
+ if (source == parseverticesItem)
24653334 {
24663335 ParseVertices();
24673336 } else
2468
- if (event.getSource() == textureFieldItem)
3337
+ if (source == textureFieldItem)
24693338 {
24703339 TextureVertices();
24713340 } else
2472
- if (event.getSource() == alignItem)
3341
+ if (source == alignItem)
24733342 {
24743343 Align();
24753344 } else
2476
- if (event.getSource() == mirrorItem)
3345
+ if (source == mirrorItem)
24773346 {
24783347 MirrorPoses();
24793348 } else
2480
- if (event.getSource() == reduceMorphItem)
3349
+ if (source == reduceMorphItem)
24813350 {
24823351 MeshReduction(false);
24833352 } else
2484
- if (event.getSource() == reduce34MorphItem)
3353
+ if (source == reduce34MorphItem)
24853354 {
24863355 MeshReduction(true);
24873356 } else
2488
- if (event.getSource() == reverseTrianglesItem)
3357
+ if (source == reverseTrianglesItem)
24893358 {
24903359 ReverseTriangles();
24913360 } else
2492
- if (event.getSource() == reduceMeshItem)
3361
+ if (source == reduceMeshItem)
24933362 {
24943363 ReduceMesh(false);
24953364 } else
2496
- if (event.getSource() == reduce34MeshItem)
3365
+ if (source == reduce34MeshItem)
24973366 {
24983367 ReduceMesh(true);
24993368 } else
2500
- if (event.getSource() == increaseMeshItem)
3369
+ if (source == increaseMeshItem)
25013370 {
25023371 IncreaseMesh();
25033372 } else
2504
- if (event.getSource() == clipMeshItem)
3373
+ if (source == clipMeshItem)
25053374 {
25063375 ClipMesh();
25073376 } else
2508
- if (event.getSource() == smoothMeshItem)
3377
+ if (source == smoothMeshItem)
25093378 {
25103379 SmoothMesh();
25113380 } else
2512
- if (event.getSource() == transformgeometryItem)
3381
+ if (source == transformGeometryItem)
25133382 {
25143383 TransformGeometry();
25153384 } else
2516
- if (event.getSource() == resetTransformItem)
3385
+ if (source == transformChildrenItem)
3386
+ {
3387
+ TransformChildren();
3388
+ } else
3389
+ if (source == resetTransformItem)
25173390 {
25183391 ResetTransform();
25193392 } else
2520
- if (event.getSource() == resetCentroidItem)
3393
+ if (source == resetCentroidItem)
25213394 {
2522
- ResetCentroid();
3395
+ ResetCentroid(true);
25233396 } else
2524
- if (event.getSource() == resetParentItem)
3397
+ if (source == resetCentroidXZItem)
3398
+ {
3399
+ ResetCentroid(false);
3400
+ } else
3401
+ if (source == resetParentItem)
25253402 {
25263403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25273404 {
....@@ -2531,7 +3408,7 @@
25313408
25323409 refreshContents();
25333410 } else
2534
- if (event.getSource() == repairParentItem)
3411
+ if (source == repairParentItem)
25353412 {
25363413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25373414 {
....@@ -2545,7 +3422,21 @@
25453422
25463423 refreshContents();
25473424 } else
2548
- 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)
25493440 {
25503441 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513442 {
....@@ -2557,7 +3448,7 @@
25573448 ResetModel();
25583449 refreshContents();
25593450 } else
2560
- if (event.getSource() == sortbynameItem)
3451
+ if (source == sortbynameItem)
25613452 {
25623453 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25633454 {
....@@ -2569,7 +3460,7 @@
25693460 ResetModel();
25703461 refreshContents();
25713462 } else
2572
- if (event.getSource() == attachPigmentItem)
3463
+ if (source == attachPigmentItem)
25733464 {
25743465 String texture = GetFile("Attach pigment");
25753466 Object3D obj;
....@@ -2581,7 +3472,7 @@
25813472
25823473 refreshContents();
25833474 } else
2584
- if (event.getSource() == detachPigmentItem)
3475
+ if (source == detachPigmentItem)
25853476 {
25863477 Object3D obj;
25873478 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2592,7 +3483,7 @@
25923483
25933484 refreshContents();
25943485 } else
2595
- if (event.getSource() == attachBumpItem)
3486
+ if (source == attachBumpItem)
25963487 {
25973488 String texture = GetFile("Attach bump");
25983489 Object3D obj;
....@@ -2604,18 +3495,18 @@
26043495
26053496 refreshContents();
26063497 } else
2607
- if (event.getSource() == detachBumpItem)
3498
+ if (source == detachBumpItem)
26083499 {
26093500 Object3D obj;
26103501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26113502 {
26123503 obj = (Object3D)e.nextElement();
2613
- obj.SetBumpTexture(null);
3504
+ obj.ResetBumpTexture();
26143505 }
26153506
26163507 refreshContents();
26173508 } else
2618
- if (event.getSource() == pigmentBumpItem)
3509
+ if (source == pigmentBumpItem)
26193510 {
26203511 Object3D obj;
26213512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2626,158 +3517,262 @@
26263517
26273518 refreshContents();
26283519 } else
2629
- 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)
26303546 {
26313547 CameraPane.flash = true;
26323548 refreshContents();
26333549 } else
2634
- if (event.getSource() == oneButton)
3550
+ if (source == oneButton)
26353551 {
26363552 } else
2637
- if (event.getSource() == twoButton)
3553
+ if (source == twoButton)
26383554 {
26393555 radio.layout = twoButton;
3556
+
3557
+ if (CameraPane.FULLSCREEN)
3558
+ fullscreenLayout = radio.layout;
3559
+
26403560 // bug
26413561 //gridPanel.setDividerLocation(1.0);
26423562 //bigPanel.setDividerLocation(0.0);
2643
- bigThree.remove(scenePanel);
2644
- bigThree.remove(centralPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2651
- aWindowConstraints.weightx = 0;
2652
- aWindowConstraints.weighty = 1;
2653
- //bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- bigThree.add(centralPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- bigThree.revalidate();
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
+
26673610 } else
2668
- if (event.getSource() == threeButton)
3611
+ if (source == threeButton)
26693612 {
26703613 radio.layout = threeButton;
2671
- bigThree.remove(scenePanel);
2672
- bigThree.remove(centralPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- //bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(centralPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aConstraints.gridheight = 3;
2692
- aConstraints.fill = GridBagConstraints.VERTICAL;
2693
- bigThree.add(XYZPanel, aWindowConstraints);
2694
- bigThree.revalidate();
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();
26953651 } else
2696
- if (event.getSource() == fourButton)
3652
+ if (source == fourButton)
26973653 {
26983654 radio.layout = fourButton;
2699
- bigThree.remove(scenePanel);
2700
- bigThree.remove(centralPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2707
- aWindowConstraints.weightx = 1;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(scenePanel, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- //bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aWindowConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- //bigThree.add(XYZPanel, aWindowConstraints);
2722
- bigThree.revalidate();
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();
27233691 } else
2724
- if (event.getSource() == sixButton)
3692
+ if (source == sixButton)
27253693 {
27263694 radio.layout = sixButton;
2727
- bigThree.remove(scenePanel);
2728
- bigThree.remove(centralPanel);
2729
- bigThree.remove(XYZPanel);
2730
- aWindowConstraints.gridx = 0;
2731
- aWindowConstraints.gridy = 0;
2732
- aWindowConstraints.gridwidth = 1;
2733
- // aConstraints.gridheight = 3;
2734
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2735
- aWindowConstraints.weightx = 0;
2736
- aWindowConstraints.weighty = 1;
2737
- bigThree.add(scenePanel, aWindowConstraints);
2738
- aWindowConstraints.weightx = 1;
2739
- aWindowConstraints.gridwidth = 3;
2740
- // aWindowConstraints.gridheight = 3;
2741
- aWindowConstraints.gridx = 1;
2742
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2743
- bigThree.add(centralPanel, aWindowConstraints);
2744
- aWindowConstraints.weightx = 0;
2745
- aWindowConstraints.gridx = 4;
2746
- aWindowConstraints.gridwidth = 1;
2747
- // aWindowConstraints.gridheight = 3;
2748
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2749
- //bigThree.add(XYZPanel, aConstraints);
2750
- bigThree.revalidate();
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();
27513732 } else
2752
- if (event.getSource() == sevenButton)
3733
+ if (source == sevenButton)
27533734 {
27543735 radio.layout = sevenButton;
2755
- bigThree.remove(scenePanel);
2756
- bigThree.remove(centralPanel);
2757
- bigThree.remove(XYZPanel);
2758
- aWindowConstraints.gridx = 0;
2759
- aWindowConstraints.gridy = 0;
2760
- aWindowConstraints.gridwidth = 1;
2761
- // aWindowConstraints.gridheight = 3;
2762
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2763
- aWindowConstraints.weightx = 0;
2764
- aWindowConstraints.weighty = 1;
2765
- bigThree.add(scenePanel, aWindowConstraints);
2766
- aWindowConstraints.weightx = 1;
2767
- aWindowConstraints.gridwidth = 3;
2768
- // aWindowConstraints.gridheight = 3;
2769
- aWindowConstraints.gridx = 1;
2770
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2771
- bigThree.add(centralPanel, aWindowConstraints);
2772
- aWindowConstraints.weightx = 0;
2773
- aWindowConstraints.gridx = 4;
2774
- aWindowConstraints.gridwidth = 1;
2775
- // aConstraints.gridheight = 3;
2776
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2777
- bigThree.add(XYZPanel, aWindowConstraints);
2778
- bigThree.revalidate();
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();
27793774 } else
2780
- if (event.getSource() == rootButton)
3775
+ if (source == rootButton)
27813776 {
27823777 Object3D obj;
27833778 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2787,66 +3782,85 @@
27873782 EditObject(obj);
27883783 }
27893784
3785
+ cameraView.requestFocusInWindow();
27903786 refreshContents(true);
27913787 } else
2792
- if (event.getSource() == closeButton)
3788
+ if (source == closeButton)
27933789 {
27943790 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27953791 cRadio ab;
27963792 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27973793 {
27983794 ab = (cRadio)e.nextElement();
2799
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3795
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28003796 {
3797
+ // Patch to avoid bug with transparency.
3798
+ if (!ab.hadMaterial)
3799
+ {
3800
+ ab.object.material = null;
3801
+ }
3802
+
28013803 buttonGroup.remove(ab);
28023804 radioPanel.remove(ab);
28033805
2804
- ab.GetObject().editWindow = null;
3806
+ //ab.GetObject().editWindow = null;
3807
+ ab.GetObject().manipWindow = null;
28053808 // ab.GetObject().objectUI = null; // ?????????
28063809
28073810 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28083811 break;
28093812 }
28103813 }
3814
+
3815
+ cameraView.requestFocusInWindow();
28113816 refreshContents(true);
28123817 } else
2813
- if (event.getSource() == editItem || event.getSource() == editButton)
3818
+ if (source == editItem || source == editButton)
28143819 {
3820
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3821
+ {
3822
+ Object3D child = (Object3D)e.nextElement();
3823
+ child.pinned = true;
3824
+ }
3825
+
28153826 EditSelection(false);
28163827 } else
2817
- if (event.getSource() == uneditButton)
3828
+ if (source == uneditButton)
28183829 {
28193830 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28203831 {
28213832 Object3D child = (Object3D)e.nextElement();
28223833 if(child.editWindow != null)
2823
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3834
+ child.pinned = false;
28243835 child.CloseUI();
28253836 listUI.remove(child);
3837
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28263838
2827
- child.editWindow = null; // ???????????
3839
+ //child.editWindow = null; // ???????????
28283840 }
2829
- objEditor.ctrlPanel.revalidate();
3841
+ objEditor.ctrlPanel.FlushUI();
28303842 //objEditor.jTree.clearSelection();
28313843 //objEditor.ResetSliders();
28323844 refreshContents(true);
28333845 } else
2834
- if (event.getSource() == clearPanelButton)
3846
+ if (source == clearPanelButton)
28353847 {
28363848 assert(copy == group);
28373849 //copy.ClearUI();
28383850 for (Object3D obj : listUI)
28393851 {
3852
+ obj.pinned = false;
28403853 obj.CloseUI();
28413854 }
28423855 listUI.clear();
3856
+ SetPinStates(group.selection.size() > 0);
28433857 refreshContents(true);
28443858 } else
2845
- if (event.getSource() == allParamsButton)
3859
+ if (source == allParamsButton)
28463860 {
28473861 assert(copy == group);
28483862
2849
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3863
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28503864
28513865 for (Object3D obj : listUI)
28523866 {
....@@ -2863,19 +3877,19 @@
28633877
28643878 refreshContents(true);
28653879 } else
2866
- if (event.getSource() == unselectButton)
3880
+ if (source == unselectButton)
28673881 {
28683882 objEditor.jTree.clearSelection();
28693883 // ?? oct 2012 GrafreeD.clipboard.clear();
28703884 objEditor.ResetSliders();
28713885 refreshContents(true);
28723886 } else
2873
- if(event.getSource() instanceof cRadio)
3887
+ if(source instanceof cRadio)
28743888 {
28753889 group.parent = keepparent;
28763890 group.attributes = 0;
28773891 //group.editWindow = null;
2878
- /*cRadio*/ radio = (cRadio)event.getSource();
3892
+ /*cRadio*/ radio = (cRadio)source;
28793893 Object3D obj = radio.GetObject();
28803894 System.out.println("Edit " + obj);
28813895 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2895,7 +3909,10 @@
28953909 }
28963910
28973911 copy = group;
2898
- //CameraPane.theRenderer.object = group;
3912
+
3913
+ SetUndoStates();
3914
+
3915
+ //Globals.theRenderer.object = group;
28993916 if(!useclient)
29003917 {
29013918 cameraView.renderCamera = radio.camera;
....@@ -2904,25 +3921,55 @@
29043921 cameraView.cameras[cameraView.cameracount] = radio.camera;
29053922 cameraView.targetLookAt.set(radio.camera.lookAt);
29063923 cameraView.object = group;
2907
- cameraView.lighttouched = true;
3924
+ //cameraView.lighttouched = true;
3925
+ Globals.lighttouched = true;
29083926 topView.object = group;
29093927 frontView.object = group;
29103928 sideView.object = group;
29113929 }
2912
- group.editWindow = this;
3930
+
3931
+// fix "+" issue
3932
+ //group.editWindow = this;
3933
+ group.manipWindow = this;
3934
+
29133935 /*
29143936 currentLayout = radio.layout;
29153937 if (currentLayout == null)
29163938 currentLayout = sevenButton;
29173939 */
29183940 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);
29193949 keepparent = group.parent;
29203950 // PARENT = NULL or not???
29213951 //group.parent = null; // ROOT
29223952 //group.attributes = -1;
29233953 ResetModel();
3954
+
3955
+ cameraView.requestFocusInWindow();
29243956 refreshContents(true);
2925
- }
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
+ }
29263973 else
29273974 {
29283975 //return super.action(event, arg);
....@@ -2931,7 +3978,6 @@
29313978 }
29323979
29333980 boolean useclient = false;
2934
- cRadio radio;
29353981
29363982 void ToggleRoot()
29373983 {
....@@ -2940,7 +3986,7 @@
29403986 if (useclient)
29413987 {
29423988 cameraView.object = client;
2943
- cameraView.lighttouched = true;
3989
+ Globals.lighttouched = true;
29443990 //topView.object = client;
29453991 //frontView.object = client;
29463992 //sideView.object = client;
....@@ -2948,7 +3994,7 @@
29483994 else
29493995 {
29503996 cameraView.object = group;
2951
- cameraView.lighttouched = true;
3997
+ Globals.lighttouched = true;
29523998 //topView.object = group;
29533999 //frontView.object = group;
29544000 //sideView.object = group;
....@@ -2983,6 +4029,28 @@
29834029 refreshContents();
29844030 }
29854031
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
+ }
29864054
29874055 void ResetTransform()
29884056 {
....@@ -3095,7 +4163,7 @@
30954163 refreshContents();
30964164 }
30974165
3098
- void ResetCentroid()
4166
+ void ResetCentroid(boolean full)
30994167 {
31004168 Object3D obj;
31014169 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3110,12 +4178,16 @@
31104178 LA.matIdentity(Object3D.mat);
31114179 obj.getBounds(minima, maxima, false);
31124180 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3113
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4181
+ if (full)
4182
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31144183 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31154184 obj.TransformMesh(Object3D.mat);
4185
+
31164186 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3117
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4187
+ if (full)
4188
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31184189 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4190
+
31194191 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31204192 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31214193 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3144,7 +4216,8 @@
31444216
31454217 int size = obj.MemorySize();
31464218
3147
- 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)");
31484221 }
31494222 }
31504223 catch (Exception e)
....@@ -3181,9 +4254,9 @@
31814254 obj = (Object3D)e.nextElement();
31824255
31834256 System.out.println("Object is: " + obj);
3184
- GrafreeD.AnalyzeObject(obj);
4257
+ Grafreed.AnalyzeObject(obj);
31854258 System.out.println("Boundary rep: " + obj.bRep);
3186
- GrafreeD.AnalyzeObject(obj.bRep);
4259
+ Grafreed.AnalyzeObject(obj.bRep);
31874260
31884261 // System.err.println((size/1024) + " KB is the size of " + obj);
31894262 }
....@@ -3225,6 +4298,13 @@
32254298 void GenNormals(boolean crease)
32264299 {
32274300 group.GenNormalsS(crease);
4301
+
4302
+ refreshContents();
4303
+ }
4304
+
4305
+ void GenNormalsMESH()
4306
+ {
4307
+ group.GenNormalsMeshS();
32284308
32294309 refreshContents();
32304310 }
....@@ -3397,8 +4477,8 @@
33974477
33984478 void ParseVertices()
33994479 {
3400
- boolean epsequal = GrafreeD.epsequal;
3401
- GrafreeD.epsequal = true;
4480
+ boolean epsequal = Grafreed.epsequal;
4481
+ Grafreed.epsequal = true;
34024482
34034483 for (int i=0; i<group.selection.size(); i++)
34044484 {
....@@ -3423,7 +4503,7 @@
34234503 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34244504 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34254505
3426
- g.add(GrafreeD.clipboard);
4506
+ g.add(Grafreed.clipboard);
34274507
34284508 buffer.add(g);
34294509 }
....@@ -3438,7 +4518,7 @@
34384518 makeSomething(buffer, i==group.selection.size()-1);
34394519 }
34404520
3441
- GrafreeD.epsequal = epsequal;
4521
+ Grafreed.epsequal = epsequal;
34424522
34434523 refreshContents();
34444524 }
....@@ -3456,7 +4536,16 @@
34564536 String pigment = Object3D.GetPigment(tex);
34574537 //String bump = Object3D.GetBump(tex);
34584538
3459
- 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
+ }
34604549
34614550 double s = v.s;
34624551
....@@ -3544,11 +4633,11 @@
35444633
35454634 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35464635
3547
- boolean random = CameraPane.RANDOM;
3548
- CameraPane.RANDOM = false; // parse all random nodes
4636
+ boolean random = CameraPane.SWITCH;
4637
+ CameraPane.SWITCH = false; // parse all random nodes
35494638 lowres.linkVerticesThis(null);
35504639 lowres.linkVerticesThis(sn);
3551
- CameraPane.RANDOM = random;
4640
+ CameraPane.SWITCH = random;
35524641
35534642 System.err.flush();
35544643
....@@ -3588,7 +4677,7 @@
35884677 return;
35894678
35904679 Object3D poses = group.selection.get(0);
3591
- Object3D ref = GrafreeD.clipboard.get(0);
4680
+ Object3D ref = Grafreed.clipboard.get(0);
35924681
35934682 Object3D newgroup = new Object3D("Po:" + poses.name);
35944683
....@@ -3757,7 +4846,7 @@
37574846 group.selection.RelinkToSupport(); // july 2014
37584847 System.out.println("DONE.");
37594848 refreshContents();
3760
- 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));
37614850 }
37624851
37634852 void ReduceMesh(boolean reduction34)
....@@ -3782,9 +4871,9 @@
37824871
37834872 void ClipMesh()
37844873 {
3785
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4874
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37864875 {
3787
- Object3D content = GrafreeD.clipboard.get(0);
4876
+ Object3D content = Grafreed.clipboard.get(0);
37884877
37894878 if (content instanceof cGroup && ((cGroup)content).transientlink )
37904879 content = ((cGroup)content).get(0);
....@@ -3793,7 +4882,7 @@
37934882 // {
37944883 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37954884 // }
3796
- group.selection.ClipMesh(GrafreeD.clipboard);
4885
+ group.selection.ClipMesh(Grafreed.clipboard);
37974886 }
37984887 // group.selection.ClipMesh(GrafreeD.clipboard);
37994888 System.out.println("DONE.");
....@@ -3840,6 +4929,18 @@
38404929 void MarkLeaves(boolean hide)
38414930 {
38424931 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);
38434944 refreshContents();
38444945 }
38454946
....@@ -3914,28 +5015,25 @@
39145015 // }
39155016 // }
39165017
3917
- static boolean allparams = true;
3918
-
3919
- static Vector<Object3D> listUI = new Vector<Object3D>();
3920
-
39215018 void EditSelection(boolean newWindow)
39225019 {
5020
+ if (group.selection == null)
5021
+ {
5022
+ EditElement(group, newWindow); // ? new
5023
+ return;
5024
+ }
5025
+
39235026 // aConstraints.gridy = 0;
39245027 for (int i=0; i<group.selection.size(); i++)
39255028 {
39265029 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39275030 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5031
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39295032
39305033 Object3D elem = (Object3D)group.selection.elementAt(i);
3931
- if(elem != group)
5034
+ if(elem != group || !newWindow)
39325035 {
3933
- // if (!(elem instanceof Composite))
3934
- // newWindow = false;
3935
- listUI.add(elem);
3936
- elem.openEditWindow(this, newWindow); //, false);
3937
- System.out.println("edit : " + elem);
3938
- elem.editWindow.refreshContents(true); // ? new
5036
+ EditElement(elem, newWindow); // ? new
39395037 }
39405038 }
39415039 }
....@@ -3998,9 +5096,7 @@
39985096
39995097 freezemodel = false;
40005098 }
4001
-
4002
- boolean flashIt = true;
4003
-
5099
+
40045100 public void valueChanged(TreeSelectionEvent e)
40055101 //public boolean handleEvent(Event event)
40065102 {
....@@ -4010,7 +5106,8 @@
40105106 //new Exception().printStackTrace();
40115107
40125108 freezemodel = true;
4013
-
5109
+ ClearUnpinned();
5110
+
40145111 /**/
40155112 //switch (event.id)
40165113 {
....@@ -4018,7 +5115,6 @@
40185115 //case 702: // Event.LIST_DESELECT
40195116 group.deselectAll();
40205117 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4021
- objEditor.ClearInfo(); // .GetMaterial());
40225118 if (tps != null)
40235119 {
40245120 for (int i=0; i < tps.length; i++)
....@@ -4027,33 +5123,39 @@
40275123
40285124 //if (child.parent != null)
40295125 //child.parent.addSelectee(child);
5126
+ objEditor.SetMaterial(child);
40305127 group.addSelectee(child);
4031
- objEditor.SetMaterial(child); // .GetMaterial());
4032
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4033
- System.err.println("info : " + child.GetPath());
40345128 }
40355129 }
4036
- else
4037
- {
4038
- objEditor.SetMaterial(group); // .GetMaterial());
4039
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4040
- System.err.println("info : " + group.GetPath());
4041
- }
5130
+// else
5131
+// {
5132
+// objEditor.SetMaterial(group); // .GetMaterial());
5133
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5134
+// System.err.println("info : " + group.GetPath());
5135
+// }
40425136
4043
- objEditor.SetText(); // jan 2014
4044
-
4045
- 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))
40465138 CameraPane.flash = true;
40475139
4048
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5140
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40495141 // a camera
40505142 {
4051
- CameraPane.camerachangeframe = 0; // don't refuse it
4052
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4053
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4054
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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;
40555150 }
40565151
5152
+ if (tps != null && tps.length == 1)
5153
+ {
5154
+ EditSelection(false);
5155
+ }
5156
+
5157
+ SetPinStates(tps != null && tps.length > 0);
5158
+
40575159 refreshContents();
40585160 //return true;
40595161 }
....@@ -4062,6 +5164,37 @@
40625164
40635165 freezemodel = false;
40645166 }
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
+ }
40655198
40665199 void linkSomething(Object3D thing)
40675200 {
....@@ -4133,16 +5266,19 @@
41335266 {
41345267 if (group.selection.isEmpty())
41355268 return;
4136
- GrafreeD.clipboardIsTempGroup = false;
5269
+
5270
+ Grafreed.clipboardIsTempGroup = false;
41375271 Composite tGroup = null;
41385272 if (group.selection.size() > 0) // 1)
41395273 {
41405274 tGroup = new cGroup();
4141
- GrafreeD.clipboardIsTempGroup = true;
5275
+ Grafreed.clipboardIsTempGroup = true;
41425276 }
41435277
41445278 if (cut)
41455279 {
5280
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5281
+// Save();
41465282 //int indices[] = jList.getSelectedIndices();
41475283 //for (int i = indices.length - 1; i >= 0; i--)
41485284 //jList.remove(indices[i]);
....@@ -4178,16 +5314,16 @@
41785314 //System.out.println("cut " + child);
41795315 //System.out.println("parent = " + child.parent);
41805316 // tmp.addChild(child);
4181
- if (GrafreeD.clipboardIsTempGroup)
5317
+ if (Grafreed.clipboardIsTempGroup)
41825318 tGroup.add/*Child*/(tmp);
41835319 else
4184
- GrafreeD.clipboard = tmp;
5320
+ Grafreed.clipboard = tmp;
41855321 }
41865322 else
4187
- if (GrafreeD.clipboardIsTempGroup)
5323
+ if (Grafreed.clipboardIsTempGroup)
41885324 tGroup.add/*Child*/(child);
41895325 else
4190
- GrafreeD.clipboard = child;
5326
+ Grafreed.clipboard = child;
41915327 }
41925328
41935329 //ResetModel();
....@@ -4219,21 +5355,23 @@
42195355 //System.out.println("cut " + elem);
42205356 //System.out.println("parent = " + elem.parent);
42215357 // tmp.addChild(elem);
4222
- if (GrafreeD.clipboardIsTempGroup)
5358
+ if (Grafreed.clipboardIsTempGroup)
42235359 tGroup.add/*Child*/(tmp);
42245360 else
4225
- GrafreeD.clipboard = tmp;
5361
+ Grafreed.clipboard = tmp;
42265362 }
42275363 else
4228
- if (GrafreeD.clipboardIsTempGroup)
5364
+ if (Grafreed.clipboardIsTempGroup)
42295365 tGroup.add/*Child*/(child);
42305366 else
4231
- GrafreeD.clipboard = child;
5367
+ Grafreed.clipboard = child;
42325368 }
42335369
42345370 }
4235
- if (GrafreeD.clipboardIsTempGroup)
4236
- GrafreeD.clipboard = tGroup;
5371
+
5372
+ if (Grafreed.clipboardIsTempGroup)
5373
+ Grafreed.clipboard = tGroup;
5374
+
42375375 if (cut)
42385376 {
42395377 ResetModel();
....@@ -4243,11 +5381,15 @@
42435381
42445382 void paste(boolean expand)
42455383 {
5384
+ if (Globals.REPLACEONMAKE)
5385
+ Save();
5386
+ boolean keep = Globals.REPLACEONMAKE;
5387
+ Globals.REPLACEONMAKE = false;
42465388 // if (GrafreeD.clipboard == null)
42475389 // return;
42485390 boolean first = true;
42495391
4250
- if (GrafreeD.clipboardIsTempGroup)
5392
+ if (Grafreed.clipboardIsTempGroup)
42515393 {
42525394 Composite temp;
42535395
....@@ -4258,7 +5400,7 @@
42585400 temp = (Composite)Applet3D.clipboard.deepCopy();
42595401 */
42605402 Object3D elem;
4261
- 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))
42625404 {
42635405 Object3D child = (Object3D)e.nextElement();
42645406
....@@ -4292,21 +5434,22 @@
42925434 //Object3D cb = Applet3D.clipboard;
42935435 //temp.addChild(cb);
42945436 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4295
- assert(GrafreeD.clipboard.parent == null);
4296
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4297
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4298
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4299
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
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());
43005442 else
4301
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4302
- GrafreeD.clipboard.get(0).parent = keepparent;
5443
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5444
+ Grafreed.clipboard.get(0).parent = keepparent;
43035445 }
43045446
5447
+ Globals.REPLACEONMAKE = keep;
43055448 ResetModel();
43065449 refreshContents();
43075450 }
43085451
4309
- void pasteInto(boolean copyit)
5452
+ void pasteInto(boolean copyit, boolean clone)
43105453 {
43115454 // if (GrafreeD.clipboard == null)
43125455 // return;
....@@ -4335,15 +5478,22 @@
43355478 if (copyit)
43365479 {
43375480 // paste(false);
4338
- CloneClipboard(false); // sept 2014
5481
+ if (clone)
5482
+ {
5483
+ CloneClipboard(false); // sept 2014
5484
+ }
5485
+ else
5486
+ {
5487
+ paste(false);
5488
+ }
43395489 }
43405490 else
43415491 {
43425492 boolean first = true;
43435493
4344
- if (GrafreeD.clipboardIsTempGroup)
5494
+ if (Grafreed.clipboardIsTempGroup)
43455495 {
4346
- Composite temp = (Composite)GrafreeD.clipboard;
5496
+ Composite temp = (Composite)Grafreed.clipboard;
43475497 Object3D copy;
43485498 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43495499 {
....@@ -4353,7 +5503,7 @@
43535503 }
43545504 } else
43555505 {
4356
- linkSomething(GrafreeD.clipboard); //.get(0));
5506
+ linkSomething(Grafreed.clipboard); //.get(0));
43575507 }
43585508 }
43595509 }
....@@ -4430,6 +5580,10 @@
44305580
44315581 void group(Object3D csg, boolean grab)
44325582 {
5583
+ if (Globals.REPLACEONMAKE)
5584
+ Save();
5585
+ boolean keep = Globals.REPLACEONMAKE;
5586
+ Globals.REPLACEONMAKE = false;
44335587 if (//false) // why??
44345588 !group.selection.isEmpty())
44355589 {
....@@ -4543,10 +5697,15 @@
45435697 //node.add(csg);
45445698 //makeSomething(node);
45455699 makeSomething(csg);
5700
+ Globals.REPLACEONMAKE = keep;
45465701 }
45475702
45485703 void Ungroup(Object3D g)
45495704 {
5705
+ if (Globals.REPLACEONMAKE)
5706
+ Save();
5707
+ boolean keep = Globals.REPLACEONMAKE;
5708
+ Globals.REPLACEONMAKE = false;
45505709 if (g instanceof HiddenObject)
45515710 {
45525711 HiddenObject h = (HiddenObject) g;
....@@ -4563,6 +5722,7 @@
45635722 objEditor.makeSomething(g.get(i), false);
45645723 }
45655724 }
5725
+ Globals.REPLACEONMAKE = keep;
45665726 }
45675727
45685728 void ungroup()
....@@ -4758,21 +5918,6 @@
47585918 }
47595919 */
47605920
4761
- void ImportGFD()
4762
- {
4763
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4764
- browser.show();
4765
- String filename = browser.getFile();
4766
- if (filename != null && filename.length() > 0)
4767
- {
4768
- String fullname = browser.getDirectory() + filename;
4769
-
4770
- //Object3D readobj =
4771
- objEditor.ReadGFD(fullname, objEditor);
4772
- //makeSomething(readobj);
4773
- }
4774
- }
4775
-
47765921 /*
47775922 public void Callback(Object obj)
47785923 {
....@@ -4796,26 +5941,9 @@
47965941 }
47975942 */
47985943
4799
- void ImportVRMLX3D()
4800
- {
4801
- if (GrafreeD.standAlone)
4802
- {
4803
- /**/
4804
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4805
- browser.show();
4806
- String filename = browser.getFile();
4807
- if (filename != null && filename.length() > 0)
4808
- {
4809
- String fullname = browser.getDirectory() + filename;
4810
- LoadVRMLX3D(fullname);
4811
- }
4812
- /**/
4813
- }
4814
- }
4815
-
48165944 String GetFile(String dialogName)
48175945 {
4818
- if (GrafreeD.standAlone)
5946
+ if (Grafreed.standAlone)
48195947 {
48205948 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48215949 browser.show();
....@@ -4879,10 +6007,48 @@
48796007 cButton flashSelectionButton;
48806008 cButton editButton;
48816009 cButton uneditButton;
6010
+ JCheckBox allParamsButton;
48826011 cButton clearpanelButton;
4883
- cButton allParamsButton;
48846012 cButton unselectButton;
48856013
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
+
48866052 cButton screenfitButton;
48876053 cButton screenfitpointButton;
48886054 cButton snapobjectButton;
....@@ -4894,14 +6060,6 @@
48946060
48956061 cButton setsupportButton;
48966062
4897
- cButton twoButton;
4898
- cButton sixButton;
4899
- cButton threeButton;
4900
- cButton sevenButton;
4901
- cButton fourButton; // full panel
4902
- cButton oneButton; // full XYZ
4903
- //cButton currentLayout;
4904
-
49056063 //
49066064 //Composite
49076065 Object3D // to do !!
....@@ -4911,9 +6069,11 @@
49116069 //JTree jTree;
49126070 private MenuItem lookAtItem;
49136071 private MenuItem lookFromItem;
4914
- private MenuItem switchItem;
6072
+ private MenuItem switchViewItem;
49156073 private MenuItem cutItem;
4916
- private MenuItem duplicateItem;
6074
+ private MenuItem undoItem;
6075
+ private MenuItem redoItem;
6076
+ private JMenuItem duplicateItem;
49176077 private MenuItem cloneItem;
49186078 private MenuItem cloneSupportItem;
49196079 private MenuItem overwriteGeoItem;
....@@ -4926,7 +6086,7 @@
49266086 private MenuItem linkverticesItem;
49276087 private MenuItem relinkverticesItem;
49286088 private MenuItem setMasterItem;
4929
- private MenuItem resetMeshItem;
6089
+ private MenuItem resetAllItem;
49306090 private MenuItem stepAllItem;
49316091 private MenuItem revertMeshItem;
49326092 private MenuItem poseMeshItem;
....@@ -4937,10 +6097,11 @@
49376097 private MenuItem mergeGeometriesItem;
49386098 private MenuItem copyItem;
49396099 private MenuItem pasteItem;
6100
+ private MenuItem pasteIntoItem;
49406101 private MenuItem pasteLinkItem;
49416102 private MenuItem pasteCloneItem;
49426103 private MenuItem pasteExpandItem;
4943
- private MenuItem clearItem;
6104
+ private MenuItem deleteItem;
49446105 private MenuItem clearAllItem;
49456106 private MenuItem genUVItem;
49466107 private MenuItem genNormalsMESHItem;
....@@ -4975,6 +6136,10 @@
49756136 private MenuItem showleavesItem;
49766137 private MenuItem markleavesItem;
49776138 private MenuItem unmarkleavesItem;
6139
+ private MenuItem rewindleavesItem;
6140
+ private MenuItem unrewindleavesItem;
6141
+ private MenuItem randomleavesItem;
6142
+ private MenuItem unrandomleavesItem;
49786143
49796144 private MenuItem flipVItem;
49806145 private MenuItem unflipVItem;
....@@ -4986,15 +6151,17 @@
49866151 private MenuItem panoTexturesItem;
49876152
49886153 private MenuItem resetCentroidItem;
4989
- private MenuItem transformgeometryItem;
6154
+ private MenuItem resetCentroidXZItem;
49906155 private MenuItem resetTransformItem;
6156
+ private MenuItem transformGeometryItem;
6157
+ private MenuItem transformChildrenItem;
49916158 private MenuItem hideItem;
49926159 private MenuItem grabItem;
49936160 private MenuItem backItem;
49946161 private MenuItem frontItem;
49956162 private MenuItem cameraItem;
49966163 private MenuItem compositeItem;
4997
- private MenuItem randomItem;
6164
+ private MenuItem switchItem;
49986165 private MenuItem physicsItem;
49996166 private MenuItem frameselectorItem;
50006167 private MenuItem scriptNodeItem;
....@@ -5009,6 +6176,7 @@
50096176
50106177 private MenuItem resetParentItem;
50116178 private MenuItem repairParentItem;
6179
+ private MenuItem repairShadowItem;
50126180 private MenuItem sortbysizeItem;
50136181 private MenuItem sortbynameItem;
50146182
....@@ -5017,6 +6185,8 @@
50176185 private MenuItem attachBumpItem;
50186186 private MenuItem detachBumpItem;
50196187 private MenuItem pigmentBumpItem;
6188
+ private MenuItem embedTexturesItem;
6189
+ private MenuItem deEmbedTexturesItem;
50206190
50216191 private MenuItem particleItem;
50226192 private MenuItem ragdollItem;
....@@ -5033,7 +6203,7 @@
50336203 private MenuItem blobItem;
50346204 private MenuItem latheItem;
50356205 private MenuItem bezierItem;
5036
- private MenuItem checkerItem;
6206
+ private MenuItem overlayItem;
50376207 private MenuItem meshItem;
50386208 // private MenuItem meshGroupItem;
50396209 private MenuItem springItem;
....@@ -5055,11 +6225,6 @@
50556225 private MenuItem doubleItem;
50566226 private MenuItem tripleItem;
50576227
5058
- private MenuItem importGFDItem;
5059
- private MenuItem importVRMLX3DItem;
5060
- private MenuItem import3DSItem;
5061
- private MenuItem importOBJItem;
5062
-
50636228 private MenuItem computeAOItem;
50646229 private MenuItem recompileItem;
50656230 private MenuItem editScriptItem;
....@@ -5069,4 +6234,8 @@
50696234 private MenuItem analyzeItem;
50706235 private MenuItem dumpItem;
50716236 //boolean freezemodel = false;
6237
+
6238
+ Menu cameraMenu;
6239
+ MenuItem editCameraItem;
6240
+ MenuItem restoreCameraItem;
50726241 }