Normand Briere
2019-07-30 7a77e39423398b7ad8bf7e80cf45fac6817000c2
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.versions == null)
360
+ {
361
+ copy.versions = new byte[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.versions == null)
387
+ {
388
+ copy.versions = new byte[100][];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
82393 }
83394
84395 void CloneSelection(boolean supports)
85396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
86401 // Object3D keep = GrafreeD.clipboard;
87402 //Object3D obj;
88403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +408,19 @@
93408
94409 makeSomething(clone, i==group.selection.size()-1);
95410 }
411
+ Globals.REPLACEONMAKE = keep;
96412 }
97413
98414 void CloneClipboard(boolean supports)
99415 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
416
+ assert(Grafreed.clipboard.parent == null);
417
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
418
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
419
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
420
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105421 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
422
+ makeSomething(CloneObject(Grafreed.clipboard, false));
423
+ Grafreed.clipboard.get(0).parent = keepparent;
108424 }
109425
110426 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +434,7 @@
118434 // obj.support = null;
119435 if (!supports)
120436 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
437
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122438 obj.parent = parent;
123439 // obj.support = support;
124440 // clone.support = support; // aout 2013
....@@ -147,30 +463,29 @@
147463
148464 //JTextField nameField;
149465
150
- void SetupMenu2(ObjEditor oe)
466
+ void SetupMenu2(GroupEditor oe)
151467 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
468
+ oe.jTree = new cTree();
469
+
163470 Menu menu;
164471 oe.menuBar.add(menu = new Menu("Edit"));
165472 //editItem = menu.add(new MenuItem("Edit"));
166473 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
474
+
475
+// undoItem = menu.add(new MenuItem("Undo"));
476
+// undoItem.addActionListener(this);
477
+// redoItem = menu.add(new MenuItem("Redo"));
478
+// redoItem.addActionListener(this);
479
+// menu.add("-");
480
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168481 duplicateItem.addActionListener(this);
169
- menu.add("-");
170482 cloneItem = menu.add(new MenuItem("Clone"));
171483 cloneItem.addActionListener(this);
484
+ if (Globals.ADVANCED)
485
+ {
172486 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173487 cloneSupportItem.addActionListener(this);
488
+ }
174489 menu.add("-");
175490 cutItem = menu.add(new MenuItem("Cut"));
176491 cutItem.addActionListener(this);
....@@ -178,27 +493,123 @@
178493 copyItem.addActionListener(this);
179494 pasteItem = menu.add(new MenuItem("Paste"));
180495 pasteItem.addActionListener(this);
496
+
497
+ menu.add("-");
498
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
499
+ pasteIntoItem.addActionListener(this);
181500 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182501 pasteLinkItem.addActionListener(this);
183502 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184503 pasteCloneItem.addActionListener(this);
185504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186505 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
506
+ menu.add("-");
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
509
+
510
+ if (Globals.ADVANCED)
511
+ {
512
+ // Deletes the cameras...
189513 clearAllItem = menu.add(new MenuItem("Clear All"));
190514 clearAllItem.addActionListener(this);
515
+ }
516
+
517
+ menuBar.add(cameraMenu = new Menu("View"));
518
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
519
+ //zBufferItem.addActionListener(this);
520
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
521
+ //normalLensItem.addActionListener(this);
522
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
523
+ restoreCameraItem.addActionListener(this);
524
+
525
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
526
+// toggleFullScreenItem.addItemListener(this);
527
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
528
+// cameraMenu.add("-");
529
+//
530
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
531
+// toggleTextureItem.addItemListener(this);
532
+// toggleTextureItem.setState(CameraPane.textureon);
533
+//
534
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
535
+// toggleSwitchItem.addItemListener(this);
536
+// toggleSwitchItem.setState(CameraPane.SWITCH);
537
+
538
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
539
+ toggleHandleItem.addItemListener(this);
540
+ toggleHandleItem.setState(CameraPane.HANDLES);
541
+
542
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
543
+ togglePaintItem.addItemListener(this);
544
+ togglePaintItem.setState(CameraPane.PAINTMODE);
545
+
546
+ if (Globals.ADVANCED)
547
+ {
548
+ cameraMenu.add("-");
549
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
550
+ toggleLiveItem.addItemListener(this);
551
+ toggleLiveItem.setState(Globals.isLIVE());
191552
553
+ cameraMenu.add(stepItem = new MenuItem("Step"));
554
+ stepItem.addActionListener(this);
555
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
556
+ // toggleDLItem.addItemListener(this);
557
+ // toggleDLItem.setState(false);
558
+
559
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
560
+ toggleRenderItem.addItemListener(this);
561
+ toggleRenderItem.setState(!CameraPane.frozen);
562
+
563
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
564
+ toggleDebugItem.addItemListener(this);
565
+ toggleDebugItem.setState(Globals.DEBUG);
566
+
567
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
568
+ toggleFrustumItem.addItemListener(this);
569
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
570
+
571
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
572
+ toggleFootContactItem.addItemListener(this);
573
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
574
+
575
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
576
+ toggleTimelineItem.addItemListener(this);
577
+ }
578
+
579
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
580
+// toggleRootItem.addItemListener(this);
581
+// toggleRootItem.setState(false);
582
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
583
+// animationItem.addItemListener(this);
584
+// animationItem.setState(CameraPane.ANIMATION);
585
+ cameraMenu.add("-");
586
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
587
+ editCameraItem.addActionListener(this);
588
+
589
+ if (Globals.ADVANCED)
590
+ {
591
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595
+ oe.cameraMenu.add("-");
596
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597
+ openWindowItem.addActionListener(this);
598
+ editLeafItem.addActionListener(this);
599
+ lookAtItem.addActionListener(this);
600
+ //lookFromItem.addActinoListener(this);
601
+ //switchViewItem.addActionListener(this);
602
+ }
603
+
192604 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
197607 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198608 revertMeshItem.addActionListener(this);
199609 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200610 resetreferencesItem.addActionListener(this);
201611 menu.add("-");
612
+ }
202613 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203614 overwriteGeoItem.addActionListener(this);
204615 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +621,104 @@
210621 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211622 overwriteUVItem.addActionListener(this);
212623 menu.add("-");
624
+ if (Globals.ADVANCED)
625
+ {
213626 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214627 generateMeshItem.addActionListener(this);
215628 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216629 poseMeshItem.addActionListener(this);
217630 menu.add("-");
631
+ }
218632 resetsupportItem = menu.add(new MenuItem("Reset support"));
219633 resetsupportItem.addActionListener(this);
220634 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221635 linkverticesItem.addActionListener(this);
636
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
637
+ relinkverticesItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
222641 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223642 setMasterItem.addActionListener(this);
643
+ }
224644
225645 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
228648 backItem = menu.add(new MenuItem("Back"));
229649 backItem.addActionListener(this);
230650 frontItem = menu.add(new MenuItem("Front"));
231651 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
657
+ hideItem = menu.add(new MenuItem("Hidden Group"));
658
+ hideItem.addActionListener(this);
659
+ }
660
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
661
+ ungroupItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
241669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242670 switchGeoItem.addActionListener(this);
243671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244672 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
246674 morphItem.addActionListener(this);
675
+
676
+ menu.add("-");
677
+ physicsItem = menu.add(new MenuItem("Physics"));
678
+ physicsItem.addActionListener(this);
679
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
680
+ frameselectorItem.addActionListener(this);
247681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248682 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
683
+ }
251684
252685 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
688
+ billboardItem = menu.add(new MenuItem("Billboard"));
689
+ billboardItem.addActionListener(this);
255690 csgItem = menu.add(new MenuItem("CSG"));
256691 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258693 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260695 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
701
+ if (Globals.ADVANCED)
702
+ {
703
+ menu.add("-");
263704 linkerItem = menu.add(new MenuItem("Linker"));
264705 linkerItem.addActionListener(this);
265706 templateItem = menu.add(new MenuItem("Template"));
266707 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269708 pointflowItem = menu.add(new MenuItem("Point Flow"));
270709 pointflowItem.addActionListener(this);
710
+ }
271711 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274712 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275713 resetTransformItem.addActionListener(this);
276714 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277715 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
716
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
717
+ resetCentroidXZItem.addActionListener(this);
718
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
719
+ transformGeometryItem.addActionListener(this);
720
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
721
+ transformChildrenItem.addActionListener(this);
280722
281723 oe.menuBar.add(menu = new Menu("Geometry"));
282724 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -287,6 +729,11 @@
287729 genNormalsCADItem.addActionListener(this);
288730 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289731 genNormalsMESHItem.addActionListener(this);
732
+ if (Globals.ADVANCED)
733
+ {
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
735
+ genNormalsMINEItem.addActionListener(this);
736
+ }
290737 stripifyItem = menu.add(new MenuItem("Stripify"));
291738 stripifyItem.addActionListener(this);
292739 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +755,34 @@
308755 reduce34MeshItem.addActionListener(this);
309756 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310757 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313758 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314759 clipMeshItem.addActionListener(this);
760
+
761
+ if (Globals.ADVANCED)
762
+ {
763
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
764
+ smoothMeshItem.addActionListener(this);
765
+ }
315766
316767 oe.menuBar.add(menu = new Menu("Attributes"));
317768 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318769 clearMaterialsItem.addActionListener(this);
770
+ resetAllItem = menu.add(new MenuItem("Reset All"));
771
+ resetAllItem.addActionListener(this);
772
+ stepAllItem = menu.add(new MenuItem("Step All"));
773
+ stepAllItem.addActionListener(this);
319774 menu.add("-");
320775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321776 liveleavesItem.addActionListener(this);
322777 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323778 unliveleavesItem.addActionListener(this);
779
+ if (Globals.ADVANCED)
780
+ {
324781 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325782 supportleavesItem.addActionListener(this);
326783 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327784 unsupportleavesItem.addActionListener(this);
785
+ }
328786 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329787 hideleavesItem.addActionListener(this);
330788 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +791,14 @@
333791 markleavesItem.addActionListener(this);
334792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335793 unmarkleavesItem.addActionListener(this);
794
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795
+ rewindleavesItem.addActionListener(this);
796
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
797
+ unrewindleavesItem.addActionListener(this);
798
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
799
+ randomleavesItem.addActionListener(this);
800
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
801
+ unrandomleavesItem.addActionListener(this);
336802 menu.add("-");
337803 flipVItem = menu.add(new MenuItem("Flip V"));
338804 flipVItem.addActionListener(this);
....@@ -358,45 +824,56 @@
358824 attachBumpItem.addActionListener(this);
359825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
360826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
361828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
362829 detachPigmentItem.addActionListener(this);
363830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
364831 detachBumpItem.addActionListener(this);
832
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
833
+ embedTexturesItem.addActionListener(this);
834
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
835
+ deEmbedTexturesItem.addActionListener(this);
365836 menu.add("-");
366837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
367838 sortbysizeItem.addActionListener(this);
368839 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369840 sortbynameItem.addActionListener(this);
370841 menu.add("-");
842
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
843
+ shareGeometriesItem.addActionListener(this);
844
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845
+ mergeGeometriesItem.addActionListener(this);
846
+ if (Globals.ADVANCED)
847
+ {
848
+ // Pretty much the same as duplicate and clone.
371849 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372850 extractGeometriesItem.addActionListener(this);
373851 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374852 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
853
+ }
379854
380855 oe.menuBar.add(menu = new Menu("Insert"));
381856 buildCreateMenu(menu);
382857
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394858 oe.menuBar.add(menu = new Menu("Tools"));
395859 buildToolsMenu(menu);
396860 }
397861
862
+
398863 void SetupUI2(ObjEditor oe)
399864 {
865
+ // June 2019
866
+ if (oe == null)
867
+ {
868
+ //super.SetupUI2(this);
869
+ //return;
870
+ }
871
+
872
+ if (copy != group)
873
+ {
874
+ //super.SetupUI2(this);
875
+ }
876
+
400877 //new Exception().printStackTrace();
401878
402879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +902,239 @@
425902 oe.radioPanel.add(dummyButton);
426903 oe.buttonGroup.add(dummyButton);
427904 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
431908
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
909
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
910
+
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
914
+
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
921
+
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ screenfitButton.setToolTipText("Screen fit");
928
+ screenfitButton.addActionListener(this);
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("New version");
936
+ saveButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ undoButton.setToolTipText("Previous version");
940
+ undoButton.addActionListener(this);
941
+ undoButton.setEnabled(false);
942
+
943
+ cGridBag updown = new cGridBag().setVertical(true);
944
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+ restoreButton.setToolTipText("Restore current");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Replace current");
951
+ replaceButton.addActionListener(this);
952
+ replaceButton.setEnabled(false);
953
+
954
+ copyOptionsPanel.add(updown);
955
+
956
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
+ redoButton.setToolTipText("Next version");
958
+ redoButton.addActionListener(this);
959
+ redoButton.setEnabled(false);
960
+
961
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
962
+ liveCB.setToolTipText("Enable animation");
433963 liveCB.addItemListener(this);
434964
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
965
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
966
+ oneStepButton.setToolTipText("Animate one step forward");
967
+ oneStepButton.addActionListener(this);
968
+
969
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
970
+ fastCB.setToolTipText("Fast mode");
453971 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
972
+
973
+ //oe.toolboxPanel.Return();
974
+
975
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
976
+// trackCB.setToolTipText("Enable tracking");
977
+// trackCB.addItemListener(this);
460978
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
495
- trackCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
499
- screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
501979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502980 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507981
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
514
- flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518
-
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
521
- twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
982
+ if (Globals.ADVANCED)
983
+ {
984
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
985
+ snapobjectButton.addActionListener(this);
986
+ snapobjectButton.setToolTipText("Snap Object");
987
+
988
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523989 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
525
- sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
990
+ fourButton.setToolTipText("Show control panel only");
991
+ }
992
+
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
994
+
995
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
+ twoButton.setToolTipText("Show 3D view only");
997
+ twoButton.addActionListener(this);
998
+ this.fullscreenLayout = twoButton;
999
+
1000
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1001
+ threeButton.setToolTipText("Show controls and 3D view");
5271002 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
529
- sevenButton.addActionListener(this);
1003
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1004
+ sixButton.setToolTipText("Show 3D view and controls");
1005
+ sixButton.addActionListener(this);
1006
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+// sevenButton.setToolTipText("3-column layout");
1008
+// sevenButton.addActionListener(this);
5301009 //
5311010
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
5331013 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1014
+
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1016
+ closeButton.setToolTipText("Close tab");
5361017 closeButton.addActionListener(this);
5371018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5381019 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540
-
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
543
- editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
5471020
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1021
+ cGridBag row1 = new cGridBag();
1022
+
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
1110
+ editButton.addActionListener(this);
1111
+
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
5491114 uneditButton.addActionListener(this);
5501115
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
5631118 allParamsButton.addActionListener(this);
5641119
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ clearPanelButton.setToolTipText("Clear edit panel");
1122
+ clearPanelButton.addActionListener(this);
1123
+
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ unselectButton.setToolTipText("Unselect");
5701126 unselectButton.addActionListener(this);
5711127
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
1131
+
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
1137
+
5721138 // oe.aConstraints.gridx += 1;
5731139 // oe.aConstraints.weighty = 0;
5741140 // oe.aConstraints.gridwidth = 1;
....@@ -580,47 +1146,32 @@
5801146 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5811147 // gcButton.addActionListener(this);
5821148
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
1149
+ cGridBag jSPPanel = new cGridBag();
1150
+
1151
+ JScrollPane jSP;
5941152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5961154 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
601
-
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
- colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
609
- materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
612
- textureCB.addItemListener(this);
613
-
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
6161155
1156
+ oe.treePanel.add(jSPPanel);
1157
+ oe.treePanel.Return();
1158
+
1159
+ oe.treePanel.add(copyOptionsPanel);
1160
+ oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
1164
+
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
1167
+
6171168 //jList.addListSelectionListener(this);
6181169 oe.jTree.addTreeSelectionListener(this);
6191170 //jTree.setRootVisible(false);
6201171 //jTree.setEditable(true);
6211172 oe.jTree.setDragEnabled(true);
6221173 //jTree.setPreferredSize(new Dimension(10,10));
623
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
6241175
6251176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6261177
....@@ -632,23 +1183,160 @@
6321183 dgr.addDragGestureListener(this);
6331184 }catch(Exception e) {}
6341185 */
635
- radio.layout = sevenButton;
1186
+ radio.layout = sixButton; // sevenButton;
6361187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6371188 }
1189
+
1190
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1191
+ {
1192
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1193
+ colorCB.setToolTipText("Copy color when dropped");
1194
+ colorCB.addItemListener(this);
1195
+
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
1206
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1207
+ boxCB.setToolTipText("Display bounding boxes");
1208
+ boxCB.addItemListener(this);
1209
+
1210
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
1212
+ zoomBoxCB.addItemListener(this);
1213
+
1214
+ if (true) // Globals.ADVANCED)
1215
+ {
1216
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1217
+// supportCB.setToolTipText("Enable rigging");
1218
+// supportCB.addItemListener(this);
1219
+
1220
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1221
+ freezeCB.setToolTipText("Fast moving camera");
1222
+ freezeCB.addItemListener(this);
1223
+
1224
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1225
+ // localCB.addItemListener(this);
1226
+
1227
+ panel.Return();
1228
+
1229
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1230
+ crowdCB.setToolTipText("Used for crowds");
1231
+ crowdCB.addItemListener(this);
1232
+
1233
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1234
+ smoothCB.setToolTipText("Snapping delay");
1235
+ smoothCB.addItemListener(this);
1236
+
1237
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
+ slowCB.setToolTipText("Smooth interpolation");
1239
+ slowCB.addItemListener(this);
1240
+
1241
+// constraints.gridy += 1;
1242
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1243
+// speakerMocapCB.addItemListener(this);
1244
+
1245
+ panel.Return();
1246
+
1247
+ if (false)
1248
+ {
1249
+ // handled in scripts
1250
+ //constraints.gridy += 1;
1251
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1252
+ speakerCameraCB.addItemListener(this);
1253
+
1254
+ //constraints.gridy += 1;
1255
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1256
+ speakerFocusCB.addItemListener(this);
1257
+
1258
+ //constraints.gridy += 1;
1259
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1260
+ smoothfocusCB.addItemListener(this);
1261
+ panel.Return();
1262
+ }
1263
+
1264
+//constraints.gridx += 1;
1265
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1266
+// debugCB.addItemListener(this);
1267
+
1268
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1269
+ trackCB.setToolTipText("Enable tracking target");
1270
+ trackCB.addItemListener(this);
1271
+
1272
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1273
+ oeilCB.setToolTipText("Move camera when tracking");
1274
+ oeilCB.addItemListener(this);
1275
+
1276
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1277
+ shadowCB.setToolTipText("When live compute shadows");
1278
+ shadowCB.addItemListener(this);
1279
+
1280
+ panel.Return();
1281
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1282
+ toggleTextureCB.setToolTipText("Load textures");
1283
+ toggleTextureCB.addItemListener(this);
1284
+
1285
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1286
+ toggleSwitchCB.setToolTipText("Choose a single item");
1287
+ toggleSwitchCB.addItemListener(this);
1288
+
1289
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1290
+ autokeepCB.setToolTipText("On structure change");
1291
+ autokeepCB.addItemListener(this);
1292
+
1293
+ panel.Return();
1294
+ if (Globals.ADVANCED)
1295
+ {
1296
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1297
+ lookAtCB.setToolTipText("Look-at target");
1298
+ lookAtCB.addItemListener(this);
1299
+ }
1300
+
1301
+ }
1302
+
1303
+ cGridBag fill = new cGridBag();
1304
+ fill.preferredHeight = 200;
1305
+ cGridBag fill2 = new cGridBag();
1306
+ fill2.preferredHeight = 200;
1307
+ cGridBag fill3 = new cGridBag();
1308
+ fill3.preferredHeight = 200;
1309
+
1310
+ panel.add(fill);
1311
+ panel.add(fill2);
1312
+ panel.add(fill3);
1313
+
1314
+ }
6381315
6391316 void EditObject(Object3D obj)
6401317 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
1318
+ cRadio radioButton = new cRadio(obj.name);
1319
+
1320
+ // June 2019. Patch to avoid bug with transparency.
1321
+ radioButton.hadMaterial = obj.material != null;
1322
+ if (!radioButton.hadMaterial)
1323
+ {
1324
+ obj.material = new cMaterial();
1325
+ }
1326
+
1327
+ radioButton.SetObject(obj);
1328
+ radioButton.layout = sixButton; // sevenButton;
1329
+ radioButton.SetCamera(cameraView.renderCamera, false);
1330
+ radioButton.addActionListener(this);
1331
+ radioPanel.add(radioButton);
1332
+ buttonGroup.add(radioButton);
1333
+ radioButton.doClick();
6491334 }
1335
+
6501336 void SetupViews(ObjEditor oe)
6511337 {
1338
+ theFrame = this;
1339
+
6521340 oe.SetupViews();
6531341
6541342 System.out.println("SetupViews");
....@@ -657,22 +1345,28 @@
6571345 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6581346 }
6591347
660
- JCheckBox liveCB;
661
- JCheckBox supportCB;
662
- JCheckBox localCB;
663
- JCheckBox crowdCB;
664
- JCheckBox smoothCB;
665
- JCheckBox fastCB;
666
- JCheckBox slowCB;
667
- JCheckBox boxCB;
668
- JCheckBox trackCB;
669
- JCheckBox smoothfocusCB;
1348
+ cToggleButton liveCB;
1349
+ cCheckBox supportCB;
1350
+ cCheckBox localCB;
1351
+ cCheckBox crowdCB;
1352
+ cCheckBox smoothCB;
1353
+ cToggleButton fastCB;
1354
+ cCheckBox slowCB;
1355
+ cCheckBox boxCB;
1356
+ cCheckBox zoomBoxCB;
1357
+ cCheckBox freezeCB;
1358
+ //cToggleButton trackCB;
1359
+ cCheckBox trackCB;
1360
+ cCheckBox smoothfocusCB;
6701361 // JCheckBox speakerMocapCB;
671
- JCheckBox speakerCameraCB;
672
- JCheckBox speakerFocusCB;
673
- JCheckBox debugCB;
674
- JCheckBox oeilCB;
675
- JCheckBox lookAtCB;
1362
+ cCheckBox speakerCameraCB;
1363
+ cCheckBox speakerFocusCB;
1364
+ cCheckBox debugCB;
1365
+
1366
+ cCheckBox oeilCB;
1367
+ cCheckBox shadowCB;
1368
+ cCheckBox autokeepCB;
1369
+ cCheckBox lookAtCB;
6761370
6771371 // static int COLOR = 1;
6781372 // static int MATERIAL = 2;
....@@ -680,9 +1374,9 @@
6801374
6811375 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6821376
683
- JCheckBox colorCB;
684
- JCheckBox materialCB;
685
- JCheckBox textureCB;
1377
+ cCheckBox colorCB;
1378
+ cCheckBox materialCB;
1379
+ cCheckBox textureCB;
6861380
6871381 public void itemStateChanged(ItemEvent e)
6881382 {
....@@ -707,10 +1401,10 @@
7071401 dropAttributes |= Object3D.TEXTURE;
7081402 else
7091403 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
1404
+ } else if(e.getSource() == liveCB)
7121405 {
7131406 cameraView.ToggleLive();
1407
+ refreshContents(false);
7141408 }
7151409 else if(e.getSource() == supportCB)
7161410 {
....@@ -746,6 +1440,10 @@
7461440 cameraView.repaint();
7471441 // refreshContents();
7481442 }
1443
+ else if(e.getSource() == zoomBoxCB)
1444
+ {
1445
+ cameraView.ToggleZoomBoxMode();
1446
+ }
7491447 else if(e.getSource() == smoothfocusCB)
7501448 {
7511449 cameraView.ToggleSmoothFocus();
....@@ -771,6 +1469,18 @@
7711469 {
7721470 cameraView.ToggleOeil();
7731471 }
1472
+ else if(e.getSource() == shadowCB)
1473
+ {
1474
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1475
+ }
1476
+ else if(e.getSource() == freezeCB)
1477
+ {
1478
+ Globals.FREEZEONMOVE ^= true;
1479
+ }
1480
+ else if(e.getSource() == autokeepCB)
1481
+ {
1482
+ Globals.REPLACEONMAKE ^= true;
1483
+ }
7741484 else if(e.getSource() == lookAtCB)
7751485 {
7761486 cameraView.ToggleLookAt();
....@@ -787,7 +1497,8 @@
7871497
7881498 /**/
7891499 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
790
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1500
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1501
+ TreePath path = objEditor.jTree.getSelectionPath();
7911502 if ((path == null) || (path.getPathCount() <= 1)) {
7921503 // We can't move the root node or an empty selection
7931504 return;
....@@ -850,8 +1561,6 @@
8501561 }
8511562 }
8521563
853
- String string = (String) object;
854
-
8551564 System.out.println("Transfer = " + object + "; drop : " + target);
8561565 // if( object instanceof java.io.File[])
8571566 // {
....@@ -859,7 +1568,11 @@
8591568 // objEditor.DropFile((java.io.File[]) object, true);
8601569 // return;
8611570 // }
862
- if (string.charAt(0) == '/')
1571
+
1572
+ String string = object.toString();
1573
+
1574
+ // File path for Mac and Windows
1575
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631576 {
8641577 // file(s)
8651578 String[] names = string.split("\n");
....@@ -886,7 +1599,7 @@
8861599
8871600 flashIt = false;
8881601 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1602
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901603 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911604
8921605 if (group.selection.size() == 1)
....@@ -902,23 +1615,33 @@
9021615
9031616 assert target == objEditor.jTree;
9041617 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1618
+ Object3D destinationLeaf;
9051619 try {
906
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1620
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9071621 } catch (Exception e) {
9081622 System.out.println("destinationPath : " + destinationPath);
9091623 return;
9101624 }
9111625
912
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1626
+ for (int i=group.selection.size(); --i>=0;)
9131627 {
1628
+ Object3D child = (Object3D)group.selection.elementAt(i);
1629
+
1630
+ // Cannot move into itself
1631
+ if (child == destinationLeaf)
1632
+ return;
1633
+ }
1634
+
1635
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1636
+// {
9141637 loadClipboard(true);
9151638 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
917
- } else {
918
- loadClipboard(false);
919
- objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
921
- }
1639
+ pasteInto(false, false);
1640
+// } else {
1641
+// loadClipboard(false);
1642
+// objEditor.jTree.setSelectionPath(destinationPath);
1643
+// pasteInto(false, false); // true); // ???
1644
+// }
9221645 }
9231646 public void dropActionChanged(DropTargetDragEvent dtde)
9241647 // Called if the user has modified the current drop gesture
....@@ -1023,83 +1746,107 @@
10231746 {
10241747 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10251748 //heightFieldItem.addActionListener(this);
1026
- gridItem = menu.add(new MenuItem("Grid"));
1027
- gridItem.addActionListener(this);
1028
- rectoidItem = menu.add(new MenuItem("Box"));
1029
- rectoidItem.addActionListener(this);
1030
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1031
- ellipsoidItem.addActionListener(this);
1032
- coneItem = menu.add(new MenuItem("Cone"));
1033
- coneItem.addActionListener(this);
1034
- torusItem = menu.add(new MenuItem("Torus"));
1035
- torusItem.addActionListener(this);
1036
- superItem = menu.add(new MenuItem("Superellipsoid"));
1037
- superItem.addActionListener(this);
1038
- particleItem = menu.add(new MenuItem("Particle system"));
1039
- particleItem.addActionListener(this);
1749
+// gridItem = menu.add(new MenuItem("Grid"));
1750
+// gridItem.addActionListener(this);
1751
+// rectoidItem = menu.add(new MenuItem("Box"));
1752
+// rectoidItem.addActionListener(this);
1753
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1754
+// ellipsoidItem.addActionListener(this);
1755
+// coneItem = menu.add(new MenuItem("Cone"));
1756
+// coneItem.addActionListener(this);
1757
+// torusItem = menu.add(new MenuItem("Torus"));
1758
+// torusItem.addActionListener(this);
1759
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1760
+// superItem.addActionListener(this);
1761
+
1762
+ cameraItem = menu.add(new MenuItem("Camera"));
1763
+ cameraItem.addActionListener(this);
1764
+
1765
+ if (!Globals.ADVANCED)
1766
+ {
1767
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1768
+ kleinItem.addActionListener(this);
1769
+ }
1770
+
1771
+// particleItem = menu.add(new MenuItem("Particle system"));
1772
+// particleItem.addActionListener(this);
1773
+ if (Globals.ADVANCED)
1774
+ {
10401775 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411776 ragdollItem.addActionListener(this);
10421777 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431778 ragdoll2Item.addActionListener(this);
1779
+ }
10441780 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1781
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461782 meshItem.addActionListener(this);
10471783 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481784 // meshGroupItem.addActionListener(this);
1785
+ if (Globals.ADVANCED)
1786
+ {
10491787 springItem = menu.add(new MenuItem("Spring"));
10501788 springItem.addActionListener(this);
10511789 flagItem = menu.add(new MenuItem("Flag"));
10521790 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571791 blobItem = menu.add(new MenuItem("Blob"));
10581792 blobItem.addActionListener(this);
10591793 latheItem = menu.add(new MenuItem("Lathe"));
10601794 latheItem.addActionListener(this);
1061
- lightItem = menu.add(new MenuItem("Light"));
1062
- lightItem.addActionListener(this);
1795
+ }
1796
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1797
+ bezierItem.addActionListener(this);
1798
+// overlayItem = menu.add(new MenuItem("Overlay"));
1799
+// overlayItem.addActionListener(this);
1800
+// lightItem = menu.add(new MenuItem("Light"));
1801
+// lightItem.addActionListener(this);
10631802 menu.add("-");
10641803 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10651804 //superLoopItem.addActionListener(this);
1066
- loopItem = menu.add(new MenuItem("Loop"));
1067
- loopItem.addActionListener(this);
1805
+// loopItem = menu.add(new MenuItem("Loop"));
1806
+// loopItem.addActionListener(this);
10681807 doubleItem = menu.add(new MenuItem("Fork"));
10691808 doubleItem.addActionListener(this);
1809
+ if (Globals.ADVANCED)
1810
+ {
10701811 tripleItem = menu.add(new MenuItem("Trident"));
10711812 tripleItem.addActionListener(this);
1813
+ }
10721814 }
10731815
10741816 void buildToolsMenu(Menu menu)
10751817 {
10761818 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771819 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1820
+ animationItem.setState(Globals.ANIMATION);
1821
+
1822
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1823
+ archiveItem.addActionListener(this);
10791824
10801825 menu.add("-");
10811826 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821827 parseverticesItem.addActionListener(this);
10831828 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841829 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1830
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861831 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891832 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901833 reduceMorphItem.addActionListener(this);
10911834 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921835 reduce34MorphItem.addActionListener(this);
1093
-
1094
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1095
- computeAOItem.addActionListener(this);
10961836 menu.add("-");
1097
-
10981837 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991838 memoryItem.addActionListener(this);
1839
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1840
+ computeAOItem.addActionListener(this);
1841
+
1842
+ if (Globals.ADVANCED)
1843
+ {
1844
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1845
+ mirrorItem.addActionListener(this);
1846
+ menu.add("-");
11001847 menu.add(analyzeItem = new MenuItem("Analyze"));
11011848 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1849
+ menu.add(dumpItem = new MenuItem("Print"));
11031850 dumpItem.addActionListener(this);
11041851 // menu.add(pathItem = new MenuItem("From-to path"));
11051852 // pathItem.addActionListener(this);
....@@ -1108,6 +1855,8 @@
11081855 resetParentItem.addActionListener(this);
11091856 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101857 repairParentItem.addActionListener(this);
1858
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1859
+ repairShadowItem.addActionListener(this);
11111860 menu.add(invariantsItem = new MenuItem("Invariants"));
11121861 invariantsItem.addActionListener(this);
11131862 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1864,7 @@
11151864 menu.add("-");
11161865 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171866 editScriptItem.addActionListener(this);
1867
+ }
11181868 }
11191869
11201870 void ScreenFit()
....@@ -1237,9 +1987,34 @@
12371987 shadow.material = new cMaterial(obj.material);
12381988 shadow.material.diffuse = 0.0001f;
12391989 shadow.material.specular = 0.0001f;
1990
+ //shadow.projectedVertices[1].x = 300;
12401991
12411992 makeSomething(shadow);
12421993 }
1994
+
1995
+ private void ClearUnpinned()
1996
+ {
1997
+ //for (Object3D obj : listUI)
1998
+ for (int i=listUI.size(); --i>=0;)
1999
+ {
2000
+ Object3D obj = listUI.elementAt(i);
2001
+ if (!obj.pinned)
2002
+ {
2003
+ obj.CloseUI();
2004
+ listUI.remove(i);
2005
+ }
2006
+ }
2007
+ }
2008
+
2009
+ private void EditElement(Object3D elem, boolean newWindow)
2010
+ {
2011
+ // if (!(elem instanceof Composite))
2012
+ // newWindow = false;
2013
+ listUI.add(elem);
2014
+ elem.openEditWindow(this, newWindow); //, false);
2015
+ System.out.println("edit : " + elem);
2016
+ elem.editWindow.refreshContents(true); // ? new
2017
+ }
12432018
12442019 /**
12452020 * applyExample
....@@ -1443,9 +2218,9 @@
14432218
14442219 void Overwrite(int mask)
14452220 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2221
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14472222 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
2223
+ Object3D content = Grafreed.clipboard.get(0);
14492224
14502225 if (content instanceof cGroup && ((cGroup)content).transientlink )
14512226 content = ((cGroup)content).get(0);
....@@ -1468,6 +2243,7 @@
14682243 //
14692244 public void actionPerformed(ActionEvent event) // , Object arg)
14702245 {
2246
+ Object source = event.getSource();
14712247 /*
14722248 if (event.getSource() == nameField)
14732249 {
....@@ -1479,11 +2255,11 @@
14792255 }
14802256 else
14812257 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2258
+ if (source == lookAtItem || source == lookFromItem)
14832259 {
14842260 ScreenFit();
14852261 } else
1486
- if (event.getSource() == switchItem)
2262
+ if (source == switchViewItem)
14872263 {
14882264 cVector v1 = new cVector();
14892265 cVector v2 = new cVector();
....@@ -1492,11 +2268,11 @@
14922268 objEditor.cameraView.renderCamera.setAim(v2, v1);
14932269 objEditor.cameraView.repaint();
14942270 } else
1495
- if (event.getSource() == rectoidItem)
2271
+ if (source == rectoidItem || source == boxButton)
14962272 {
14972273 makeSomething(new Box());
14982274 } else
1499
- if (event.getSource() == particleItem)
2275
+ if (source == particleItem || source == particlesButton)
15002276 {
15012277 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15022278 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +2293,9 @@
15172293 applyExample(particleGeom, "SMOKE");
15182294 makeSomething(particleGeom);
15192295 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2296
+ if (source == ragdollItem || source == ragdoll2Item)
15212297 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2298
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15232299
15242300 ragdoll.toParent = LA.newMatrix();
15252301 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +2313,7 @@
15372313 } else
15382314 /*
15392315 */
1540
- if (event.getSource() == heightFieldItem)
2316
+ if (source == heightFieldItem)
15412317 {
15422318 Object3D obj = new Object3D();
15432319
....@@ -1575,27 +2351,31 @@
15752351
15762352 makeSomething(obj);
15772353 } else
1578
- if (event.getSource() == gridItem)
2354
+ if (source == gridItem || source == gridButton)
15792355 {
15802356 makeSomething(new Grid());
15812357 } else
1582
- if (event.getSource() == ellipsoidItem)
2358
+ if (source == ellipsoidItem || source == sphereButton)
15832359 {
15842360 makeSomething(new Sphere());
15852361 } else
1586
- if (event.getSource() == coneItem)
2362
+ if (source == coneItem || source == coneButton)
15872363 {
15882364 makeSomething(new Cone());
15892365 } else
1590
- if (event.getSource() == torusItem)
2366
+ if (source == torusItem || source == torusButton)
15912367 {
15922368 makeSomething(new Torus());
15932369 } else
1594
- if (event.getSource() == superItem)
2370
+ if (source == superItem || source == superButton)
15952371 {
15962372 makeSomething(new Superellipsoid());
15972373 } else
1598
- if (event.getSource() == blobItem)
2374
+ if (source == kleinItem || source == kleinButton)
2375
+ {
2376
+ makeSomething(new Klein());
2377
+ } else
2378
+ if (source == blobItem)
15992379 {
16002380 Blob blob = new Blob();
16012381 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2383,15 @@
16032383 //blob.retile();
16042384 makeSomething(blob);
16052385 } else
1606
- if (event.getSource() == latheItem)
2386
+ if (source == latheItem)
16072387 {
16082388 makeSomething(new Lathe());
16092389 } else
1610
- if (event.getSource() == bezierItem)
2390
+ if (source == bezierItem)
16112391 {
16122392 makeSomething(new BezierSurface());
16132393 } else
1614
- if (event.getSource() == checkerItem)
2394
+ if (source == overlayItem || source == overlayButton)
16152395 {
16162396 /*
16172397 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2406,7 @@
16262406 */
16272407 makeSomething(new Checker());
16282408 } else
1629
- if (event.getSource() == meshItem)
2409
+ if (source == meshItem)
16302410 {
16312411 Object3D itemtomake = new Object3D();
16322412 Object3D child;
....@@ -1647,35 +2427,52 @@
16472427 makeSomething(child);
16482428 }
16492429 } else
1650
- if (event.getSource() == springItem)
2430
+ if (source == springItem)
16512431 {
16522432 cSpring s = new cSpring();
16532433 s.setup();
16542434 makeSomething(s);
16552435 } else
1656
- if (event.getSource() == flagItem)
2436
+ if (source == flagItem)
16572437 {
16582438 cSpring s = new cFlag();
16592439 s.setup();
16602440 makeSomething(s);
16612441 } else
1662
- if (event.getSource() == lightItem)
2442
+ if (source == lightItem || source == lightButton)
16632443 {
16642444 makeSomething(new Light());
16652445 } else
1666
- if (event.getSource() == csgItem)
2446
+// if (source == skybox1Button ||
2447
+// source == skybox2Button ||
2448
+// source == skybox3Button ||
2449
+// source == skybox4Button ||
2450
+// source == skybox5Button ||
2451
+// source == skybox6Button ||
2452
+// source == skybox7Button ||
2453
+// source == skybox11Button ||
2454
+// source == skybox12Button ||
2455
+// source == skybox13Button ||
2456
+// source == skybox14Button ||
2457
+// source == skybox15Button ||
2458
+// source == skybox16Button ||
2459
+// source == skybox17Button)
2460
+// {
2461
+// ChangeSkybox(source);
2462
+// } else
2463
+ if (source == csgItem)
16672464 {
16682465 group(new CSG());
16692466 } else
1670
- if (event.getSource() == templateItem)
2467
+ if (source == templateItem)
16712468 {
16722469 group(new cTemplate());
16732470 } else
1674
- if (event.getSource() == attributeItem)
2471
+ if (source == attributeItem)
16752472 {
16762473 makeSomething(new Attribute());
16772474 } else
1678
- if (event.getSource() == pointflowItem)
2475
+ if (source == pointflowItem)
16792476 {
16802477 makeSomething(new PointFlow());
16812478 } else
....@@ -1687,7 +2484,7 @@
16872484 } else
16882485 */
16892486
1690
- if (event.getSource() == superLoopItem)
2487
+ if (source == superLoopItem)
16912488 {
16922489 Composite g = new cGroup();
16932490 for (int i=0; i<15; i++)
....@@ -1709,30 +2506,30 @@
17092506
17102507 group(g);
17112508 } else
1712
- if (event.getSource() == loopItem)
2509
+ if (source == loopItem || source == loopButton)
17132510 {
17142511 Composite csg = new GroupLeaf();
17152512 csg.count = 5;
17162513 group(csg);
1717
- Composite child = new cGroup();
2514
+ Composite child = new cGroup("Branch");
17182515 csg.addChild(child);
17192516 child.addChild(csg);
17202517 } else
1721
- if (event.getSource() == doubleItem)
2518
+ if (source == doubleItem)
17222519 {
1723
- Composite csg = new GroupLeaf();
2520
+ Composite csg = new GroupLeaf("Fork");
17242521 csg.count = 5;
17252522 group(csg);
1726
- Composite child = new cGroup();
2523
+ Composite child = new cGroup("Branch A");
17272524 csg.addChild(child);
17282525 child.addChild(csg);
1729
- child = new cGroup();
2526
+ child = new cGroup("Branch B");
17302527 csg.addChild(child);
17312528 child.addChild(csg);
17322529 } else
1733
- if (event.getSource() == tripleItem)
2530
+ if (source == tripleItem)
17342531 {
1735
- Composite csg = new GroupLeaf();
2532
+ Composite csg = new GroupLeaf("Trident");
17362533 csg.count = 4;
17372534 group(csg);
17382535 Composite child = new cGroup();
....@@ -1745,73 +2542,98 @@
17452542 csg.addChild(child);
17462543 child.addChild(csg);
17472544 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2545
+ if (source == computeAOItem)
17502546 {
1751
- ImportGFD();
2547
+ Globals.drawMode = CameraPane.OCCLUSION;
2548
+ cameraView.repaint();
17522549 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
2550
+ if (source == recompileItem)
17712551 {
17722552 Recompile();
17732553 refreshContents();
17742554 } else
1775
- if (event.getSource() == editScriptItem)
2555
+ if (source == editScriptItem)
17762556 {
17772557 OpenDialog();
17782558 refreshContents();
17792559 } else
1780
- if (event.getSource() == invariantsItem)
2560
+ if (source == invariantsItem)
17812561 {
17822562 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2563
+ Grafreed.grafreeD.universe.invariants();
17842564 } else
1785
- if (event.getSource() == memoryItem)
2565
+ if (source == memoryItem)
17862566 {
17872567 //System.out.println("Invariants:");
17882568 PrintMemory();
17892569 } else
1790
- if (event.getSource() == pathItem)
2570
+ if (source == pathItem)
17912571 {
17922572 PrintPath();
17932573 } else
1794
- if (event.getSource() == analyzeItem)
2574
+ if (source == analyzeItem)
17952575 {
17962576 AnalyzeObject();
17972577 } else
1798
- if (event.getSource() == dumpItem)
2578
+ if (source == dumpItem)
17992579 {
18002580 DumpObject();
18012581 } else
1802
- if (event.getSource() == screenfitButton)
2582
+ if (source == minButton)
18032583 {
1804
- //Reload(lastConverter, lastFilename, true);
2584
+ Minimize();
2585
+ } else
2586
+ if (source == maxButton)
2587
+ {
2588
+ Maximize();
2589
+ } else
2590
+ if (source == fullButton)
2591
+ {
2592
+ ToggleFullScreen();
2593
+ } else
2594
+ if (source == undoButton)
2595
+ {
2596
+ // Go to previous version
2597
+ //if (!Undo())
2598
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2599
+ Undo();
2600
+ } else
2601
+ if (source == restoreButton)
2602
+ {
2603
+ // Restore current version
2604
+ Restore();
2605
+ } else
2606
+ if (source == replaceButton)
2607
+ {
2608
+ // Overwrite current version
2609
+ Replace();
2610
+ } else
2611
+ if (source == redoButton)
2612
+ {
2613
+ // Go to next version
2614
+ Redo();
2615
+ } else
2616
+ if (source == saveButton)
2617
+ {
2618
+ // Save a new version
2619
+ if (!Save(true))
2620
+ java.awt.Toolkit.getDefaultToolkit().beep();
2621
+ } else
2622
+ if (source == oneStepButton)
2623
+ {
2624
+ Globals.ONESTEP = true;
2625
+ cameraView.repaint();
2626
+ } else
2627
+ if (source == screenfitButton)
2628
+ {
18052629 ScreenFit();
18062630 } else
1807
- if (event.getSource() == screenfitpointButton)
2631
+ if (source == screenfitpointButton)
18082632 {
1809
- //Reload(lastConverter, lastFilename, true);
18102633 ScreenFitPoint();
18112634 } else
1812
- if (event.getSource() == snapobjectButton)
2635
+ if (source == snapobjectButton)
18132636 {
1814
- //Reload(lastConverter, lastFilename, true);
18152637 SnapObject();
18162638 } else
18172639 // if (event.getSource() == recompileButton)
....@@ -1820,13 +2642,13 @@
18202642 // Recompile();
18212643 // refreshContents();
18222644 // } else
1823
- if (event.getSource() == gcButton)
2645
+ if (source == gcButton)
18242646 {
18252647 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262648 System.gc();
18272649 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282650 } else
1829
- if (event.getSource() == editLeafItem)
2651
+ if (source == editLeafItem)
18302652 {
18312653 Object3D obj;
18322654 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2662,74 @@
18402662 }
18412663 refreshContents(true);
18422664 } else
1843
- if (event.getSource() == openWindowItem)
2665
+ if (source == openWindowItem)
18442666 {
18452667 EditSelection(true);
18462668 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2669
+ if (source == cutItem || source == clearButton)
18482670 {
18492671 loadClipboard(true);
18502672 } else
1851
- if (event.getSource() == duplicateItem)
2673
+ if (source == undoItem)
18522674 {
1853
- Object3D keep = GrafreeD.clipboard;
2675
+ Undo();
2676
+ } else
2677
+ if (source == redoItem)
2678
+ {
2679
+ Redo();
2680
+ } else
2681
+ if (source == duplicateItem)
2682
+ {
2683
+ Object3D keep = Grafreed.clipboard;
18542684 loadClipboard(false);
18552685 paste(false);
1856
- GrafreeD.clipboard = keep;
2686
+ Grafreed.clipboard = keep;
18572687 } else
1858
- if (event.getSource() == cloneItem)
2688
+ if (source == cloneItem)
18592689 {
18602690 CloneSelection(false);
18612691 } else
1862
- if (event.getSource() == cloneSupportItem)
2692
+ if (source == cloneSupportItem)
18632693 {
18642694 CloneSelection(true);
18652695 } else
1866
- if (event.getSource() == copyItem)
2696
+ if (source == copyItem)
18672697 {
18682698 loadClipboard(false);
18692699 } else
1870
- if (event.getSource() == pasteItem)
2700
+ if (source == pasteItem)
18712701 {
18722702 paste(false);
18732703 } else
1874
- if (event.getSource() == pasteLinkItem)
2704
+ if (source == pasteIntoItem)
18752705 {
1876
- pasteInto(false);
2706
+ pasteInto(true, false);
18772707 } else
1878
- if (event.getSource() == pasteCloneItem)
2708
+ if (source == pasteLinkItem)
18792709 {
1880
- pasteInto(true);
2710
+ pasteInto(false, false);
18812711 } else
1882
- if (event.getSource() == pasteExpandItem)
2712
+ if (source == pasteCloneItem)
2713
+ {
2714
+ pasteInto(true, true);
2715
+ } else
2716
+ if (source == pasteExpandItem)
18832717 {
18842718 paste(true);
18852719 } else
1886
- if (event.getSource() == synchronizeItem)
2720
+ if (source == synchronizeItem)
18872721 {
18882722 Overwrite(Object3D.TRANSFORM);
18892723 } else
1890
- if (event.getSource() == overwriteNameItem)
2724
+ if (source == overwriteNameItem)
18912725 {
18922726 Overwrite(Object3D.NAME);
18932727 } else
1894
- if (event.getSource() == overwriteUVItem)
2728
+ if (source == overwriteUVItem)
18952729 {
18962730 Overwrite(Object3D.UV);
18972731 } else
1898
- if (event.getSource() == overwriteMatItem)
2732
+ if (source == overwriteMatItem)
18992733 {
19002734 /* july 2015
19012735 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2749,7 @@
19152749
19162750 Overwrite(dropAttributes);
19172751 }
1918
- if (event.getSource() == overwriteGeoItem)
2752
+ if (source == overwriteGeoItem)
19192753 {
19202754 Overwrite(Object3D.GEOMETRY);
19212755 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2766,7 @@
19322766 // refreshContents();
19332767 // }
19342768 } else
1935
- if (event.getSource() == generateMeshItem)
2769
+ if (source == generateMeshItem)
19362770 {
19372771 //if (group.selection.size() == 1)
19382772 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2777,7 @@
19432777 ResetModel();
19442778 refreshContents();
19452779 } else
1946
- if (event.getSource() == extractGeometriesItem)
2780
+ if (source == extractGeometriesItem)
19472781 {
19482782 boolean one = false;
19492783
....@@ -1970,7 +2804,7 @@
19702804 ResetModel();
19712805 refreshContents();
19722806 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2807
+ if (source == cloneGeometriesItem)
19742808 {
19752809 boolean one = false;
19762810
....@@ -1996,32 +2830,37 @@
19962830 ResetModel();
19972831 refreshContents();
19982832 } else
1999
- if (event.getSource() == shareGeometriesItem)
2833
+ if (source == shareGeometriesItem)
20002834 {
20012835 boolean one = false;
20022836
20032837 if (group.selection.size() == 1)
20042838 one = true;
20052839
2840
+ Object3D merge = null;
2841
+
20062842 Object3D content = new cGroup();
20072843
20082844 for (int i=0; i<group.selection.size(); i++)
20092845 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2846
+ merge = new Merge(group.selection.get(i));
20112847
20122848 if (one)
2013
- makeSomething(sel, false);
2849
+ makeSomething(merge, false);
20142850 else
2015
- content.addChild(sel);
2851
+ content.addChild(merge);
20162852 }
20172853
20182854 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2855
+ makeSomething(content, true);
2856
+ else
2857
+ {
2858
+ ResetModel();
2859
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2860
+ refreshContents();
2861
+ }
20232862 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2863
+ if (source == mergeGeometriesItem)
20252864 {
20262865 boolean one = false;
20272866
....@@ -2051,7 +2890,7 @@
20512890 ResetModel();
20522891 refreshContents();
20532892 } else
2054
- if (event.getSource() == linkverticesItem)
2893
+ if (source == linkverticesItem)
20552894 {
20562895 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572896 // {
....@@ -2064,39 +2903,48 @@
20642903 // group.selection.get(0).setMasterThis(content); // should be identity
20652904 // refreshContents();
20662905 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2906
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682907 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2908
+ Object3D content = Grafreed.clipboard.get(0);
20702909
20712910 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722911 content = ((cGroup)content).get(0);
20732912
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2913
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752914 for (int i=0; i<group.selection.size(); i++)
20762915 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2916
+ boolean random = CameraPane.SWITCH;
2917
+ CameraPane.SWITCH = false; // parse all random nodes
20792918 group.selection.get(i).linkVerticesThis(content);
20802919 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2920
+ CameraPane.SWITCH = random;
20822921 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2922
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842923 refreshContents();
20852924 }
20862925 } else
2087
- if (event.getSource() == resetsupportItem)
2926
+ if (source == resetsupportItem)
20882927 {
20892928 for (int i=0; i<group.selection.size(); i++)
20902929 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2930
+ boolean random = CameraPane.SWITCH;
2931
+ CameraPane.SWITCH = false; // parse all random nodes
20932932 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2933
+ CameraPane.SWITCH = random;
20952934 }
20962935
20972936 refreshContents();
20982937 } else
2099
- if (event.getSource() == resetreferencesItem)
2938
+ if (source == relinkverticesItem)
2939
+ {
2940
+ boolean random = CameraPane.SWITCH;
2941
+ CameraPane.SWITCH = false; // parse all random nodes
2942
+ group.selection.RelinkToSupport();
2943
+ CameraPane.SWITCH = random;
2944
+
2945
+ refreshContents();
2946
+ } else
2947
+ if (source == resetreferencesItem)
21002948 {
21012949 for (int i=0; i<group.selection.size(); i++)
21022950 {
....@@ -2105,11 +2953,11 @@
21052953
21062954 refreshContents();
21072955 } else
2108
- if (event.getSource() == setMasterItem)
2956
+ if (source == setMasterItem)
21092957 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2958
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112959 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2960
+ Object3D content = Grafreed.clipboard.get(0);
21132961
21142962 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152963 content = ((cGroup)content).get(0);
....@@ -2118,13 +2966,13 @@
21182966 refreshContents();
21192967 }
21202968 } else
2121
- if (event.getSource() == poseMeshItem)
2969
+ if (source == poseMeshItem)
21222970 {
21232971 if (group.selection.size() == 1)
21242972 {
2125
- if (GrafreeD.clipboard.size() == 1)
2973
+ if (Grafreed.clipboard.size() == 1)
21262974 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2975
+ Object3D content = Grafreed.clipboard.get(0);
21282976
21292977 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302978 content = ((cGroup)content).get(0);
....@@ -2137,19 +2985,19 @@
21372985 }
21382986
21392987 } else
2140
- if (event.getSource() == revertMeshItem)
2988
+ if (source == revertMeshItem)
21412989 {
21422990 RevertMeshes();
21432991 } else
2144
- if (event.getSource() == resetMeshItem)
2992
+ if (source == resetAllItem)
21452993 {
21462994 ResetAll();
21472995 } else
2148
- if (event.getSource() == stepAllItem)
2996
+ if (source == stepAllItem)
21492997 {
21502998 StepAll();
21512999 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3000
+ if (source == deleteItem) // || event.getSource() == clearButton)
21533001 {
21543002 //int indices[] = jList.getSelectedIndices();
21553003 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +3005,46 @@
21573005
21583006 ClearSelection(false);
21593007 } else
2160
- if (event.getSource() == clearAllItem)
3008
+ if (source == clearAllItem)
21613009 {
21623010 ClearSelection(true);
21633011 } else
2164
- if (event.getSource() == grabItem)
3012
+ if (source == grabItem || source == groupButton)
21653013 {
2166
- group(new cGroup(), true);
3014
+ group(new cGroup(), false); // true);
21673015 } else
2168
- if (event.getSource() == frontItem)
3016
+ if (source == hideItem)
3017
+ {
3018
+ group(new HiddenObject());
3019
+ } else
3020
+ if (source == frontItem)
21693021 {
21703022 front();
21713023 } else
2172
- if (event.getSource() == backItem)
3024
+ if (source == backItem)
21733025 {
21743026 back();
21753027 } else
2176
- if (event.getSource() == cameraItem)
3028
+ if (source == cameraItem)
21773029 {
21783030 makeSomething(new Camera());
21793031 } else
2180
- if (event.getSource() == compositeItem)
3032
+ if (source == compositeItem || source == compositeButton)
21813033 {
21823034 group(new Composite());
21833035 } else
2184
- if (event.getSource() == randomItem)
3036
+ if (source == switchItem || source == switchButton)
21853037 {
21863038 RandomNode random = new RandomNode();
21873039 group(random);
21883040 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
3041
+ random.name = random.get(0).name + "Switch";
21903042 } else
2191
- if (event.getSource() == physicsItem)
3043
+ if (source == physicsItem)
21923044 {
21933045 group(new PhysicsNode());
21943046 } else
2195
- if (event.getSource() == frameselectorItem)
3047
+ if (source == frameselectorItem)
21963048 {
21973049 for (int i=0; i<group.selection.size(); i++)
21983050 {
....@@ -2204,7 +3056,7 @@
22043056 ResetModel();
22053057 refreshContents();
22063058 } else
2207
- if (event.getSource() == switchGeoItem)
3059
+ if (source == switchGeoItem)
22083060 {
22093061 for (int i=0; i<group.selection.size(); i++)
22103062 {
....@@ -2216,7 +3068,7 @@
22163068 ResetModel();
22173069 refreshContents();
22183070 } else
2219
- if (event.getSource() == switchTransfoItem)
3071
+ if (source == switchTransfoItem)
22203072 {
22213073 for (int i=0; i<group.selection.size(); i++)
22223074 {
....@@ -2228,7 +3080,7 @@
22283080 ResetModel();
22293081 refreshContents();
22303082 } else
2231
- if (event.getSource() == morphItem)
3083
+ if (source == morphItem)
22323084 {
22333085 for (int i=0; i<group.selection.size(); i++)
22343086 {
....@@ -2240,7 +3092,7 @@
22403092 ResetModel();
22413093 refreshContents();
22423094 } else
2243
- if (event.getSource() == scriptNodeItem)
3095
+ if (source == scriptNodeItem)
22443096 {
22453097 boolean atleastone = false;
22463098
....@@ -2279,199 +3131,252 @@
22793131 }
22803132 }
22813133 } else
2282
- if (event.getSource() == linkerItem)
3134
+ if (source == linkerItem)
22833135 {
22843136 group(new cLinker());
22853137 } else
2286
- if (event.getSource() == textureItem)
3138
+ if (source == textureItem || source == textureButton)
22873139 {
22883140 group(new TextureNode());
22893141 } else
2290
- if (event.getSource() == shadowXItem)
3142
+ if (source == billboardItem)
3143
+ {
3144
+ group(new BillboardNode());
3145
+ } else
3146
+ if (source == shadowXItem)
22913147 {
22923148 CastShadow(0);
22933149 } else
2294
- if (event.getSource() == shadowYItem)
3150
+ if (source == shadowYItem)
22953151 {
22963152 CastShadow(1);
22973153 } else
2298
- if (event.getSource() == shadowZItem)
3154
+ if (source == shadowZItem)
22993155 {
23003156 CastShadow(2);
23013157 } else
2302
- if (event.getSource() == ungroupItem)
3158
+ if (source == ungroupItem || source == ungroupButton)
23033159 {
2304
- ungroup();
3160
+ boolean hasRoot = false;
3161
+
3162
+ for (int i=0; i<group.selection.size(); i++)
3163
+ {
3164
+ if (group.selection.get(i) == group)
3165
+ {
3166
+ hasRoot = true;
3167
+ break;
3168
+ }
3169
+ }
3170
+
3171
+ if (!hasRoot)
3172
+ {
3173
+ for (int i=0; i<group.selection.size(); i++)
3174
+ {
3175
+ Ungroup(group.selection.get(i));
3176
+ }
3177
+
3178
+ ClearSelection(false);
3179
+
3180
+ refreshContents();
3181
+ }
23053182 } else
2306
- if (event.getSource() == genUVItem)
3183
+ if (source == genUVItem)
23073184 {
23083185 GenUV();
23093186 } else
2310
- if (event.getSource() == genNormalsCADItem)
3187
+ if (source == genNormalsCADItem)
23113188 {
23123189 GenNormals(true);
23133190 } else
2314
- if (event.getSource() == genNormalsMESHItem)
3191
+ if (source == genNormalsMESHItem)
23153192 {
2316
- GenNormals(true); // TODO
3193
+ GenNormalsMESH();
23173194 } else
2318
- if (event.getSource() == genNormalsORGANItem)
3195
+ if (source == genNormalsORGANItem)
23193196 {
23203197 GenNormals(false);
23213198 } else
2322
- if (event.getSource() == stripifyItem)
3199
+ if (source == genNormalsMINEItem)
3200
+ {
3201
+ GenNormalsMINE();
3202
+ } else
3203
+ if (source == stripifyItem)
23233204 {
23243205 Stripify();
23253206 } else
2326
- if (event.getSource() == unstripifyItem)
3207
+ if (source == unstripifyItem)
23273208 {
23283209 Unstripify();
23293210 } else
2330
- if (event.getSource() == trimItem)
3211
+ if (source == trimItem)
23313212 {
23323213 Trim();
23333214 } else
2334
- if (event.getSource() == untrimItem)
3215
+ if (source == untrimItem)
23353216 {
23363217 Untrim();
23373218 } else
2338
- if (event.getSource() == clearColorsItem)
3219
+ if (source == clearColorsItem)
23393220 {
23403221 ClearColors();
23413222 } else
2342
- if (event.getSource() == clearMaterialsItem)
3223
+ if (source == clearMaterialsItem)
23433224 {
23443225 ClearMaterials();
23453226 } else
2346
- if (event.getSource() == liveleavesItem)
3227
+ if (source == liveleavesItem)
23473228 {
23483229 LiveLeaves(true);
23493230 } else
2350
- if (event.getSource() == unliveleavesItem)
3231
+ if (source == unliveleavesItem)
23513232 {
23523233 LiveLeaves(false);
23533234 } else
2354
- if (event.getSource() == supportleavesItem)
3235
+ if (source == supportleavesItem)
23553236 {
23563237 SupportLeaves(true);
23573238 } else
2358
- if (event.getSource() == unsupportleavesItem)
3239
+ if (source == unsupportleavesItem)
23593240 {
23603241 SupportLeaves(false);
23613242 } else
2362
- if (event.getSource() == hideleavesItem)
3243
+ if (source == hideleavesItem)
23633244 {
23643245 HideLeaves(true);
23653246 } else
2366
- if (event.getSource() == showleavesItem)
3247
+ if (source == showleavesItem)
23673248 {
23683249 HideLeaves(false);
23693250 } else
2370
- if (event.getSource() == markleavesItem)
3251
+ if (source == markleavesItem)
23713252 {
23723253 MarkLeaves(true);
23733254 } else
2374
- if (event.getSource() == unmarkleavesItem)
3255
+ if (source == unmarkleavesItem)
23753256 {
23763257 MarkLeaves(false);
23773258 } else
2378
- if (event.getSource() == flipVItem)
3259
+ if (source == rewindleavesItem)
3260
+ {
3261
+ RewindLeaves(true);
3262
+ } else
3263
+ if (source == unrewindleavesItem)
3264
+ {
3265
+ RewindLeaves(false);
3266
+ } else
3267
+ if (source == randomleavesItem)
3268
+ {
3269
+ RandomLeaves(true);
3270
+ } else
3271
+ if (source == unrandomleavesItem)
3272
+ {
3273
+ RandomLeaves(false);
3274
+ } else
3275
+ if (source == flipVItem)
23793276 {
23803277 FlipV(true);
23813278 } else
2382
- if (event.getSource() == unflipVItem)
3279
+ if (source == unflipVItem)
23833280 {
23843281 FlipV(false);
23853282 } else
2386
- if (event.getSource() == lowTexturesItem)
3283
+ if (source == lowTexturesItem)
23873284 {
23883285 SetTexRes(0);
23893286 } else
2390
- if (event.getSource() == normalTexturesItem)
3287
+ if (source == normalTexturesItem)
23913288 {
23923289 SetTexRes(1);
23933290 } else
2394
- if (event.getSource() == highTexturesItem)
3291
+ if (source == highTexturesItem)
23953292 {
23963293 SetTexRes(2);
23973294 } else
2398
- if (event.getSource() == veryhighTexturesItem)
3295
+ if (source == veryhighTexturesItem)
23993296 {
24003297 SetTexRes(3);
24013298 } else
2402
- if (event.getSource() == maxTexturesItem)
3299
+ if (source == maxTexturesItem)
24033300 {
24043301 SetTexRes(4);
24053302 } else
2406
- if (event.getSource() == panoTexturesItem)
3303
+ if (source == panoTexturesItem)
24073304 {
24083305 SetTexRes(5);
24093306 } else
2410
- if (event.getSource() == reverseNormalsItem)
3307
+ if (source == reverseNormalsItem)
24113308 {
24123309 ReverseNormals();
24133310 } else
2414
- if (event.getSource() == parseverticesItem)
3311
+ if (source == parseverticesItem)
24153312 {
24163313 ParseVertices();
24173314 } else
2418
- if (event.getSource() == textureFieldItem)
3315
+ if (source == textureFieldItem)
24193316 {
24203317 TextureVertices();
24213318 } else
2422
- if (event.getSource() == alignItem)
3319
+ if (source == alignItem)
24233320 {
24243321 Align();
24253322 } else
2426
- if (event.getSource() == mirrorItem)
3323
+ if (source == mirrorItem)
24273324 {
24283325 MirrorPoses();
24293326 } else
2430
- if (event.getSource() == reduceMorphItem)
3327
+ if (source == reduceMorphItem)
24313328 {
24323329 MeshReduction(false);
24333330 } else
2434
- if (event.getSource() == reduce34MorphItem)
3331
+ if (source == reduce34MorphItem)
24353332 {
24363333 MeshReduction(true);
24373334 } else
2438
- if (event.getSource() == reverseTrianglesItem)
3335
+ if (source == reverseTrianglesItem)
24393336 {
24403337 ReverseTriangles();
24413338 } else
2442
- if (event.getSource() == reduceMeshItem)
3339
+ if (source == reduceMeshItem)
24433340 {
24443341 ReduceMesh(false);
24453342 } else
2446
- if (event.getSource() == reduce34MeshItem)
3343
+ if (source == reduce34MeshItem)
24473344 {
24483345 ReduceMesh(true);
24493346 } else
2450
- if (event.getSource() == increaseMeshItem)
3347
+ if (source == increaseMeshItem)
24513348 {
24523349 IncreaseMesh();
24533350 } else
2454
- if (event.getSource() == clipMeshItem)
3351
+ if (source == clipMeshItem)
24553352 {
24563353 ClipMesh();
24573354 } else
2458
- if (event.getSource() == smoothMeshItem)
3355
+ if (source == smoothMeshItem)
24593356 {
24603357 SmoothMesh();
24613358 } else
2462
- if (event.getSource() == transformgeometryItem)
3359
+ if (source == transformGeometryItem)
24633360 {
24643361 TransformGeometry();
24653362 } else
2466
- if (event.getSource() == resetTransformItem)
3363
+ if (source == transformChildrenItem)
3364
+ {
3365
+ TransformChildren();
3366
+ } else
3367
+ if (source == resetTransformItem)
24673368 {
24683369 ResetTransform();
24693370 } else
2470
- if (event.getSource() == resetCentroidItem)
3371
+ if (source == resetCentroidItem)
24713372 {
2472
- ResetCentroid();
3373
+ ResetCentroid(true);
24733374 } else
2474
- if (event.getSource() == resetParentItem)
3375
+ if (source == resetCentroidXZItem)
3376
+ {
3377
+ ResetCentroid(false);
3378
+ } else
3379
+ if (source == resetParentItem)
24753380 {
24763381 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773382 {
....@@ -2481,7 +3386,7 @@
24813386
24823387 refreshContents();
24833388 } else
2484
- if (event.getSource() == repairParentItem)
3389
+ if (source == repairParentItem)
24853390 {
24863391 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873392 {
....@@ -2495,7 +3400,21 @@
24953400
24963401 refreshContents();
24973402 } else
2498
- if (event.getSource() == sortbysizeItem)
3403
+ if (source == repairShadowItem)
3404
+ {
3405
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3406
+ {
3407
+ Object3D obj = (Object3D)e.nextElement();
3408
+ obj.RepairShadow();
3409
+// for (int i=0; i<obj.size(); i++)
3410
+// {
3411
+// obj.get(i).parent = obj;
3412
+// }
3413
+ }
3414
+
3415
+ refreshContents();
3416
+ } else
3417
+ if (source == sortbysizeItem)
24993418 {
25003419 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013420 {
....@@ -2507,7 +3426,7 @@
25073426 ResetModel();
25083427 refreshContents();
25093428 } else
2510
- if (event.getSource() == sortbynameItem)
3429
+ if (source == sortbynameItem)
25113430 {
25123431 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133432 {
....@@ -2519,7 +3438,7 @@
25193438 ResetModel();
25203439 refreshContents();
25213440 } else
2522
- if (event.getSource() == attachPigmentItem)
3441
+ if (source == attachPigmentItem)
25233442 {
25243443 String texture = GetFile("Attach pigment");
25253444 Object3D obj;
....@@ -2531,7 +3450,7 @@
25313450
25323451 refreshContents();
25333452 } else
2534
- if (event.getSource() == detachPigmentItem)
3453
+ if (source == detachPigmentItem)
25353454 {
25363455 Object3D obj;
25373456 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3461,7 @@
25423461
25433462 refreshContents();
25443463 } else
2545
- if (event.getSource() == attachBumpItem)
3464
+ if (source == attachBumpItem)
25463465 {
25473466 String texture = GetFile("Attach bump");
25483467 Object3D obj;
....@@ -2554,18 +3473,18 @@
25543473
25553474 refreshContents();
25563475 } else
2557
- if (event.getSource() == detachBumpItem)
3476
+ if (source == detachBumpItem)
25583477 {
25593478 Object3D obj;
25603479 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25613480 {
25623481 obj = (Object3D)e.nextElement();
2563
- obj.SetBumpTexture(null);
3482
+ obj.ResetBumpTexture();
25643483 }
25653484
25663485 refreshContents();
25673486 } else
2568
- if (event.getSource() == pigmentBumpItem)
3487
+ if (source == pigmentBumpItem)
25693488 {
25703489 Object3D obj;
25713490 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3495,262 @@
25763495
25773496 refreshContents();
25783497 } else
2579
- if (event.getSource() == flashSelectionButton)
3498
+ if (source == embedTexturesItem)
3499
+ {
3500
+ Object3D obj;
3501
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3502
+ {
3503
+ obj = (Object3D)e.nextElement();
3504
+ obj.EmbedTextures(true);
3505
+ }
3506
+
3507
+ refreshContents();
3508
+ } else
3509
+ if (source == deEmbedTexturesItem)
3510
+ {
3511
+ Object3D obj;
3512
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3513
+ {
3514
+ obj = (Object3D)e.nextElement();
3515
+ obj.EmbedTextures(false);
3516
+ }
3517
+
3518
+ CameraPane.texturepigment.clear();
3519
+ CameraPane.texturebump.clear();
3520
+
3521
+ refreshContents();
3522
+ } else
3523
+ if (source == flashSelectionButton)
25803524 {
25813525 CameraPane.flash = true;
25823526 refreshContents();
25833527 } else
2584
- if (event.getSource() == oneButton)
3528
+ if (source == oneButton)
25853529 {
25863530 } else
2587
- if (event.getSource() == twoButton)
3531
+ if (source == twoButton)
25883532 {
25893533 radio.layout = twoButton;
3534
+
3535
+ if (CameraPane.FULLSCREEN)
3536
+ fullscreenLayout = radio.layout;
3537
+
25903538 // bug
25913539 //gridPanel.setDividerLocation(1.0);
25923540 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
3541
+// bigThree.remove(scenePanel);
3542
+// bigThree.remove(centralPanel);
3543
+// bigThree.remove(XYZPanel);
3544
+// aWindowConstraints.gridx = 0;
3545
+// aWindowConstraints.gridy = 0;
3546
+// aWindowConstraints.gridwidth = 1;
3547
+// // aConstraints.gridheight = 3;
3548
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3549
+// aWindowConstraints.weightx = 0;
3550
+// aWindowConstraints.weighty = 1;
3551
+// //bigThree.add(jtp, aWindowConstraints);
3552
+// aWindowConstraints.weightx = 1;
3553
+// aWindowConstraints.gridwidth = 3;
3554
+// // aConstraints.gridheight = 3;
3555
+// aWindowConstraints.gridx = 1;
3556
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3557
+// bigThree.add(centralPanel, aWindowConstraints);
3558
+// aWindowConstraints.weightx = 0;
3559
+// aWindowConstraints.gridx = 4;
3560
+// aWindowConstraints.gridwidth = 1;
3561
+// // aConstraints.gridheight = 3;
3562
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3563
+// //bigThree.add(XYZPanel, aWindowConstraints);
3564
+// scenePanel.setVisible(false);
3565
+// centralPanel.setVisible(true);
3566
+// XYZPanel.setVisible(false);
3567
+ bigThree.ClearUI();
3568
+ bigThree.add(centralPanel);
3569
+ bigThree.FlushUI();
3570
+
3571
+ cameraView.requestFocusInWindow();
3572
+
3573
+// refreshContents(true);
3574
+//
3575
+// try
3576
+// {
3577
+// java.awt.Robot bot = new java.awt.Robot();
3578
+// int mask = InputEvent.BUTTON1_MASK;
3579
+// bot.mouseMove(100, 100);
3580
+// bot.mousePress(mask);
3581
+// bot.mouseRelease(mask);
3582
+// }
3583
+// catch (Exception e)
3584
+// {
3585
+//
3586
+// }
3587
+
26173588 } else
2618
- if (event.getSource() == threeButton)
3589
+ if (source == threeButton)
26193590 {
26203591 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
3592
+
3593
+ if (CameraPane.FULLSCREEN)
3594
+ fullscreenLayout = radio.layout;
3595
+
3596
+// bigThree.remove(scenePanel);
3597
+// bigThree.remove(centralPanel);
3598
+// bigThree.remove(XYZPanel);
3599
+// aWindowConstraints.gridx = 0;
3600
+// aWindowConstraints.gridy = 0;
3601
+// aWindowConstraints.gridwidth = 1;
3602
+// // aConstraints.gridheight = 3;
3603
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3604
+// aWindowConstraints.weightx = 0;
3605
+// aWindowConstraints.weighty = 1;
3606
+// //bigThree.add(jtp, aWindowConstraints);
3607
+// aWindowConstraints.weightx = 1;
3608
+// aWindowConstraints.gridwidth = 3;
3609
+// // aConstraints.gridheight = 3;
3610
+// aWindowConstraints.gridx = 1;
3611
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3612
+// bigThree.add(centralPanel, aWindowConstraints);
3613
+// aWindowConstraints.weightx = 0;
3614
+// aWindowConstraints.gridx = 4;
3615
+// aWindowConstraints.gridwidth = 1;
3616
+// // aConstraints.gridheight = 3;
3617
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3618
+// bigThree.add(XYZPanel, aWindowConstraints);
3619
+// bigThree.validate();
3620
+// scenePanel.setVisible(false);
3621
+// centralPanel.setVisible(true);
3622
+// XYZPanel.setVisible(true);
3623
+ bigThree.ClearUI();
3624
+ bigThree.add(scenePanel);
3625
+ bigThree.add(centralPanel);
3626
+ bigThree.FlushUI();
3627
+
3628
+ cameraView.requestFocusInWindow();
26453629 } else
2646
- if (event.getSource() == fourButton)
3630
+ if (source == fourButton)
26473631 {
26483632 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
3633
+
3634
+ if (CameraPane.FULLSCREEN)
3635
+ fullscreenLayout = radio.layout;
3636
+
3637
+// bigThree.remove(scenePanel);
3638
+// bigThree.remove(centralPanel);
3639
+// bigThree.remove(XYZPanel);
3640
+// aWindowConstraints.gridx = 0;
3641
+// aWindowConstraints.gridy = 0;
3642
+// aWindowConstraints.gridwidth = 1;
3643
+// // aWindowConstraints.gridheight = 3;
3644
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3645
+// aWindowConstraints.weightx = 1;
3646
+// aWindowConstraints.weighty = 1;
3647
+// bigThree.add(scenePanel, aWindowConstraints);
3648
+// aWindowConstraints.weightx = 1;
3649
+// aWindowConstraints.gridwidth = 3;
3650
+// // aConstraints.gridheight = 3;
3651
+// aWindowConstraints.gridx = 1;
3652
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3653
+// //bigThree.add(cameraPanel, aWindowConstraints);
3654
+// aWindowConstraints.weightx = 0;
3655
+// aWindowConstraints.gridx = 4;
3656
+// aWindowConstraints.gridwidth = 1;
3657
+// // aWindowConstraints.gridheight = 3;
3658
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3659
+// //bigThree.add(XYZPanel, aWindowConstraints);
3660
+// bigThree.validate();
3661
+// scenePanel.setVisible(true);
3662
+// centralPanel.setVisible(false);
3663
+// XYZPanel.setVisible(false);
3664
+ bigThree.ClearUI();
3665
+ bigThree.add(scenePanel);
3666
+ bigThree.FlushUI();
3667
+
3668
+ cameraView.requestFocusInWindow();
26733669 } else
2674
- if (event.getSource() == sixButton)
3670
+ if (source == sixButton)
26753671 {
26763672 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
3673
+
3674
+ if (CameraPane.FULLSCREEN)
3675
+ fullscreenLayout = radio.layout;
3676
+
3677
+// bigThree.remove(scenePanel);
3678
+// bigThree.remove(centralPanel);
3679
+// bigThree.remove(XYZPanel);
3680
+// aWindowConstraints.gridx = 0;
3681
+// aWindowConstraints.gridy = 0;
3682
+// aWindowConstraints.gridwidth = 1;
3683
+// // aConstraints.gridheight = 3;
3684
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3685
+// aWindowConstraints.weightx = 0;
3686
+// aWindowConstraints.weighty = 1;
3687
+// bigThree.add(scenePanel, aWindowConstraints);
3688
+// aWindowConstraints.weightx = 1;
3689
+// aWindowConstraints.gridwidth = 3;
3690
+// // aWindowConstraints.gridheight = 3;
3691
+// aWindowConstraints.gridx = 1;
3692
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3693
+// bigThree.add(centralPanel, aWindowConstraints);
3694
+// aWindowConstraints.weightx = 0;
3695
+// aWindowConstraints.gridx = 4;
3696
+// aWindowConstraints.gridwidth = 1;
3697
+// // aWindowConstraints.gridheight = 3;
3698
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3699
+// //bigThree.add(XYZPanel, aConstraints);
3700
+// bigThree.validate();
3701
+// scenePanel.setVisible(true);
3702
+// centralPanel.setVisible(true);
3703
+// XYZPanel.setVisible(false);
3704
+ bigThree.ClearUI();
3705
+ bigThree.add(centralPanel);
3706
+ bigThree.add(scenePanel);
3707
+ bigThree.FlushUI();
3708
+
3709
+ cameraView.requestFocusInWindow();
27013710 } else
2702
- if (event.getSource() == sevenButton)
3711
+ if (source == sevenButton)
27033712 {
27043713 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
3714
+
3715
+ if (CameraPane.FULLSCREEN)
3716
+ fullscreenLayout = radio.layout;
3717
+
3718
+// bigThree.remove(scenePanel);
3719
+// bigThree.remove(centralPanel);
3720
+// bigThree.remove(XYZPanel);
3721
+// aWindowConstraints.gridx = 0;
3722
+// aWindowConstraints.gridy = 0;
3723
+// aWindowConstraints.gridwidth = 1;
3724
+// // aWindowConstraints.gridheight = 3;
3725
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3726
+// aWindowConstraints.weightx = 0;
3727
+// aWindowConstraints.weighty = 1;
3728
+// bigThree.add(scenePanel, aWindowConstraints);
3729
+// aWindowConstraints.weightx = 1;
3730
+// aWindowConstraints.gridwidth = 3;
3731
+// // aWindowConstraints.gridheight = 3;
3732
+// aWindowConstraints.gridx = 1;
3733
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3734
+// bigThree.add(centralPanel, aWindowConstraints);
3735
+// aWindowConstraints.weightx = 0;
3736
+// aWindowConstraints.gridx = 4;
3737
+// aWindowConstraints.gridwidth = 1;
3738
+// // aConstraints.gridheight = 3;
3739
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3740
+// bigThree.add(XYZPanel, aWindowConstraints);
3741
+// bigThree.validate();
3742
+// scenePanel.setVisible(true);
3743
+// centralPanel.setVisible(true);
3744
+// XYZPanel.setVisible(true);
3745
+ bigThree.ClearUI();
3746
+ bigThree.add(scenePanel);
3747
+ bigThree.add(centralPanel);
3748
+ bigThree.add(XYZPanel);
3749
+ bigThree.FlushUI();
3750
+
3751
+ cameraView.requestFocusInWindow();
27293752 } else
2730
- if (event.getSource() == rootButton)
3753
+ if (source == rootButton)
27313754 {
27323755 Object3D obj;
27333756 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3760,84 @@
27373760 EditObject(obj);
27383761 }
27393762
3763
+ cameraView.requestFocusInWindow();
27403764 refreshContents(true);
27413765 } else
2742
- if (event.getSource() == closeButton)
3766
+ if (source == closeButton)
27433767 {
27443768 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453769 cRadio ab;
27463770 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473771 {
27483772 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3773
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503774 {
3775
+ // Patch to avoid bug with transparency.
3776
+ if (!ab.hadMaterial)
3777
+ {
3778
+ ab.object.material = null;
3779
+ }
3780
+
27513781 buttonGroup.remove(ab);
27523782 radioPanel.remove(ab);
27533783
2754
- ab.GetObject().editWindow = null;
3784
+ //ab.GetObject().editWindow = null;
3785
+ ab.GetObject().manipWindow = null;
27553786 // ab.GetObject().objectUI = null; // ?????????
27563787
27573788 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583789 break;
27593790 }
27603791 }
3792
+
3793
+ cameraView.requestFocusInWindow();
27613794 refreshContents(true);
27623795 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3796
+ if (source == editItem || source == editButton)
27643797 {
3798
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3799
+ {
3800
+ Object3D child = (Object3D)e.nextElement();
3801
+ child.pinned = true;
3802
+ }
3803
+
27653804 EditSelection(false);
27663805 } else
2767
- if (event.getSource() == uneditButton)
3806
+ if (source == uneditButton)
27683807 {
27693808 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703809 {
27713810 Object3D child = (Object3D)e.nextElement();
27723811 if(child.editWindow != null)
27733812 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3813
+ child.pinned = false;
27743814 child.CloseUI();
27753815 listUI.remove(child);
27763816
2777
- child.editWindow = null; // ???????????
3817
+ //child.editWindow = null; // ???????????
27783818 }
2779
- objEditor.ctrlPanel.revalidate();
3819
+ objEditor.ctrlPanel.FlushUI();
27803820 //objEditor.jTree.clearSelection();
27813821 //objEditor.ResetSliders();
27823822 refreshContents(true);
27833823 } else
2784
- if (event.getSource() == clearPanelButton)
3824
+ if (source == clearPanelButton)
27853825 {
27863826 assert(copy == group);
27873827 //copy.ClearUI();
27883828 for (Object3D obj : listUI)
27893829 {
3830
+ obj.pinned = false;
27903831 obj.CloseUI();
27913832 }
27923833 listUI.clear();
27933834 refreshContents(true);
27943835 } else
2795
- if (event.getSource() == allParamsButton)
3836
+ if (source == allParamsButton)
27963837 {
27973838 assert(copy == group);
27983839
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3840
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003841
28013842 for (Object3D obj : listUI)
28023843 {
....@@ -2813,19 +3854,19 @@
28133854
28143855 refreshContents(true);
28153856 } else
2816
- if (event.getSource() == unselectButton)
3857
+ if (source == unselectButton)
28173858 {
28183859 objEditor.jTree.clearSelection();
28193860 // ?? oct 2012 GrafreeD.clipboard.clear();
28203861 objEditor.ResetSliders();
28213862 refreshContents(true);
28223863 } else
2823
- if(event.getSource() instanceof cRadio)
3864
+ if(source instanceof cRadio)
28243865 {
28253866 group.parent = keepparent;
28263867 group.attributes = 0;
28273868 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3869
+ /*cRadio*/ radio = (cRadio)source;
28293870 Object3D obj = radio.GetObject();
28303871 System.out.println("Edit " + obj);
28313872 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3886,10 @@
28453886 }
28463887
28473888 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3889
+
3890
+ SetUndoStates();
3891
+
3892
+ //Globals.theRenderer.object = group;
28493893 if(!useclient)
28503894 {
28513895 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3898,52 @@
28543898 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553899 cameraView.targetLookAt.set(radio.camera.lookAt);
28563900 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3901
+ //cameraView.lighttouched = true;
3902
+ Globals.lighttouched = true;
28583903 topView.object = group;
28593904 frontView.object = group;
28603905 sideView.object = group;
28613906 }
2862
- group.editWindow = this;
3907
+
3908
+// fix "+" issue
3909
+ //group.editWindow = this;
3910
+ group.manipWindow = this;
3911
+
28633912 /*
28643913 currentLayout = radio.layout;
28653914 if (currentLayout == null)
28663915 currentLayout = sevenButton;
28673916 */
28683917 radio.layout.doClick();
3918
+
3919
+ ClearUnpinned();
3920
+ //Grafreed.Assert(group != null);
3921
+ //Grafreed.Assert(group.selection != null);
3922
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3923
+ if (group.selection == null || group.selection.size() == 1)
3924
+ EditSelection(false);
28693925 keepparent = group.parent;
28703926 // PARENT = NULL or not???
28713927 //group.parent = null; // ROOT
28723928 //group.attributes = -1;
28733929 ResetModel();
3930
+
3931
+ cameraView.requestFocusInWindow();
28743932 refreshContents(true);
2875
- }
3933
+ } else if (event.getSource() == editCameraItem)
3934
+ {
3935
+ cameraView.ProtectCamera();
3936
+ cameraView.repaint();
3937
+ return;
3938
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3939
+ {
3940
+ cameraView.RevertCamera();
3941
+ cameraView.repaint();
3942
+ return;
3943
+ // } else if (event.getSource() == textureButton)
3944
+ // {
3945
+ // return; // true;
3946
+ }
28763947 else
28773948 {
28783949 //return super.action(event, arg);
....@@ -2881,7 +3952,6 @@
28813952 }
28823953
28833954 boolean useclient = false;
2884
- cRadio radio;
28853955
28863956 void ToggleRoot()
28873957 {
....@@ -2890,7 +3960,7 @@
28903960 if (useclient)
28913961 {
28923962 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3963
+ Globals.lighttouched = true;
28943964 //topView.object = client;
28953965 //frontView.object = client;
28963966 //sideView.object = client;
....@@ -2898,7 +3968,7 @@
28983968 else
28993969 {
29003970 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3971
+ Globals.lighttouched = true;
29023972 //topView.object = group;
29033973 //frontView.object = group;
29043974 //sideView.object = group;
....@@ -2933,6 +4003,28 @@
29334003 refreshContents();
29344004 }
29354005
4006
+ void TransformChildren()
4007
+ {
4008
+ Object3D obj;
4009
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4010
+ {
4011
+ obj = (Object3D)e.nextElement();
4012
+ obj.KeepTextureMatrices();
4013
+ obj.TransformChildren();
4014
+ obj.RestoreTextureMatrices();
4015
+
4016
+// if (obj.parent == null)
4017
+// {
4018
+// System.out.println("NULL PARENT!");
4019
+// new Exception().printStackTrace();
4020
+// }
4021
+// else
4022
+// TouchTransform(obj);
4023
+// //obj.parent.Touch();
4024
+ }
4025
+
4026
+ refreshContents();
4027
+ }
29364028
29374029 void ResetTransform()
29384030 {
....@@ -3045,7 +4137,7 @@
30454137 refreshContents();
30464138 }
30474139
3048
- void ResetCentroid()
4140
+ void ResetCentroid(boolean full)
30494141 {
30504142 Object3D obj;
30514143 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +4152,16 @@
30604152 LA.matIdentity(Object3D.mat);
30614153 obj.getBounds(minima, maxima, false);
30624154 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4155
+ if (full)
4156
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30644157 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30654158 obj.TransformMesh(Object3D.mat);
4159
+
30664160 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4161
+ if (full)
4162
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30684163 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4164
+
30694165 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30704166 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30714167 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +4190,8 @@
30944190
30954191 int size = obj.MemorySize();
30964192
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
4193
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4194
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30984195 }
30994196 }
31004197 catch (Exception e)
....@@ -3131,9 +4228,9 @@
31314228 obj = (Object3D)e.nextElement();
31324229
31334230 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
4231
+ Grafreed.AnalyzeObject(obj);
31354232 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
4233
+ Grafreed.AnalyzeObject(obj.bRep);
31374234
31384235 // System.err.println((size/1024) + " KB is the size of " + obj);
31394236 }
....@@ -3175,6 +4272,20 @@
31754272 void GenNormals(boolean crease)
31764273 {
31774274 group.GenNormalsS(crease);
4275
+
4276
+ refreshContents();
4277
+ }
4278
+
4279
+ void GenNormalsMESH()
4280
+ {
4281
+ group.GenNormalsMeshS();
4282
+
4283
+ refreshContents();
4284
+ }
4285
+
4286
+ void GenNormalsMINE()
4287
+ {
4288
+ group.selection.GenNormalsMINE();
31784289
31794290 refreshContents();
31804291 }
....@@ -3340,8 +4451,8 @@
33404451
33414452 void ParseVertices()
33424453 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4454
+ boolean epsequal = Grafreed.epsequal;
4455
+ Grafreed.epsequal = true;
33454456
33464457 for (int i=0; i<group.selection.size(); i++)
33474458 {
....@@ -3366,7 +4477,7 @@
33664477 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674478 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684479
3369
- g.add(GrafreeD.clipboard);
4480
+ g.add(Grafreed.clipboard);
33704481
33714482 buffer.add(g);
33724483 }
....@@ -3381,7 +4492,7 @@
33814492 makeSomething(buffer, i==group.selection.size()-1);
33824493 }
33834494
3384
- GrafreeD.epsequal = epsequal;
4495
+ Grafreed.epsequal = epsequal;
33854496
33864497 refreshContents();
33874498 }
....@@ -3399,7 +4510,16 @@
33994510 String pigment = Object3D.GetPigment(tex);
34004511 //String bump = Object3D.GetBump(tex);
34014512
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4513
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4514
+
4515
+ try
4516
+ {
4517
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4518
+ }
4519
+ catch (Exception e)
4520
+ {
4521
+ System.err.println("FAIL: " + node);
4522
+ }
34034523
34044524 double s = v.s;
34054525
....@@ -3447,12 +4567,26 @@
34474567
34484568 void Align()
34494569 {
4570
+ if (group.selection.size() == 0)
4571
+ return;
4572
+
4573
+ cVector bbmin = new cVector();
4574
+ cVector bbmax = new cVector();
4575
+
4576
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4577
+
4578
+ double dx = bbmax.x - bbmin.x;
4579
+ double dy = bbmax.y - bbmin.y;
4580
+ double dz = bbmax.z - bbmin.z;
4581
+
4582
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4583
+
34504584 for (int i=0; i<group.selection.size(); i++)
34514585 {
34524586 Object3D obj = group.selection.get(i);
34534587
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4588
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4589
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564590 }
34574591
34584592 refreshContents();
....@@ -3473,11 +4607,11 @@
34734607
34744608 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754609
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4610
+ boolean random = CameraPane.SWITCH;
4611
+ CameraPane.SWITCH = false; // parse all random nodes
34784612 lowres.linkVerticesThis(null);
34794613 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4614
+ CameraPane.SWITCH = random;
34814615
34824616 System.err.flush();
34834617
....@@ -3517,7 +4651,7 @@
35174651 return;
35184652
35194653 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4654
+ Object3D ref = Grafreed.clipboard.get(0);
35214655
35224656 Object3D newgroup = new Object3D("Po:" + poses.name);
35234657
....@@ -3686,7 +4820,7 @@
36864820 group.selection.RelinkToSupport(); // july 2014
36874821 System.out.println("DONE.");
36884822 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4823
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904824 }
36914825
36924826 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4845,9 @@
37114845
37124846 void ClipMesh()
37134847 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4848
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154849 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4850
+ Object3D content = Grafreed.clipboard.get(0);
37174851
37184852 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194853 content = ((cGroup)content).get(0);
....@@ -3722,7 +4856,7 @@
37224856 // {
37234857 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244858 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4859
+ group.selection.ClipMesh(Grafreed.clipboard);
37264860 }
37274861 // group.selection.ClipMesh(GrafreeD.clipboard);
37284862 System.out.println("DONE.");
....@@ -3769,6 +4903,18 @@
37694903 void MarkLeaves(boolean hide)
37704904 {
37714905 group.selection.MarkLeaves(hide);
4906
+ refreshContents();
4907
+ }
4908
+
4909
+ void RewindLeaves(boolean hide)
4910
+ {
4911
+ group.selection.RewindLeaves(hide);
4912
+ refreshContents();
4913
+ }
4914
+
4915
+ void RandomLeaves(boolean hide)
4916
+ {
4917
+ group.selection.RandomLeaves(hide);
37724918 refreshContents();
37734919 }
37744920
....@@ -3843,28 +4989,25 @@
38434989 // }
38444990 // }
38454991
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38504992 void EditSelection(boolean newWindow)
38514993 {
4994
+ if (group.selection == null)
4995
+ {
4996
+ EditElement(group, newWindow); // ? new
4997
+ return;
4998
+ }
4999
+
38525000 // aConstraints.gridy = 0;
38535001 for (int i=0; i<group.selection.size(); i++)
38545002 {
38555003 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38565004 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5005
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38585006
38595007 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
5008
+ if(elem != group || !newWindow)
38615009 {
3862
- // if (!(elem instanceof Composite))
3863
- // newWindow = false;
3864
- listUI.add(elem);
3865
- elem.openEditWindow(this, newWindow); //, false);
3866
- System.out.println("edit : " + elem);
3867
- elem.editWindow.refreshContents(true); // ? new
5010
+ EditElement(elem, newWindow); // ? new
38685011 }
38695012 }
38705013 }
....@@ -3939,7 +5082,8 @@
39395082 //new Exception().printStackTrace();
39405083
39415084 freezemodel = true;
3942
-
5085
+ ClearUnpinned();
5086
+
39435087 /**/
39445088 //switch (event.id)
39455089 {
....@@ -3947,7 +5091,6 @@
39475091 //case 702: // Event.LIST_DESELECT
39485092 group.deselectAll();
39495093 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39515094 if (tps != null)
39525095 {
39535096 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +5099,39 @@
39565099
39575100 //if (child.parent != null)
39585101 //child.parent.addSelectee(child);
5102
+ objEditor.SetMaterial(child);
39595103 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39635104 }
39645105 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
5106
+// else
5107
+// {
5108
+// objEditor.SetMaterial(group); // .GetMaterial());
5109
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5110
+// System.err.println("info : " + group.GetPath());
5111
+// }
39715112
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5113
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39755114 CameraPane.flash = true;
39765115
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5116
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39785117 // a camera
39795118 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5119
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5120
+ {
5121
+ CameraPane.camerachangeframe = 0; // don't refuse it
5122
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5123
+ }
5124
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5125
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39845126 }
39855127
5128
+ if (tps != null && tps.length == 1)
5129
+ {
5130
+ EditSelection(false);
5131
+ }
5132
+
5133
+ SetPinStates(tps != null && tps.length > 0);
5134
+
39865135 refreshContents();
39875136 //return true;
39885137 }
....@@ -3991,6 +5140,35 @@
39915140
39925141 freezemodel = false;
39935142 }
5143
+
5144
+ void SetPinStates(boolean enabled)
5145
+ {
5146
+ editButton.setEnabled(enabled);
5147
+ uneditButton.setEnabled(enabled);
5148
+ unselectButton.setEnabled(enabled);
5149
+ flashSelectionButton.setEnabled(enabled);
5150
+ }
5151
+
5152
+ void refreshContents(boolean cp)
5153
+ {
5154
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5155
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5156
+ {
5157
+ objEditor.ClearInfo(); // .GetMaterial());
5158
+
5159
+ for (int i=0; i < group.selection.Size(); i++)
5160
+ {
5161
+ Object3D child = (Object3D) group.selection.get(i);
5162
+
5163
+ objEditor.AddInfo(child, this, true);
5164
+ System.err.println("info : " + child.GetPath());
5165
+ }
5166
+
5167
+ objEditor.SetText(); // jan 2014
5168
+ }
5169
+
5170
+ super.refreshContents(cp);
5171
+ }
39945172
39955173 void linkSomething(Object3D thing)
39965174 {
....@@ -4062,16 +5240,19 @@
40625240 {
40635241 if (group.selection.isEmpty())
40645242 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
5243
+
5244
+ Grafreed.clipboardIsTempGroup = false;
40665245 Composite tGroup = null;
40675246 if (group.selection.size() > 0) // 1)
40685247 {
40695248 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
5249
+ Grafreed.clipboardIsTempGroup = true;
40715250 }
40725251
40735252 if (cut)
40745253 {
5254
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5255
+// Save();
40755256 //int indices[] = jList.getSelectedIndices();
40765257 //for (int i = indices.length - 1; i >= 0; i--)
40775258 //jList.remove(indices[i]);
....@@ -4107,16 +5288,16 @@
41075288 //System.out.println("cut " + child);
41085289 //System.out.println("parent = " + child.parent);
41095290 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
5291
+ if (Grafreed.clipboardIsTempGroup)
41115292 tGroup.add/*Child*/(tmp);
41125293 else
4113
- GrafreeD.clipboard = tmp;
5294
+ Grafreed.clipboard = tmp;
41145295 }
41155296 else
4116
- if (GrafreeD.clipboardIsTempGroup)
5297
+ if (Grafreed.clipboardIsTempGroup)
41175298 tGroup.add/*Child*/(child);
41185299 else
4119
- GrafreeD.clipboard = child;
5300
+ Grafreed.clipboard = child;
41205301 }
41215302
41225303 //ResetModel();
....@@ -4148,21 +5329,23 @@
41485329 //System.out.println("cut " + elem);
41495330 //System.out.println("parent = " + elem.parent);
41505331 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
5332
+ if (Grafreed.clipboardIsTempGroup)
41525333 tGroup.add/*Child*/(tmp);
41535334 else
4154
- GrafreeD.clipboard = tmp;
5335
+ Grafreed.clipboard = tmp;
41555336 }
41565337 else
4157
- if (GrafreeD.clipboardIsTempGroup)
5338
+ if (Grafreed.clipboardIsTempGroup)
41585339 tGroup.add/*Child*/(child);
41595340 else
4160
- GrafreeD.clipboard = child;
5341
+ Grafreed.clipboard = child;
41615342 }
41625343
41635344 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
5345
+
5346
+ if (Grafreed.clipboardIsTempGroup)
5347
+ Grafreed.clipboard = tGroup;
5348
+
41665349 if (cut)
41675350 {
41685351 ResetModel();
....@@ -4172,11 +5355,15 @@
41725355
41735356 void paste(boolean expand)
41745357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
41755362 // if (GrafreeD.clipboard == null)
41765363 // return;
41775364 boolean first = true;
41785365
4179
- if (GrafreeD.clipboardIsTempGroup)
5366
+ if (Grafreed.clipboardIsTempGroup)
41805367 {
41815368 Composite temp;
41825369
....@@ -4187,7 +5374,7 @@
41875374 temp = (Composite)Applet3D.clipboard.deepCopy();
41885375 */
41895376 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5377
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41915378 {
41925379 Object3D child = (Object3D)e.nextElement();
41935380
....@@ -4221,21 +5408,22 @@
42215408 //Object3D cb = Applet3D.clipboard;
42225409 //temp.addChild(cb);
42235410 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5411
+ assert(Grafreed.clipboard.parent == null);
5412
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5413
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5414
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5415
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42295416 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
5417
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5418
+ Grafreed.clipboard.get(0).parent = keepparent;
42325419 }
42335420
5421
+ Globals.REPLACEONMAKE = keep;
42345422 ResetModel();
42355423 refreshContents();
42365424 }
42375425
4238
- void pasteInto(boolean copyit)
5426
+ void pasteInto(boolean copyit, boolean clone)
42395427 {
42405428 // if (GrafreeD.clipboard == null)
42415429 // return;
....@@ -4264,15 +5452,22 @@
42645452 if (copyit)
42655453 {
42665454 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5455
+ if (clone)
5456
+ {
5457
+ CloneClipboard(false); // sept 2014
5458
+ }
5459
+ else
5460
+ {
5461
+ paste(false);
5462
+ }
42685463 }
42695464 else
42705465 {
42715466 boolean first = true;
42725467
4273
- if (GrafreeD.clipboardIsTempGroup)
5468
+ if (Grafreed.clipboardIsTempGroup)
42745469 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5470
+ Composite temp = (Composite)Grafreed.clipboard;
42765471 Object3D copy;
42775472 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785473 {
....@@ -4282,7 +5477,7 @@
42825477 }
42835478 } else
42845479 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5480
+ linkSomething(Grafreed.clipboard); //.get(0));
42865481 }
42875482 }
42885483 }
....@@ -4359,6 +5554,10 @@
43595554
43605555 void group(Object3D csg, boolean grab)
43615556 {
5557
+ if (Globals.REPLACEONMAKE)
5558
+ Save();
5559
+ boolean keep = Globals.REPLACEONMAKE;
5560
+ Globals.REPLACEONMAKE = false;
43625561 if (//false) // why??
43635562 !group.selection.isEmpty())
43645563 {
....@@ -4472,8 +5671,34 @@
44725671 //node.add(csg);
44735672 //makeSomething(node);
44745673 makeSomething(csg);
5674
+ Globals.REPLACEONMAKE = keep;
44755675 }
44765676
5677
+ void Ungroup(Object3D g)
5678
+ {
5679
+ if (Globals.REPLACEONMAKE)
5680
+ Save();
5681
+ boolean keep = Globals.REPLACEONMAKE;
5682
+ Globals.REPLACEONMAKE = false;
5683
+ if (g instanceof HiddenObject)
5684
+ {
5685
+ HiddenObject h = (HiddenObject) g;
5686
+
5687
+ for (int i=0; i<h.ActualSize(); i++)
5688
+ {
5689
+ objEditor.makeSomething(h.get(i), false);
5690
+ }
5691
+ }
5692
+ else
5693
+ {
5694
+ for (int i=0; i<g.Size(); i++)
5695
+ {
5696
+ objEditor.makeSomething(g.get(i), false);
5697
+ }
5698
+ }
5699
+ Globals.REPLACEONMAKE = keep;
5700
+ }
5701
+
44775702 void ungroup()
44785703 {
44795704 /*
....@@ -4667,21 +5892,6 @@
46675892 }
46685893 */
46695894
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855895 /*
46865896 public void Callback(Object obj)
46875897 {
....@@ -4705,26 +5915,9 @@
47055915 }
47065916 */
47075917
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255918 String GetFile(String dialogName)
47265919 {
4727
- if (GrafreeD.standAlone)
5920
+ if (Grafreed.standAlone)
47285921 {
47295922 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305923 browser.show();
....@@ -4788,10 +5981,49 @@
47885981 cButton flashSelectionButton;
47895982 cButton editButton;
47905983 cButton uneditButton;
5984
+ JCheckBox allParamsButton;
47915985 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935986 cButton unselectButton;
47945987
5988
+ cButton restoreCameraButton;
5989
+
5990
+ cButton saveButton;
5991
+ cButton oneStepButton;
5992
+
5993
+ cButton groupButton;
5994
+ cButton ungroupButton;
5995
+ cButton compositeButton;
5996
+ cButton switchButton;
5997
+ cButton loopButton;
5998
+ cButton textureButton;
5999
+
6000
+ cButton skybox1Button;
6001
+ cButton skybox2Button;
6002
+ cButton skybox3Button;
6003
+ cButton skybox4Button;
6004
+ cButton skybox5Button;
6005
+ cButton skybox6Button;
6006
+ cButton skybox7Button;
6007
+
6008
+ cButton skybox11Button;
6009
+ cButton skybox12Button;
6010
+ cButton skybox13Button;
6011
+ cButton skybox14Button;
6012
+ cButton skybox15Button;
6013
+ cButton skybox16Button;
6014
+ cButton skybox17Button;
6015
+
6016
+ cButton gridButton;
6017
+ cButton boxButton;
6018
+ cButton sphereButton;
6019
+ cButton coneButton;
6020
+ cButton torusButton;
6021
+ cButton superButton;
6022
+ cButton kleinButton;
6023
+ cButton particlesButton;
6024
+ cButton overlayButton;
6025
+ cButton lightButton;
6026
+
47956027 cButton screenfitButton;
47966028 cButton screenfitpointButton;
47976029 cButton snapobjectButton;
....@@ -4803,14 +6035,6 @@
48036035
48046036 cButton setsupportButton;
48056037
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
4813
-
48146038 //
48156039 //Composite
48166040 Object3D // to do !!
....@@ -4820,9 +6044,11 @@
48206044 //JTree jTree;
48216045 private MenuItem lookAtItem;
48226046 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
6047
+ private MenuItem switchViewItem;
48246048 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
6049
+ private MenuItem undoItem;
6050
+ private MenuItem redoItem;
6051
+ private JMenuItem duplicateItem;
48266052 private MenuItem cloneItem;
48276053 private MenuItem cloneSupportItem;
48286054 private MenuItem overwriteGeoItem;
....@@ -4833,8 +6059,9 @@
48336059 private MenuItem resetsupportItem;
48346060 private MenuItem resetreferencesItem;
48356061 private MenuItem linkverticesItem;
6062
+ private MenuItem relinkverticesItem;
48366063 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
6064
+ private MenuItem resetAllItem;
48386065 private MenuItem stepAllItem;
48396066 private MenuItem revertMeshItem;
48406067 private MenuItem poseMeshItem;
....@@ -4845,15 +6072,17 @@
48456072 private MenuItem mergeGeometriesItem;
48466073 private MenuItem copyItem;
48476074 private MenuItem pasteItem;
6075
+ private MenuItem pasteIntoItem;
48486076 private MenuItem pasteLinkItem;
48496077 private MenuItem pasteCloneItem;
48506078 private MenuItem pasteExpandItem;
4851
- private MenuItem clearItem;
6079
+ private MenuItem deleteItem;
48526080 private MenuItem clearAllItem;
48536081 private MenuItem genUVItem;
48546082 private MenuItem genNormalsMESHItem;
48556083 private MenuItem genNormalsCADItem;
48566084 private MenuItem genNormalsORGANItem;
6085
+ private MenuItem genNormalsMINEItem;
48576086 private MenuItem stripifyItem;
48586087 private MenuItem unstripifyItem;
48596088 private MenuItem trimItem;
....@@ -4882,6 +6111,10 @@
48826111 private MenuItem showleavesItem;
48836112 private MenuItem markleavesItem;
48846113 private MenuItem unmarkleavesItem;
6114
+ private MenuItem rewindleavesItem;
6115
+ private MenuItem unrewindleavesItem;
6116
+ private MenuItem randomleavesItem;
6117
+ private MenuItem unrandomleavesItem;
48856118
48866119 private MenuItem flipVItem;
48876120 private MenuItem unflipVItem;
....@@ -4893,14 +6126,17 @@
48936126 private MenuItem panoTexturesItem;
48946127
48956128 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
6129
+ private MenuItem resetCentroidXZItem;
48976130 private MenuItem resetTransformItem;
6131
+ private MenuItem transformGeometryItem;
6132
+ private MenuItem transformChildrenItem;
6133
+ private MenuItem hideItem;
48986134 private MenuItem grabItem;
48996135 private MenuItem backItem;
49006136 private MenuItem frontItem;
49016137 private MenuItem cameraItem;
49026138 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
6139
+ private MenuItem switchItem;
49046140 private MenuItem physicsItem;
49056141 private MenuItem frameselectorItem;
49066142 private MenuItem scriptNodeItem;
....@@ -4915,6 +6151,7 @@
49156151
49166152 private MenuItem resetParentItem;
49176153 private MenuItem repairParentItem;
6154
+ private MenuItem repairShadowItem;
49186155 private MenuItem sortbysizeItem;
49196156 private MenuItem sortbynameItem;
49206157
....@@ -4923,6 +6160,8 @@
49236160 private MenuItem attachBumpItem;
49246161 private MenuItem detachBumpItem;
49256162 private MenuItem pigmentBumpItem;
6163
+ private MenuItem embedTexturesItem;
6164
+ private MenuItem deEmbedTexturesItem;
49266165
49276166 private MenuItem particleItem;
49286167 private MenuItem ragdollItem;
....@@ -4935,10 +6174,11 @@
49356174 private MenuItem coneItem;
49366175 private MenuItem torusItem;
49376176 private MenuItem superItem;
6177
+ private MenuItem kleinItem;
49386178 private MenuItem blobItem;
49396179 private MenuItem latheItem;
49406180 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
6181
+ private MenuItem overlayItem;
49426182 private MenuItem meshItem;
49436183 // private MenuItem meshGroupItem;
49446184 private MenuItem springItem;
....@@ -4947,6 +6187,7 @@
49476187 private MenuItem csgItem;
49486188 private MenuItem templateItem;
49496189 private MenuItem textureItem;
6190
+ private MenuItem billboardItem;
49506191 private MenuItem shadowXItem;
49516192 private MenuItem shadowYItem;
49526193 private MenuItem shadowZItem;
....@@ -4959,11 +6200,6 @@
49596200 private MenuItem doubleItem;
49606201 private MenuItem tripleItem;
49616202
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49676203 private MenuItem computeAOItem;
49686204 private MenuItem recompileItem;
49696205 private MenuItem editScriptItem;
....@@ -4973,4 +6209,8 @@
49736209 private MenuItem analyzeItem;
49746210 private MenuItem dumpItem;
49756211 //boolean freezemodel = false;
6212
+
6213
+ Menu cameraMenu;
6214
+ MenuItem editCameraItem;
6215
+ MenuItem restoreCameraItem;
49766216 }