Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
GroupEditor.java
....@@ -12,9 +12,10 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1819 ObjectUI,
1920 Runnable,
2021 ActionListener,
....@@ -22,6 +23,302 @@
2223 DragGestureListener, DragSourceListener, DropTargetListener,
2324 ItemListener // ListSelectionListener
2425 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("penguins", "yonder", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
25322 //ObjEditor objEditor;
26323 public void closeUI2()
27324 {
....@@ -59,6 +356,12 @@
59356 this.copy = this.group = group;
60357 //selectees = this.group.selectees;
61358
359
+ if (copy.versionlist == null)
360
+ {
361
+ copy.versionlist = new Object3D[100];
362
+ copy.versionindex = -1;
363
+ }
364
+
62365 if(ui)
63366 SetupUI(objEditor);
64367 }
....@@ -73,17 +376,29 @@
73376 this.copy = this.group = copy;
74377 //selectees = this.group.selectees;
75378
76
- SetupMenu2(objEditor);
379
+ SetupMenu2(this); //objEditor);
77380 SetupUI2(objEditor);
78381 objEditor.SetupUI(true);
79382 SetupViews(objEditor);
80383
81384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versionlist == null)
387
+ {
388
+ copy.versionlist = new Object3D[100];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
82393 }
83394
84395 void CloneSelection(boolean supports)
85396 {
86
- // Object3D keep = GraphreeD.clipboard;
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
401
+ // Object3D keep = GrafreeD.clipboard;
87402 //Object3D obj;
88403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89404 {
....@@ -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(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.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(GraphreeD.clipboard, false));
107
- GraphreeD.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)GraphreeD.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,26 +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);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
193
- resetMeshItem.addActionListener(this);
194
- stepAllItem = menu.add(new MenuItem("Step All"));
195
- stepAllItem.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());
552
+
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
+
604
+ oe.menuBar.add(menu = new Menu("Setting"));
605
+ if (Globals.ADVANCED)
606
+ {
196607 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197608 revertMeshItem.addActionListener(this);
198609 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199610 resetreferencesItem.addActionListener(this);
200611 menu.add("-");
612
+ }
201613 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202614 overwriteGeoItem.addActionListener(this);
203615 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +621,104 @@
209621 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210622 overwriteUVItem.addActionListener(this);
211623 menu.add("-");
624
+ if (Globals.ADVANCED)
625
+ {
212626 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213627 generateMeshItem.addActionListener(this);
214628 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215629 poseMeshItem.addActionListener(this);
216630 menu.add("-");
631
+ }
217632 resetsupportItem = menu.add(new MenuItem("Reset support"));
218633 resetsupportItem.addActionListener(this);
219634 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220635 linkverticesItem.addActionListener(this);
636
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
637
+ relinkverticesItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
221641 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222642 setMasterItem.addActionListener(this);
643
+ }
223644
224
- oe.menuBar.add(menu = new Menu("Object"));
225
- grabItem = menu.add(new MenuItem("Grab"));
226
- grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
645
+ oe.menuBar.add(menu = new Menu("Group"));
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
229648 backItem = menu.add(new MenuItem("Back"));
230649 backItem.addActionListener(this);
231
- compositeItem = menu.add(new MenuItem("Composite"));
232
- compositeItem.addActionListener(this);
233
- menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
235
- randomItem.addActionListener(this);
236
- physicsItem = menu.add(new MenuItem("Physics"));
237
- physicsItem.addActionListener(this);
238
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
239
- frameselectorItem.addActionListener(this);
650
+ frontItem = menu.add(new MenuItem("Front"));
651
+ frontItem.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
+ {
240669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241670 switchGeoItem.addActionListener(this);
242671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243672 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
245674 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);
246681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247682 scriptNodeItem.addActionListener(this);
248
- cameraItem = menu.add(new MenuItem("Camera"));
249
- cameraItem.addActionListener(this);
250
- menu.add("-");
251
- textureItem = menu.add(new MenuItem("Texture"));
252
- textureItem.addActionListener(this);
683
+ }
684
+
685
+ oe.menuBar.add(menu = new Menu("Object"));
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
688
+ billboardItem = menu.add(new MenuItem("Billboard"));
689
+ billboardItem.addActionListener(this);
253690 csgItem = menu.add(new MenuItem("CSG"));
254691 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256693 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258695 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
701
+ if (Globals.ADVANCED)
702
+ {
703
+ menu.add("-");
261704 linkerItem = menu.add(new MenuItem("Linker"));
262705 linkerItem.addActionListener(this);
263706 templateItem = menu.add(new MenuItem("Template"));
264707 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267708 pointflowItem = menu.add(new MenuItem("Point Flow"));
268709 pointflowItem.addActionListener(this);
710
+ }
269711 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272712 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273713 resetTransformItem.addActionListener(this);
274714 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275715 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- 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);
278722
279723 oe.menuBar.add(menu = new Menu("Geometry"));
280724 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +727,13 @@
283727 genNormalsORGANItem.addActionListener(this);
284728 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285729 genNormalsCADItem.addActionListener(this);
730
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
731
+ genNormalsMESHItem.addActionListener(this);
732
+ if (Globals.ADVANCED)
733
+ {
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
735
+ genNormalsMINEItem.addActionListener(this);
736
+ }
286737 stripifyItem = menu.add(new MenuItem("Stripify"));
287738 stripifyItem.addActionListener(this);
288739 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +743,6 @@
292743 untrimItem = menu.add(new MenuItem("Untrim"));
293744 untrimItem.addActionListener(this);
294745 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297746 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298747 clearColorsItem.addActionListener(this);
299748 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +755,34 @@
306755 reduce34MeshItem.addActionListener(this);
307756 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308757 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311758 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312759 clipMeshItem.addActionListener(this);
760
+
761
+ if (Globals.ADVANCED)
762
+ {
763
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
764
+ smoothMeshItem.addActionListener(this);
765
+ }
766
+
767
+ oe.menuBar.add(menu = new Menu("Attributes"));
768
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
769
+ 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);
313774 menu.add("-");
314775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315776 liveleavesItem.addActionListener(this);
316777 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317778 unliveleavesItem.addActionListener(this);
779
+ if (Globals.ADVANCED)
780
+ {
318781 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319782 supportleavesItem.addActionListener(this);
320783 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321784 unsupportleavesItem.addActionListener(this);
785
+ }
322786 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323787 hideleavesItem.addActionListener(this);
324788 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +791,31 @@
327791 markleavesItem.addActionListener(this);
328792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329793 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);
330802 menu.add("-");
331803 flipVItem = menu.add(new MenuItem("Flip V"));
332804 flipVItem.addActionListener(this);
333805 unflipVItem = menu.add(new MenuItem("Unflip V"));
334806 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
807
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336808 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
809
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338810 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
811
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340812 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
813
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342814 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
815
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344816 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
817
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346818 panoTexturesItem.addActionListener(this);
347
- menu.add("-");
348
- extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
349
- extractGeometriesItem.addActionListener(this);
350
- cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
351
- cloneGeometriesItem.addActionListener(this);
352
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
353
- shareGeometriesItem.addActionListener(this);
354
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
355
- mergeGeometriesItem.addActionListener(this);
356819
357820 oe.menuBar.add(menu = new Menu("Selection"));
358821 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -361,23 +824,56 @@
361824 attachBumpItem.addActionListener(this);
362825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
363826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
364828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
365829 detachPigmentItem.addActionListener(this);
366830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
367831 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);
368836 menu.add("-");
369837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
370838 sortbysizeItem.addActionListener(this);
371839 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372840 sortbynameItem.addActionListener(this);
841
+ 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.
849
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
850
+ extractGeometriesItem.addActionListener(this);
851
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
852
+ cloneGeometriesItem.addActionListener(this);
853
+ }
854
+
373855 oe.menuBar.add(menu = new Menu("Insert"));
374856 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
857
+
858
+ oe.menuBar.add(menu = new Menu("Tools"));
376859 buildToolsMenu(menu);
377860 }
378861
862
+
379863 void SetupUI2(ObjEditor oe)
380864 {
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
+
381877 //new Exception().printStackTrace();
382878
383879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +902,243 @@
406902 oe.radioPanel.add(dummyButton);
407903 oe.buttonGroup.add(dummyButton);
408904 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
412908
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
909
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
910
+
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
914
+
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
921
+
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ screenfitButton.setToolTipText("Screen fit");
928
+ screenfitButton.addActionListener(this);
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveVersionButton.setToolTipText("Duplicate current version");
936
+ saveVersionButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ deleteVersionButton.setToolTipText("Delete current version");
940
+ deleteVersionButton.addActionListener(this);
941
+
942
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
943
+ previousVersionButton.setToolTipText("Previous version");
944
+ previousVersionButton.addActionListener(this);
945
+ previousVersionButton.setEnabled(false);
946
+
947
+ cGridBag updown = new cGridBag().setVertical(true);
948
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
949
+ restoreButton.setToolTipText("Undo (restore current version)");
950
+ restoreButton.addActionListener(this);
951
+ //restoreButton.setEnabled(false);
952
+
953
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
954
+ replaceButton.setToolTipText("Save (replace current version)");
955
+ replaceButton.addActionListener(this);
956
+ //replaceButton.setEnabled(false);
957
+
958
+ copyOptionsPanel.add(updown);
959
+
960
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
961
+ nextVersionButton.setToolTipText("Next version");
962
+ nextVersionButton.addActionListener(this);
963
+ nextVersionButton.setEnabled(false);
964
+
965
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
966
+ liveCB.setToolTipText("Enable animation");
414967 liveCB.addItemListener(this);
415968
416
- oe.aConstraints.gridx += 1;
417
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
418
- supportCB.addItemListener(this);
419
-
420
- // oe.aConstraints.gridx += 1;
421
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
422
- // localCB.addItemListener(this);
423
-
424
- oe.aConstraints.gridx += 1;
425
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
426
- crowdCB.addItemListener(this);
427
-
428
- oe.aConstraints.gridx += 1;
429
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
430
- smoothCB.addItemListener(this);
431
-
432
- oe.aConstraints.gridx += 1;
433
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
969
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
970
+ oneStepButton.setToolTipText("Animate one step forward");
971
+ oneStepButton.addActionListener(this);
972
+
973
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
974
+ fastCB.setToolTipText("Fast mode");
434975 fastCB.addItemListener(this);
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
437
- slowCB.addItemListener(this);
438
- oe.aConstraints.gridx += 1;
439
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
440
- boxCB.addItemListener(this);
976
+
977
+ //oe.toolboxPanel.Return();
978
+
979
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
980
+// trackCB.setToolTipText("Enable tracking");
981
+// trackCB.addItemListener(this);
441982
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
476
- trackCB.addItemListener(this);
477
-
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
480
- screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
482983 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483984 // screenfitpointButton.addActionListener(this);
484
-// oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486
- snapobjectButton.addActionListener(this);
487
- oe.aConstraints.gridx += 1;
488985
489
- //aConstraints.gridx = 0;
490
- //aConstraints.gridy += 1;
491
- oe.aConstraints.weighty = 0;
492
- oe.aConstraints.gridwidth = 1;
493
-
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
495
- flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499
-
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
502
- twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
986
+ if (Globals.ADVANCED)
987
+ {
988
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ snapobjectButton.addActionListener(this);
990
+ snapobjectButton.setToolTipText("Snap Object");
991
+
992
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504993 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
506
- sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
994
+ fourButton.setToolTipText("Show control panel only");
995
+ }
996
+
997
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
998
+
999
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
+ twoButton.setToolTipText("Show 3D view only");
1001
+ twoButton.addActionListener(this);
1002
+ this.fullscreenLayout = twoButton;
1003
+
1004
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
+ threeButton.setToolTipText("Show controls and 3D view");
5081006 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
1007
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
+ sixButton.setToolTipText("Show 3D view and controls");
1009
+ sixButton.addActionListener(this);
1010
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+// sevenButton.setToolTipText("3-column layout");
1012
+// sevenButton.addActionListener(this);
5111013 //
5121014
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1015
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1016
+ rootButton.setToolTipText("Open selection in new tab");
5141017 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1018
+
1019
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1020
+ closeButton.setToolTipText("Close tab");
5171021 closeButton.addActionListener(this);
5181022 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5191023 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521
-
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
524
- editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
5281024
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1025
+ cGridBag row1 = new cGridBag();
1026
+
1027
+ // INSERT
1028
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ gridButton.setToolTipText("Create grid");
1030
+ gridButton.addActionListener(this);
1031
+
1032
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ boxButton.setToolTipText("Create box");
1034
+ boxButton.addActionListener(this);
1035
+
1036
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ sphereButton.setToolTipText("Create sphere");
1038
+ sphereButton.addActionListener(this);
1039
+
1040
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ coneButton.setToolTipText("Create cone");
1042
+ coneButton.addActionListener(this);
1043
+
1044
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ torusButton.setToolTipText("Create torus");
1046
+ torusButton.addActionListener(this);
1047
+
1048
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ superButton.setToolTipText("Create superellipsoid");
1050
+ superButton.addActionListener(this);
1051
+
1052
+ if (Globals.ADVANCED)
1053
+ {
1054
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ kleinButton.setToolTipText("Create Klein bottle");
1056
+ kleinButton.addActionListener(this);
1057
+ }
1058
+
1059
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1060
+ particlesButton.setToolTipText("Create particle system");
1061
+ particlesButton.addActionListener(this);
1062
+
1063
+ oe.toolboxPanel.add(row1);
1064
+
1065
+ cGridBag row2 = new cGridBag();
1066
+
1067
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ groupButton.setToolTipText("Create group");
1069
+ groupButton.addActionListener(this);
1070
+
1071
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ compositeButton.setToolTipText("Create composite");
1073
+ compositeButton.addActionListener(this);
1074
+
1075
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ switchButton.setToolTipText("Create item switcher");
1077
+ switchButton.addActionListener(this);
1078
+
1079
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ loopButton.setToolTipText("Create loop");
1081
+ loopButton.addActionListener(this);
1082
+
1083
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ textureButton.setToolTipText("Create texture");
1085
+ textureButton.addActionListener(this);
1086
+
1087
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ overlayButton.setToolTipText("Create overlay");
1089
+ overlayButton.addActionListener(this);
1090
+
1091
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ lightButton.setToolTipText("Create light");
1093
+ lightButton.addActionListener(this);
1094
+
1095
+ oe.toolboxPanel.add(row2);
1096
+
1097
+ // ENVYMAPS
1098
+ cGridBag skyboxpane = new cGridBag();
1099
+ skyboxpane.preferredHeight = 100;
1100
+
1101
+ oe.toolboxPanel.add(skyboxpane);
1102
+
1103
+ JTabbedPane skyboxpanel = new JTabbedPane();
1104
+ skyboxpane.add(skyboxpanel);
1105
+
1106
+ AddSkyboxTab0(skyboxpanel);
1107
+ AddSkyboxTab1(skyboxpanel);
1108
+ AddSkyboxTab2(skyboxpanel);
1109
+ AddSkyboxTab3(skyboxpanel);
1110
+
1111
+ // EDIT panel
1112
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ editButton.setToolTipText("Pin selection controls");
1114
+ editButton.addActionListener(this);
1115
+
1116
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5301118 uneditButton.addActionListener(this);
5311119
532
- oe.aConstraints.gridx += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
537
- clearPanelButton.addActionListener(this);
538
-
539
- oe.aConstraints.gridx += 1;
540
- oe.aConstraints.weighty = 0;
541
- oe.aConstraints.gridwidth = 1;
542
-
543
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1120
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
+ allParamsButton.setToolTipText("Show all controle");
5441122 allParamsButton.addActionListener(this);
5451123
546
- oe.aConstraints.gridx += 1;
547
- oe.aConstraints.weighty = 0;
548
- oe.aConstraints.gridwidth = 1;
549
-
550
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1124
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ clearPanelButton.setToolTipText("Clear edit panel");
1126
+ clearPanelButton.addActionListener(this);
1127
+
1128
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ unselectButton.setToolTipText("Unselect");
5511130 unselectButton.addActionListener(this);
5521131
1132
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ flashSelectionButton.setToolTipText("Highlight selection");
1134
+ flashSelectionButton.addActionListener(this);
1135
+
1136
+ editCommandsPanel.preferredHeight = 1;
1137
+
1138
+ SetPinStates(false);
1139
+// oe.treePanel.add(commandsPanel);
1140
+// oe.treePanel.Return();
1141
+
5531142 // oe.aConstraints.gridx += 1;
5541143 // oe.aConstraints.weighty = 0;
5551144 // oe.aConstraints.gridwidth = 1;
....@@ -561,47 +1150,32 @@
5611150 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5621151 // gcButton.addActionListener(this);
5631152
564
- oe.aConstraints.gridx = 0;
565
- oe.aConstraints.gridy += 1;
566
-
567
- //ctrlPanel.add(objList = new List(5, true));
568
- oe.aConstraints.gridwidth = 100;
569
- // oe.aConstraints.gridheight = 100;
570
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
571
- oe.aConstraints.gridheight = 1;
572
- oe.aConstraints.weighty = 0.5;
573
- oe.aConstraints.gridx = 0;
574
- JScrollPane jSP;
1153
+ cGridBag jSPPanel = new cGridBag();
1154
+
1155
+ JScrollPane jSP;
5751156 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
576
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1157
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5771158 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
582
-
583
- oe.aConstraints.weighty = 0;
584
- oe.aConstraints.gridwidth = 2;
585
-
586
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
587
- colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
590
- materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
593
- textureCB.addItemListener(this);
594
-
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
5971159
1160
+ oe.treePanel.add(jSPPanel);
1161
+ oe.treePanel.Return();
1162
+
1163
+ oe.treePanel.add(copyOptionsPanel);
1164
+ oe.treePanel.Return();
1165
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
+ sliderPane.preferredHeight = 1;
1168
+
1169
+// mainPanel.setDividerLocation(0.1); //1.0);
1170
+ mainPanel.setResizeWeight(0.4);
1171
+
5981172 //jList.addListSelectionListener(this);
5991173 oe.jTree.addTreeSelectionListener(this);
6001174 //jTree.setRootVisible(false);
6011175 //jTree.setEditable(true);
6021176 oe.jTree.setDragEnabled(true);
6031177 //jTree.setPreferredSize(new Dimension(10,10));
604
- jSP.setPreferredSize(new Dimension(100,200));
1178
+ //jSP.setPreferredSize(new Dimension(100,200));
6051179
6061180 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6071181
....@@ -613,23 +1187,163 @@
6131187 dgr.addDragGestureListener(this);
6141188 }catch(Exception e) {}
6151189 */
616
- radio.layout = sevenButton;
1190
+ radio.layout = threeButton; // sixButton;
6171191 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6181192 }
1193
+
1194
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1195
+ {
1196
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1197
+ colorCB.setToolTipText("Copy color when dropped");
1198
+ colorCB.addItemListener(this);
1199
+
1200
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1201
+ materialCB.setToolTipText("Copy material when dropped");
1202
+ materialCB.addItemListener(this);
1203
+
1204
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1205
+ textureCB.setToolTipText("Copy texture when dropped");
1206
+ textureCB.addItemListener(this);
1207
+
1208
+ panel.Return();
1209
+
1210
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1211
+ boxCB.setToolTipText("Display bounding boxes");
1212
+ boxCB.addItemListener(this);
1213
+
1214
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1215
+ zoomBoxCB.setToolTipText("Display only for wheel");
1216
+ zoomBoxCB.addItemListener(this);
1217
+
1218
+ if (true) // Globals.ADVANCED)
1219
+ {
1220
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1221
+// supportCB.setToolTipText("Enable rigging");
1222
+// supportCB.addItemListener(this);
1223
+
1224
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1225
+ freezeCB.setToolTipText("Fast moving camera");
1226
+ freezeCB.addItemListener(this);
1227
+
1228
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1229
+ // localCB.addItemListener(this);
1230
+
1231
+ panel.Return();
1232
+
1233
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1234
+ crowdCB.setToolTipText("Used for crowds");
1235
+ crowdCB.addItemListener(this);
1236
+
1237
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1238
+ smoothCB.setToolTipText("Snapping delay");
1239
+ smoothCB.addItemListener(this);
1240
+
1241
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1242
+// slowCB.setToolTipText("Smooth interpolation");
1243
+// slowCB.addItemListener(this);
1244
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1245
+ minshaderCB.setToolTipText("Minimal fast shader");
1246
+ minshaderCB.addItemListener(this);
1247
+
1248
+// constraints.gridy += 1;
1249
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1250
+// speakerMocapCB.addItemListener(this);
1251
+
1252
+ panel.Return();
1253
+
1254
+ if (false)
1255
+ {
1256
+ // handled in scripts
1257
+ //constraints.gridy += 1;
1258
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1259
+ speakerCameraCB.addItemListener(this);
1260
+
1261
+ //constraints.gridy += 1;
1262
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1263
+ speakerFocusCB.addItemListener(this);
1264
+
1265
+ //constraints.gridy += 1;
1266
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1267
+ smoothfocusCB.addItemListener(this);
1268
+ panel.Return();
1269
+ }
1270
+
1271
+//constraints.gridx += 1;
1272
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1273
+// debugCB.addItemListener(this);
1274
+
1275
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1276
+ trackCB.setToolTipText("Enable tracking target");
1277
+ trackCB.addItemListener(this);
1278
+
1279
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1280
+ oeilCB.setToolTipText("Move camera when tracking");
1281
+ oeilCB.addItemListener(this);
1282
+
1283
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1284
+ shadowCB.setToolTipText("When live compute shadows");
1285
+ shadowCB.addItemListener(this);
1286
+
1287
+ panel.Return();
1288
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1289
+ toggleTextureCB.setToolTipText("Load textures");
1290
+ toggleTextureCB.addItemListener(this);
1291
+
1292
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1293
+ toggleSwitchCB.setToolTipText("Choose a single item");
1294
+ toggleSwitchCB.addItemListener(this);
1295
+
1296
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1297
+ autokeepCB.setToolTipText("On structure change");
1298
+ autokeepCB.addItemListener(this);
1299
+
1300
+ panel.Return();
1301
+ if (Globals.ADVANCED)
1302
+ {
1303
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1304
+ lookAtCB.setToolTipText("Look-at target");
1305
+ lookAtCB.addItemListener(this);
1306
+ }
1307
+
1308
+ }
1309
+
1310
+ cGridBag fill = new cGridBag();
1311
+ fill.preferredHeight = 200;
1312
+ cGridBag fill2 = new cGridBag();
1313
+ fill2.preferredHeight = 200;
1314
+ cGridBag fill3 = new cGridBag();
1315
+ fill3.preferredHeight = 200;
1316
+
1317
+ panel.add(fill);
1318
+ panel.add(fill2);
1319
+ panel.add(fill3);
1320
+
1321
+ }
6191322
6201323 void EditObject(Object3D obj)
6211324 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
1325
+ cRadio radioButton = new cRadio(obj.name);
1326
+
1327
+ // June 2019. Patch to avoid bug with transparency.
1328
+ radioButton.hadMaterial = obj.material != null;
1329
+ if (!radioButton.hadMaterial)
1330
+ {
1331
+ obj.material = new cMaterial();
1332
+ }
1333
+
1334
+ radioButton.SetObject(obj);
1335
+ radioButton.layout = threeButton; // sixButton;
1336
+ radioButton.SetCamera(cameraView.renderCamera, false);
1337
+ radioButton.addActionListener(this);
1338
+ radioPanel.add(radioButton);
1339
+ buttonGroup.add(radioButton);
1340
+ radioButton.doClick();
6301341 }
1342
+
6311343 void SetupViews(ObjEditor oe)
6321344 {
1345
+ theFrame = this;
1346
+
6331347 oe.SetupViews();
6341348
6351349 System.out.println("SetupViews");
....@@ -638,22 +1352,30 @@
6381352 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391353 }
6401354
641
- JCheckBox liveCB;
642
- JCheckBox supportCB;
643
- JCheckBox localCB;
644
- JCheckBox crowdCB;
645
- JCheckBox smoothCB;
646
- JCheckBox fastCB;
647
- JCheckBox slowCB;
648
- JCheckBox boxCB;
649
- JCheckBox trackCB;
650
- JCheckBox smoothfocusCB;
1355
+ cToggleButton liveCB;
1356
+ cCheckBox supportCB;
1357
+ cCheckBox localCB;
1358
+ cCheckBox crowdCB;
1359
+ cCheckBox smoothCB;
1360
+ cCheckBox minshaderCB;
1361
+
1362
+ cToggleButton fastCB;
1363
+ cCheckBox slowCB;
1364
+ cCheckBox boxCB;
1365
+ cCheckBox zoomBoxCB;
1366
+ cCheckBox freezeCB;
1367
+ //cToggleButton trackCB;
1368
+ cCheckBox trackCB;
1369
+ cCheckBox smoothfocusCB;
6511370 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1371
+ cCheckBox speakerCameraCB;
1372
+ cCheckBox speakerFocusCB;
1373
+ cCheckBox debugCB;
1374
+
1375
+ cCheckBox oeilCB;
1376
+ cCheckBox shadowCB;
1377
+ cCheckBox autokeepCB;
1378
+ cCheckBox lookAtCB;
6571379
6581380 // static int COLOR = 1;
6591381 // static int MATERIAL = 2;
....@@ -661,9 +1383,9 @@
6611383
6621384 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631385
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1386
+ cCheckBox colorCB;
1387
+ cCheckBox materialCB;
1388
+ cCheckBox textureCB;
6671389
6681390 public void itemStateChanged(ItemEvent e)
6691391 {
....@@ -688,10 +1410,10 @@
6881410 dropAttributes |= Object3D.TEXTURE;
6891411 else
6901412 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1413
+ } else if(e.getSource() == liveCB)
6931414 {
6941415 cameraView.ToggleLive();
1416
+ refreshContents(false);
6951417 }
6961418 else if(e.getSource() == supportCB)
6971419 {
....@@ -707,6 +1429,12 @@
7071429 {
7081430 cameraView.ToggleInertia();
7091431 cameraView.repaint();
1432
+ }
1433
+ else if(e.getSource() == minshaderCB)
1434
+ {
1435
+ Globals.MINSHADER ^= true;
1436
+ cameraView.programInitialized = false;
1437
+ cameraView.repaint();
7101438 }
7111439 else if(e.getSource() == localCB)
7121440 {
....@@ -726,6 +1454,10 @@
7261454 Recompile();
7271455 cameraView.repaint();
7281456 // refreshContents();
1457
+ }
1458
+ else if(e.getSource() == zoomBoxCB)
1459
+ {
1460
+ cameraView.ToggleZoomBoxMode();
7291461 }
7301462 else if(e.getSource() == smoothfocusCB)
7311463 {
....@@ -752,6 +1484,18 @@
7521484 {
7531485 cameraView.ToggleOeil();
7541486 }
1487
+ else if(e.getSource() == shadowCB)
1488
+ {
1489
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1490
+ }
1491
+ else if(e.getSource() == freezeCB)
1492
+ {
1493
+ Globals.FREEZEONMOVE ^= true;
1494
+ }
1495
+ else if(e.getSource() == autokeepCB)
1496
+ {
1497
+ Globals.REPLACEONMAKE ^= true;
1498
+ }
7551499 else if(e.getSource() == lookAtCB)
7561500 {
7571501 cameraView.ToggleLookAt();
....@@ -768,7 +1512,8 @@
7681512
7691513 /**/
7701514 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1515
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1516
+ TreePath path = objEditor.jTree.getSelectionPath();
7721517 if ((path == null) || (path.getPathCount() <= 1)) {
7731518 // We can't move the root node or an empty selection
7741519 return;
....@@ -831,8 +1576,6 @@
8311576 }
8321577 }
8331578
834
- String string = (String) object;
835
-
8361579 System.out.println("Transfer = " + object + "; drop : " + target);
8371580 // if( object instanceof java.io.File[])
8381581 // {
....@@ -840,7 +1583,11 @@
8401583 // objEditor.DropFile((java.io.File[]) object, true);
8411584 // return;
8421585 // }
843
- if (string.charAt(0) == '/')
1586
+
1587
+ String string = object.toString();
1588
+
1589
+ // File path for Mac and Windows
1590
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441591 {
8451592 // file(s)
8461593 String[] names = string.split("\n");
....@@ -867,7 +1614,7 @@
8671614
8681615 flashIt = false;
8691616 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1617
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711618 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721619
8731620 if (group.selection.size() == 1)
....@@ -883,23 +1630,33 @@
8831630
8841631 assert target == objEditor.jTree;
8851632 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1633
+ Object3D destinationLeaf;
8861634 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1635
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881636 } catch (Exception e) {
8891637 System.out.println("destinationPath : " + destinationPath);
8901638 return;
8911639 }
8921640
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1641
+ for (int i=group.selection.size(); --i>=0;)
8941642 {
1643
+ Object3D child = (Object3D)group.selection.elementAt(i);
1644
+
1645
+ // Cannot move into itself
1646
+ if (child == destinationLeaf)
1647
+ return;
1648
+ }
1649
+
1650
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1651
+// {
8951652 loadClipboard(true);
8961653 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1654
+ pasteInto(false, false);
1655
+// } else {
1656
+// loadClipboard(false);
1657
+// objEditor.jTree.setSelectionPath(destinationPath);
1658
+// pasteInto(false, false); // true); // ???
1659
+// }
9031660 }
9041661 public void dropActionChanged(DropTargetDragEvent dtde)
9051662 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1759,109 @@
10021759
10031760 void buildCreateMenu(Menu menu)
10041761 {
1005
- gridItem = menu.add(new MenuItem("Grid"));
1006
- gridItem.addActionListener(this);
1007
- rectoidItem = menu.add(new MenuItem("Box"));
1008
- rectoidItem.addActionListener(this);
1009
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1010
- ellipsoidItem.addActionListener(this);
1011
- coneItem = menu.add(new MenuItem("Cone"));
1012
- coneItem.addActionListener(this);
1013
- torusItem = menu.add(new MenuItem("Torus"));
1014
- torusItem.addActionListener(this);
1015
- superItem = menu.add(new MenuItem("Superellipsoid"));
1016
- superItem.addActionListener(this);
1017
- particleItem = menu.add(new MenuItem("Particle system"));
1018
- particleItem.addActionListener(this);
1762
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1763
+ //heightFieldItem.addActionListener(this);
1764
+// gridItem = menu.add(new MenuItem("Grid"));
1765
+// gridItem.addActionListener(this);
1766
+// rectoidItem = menu.add(new MenuItem("Box"));
1767
+// rectoidItem.addActionListener(this);
1768
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1769
+// ellipsoidItem.addActionListener(this);
1770
+// coneItem = menu.add(new MenuItem("Cone"));
1771
+// coneItem.addActionListener(this);
1772
+// torusItem = menu.add(new MenuItem("Torus"));
1773
+// torusItem.addActionListener(this);
1774
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1775
+// superItem.addActionListener(this);
1776
+
1777
+ cameraItem = menu.add(new MenuItem("Camera"));
1778
+ cameraItem.addActionListener(this);
1779
+
1780
+ if (!Globals.ADVANCED)
1781
+ {
1782
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1783
+ kleinItem.addActionListener(this);
1784
+ }
1785
+
1786
+// particleItem = menu.add(new MenuItem("Particle system"));
1787
+// particleItem.addActionListener(this);
1788
+ if (Globals.ADVANCED)
1789
+ {
10191790 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201791 ragdollItem.addActionListener(this);
10211792 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221793 ragdoll2Item.addActionListener(this);
1794
+ }
10231795 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1796
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251797 meshItem.addActionListener(this);
10261798 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271799 // meshGroupItem.addActionListener(this);
1800
+ if (Globals.ADVANCED)
1801
+ {
10281802 springItem = menu.add(new MenuItem("Spring"));
10291803 springItem.addActionListener(this);
10301804 flagItem = menu.add(new MenuItem("Flag"));
10311805 flagItem.addActionListener(this);
1032
- bezierItem = menu.add(new MenuItem("Patch"));
1033
- bezierItem.addActionListener(this);
1034
- checkerItem = menu.add(new MenuItem("Checker"));
1035
- checkerItem.addActionListener(this);
10361806 blobItem = menu.add(new MenuItem("Blob"));
10371807 blobItem.addActionListener(this);
10381808 latheItem = menu.add(new MenuItem("Lathe"));
10391809 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1810
+ }
1811
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1812
+ bezierItem.addActionListener(this);
1813
+// overlayItem = menu.add(new MenuItem("Overlay"));
1814
+// overlayItem.addActionListener(this);
1815
+// lightItem = menu.add(new MenuItem("Light"));
1816
+// lightItem.addActionListener(this);
10421817 menu.add("-");
10431818 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441819 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1820
+// loopItem = menu.add(new MenuItem("Loop"));
1821
+// loopItem.addActionListener(this);
10471822 doubleItem = menu.add(new MenuItem("Fork"));
10481823 doubleItem.addActionListener(this);
1824
+ if (Globals.ADVANCED)
1825
+ {
10491826 tripleItem = menu.add(new MenuItem("Trident"));
10501827 tripleItem.addActionListener(this);
1051
- menu.add("-");
1052
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
1053
- importGFDItem.addActionListener(this);
1054
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
1055
- importVRMLX3DItem.addActionListener(this);
1056
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
1057
- importOBJItem.addActionListener(this);
1058
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
1059
- import3DSItem.addActionListener(this);
1828
+ }
10601829 }
10611830
10621831 void buildToolsMenu(Menu menu)
10631832 {
10641833 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651834 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1835
+ animationItem.setState(Globals.ANIMATION);
1836
+
1837
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1838
+ archiveItem.addActionListener(this);
10671839
10681840 menu.add("-");
10691841 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701842 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1843
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1844
+ textureFieldItem.addActionListener(this);
1845
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721846 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751847 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761848 reduceMorphItem.addActionListener(this);
10771849 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781850 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821851 menu.add("-");
1083
-
10841852 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851853 memoryItem.addActionListener(this);
1854
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1855
+ computeAOItem.addActionListener(this);
1856
+
1857
+ if (Globals.ADVANCED)
1858
+ {
1859
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1860
+ mirrorItem.addActionListener(this);
1861
+ menu.add("-");
10861862 menu.add(analyzeItem = new MenuItem("Analyze"));
10871863 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1864
+ menu.add(dumpItem = new MenuItem("Print"));
10891865 dumpItem.addActionListener(this);
10901866 // menu.add(pathItem = new MenuItem("From-to path"));
10911867 // pathItem.addActionListener(this);
....@@ -1094,6 +1870,8 @@
10941870 resetParentItem.addActionListener(this);
10951871 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961872 repairParentItem.addActionListener(this);
1873
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1874
+ repairShadowItem.addActionListener(this);
10971875 menu.add(invariantsItem = new MenuItem("Invariants"));
10981876 invariantsItem.addActionListener(this);
10991877 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1879,7 @@
11011879 menu.add("-");
11021880 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031881 editScriptItem.addActionListener(this);
1882
+ }
11041883 }
11051884
11061885 void ScreenFit()
....@@ -1223,9 +2002,34 @@
12232002 shadow.material = new cMaterial(obj.material);
12242003 shadow.material.diffuse = 0.0001f;
12252004 shadow.material.specular = 0.0001f;
2005
+ //shadow.projectedVertices[1].x = 300;
12262006
12272007 makeSomething(shadow);
12282008 }
2009
+
2010
+ private void ClearUnpinned()
2011
+ {
2012
+ //for (Object3D obj : listUI)
2013
+ for (int i=listUI.size(); --i>=0;)
2014
+ {
2015
+ Object3D obj = listUI.elementAt(i);
2016
+ if (!obj.pinned)
2017
+ {
2018
+ obj.CloseUI();
2019
+ listUI.remove(i);
2020
+ }
2021
+ }
2022
+ }
2023
+
2024
+ private void EditElement(Object3D elem, boolean newWindow)
2025
+ {
2026
+ // if (!(elem instanceof Composite))
2027
+ // newWindow = false;
2028
+ listUI.add(elem);
2029
+ elem.openEditWindow(this, newWindow); //, false);
2030
+ System.out.println("edit : " + elem);
2031
+ elem.editWindow.refreshContents(true); // ? new
2032
+ }
12292033
12302034 /**
12312035 * applyExample
....@@ -1429,9 +2233,9 @@
14292233
14302234 void Overwrite(int mask)
14312235 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2236
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332237 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2238
+ Object3D content = Grafreed.clipboard.get(0);
14352239
14362240 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372241 content = ((cGroup)content).get(0);
....@@ -1454,6 +2258,7 @@
14542258 //
14552259 public void actionPerformed(ActionEvent event) // , Object arg)
14562260 {
2261
+ Object source = event.getSource();
14572262 /*
14582263 if (event.getSource() == nameField)
14592264 {
....@@ -1465,11 +2270,11 @@
14652270 }
14662271 else
14672272 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2273
+ if (source == lookAtItem || source == lookFromItem)
14692274 {
14702275 ScreenFit();
14712276 } else
1472
- if (event.getSource() == switchItem)
2277
+ if (source == switchViewItem)
14732278 {
14742279 cVector v1 = new cVector();
14752280 cVector v2 = new cVector();
....@@ -1478,11 +2283,11 @@
14782283 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792284 objEditor.cameraView.repaint();
14802285 } else
1481
- if (event.getSource() == rectoidItem)
2286
+ if (source == rectoidItem || source == boxButton)
14822287 {
14832288 makeSomething(new Box());
14842289 } else
1485
- if (event.getSource() == particleItem)
2290
+ if (source == particleItem || source == particlesButton)
14862291 {
14872292 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882293 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2308,9 @@
15032308 applyExample(particleGeom, "SMOKE");
15042309 makeSomething(particleGeom);
15052310 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2311
+ if (source == ragdollItem || source == ragdoll2Item)
15072312 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2313
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092314
15102315 ragdoll.toParent = LA.newMatrix();
15112316 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2326,71 @@
15212326 makeSomething(ragdoll);
15222327 //makeSomething(new VehicleDemo());
15232328 } else
1524
- if (event.getSource() == gridItem)
2329
+ /*
2330
+ */
2331
+ if (source == heightFieldItem)
2332
+ {
2333
+ Object3D obj = new Object3D();
2334
+
2335
+ obj.CreateMaterial();
2336
+ obj.bRep = new BoundaryRep();
2337
+
2338
+ obj.bRep.CreateMesh(new iHeightField()
2339
+ {
2340
+ public double f(double x, double y)
2341
+ {
2342
+ // The Mandelbrot set is represented by coloring
2343
+ // each point (x,y) according to the number of
2344
+ // iterations it takes before the while loop in
2345
+ // this method ends. For points that are actually
2346
+ // in the Mandelbrot set, or very close to it, the
2347
+ // count will reach the maximum value, 80. These
2348
+ // points will be colored purple. All other colors
2349
+ // represent points that are definitely NOT in the set.
2350
+ x -= 600;
2351
+ y -= 500;
2352
+ x /= 200;
2353
+ y /= 200;
2354
+ int count = 0;
2355
+ double zx = x;
2356
+ double zy = y;
2357
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2358
+ double new_zx = zx*zx - zy*zy + x;
2359
+ zy = 2*zx*zy + y;
2360
+ zx = new_zx;
2361
+ count++;
2362
+ }
2363
+ return count; // Math.sqrt(count);
2364
+ }
2365
+ }, 1000,1000);
2366
+
2367
+ makeSomething(obj);
2368
+ } else
2369
+ if (source == gridItem || source == gridButton)
15252370 {
15262371 makeSomething(new Grid());
15272372 } else
1528
- if (event.getSource() == ellipsoidItem)
2373
+ if (source == ellipsoidItem || source == sphereButton)
15292374 {
15302375 makeSomething(new Sphere());
15312376 } else
1532
- if (event.getSource() == coneItem)
2377
+ if (source == coneItem || source == coneButton)
15332378 {
15342379 makeSomething(new Cone());
15352380 } else
1536
- if (event.getSource() == torusItem)
2381
+ if (source == torusItem || source == torusButton)
15372382 {
15382383 makeSomething(new Torus());
15392384 } else
1540
- if (event.getSource() == superItem)
2385
+ if (source == superItem || source == superButton)
15412386 {
15422387 makeSomething(new Superellipsoid());
15432388 } else
1544
- if (event.getSource() == blobItem)
2389
+ if (source == kleinItem || source == kleinButton)
2390
+ {
2391
+ makeSomething(new Klein());
2392
+ } else
2393
+ if (source == blobItem)
15452394 {
15462395 Blob blob = new Blob();
15472396 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2398,15 @@
15492398 //blob.retile();
15502399 makeSomething(blob);
15512400 } else
1552
- if (event.getSource() == latheItem)
2401
+ if (source == latheItem)
15532402 {
15542403 makeSomething(new Lathe());
15552404 } else
1556
- if (event.getSource() == bezierItem)
2405
+ if (source == bezierItem)
15572406 {
15582407 makeSomething(new BezierSurface());
15592408 } else
1560
- if (event.getSource() == checkerItem)
2409
+ if (source == overlayItem || source == overlayButton)
15612410 {
15622411 /*
15632412 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2419,9 @@
15702419 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712420 LA.matInvert(obj.toParent, obj.fromParent);
15722421 */
1573
- makeSomething(new CheckerIG());
2422
+ makeSomething(new Checker());
15742423 } else
1575
- if (event.getSource() == meshItem)
2424
+ if (source == meshItem)
15762425 {
15772426 Object3D itemtomake = new Object3D();
15782427 Object3D child;
....@@ -1593,35 +2442,52 @@
15932442 makeSomething(child);
15942443 }
15952444 } else
1596
- if (event.getSource() == springItem)
2445
+ if (source == springItem)
15972446 {
15982447 cSpring s = new cSpring();
15992448 s.setup();
16002449 makeSomething(s);
16012450 } else
1602
- if (event.getSource() == flagItem)
2451
+ if (source == flagItem)
16032452 {
16042453 cSpring s = new cFlag();
16052454 s.setup();
16062455 makeSomething(s);
16072456 } else
1608
- if (event.getSource() == lightItem)
2457
+ if (source == lightItem || source == lightButton)
16092458 {
16102459 makeSomething(new Light());
16112460 } else
1612
- if (event.getSource() == csgItem)
2461
+// if (source == skybox1Button ||
2462
+// source == skybox2Button ||
2463
+// source == skybox3Button ||
2464
+// source == skybox4Button ||
2465
+// source == skybox5Button ||
2466
+// source == skybox6Button ||
2467
+// source == skybox7Button ||
2468
+// source == skybox11Button ||
2469
+// source == skybox12Button ||
2470
+// source == skybox13Button ||
2471
+// source == skybox14Button ||
2472
+// source == skybox15Button ||
2473
+// source == skybox16Button ||
2474
+// source == skybox17Button)
2475
+// {
2476
+// ChangeSkybox(source);
2477
+// } else
2478
+ if (source == csgItem)
16132479 {
16142480 group(new CSG());
16152481 } else
1616
- if (event.getSource() == templateItem)
2482
+ if (source == templateItem)
16172483 {
16182484 group(new cTemplate());
16192485 } else
1620
- if (event.getSource() == attributeItem)
2486
+ if (source == attributeItem)
16212487 {
16222488 makeSomething(new Attribute());
16232489 } else
1624
- if (event.getSource() == pointflowItem)
2490
+ if (source == pointflowItem)
16252491 {
16262492 makeSomething(new PointFlow());
16272493 } else
....@@ -1633,7 +2499,7 @@
16332499 } else
16342500 */
16352501
1636
- if (event.getSource() == superLoopItem)
2502
+ if (source == superLoopItem)
16372503 {
16382504 Composite g = new cGroup();
16392505 for (int i=0; i<15; i++)
....@@ -1655,30 +2521,30 @@
16552521
16562522 group(g);
16572523 } else
1658
- if (event.getSource() == loopItem)
2524
+ if (source == loopItem || source == loopButton)
16592525 {
16602526 Composite csg = new GroupLeaf();
16612527 csg.count = 5;
16622528 group(csg);
1663
- Composite child = new cGroup();
2529
+ Composite child = new cGroup("Branch");
16642530 csg.addChild(child);
16652531 child.addChild(csg);
16662532 } else
1667
- if (event.getSource() == doubleItem)
2533
+ if (source == doubleItem)
16682534 {
1669
- Composite csg = new GroupLeaf();
2535
+ Composite csg = new GroupLeaf("Fork");
16702536 csg.count = 5;
16712537 group(csg);
1672
- Composite child = new cGroup();
2538
+ Composite child = new cGroup("Branch A");
16732539 csg.addChild(child);
16742540 child.addChild(csg);
1675
- child = new cGroup();
2541
+ child = new cGroup("Branch B");
16762542 csg.addChild(child);
16772543 child.addChild(csg);
16782544 } else
1679
- if (event.getSource() == tripleItem)
2545
+ if (source == tripleItem)
16802546 {
1681
- Composite csg = new GroupLeaf();
2547
+ Composite csg = new GroupLeaf("Trident");
16822548 csg.count = 4;
16832549 group(csg);
16842550 Composite child = new cGroup();
....@@ -1691,73 +2557,105 @@
16912557 csg.addChild(child);
16922558 child.addChild(csg);
16932559 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2560
+ if (source == computeAOItem)
16962561 {
1697
- ImportGFD();
2562
+ Globals.drawMode = CameraPane.OCCLUSION;
2563
+ cameraView.repaint();
16982564 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1700
- {
1701
- ImportVRMLX3D();
1702
- } else
1703
- if (event.getSource() == import3DSItem)
1704
- {
1705
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1706
- } else
1707
- if (event.getSource() == importOBJItem)
1708
- {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1710
- } else
1711
- if (event.getSource() == computeAOItem)
1712
- {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1715
- } else
1716
- if (event.getSource() == recompileItem)
2565
+ if (source == recompileItem)
17172566 {
17182567 Recompile();
17192568 refreshContents();
17202569 } else
1721
- if (event.getSource() == editScriptItem)
2570
+ if (source == editScriptItem)
17222571 {
17232572 OpenDialog();
17242573 refreshContents();
17252574 } else
1726
- if (event.getSource() == invariantsItem)
2575
+ if (source == invariantsItem)
17272576 {
17282577 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2578
+ Grafreed.grafreed.universe.invariants();
17302579 } else
1731
- if (event.getSource() == memoryItem)
2580
+ if (source == memoryItem)
17322581 {
17332582 //System.out.println("Invariants:");
17342583 PrintMemory();
17352584 } else
1736
- if (event.getSource() == pathItem)
2585
+ if (source == pathItem)
17372586 {
17382587 PrintPath();
17392588 } else
1740
- if (event.getSource() == analyzeItem)
2589
+ if (source == analyzeItem)
17412590 {
17422591 AnalyzeObject();
17432592 } else
1744
- if (event.getSource() == dumpItem)
2593
+ if (source == dumpItem)
17452594 {
17462595 DumpObject();
17472596 } else
1748
- if (event.getSource() == screenfitButton)
2597
+ if (source == minButton)
17492598 {
1750
- //Reload(lastConverter, lastFilename, true);
2599
+ Minimize();
2600
+ } else
2601
+ if (source == maxButton)
2602
+ {
2603
+ Maximize();
2604
+ } else
2605
+ if (source == fullButton)
2606
+ {
2607
+ ToggleFullScreen();
2608
+ } else
2609
+ if (source == previousVersionButton)
2610
+ {
2611
+ // Go to previous version
2612
+ //if (!Undo())
2613
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2614
+ PreviousVersion();
2615
+ } else
2616
+ if (source == restoreButton)
2617
+ {
2618
+ // Restore current version
2619
+ Restore();
2620
+ //restoreButton.setEnabled(false);
2621
+ } else
2622
+ if (source == replaceButton)
2623
+ {
2624
+ // Overwrite current version
2625
+ Replace();
2626
+ //replaceButton.setEnabled(false);
2627
+ } else
2628
+ if (source == nextVersionButton)
2629
+ {
2630
+ // Go to next version
2631
+ NextVersion();
2632
+ } else
2633
+ if (source == saveVersionButton)
2634
+ {
2635
+ // Save a new version
2636
+ if (!Save(true))
2637
+ java.awt.Toolkit.getDefaultToolkit().beep();
2638
+ } else
2639
+ if (source == deleteVersionButton)
2640
+ {
2641
+ // Delete a new version
2642
+ DeleteVersion();
2643
+ } else
2644
+ if (source == oneStepButton)
2645
+ {
2646
+ Globals.ONESTEP = true;
2647
+ cameraView.repaint();
2648
+ } else
2649
+ if (source == screenfitButton)
2650
+ {
17512651 ScreenFit();
17522652 } else
1753
- if (event.getSource() == screenfitpointButton)
2653
+ if (source == screenfitpointButton)
17542654 {
1755
- //Reload(lastConverter, lastFilename, true);
17562655 ScreenFitPoint();
17572656 } else
1758
- if (event.getSource() == snapobjectButton)
2657
+ if (source == snapobjectButton)
17592658 {
1760
- //Reload(lastConverter, lastFilename, true);
17612659 SnapObject();
17622660 } else
17632661 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2664,13 @@
17662664 // Recompile();
17672665 // refreshContents();
17682666 // } else
1769
- if (event.getSource() == gcButton)
2667
+ if (source == gcButton)
17702668 {
17712669 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722670 System.gc();
17732671 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742672 } else
1775
- if (event.getSource() == editLeafItem)
2673
+ if (source == editLeafItem)
17762674 {
17772675 Object3D obj;
17782676 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2684,78 @@
17862684 }
17872685 refreshContents(true);
17882686 } else
1789
- if (event.getSource() == openWindowItem)
2687
+ if (source == openWindowItem)
17902688 {
17912689 EditSelection(true);
17922690 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2691
+ if (source == cutItem || source == clearButton)
17942692 {
17952693 loadClipboard(true);
17962694 } else
1797
- if (event.getSource() == duplicateItem)
2695
+ if (source == undoItem)
17982696 {
1799
- Object3D keep = GraphreeD.clipboard;
2697
+ PreviousVersion();
2698
+ } else
2699
+ if (source == redoItem)
2700
+ {
2701
+ NextVersion();
2702
+ } else
2703
+ if (source == duplicateItem)
2704
+ {
2705
+ Object3D keep = Grafreed.clipboard;
18002706 loadClipboard(false);
18012707 paste(false);
1802
- GraphreeD.clipboard = keep;
2708
+ Grafreed.clipboard = keep;
18032709 } else
1804
- if (event.getSource() == cloneItem)
2710
+ if (source == cloneItem)
18052711 {
18062712 CloneSelection(false);
18072713 } else
1808
- if (event.getSource() == cloneSupportItem)
2714
+ if (source == cloneSupportItem)
18092715 {
18102716 CloneSelection(true);
18112717 } else
1812
- if (event.getSource() == copyItem)
2718
+ if (source == copyItem)
18132719 {
18142720 loadClipboard(false);
18152721 } else
1816
- if (event.getSource() == pasteItem)
2722
+ if (source == pasteItem)
18172723 {
18182724 paste(false);
18192725 } else
1820
- if (event.getSource() == pasteLinkItem)
2726
+ if (source == pasteIntoItem)
18212727 {
1822
- pasteInto(false);
2728
+ pasteInto(true, false);
18232729 } else
1824
- if (event.getSource() == pasteCloneItem)
2730
+ if (source == pasteLinkItem)
18252731 {
1826
- pasteInto(true);
2732
+ pasteInto(false, false);
18272733 } else
1828
- if (event.getSource() == pasteExpandItem)
2734
+ if (source == pasteCloneItem)
2735
+ {
2736
+ pasteInto(true, true);
2737
+ } else
2738
+ if (source == pasteExpandItem)
18292739 {
18302740 paste(true);
18312741 } else
1832
- if (event.getSource() == synchronizeItem)
2742
+ if (source == synchronizeItem)
18332743 {
18342744 Overwrite(Object3D.TRANSFORM);
18352745 } else
1836
- if (event.getSource() == overwriteNameItem)
2746
+ if (source == overwriteNameItem)
18372747 {
18382748 Overwrite(Object3D.NAME);
18392749 } else
1840
- if (event.getSource() == overwriteUVItem)
2750
+ if (source == overwriteUVItem)
18412751 {
18422752 Overwrite(Object3D.UV);
18432753 } else
1844
- if (event.getSource() == overwriteMatItem)
2754
+ if (source == overwriteMatItem)
18452755 {
2756
+ /* july 2015
18462757 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2758
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482759 else
18492760 {
18502761 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2767,16 @@
18562767 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572768 }
18582769 }
2770
+ */
2771
+
2772
+ Overwrite(dropAttributes);
18592773 }
1860
- if (event.getSource() == overwriteGeoItem)
2774
+ if (source == overwriteGeoItem)
18612775 {
18622776 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2777
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642778 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2779
+// Object3D content = GrafreeD.clipboard.get(0);
18662780 //
18672781 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682782 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2788,7 @@
18742788 // refreshContents();
18752789 // }
18762790 } else
1877
- if (event.getSource() == generateMeshItem)
2791
+ if (source == generateMeshItem)
18782792 {
18792793 //if (group.selection.size() == 1)
18802794 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2799,7 @@
18852799 ResetModel();
18862800 refreshContents();
18872801 } else
1888
- if (event.getSource() == extractGeometriesItem)
2802
+ if (source == extractGeometriesItem)
18892803 {
18902804 boolean one = false;
18912805
....@@ -1912,7 +2826,7 @@
19122826 ResetModel();
19132827 refreshContents();
19142828 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2829
+ if (source == cloneGeometriesItem)
19162830 {
19172831 boolean one = false;
19182832
....@@ -1938,32 +2852,37 @@
19382852 ResetModel();
19392853 refreshContents();
19402854 } else
1941
- if (event.getSource() == shareGeometriesItem)
2855
+ if (source == shareGeometriesItem)
19422856 {
19432857 boolean one = false;
19442858
19452859 if (group.selection.size() == 1)
19462860 one = true;
19472861
2862
+ Object3D merge = null;
2863
+
19482864 Object3D content = new cGroup();
19492865
19502866 for (int i=0; i<group.selection.size(); i++)
19512867 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2868
+ merge = new Merge(group.selection.get(i));
19532869
19542870 if (one)
1955
- makeSomething(sel, false);
2871
+ makeSomething(merge, false);
19562872 else
1957
- content.addChild(sel);
2873
+ content.addChild(merge);
19582874 }
19592875
19602876 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2877
+ makeSomething(content, true);
2878
+ else
2879
+ {
2880
+ ResetModel();
2881
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2882
+ refreshContents();
2883
+ }
19652884 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2885
+ if (source == mergeGeometriesItem)
19672886 {
19682887 boolean one = false;
19692888
....@@ -1993,11 +2912,11 @@
19932912 ResetModel();
19942913 refreshContents();
19952914 } else
1996
- if (event.getSource() == linkverticesItem)
2915
+ if (source == linkverticesItem)
19972916 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2917
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992918 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2919
+// Object3D content = GrafreeD.clipboard.get(0);
20012920 //
20022921 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032922 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2925,48 @@
20062925 // group.selection.get(0).setMasterThis(content); // should be identity
20072926 // refreshContents();
20082927 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2928
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20102929 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2930
+ Object3D content = Grafreed.clipboard.get(0);
20122931
20132932 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142933 content = ((cGroup)content).get(0);
20152934
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2935
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172936 for (int i=0; i<group.selection.size(); i++)
20182937 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2938
+ boolean random = CameraPane.SWITCH;
2939
+ CameraPane.SWITCH = false; // parse all random nodes
20212940 group.selection.get(i).linkVerticesThis(content);
20222941 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2942
+ CameraPane.SWITCH = random;
20242943 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2944
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262945 refreshContents();
20272946 }
20282947 } else
2029
- if (event.getSource() == resetsupportItem)
2948
+ if (source == resetsupportItem)
20302949 {
20312950 for (int i=0; i<group.selection.size(); i++)
20322951 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2952
+ boolean random = CameraPane.SWITCH;
2953
+ CameraPane.SWITCH = false; // parse all random nodes
20352954 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2955
+ CameraPane.SWITCH = random;
20372956 }
20382957
20392958 refreshContents();
20402959 } else
2041
- if (event.getSource() == resetreferencesItem)
2960
+ if (source == relinkverticesItem)
2961
+ {
2962
+ boolean random = CameraPane.SWITCH;
2963
+ CameraPane.SWITCH = false; // parse all random nodes
2964
+ group.selection.RelinkToSupport();
2965
+ CameraPane.SWITCH = random;
2966
+
2967
+ refreshContents();
2968
+ } else
2969
+ if (source == resetreferencesItem)
20422970 {
20432971 for (int i=0; i<group.selection.size(); i++)
20442972 {
....@@ -2047,11 +2975,11 @@
20472975
20482976 refreshContents();
20492977 } else
2050
- if (event.getSource() == setMasterItem)
2978
+ if (source == setMasterItem)
20512979 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2980
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20532981 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2982
+ Object3D content = Grafreed.clipboard.get(0);
20552983
20562984 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572985 content = ((cGroup)content).get(0);
....@@ -2060,13 +2988,13 @@
20602988 refreshContents();
20612989 }
20622990 } else
2063
- if (event.getSource() == poseMeshItem)
2991
+ if (source == poseMeshItem)
20642992 {
20652993 if (group.selection.size() == 1)
20662994 {
2067
- if (GraphreeD.clipboard.size() == 1)
2995
+ if (Grafreed.clipboard.size() == 1)
20682996 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2997
+ Object3D content = Grafreed.clipboard.get(0);
20702998
20712999 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723000 content = ((cGroup)content).get(0);
....@@ -2079,19 +3007,19 @@
20793007 }
20803008
20813009 } else
2082
- if (event.getSource() == revertMeshItem)
3010
+ if (source == revertMeshItem)
20833011 {
20843012 RevertMeshes();
20853013 } else
2086
- if (event.getSource() == resetMeshItem)
3014
+ if (source == resetAllItem)
20873015 {
20883016 ResetAll();
20893017 } else
2090
- if (event.getSource() == stepAllItem)
3018
+ if (source == stepAllItem)
20913019 {
20923020 StepAll();
20933021 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3022
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953023 {
20963024 //int indices[] = jList.getSelectedIndices();
20973025 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3027,46 @@
20993027
21003028 ClearSelection(false);
21013029 } else
2102
- if (event.getSource() == clearAllItem)
3030
+ if (source == clearAllItem)
21033031 {
21043032 ClearSelection(true);
21053033 } else
2106
- if (event.getSource() == grabItem)
3034
+ if (source == grabItem || source == groupButton)
21073035 {
2108
- group(new cGroup(), true);
3036
+ group(new cGroup(), false); // true);
21093037 } else
2110
- if (event.getSource() == frontItem)
3038
+ if (source == hideItem)
3039
+ {
3040
+ group(new HiddenObject());
3041
+ } else
3042
+ if (source == frontItem)
21113043 {
21123044 front();
21133045 } else
2114
- if (event.getSource() == backItem)
3046
+ if (source == backItem)
21153047 {
21163048 back();
21173049 } else
2118
- if (event.getSource() == cameraItem)
3050
+ if (source == cameraItem)
21193051 {
21203052 makeSomething(new Camera());
21213053 } else
2122
- if (event.getSource() == compositeItem)
3054
+ if (source == compositeItem || source == compositeButton)
21233055 {
21243056 group(new Composite());
21253057 } else
2126
- if (event.getSource() == randomItem)
3058
+ if (source == switchItem || source == switchButton)
21273059 {
21283060 RandomNode random = new RandomNode();
21293061 group(random);
21303062 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3063
+ random.name = random.get(0).name + "Switch";
21323064 } else
2133
- if (event.getSource() == physicsItem)
3065
+ if (source == physicsItem)
21343066 {
21353067 group(new PhysicsNode());
21363068 } else
2137
- if (event.getSource() == frameselectorItem)
3069
+ if (source == frameselectorItem)
21383070 {
21393071 for (int i=0; i<group.selection.size(); i++)
21403072 {
....@@ -2146,7 +3078,7 @@
21463078 ResetModel();
21473079 refreshContents();
21483080 } else
2149
- if (event.getSource() == switchGeoItem)
3081
+ if (source == switchGeoItem)
21503082 {
21513083 for (int i=0; i<group.selection.size(); i++)
21523084 {
....@@ -2158,7 +3090,7 @@
21583090 ResetModel();
21593091 refreshContents();
21603092 } else
2161
- if (event.getSource() == switchTransfoItem)
3093
+ if (source == switchTransfoItem)
21623094 {
21633095 for (int i=0; i<group.selection.size(); i++)
21643096 {
....@@ -2170,7 +3102,7 @@
21703102 ResetModel();
21713103 refreshContents();
21723104 } else
2173
- if (event.getSource() == morphItem)
3105
+ if (source == morphItem)
21743106 {
21753107 for (int i=0; i<group.selection.size(); i++)
21763108 {
....@@ -2182,7 +3114,7 @@
21823114 ResetModel();
21833115 refreshContents();
21843116 } else
2185
- if (event.getSource() == scriptNodeItem)
3117
+ if (source == scriptNodeItem)
21863118 {
21873119 boolean atleastone = false;
21883120
....@@ -2221,191 +3153,252 @@
22213153 }
22223154 }
22233155 } else
2224
- if (event.getSource() == linkerItem)
3156
+ if (source == linkerItem)
22253157 {
22263158 group(new cLinker());
22273159 } else
2228
- if (event.getSource() == textureItem)
3160
+ if (source == textureItem || source == textureButton)
22293161 {
22303162 group(new TextureNode());
22313163 } else
2232
- if (event.getSource() == shadowXItem)
3164
+ if (source == billboardItem)
3165
+ {
3166
+ group(new BillboardNode());
3167
+ } else
3168
+ if (source == shadowXItem)
22333169 {
22343170 CastShadow(0);
22353171 } else
2236
- if (event.getSource() == shadowYItem)
3172
+ if (source == shadowYItem)
22373173 {
22383174 CastShadow(1);
22393175 } else
2240
- if (event.getSource() == shadowZItem)
3176
+ if (source == shadowZItem)
22413177 {
22423178 CastShadow(2);
22433179 } else
2244
- if (event.getSource() == ungroupItem)
3180
+ if (source == ungroupItem || source == ungroupButton)
22453181 {
2246
- ungroup();
3182
+ boolean hasRoot = false;
3183
+
3184
+ for (int i=0; i<group.selection.size(); i++)
3185
+ {
3186
+ if (group.selection.get(i) == group)
3187
+ {
3188
+ hasRoot = true;
3189
+ break;
3190
+ }
3191
+ }
3192
+
3193
+ if (!hasRoot)
3194
+ {
3195
+ for (int i=0; i<group.selection.size(); i++)
3196
+ {
3197
+ Ungroup(group.selection.get(i));
3198
+ }
3199
+
3200
+ ClearSelection(false);
3201
+
3202
+ refreshContents();
3203
+ }
22473204 } else
2248
- if (event.getSource() == genUVItem)
3205
+ if (source == genUVItem)
22493206 {
22503207 GenUV();
22513208 } else
2252
- if (event.getSource() == genNormalsCADItem)
3209
+ if (source == genNormalsCADItem)
22533210 {
22543211 GenNormals(true);
22553212 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3213
+ if (source == genNormalsMESHItem)
3214
+ {
3215
+ GenNormalsMESH();
3216
+ } else
3217
+ if (source == genNormalsORGANItem)
22573218 {
22583219 GenNormals(false);
22593220 } else
2260
- if (event.getSource() == stripifyItem)
3221
+ if (source == genNormalsMINEItem)
3222
+ {
3223
+ GenNormalsMINE();
3224
+ } else
3225
+ if (source == stripifyItem)
22613226 {
22623227 Stripify();
22633228 } else
2264
- if (event.getSource() == unstripifyItem)
3229
+ if (source == unstripifyItem)
22653230 {
22663231 Unstripify();
22673232 } else
2268
- if (event.getSource() == trimItem)
3233
+ if (source == trimItem)
22693234 {
22703235 Trim();
22713236 } else
2272
- if (event.getSource() == untrimItem)
3237
+ if (source == untrimItem)
22733238 {
22743239 Untrim();
22753240 } else
2276
- if (event.getSource() == clearColorsItem)
3241
+ if (source == clearColorsItem)
22773242 {
22783243 ClearColors();
22793244 } else
2280
- if (event.getSource() == clearMaterialsItem)
3245
+ if (source == clearMaterialsItem)
22813246 {
22823247 ClearMaterials();
22833248 } else
2284
- if (event.getSource() == liveleavesItem)
3249
+ if (source == liveleavesItem)
22853250 {
22863251 LiveLeaves(true);
22873252 } else
2288
- if (event.getSource() == unliveleavesItem)
3253
+ if (source == unliveleavesItem)
22893254 {
22903255 LiveLeaves(false);
22913256 } else
2292
- if (event.getSource() == supportleavesItem)
3257
+ if (source == supportleavesItem)
22933258 {
22943259 SupportLeaves(true);
22953260 } else
2296
- if (event.getSource() == unsupportleavesItem)
3261
+ if (source == unsupportleavesItem)
22973262 {
22983263 SupportLeaves(false);
22993264 } else
2300
- if (event.getSource() == hideleavesItem)
3265
+ if (source == hideleavesItem)
23013266 {
23023267 HideLeaves(true);
23033268 } else
2304
- if (event.getSource() == showleavesItem)
3269
+ if (source == showleavesItem)
23053270 {
23063271 HideLeaves(false);
23073272 } else
2308
- if (event.getSource() == markleavesItem)
3273
+ if (source == markleavesItem)
23093274 {
23103275 MarkLeaves(true);
23113276 } else
2312
- if (event.getSource() == unmarkleavesItem)
3277
+ if (source == unmarkleavesItem)
23133278 {
23143279 MarkLeaves(false);
23153280 } else
2316
- if (event.getSource() == flipVItem)
3281
+ if (source == rewindleavesItem)
3282
+ {
3283
+ RewindLeaves(true);
3284
+ } else
3285
+ if (source == unrewindleavesItem)
3286
+ {
3287
+ RewindLeaves(false);
3288
+ } else
3289
+ if (source == randomleavesItem)
3290
+ {
3291
+ RandomLeaves(true);
3292
+ } else
3293
+ if (source == unrandomleavesItem)
3294
+ {
3295
+ RandomLeaves(false);
3296
+ } else
3297
+ if (source == flipVItem)
23173298 {
23183299 FlipV(true);
23193300 } else
2320
- if (event.getSource() == unflipVItem)
3301
+ if (source == unflipVItem)
23213302 {
23223303 FlipV(false);
23233304 } else
2324
- if (event.getSource() == lowTexturesItem)
3305
+ if (source == lowTexturesItem)
23253306 {
23263307 SetTexRes(0);
23273308 } else
2328
- if (event.getSource() == normalTexturesItem)
3309
+ if (source == normalTexturesItem)
23293310 {
23303311 SetTexRes(1);
23313312 } else
2332
- if (event.getSource() == highTexturesItem)
3313
+ if (source == highTexturesItem)
23333314 {
23343315 SetTexRes(2);
23353316 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3317
+ if (source == veryhighTexturesItem)
23373318 {
23383319 SetTexRes(3);
23393320 } else
2340
- if (event.getSource() == maxTexturesItem)
3321
+ if (source == maxTexturesItem)
23413322 {
23423323 SetTexRes(4);
23433324 } else
2344
- if (event.getSource() == panoTexturesItem)
3325
+ if (source == panoTexturesItem)
23453326 {
23463327 SetTexRes(5);
23473328 } else
2348
- if (event.getSource() == reverseNormalsItem)
3329
+ if (source == reverseNormalsItem)
23493330 {
23503331 ReverseNormals();
23513332 } else
2352
- if (event.getSource() == parseverticesItem)
3333
+ if (source == parseverticesItem)
23533334 {
23543335 ParseVertices();
23553336 } else
2356
- if (event.getSource() == alignItem)
3337
+ if (source == textureFieldItem)
3338
+ {
3339
+ TextureVertices();
3340
+ } else
3341
+ if (source == alignItem)
23573342 {
23583343 Align();
23593344 } else
2360
- if (event.getSource() == mirrorItem)
3345
+ if (source == mirrorItem)
23613346 {
23623347 MirrorPoses();
23633348 } else
2364
- if (event.getSource() == reduceMorphItem)
3349
+ if (source == reduceMorphItem)
23653350 {
23663351 MeshReduction(false);
23673352 } else
2368
- if (event.getSource() == reduce34MorphItem)
3353
+ if (source == reduce34MorphItem)
23693354 {
23703355 MeshReduction(true);
23713356 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3357
+ if (source == reverseTrianglesItem)
23733358 {
23743359 ReverseTriangles();
23753360 } else
2376
- if (event.getSource() == reduceMeshItem)
3361
+ if (source == reduceMeshItem)
23773362 {
23783363 ReduceMesh(false);
23793364 } else
2380
- if (event.getSource() == reduce34MeshItem)
3365
+ if (source == reduce34MeshItem)
23813366 {
23823367 ReduceMesh(true);
23833368 } else
2384
- if (event.getSource() == increaseMeshItem)
3369
+ if (source == increaseMeshItem)
23853370 {
23863371 IncreaseMesh();
23873372 } else
2388
- if (event.getSource() == clipMeshItem)
3373
+ if (source == clipMeshItem)
23893374 {
23903375 ClipMesh();
23913376 } else
2392
- if (event.getSource() == smoothMeshItem)
3377
+ if (source == smoothMeshItem)
23933378 {
23943379 SmoothMesh();
23953380 } else
2396
- if (event.getSource() == transformgeometryItem)
3381
+ if (source == transformGeometryItem)
23973382 {
23983383 TransformGeometry();
23993384 } else
2400
- if (event.getSource() == resetTransformItem)
3385
+ if (source == transformChildrenItem)
3386
+ {
3387
+ TransformChildren();
3388
+ } else
3389
+ if (source == resetTransformItem)
24013390 {
24023391 ResetTransform();
24033392 } else
2404
- if (event.getSource() == resetCentroidItem)
3393
+ if (source == resetCentroidItem)
24053394 {
2406
- ResetCentroid();
3395
+ ResetCentroid(true);
24073396 } else
2408
- if (event.getSource() == resetParentItem)
3397
+ if (source == resetCentroidXZItem)
3398
+ {
3399
+ ResetCentroid(false);
3400
+ } else
3401
+ if (source == resetParentItem)
24093402 {
24103403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113404 {
....@@ -2415,7 +3408,7 @@
24153408
24163409 refreshContents();
24173410 } else
2418
- if (event.getSource() == repairParentItem)
3411
+ if (source == repairParentItem)
24193412 {
24203413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213414 {
....@@ -2429,7 +3422,21 @@
24293422
24303423 refreshContents();
24313424 } else
2432
- if (event.getSource() == sortbysizeItem)
3425
+ if (source == repairShadowItem)
3426
+ {
3427
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3428
+ {
3429
+ Object3D obj = (Object3D)e.nextElement();
3430
+ obj.RepairShadow();
3431
+// for (int i=0; i<obj.size(); i++)
3432
+// {
3433
+// obj.get(i).parent = obj;
3434
+// }
3435
+ }
3436
+
3437
+ refreshContents();
3438
+ } else
3439
+ if (source == sortbysizeItem)
24333440 {
24343441 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353442 {
....@@ -2441,7 +3448,7 @@
24413448 ResetModel();
24423449 refreshContents();
24433450 } else
2444
- if (event.getSource() == sortbynameItem)
3451
+ if (source == sortbynameItem)
24453452 {
24463453 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473454 {
....@@ -2453,7 +3460,7 @@
24533460 ResetModel();
24543461 refreshContents();
24553462 } else
2456
- if (event.getSource() == attachPigmentItem)
3463
+ if (source == attachPigmentItem)
24573464 {
24583465 String texture = GetFile("Attach pigment");
24593466 Object3D obj;
....@@ -2465,7 +3472,7 @@
24653472
24663473 refreshContents();
24673474 } else
2468
- if (event.getSource() == detachPigmentItem)
3475
+ if (source == detachPigmentItem)
24693476 {
24703477 Object3D obj;
24713478 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3483,7 @@
24763483
24773484 refreshContents();
24783485 } else
2479
- if (event.getSource() == attachBumpItem)
3486
+ if (source == attachBumpItem)
24803487 {
24813488 String texture = GetFile("Attach bump");
24823489 Object3D obj;
....@@ -2488,18 +3495,18 @@
24883495
24893496 refreshContents();
24903497 } else
2491
- if (event.getSource() == detachBumpItem)
3498
+ if (source == detachBumpItem)
24923499 {
24933500 Object3D obj;
24943501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953502 {
24963503 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3504
+ obj.ResetBumpTexture();
24983505 }
24993506
25003507 refreshContents();
25013508 } else
2502
- if (event.getSource() == pigmentBumpItem)
3509
+ if (source == pigmentBumpItem)
25033510 {
25043511 Object3D obj;
25053512 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3517,262 @@
25103517
25113518 refreshContents();
25123519 } else
2513
- if (event.getSource() == flashSelectionButton)
3520
+ if (source == embedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(true);
3527
+ }
3528
+
3529
+ refreshContents();
3530
+ } else
3531
+ if (source == deEmbedTexturesItem)
3532
+ {
3533
+ Object3D obj;
3534
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3535
+ {
3536
+ obj = (Object3D)e.nextElement();
3537
+ obj.EmbedTextures(false);
3538
+ }
3539
+
3540
+ CameraPane.texturepigment.clear();
3541
+ CameraPane.texturebump.clear();
3542
+
3543
+ refreshContents();
3544
+ } else
3545
+ if (source == flashSelectionButton)
25143546 {
25153547 CameraPane.flash = true;
25163548 refreshContents();
25173549 } else
2518
- if (event.getSource() == oneButton)
3550
+ if (source == oneButton)
25193551 {
25203552 } else
2521
- if (event.getSource() == twoButton)
3553
+ if (source == twoButton)
25223554 {
25233555 radio.layout = twoButton;
3556
+
3557
+ if (CameraPane.FULLSCREEN)
3558
+ fullscreenLayout = radio.layout;
3559
+
25243560 // bug
25253561 //gridPanel.setDividerLocation(1.0);
25263562 //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2529
- bigThree.remove(XYZPanel);
2530
- aWindowConstraints.gridx = 0;
2531
- aWindowConstraints.gridy = 0;
2532
- aWindowConstraints.gridwidth = 1;
2533
- // aConstraints.gridheight = 3;
2534
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2535
- aWindowConstraints.weightx = 0;
2536
- aWindowConstraints.weighty = 1;
2537
- //bigThree.add(jtp, aWindowConstraints);
2538
- aWindowConstraints.weightx = 1;
2539
- aWindowConstraints.gridwidth = 3;
2540
- // aConstraints.gridheight = 3;
2541
- aWindowConstraints.gridx = 1;
2542
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2544
- aWindowConstraints.weightx = 0;
2545
- aWindowConstraints.gridx = 4;
2546
- aWindowConstraints.gridwidth = 1;
2547
- // aConstraints.gridheight = 3;
2548
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2549
- //bigThree.add(XYZPanel, aWindowConstraints);
2550
- bigThree.revalidate();
3563
+// bigThree.remove(scenePanel);
3564
+// bigThree.remove(centralPanel);
3565
+// bigThree.remove(XYZPanel);
3566
+// aWindowConstraints.gridx = 0;
3567
+// aWindowConstraints.gridy = 0;
3568
+// aWindowConstraints.gridwidth = 1;
3569
+// // aConstraints.gridheight = 3;
3570
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3571
+// aWindowConstraints.weightx = 0;
3572
+// aWindowConstraints.weighty = 1;
3573
+// //bigThree.add(jtp, aWindowConstraints);
3574
+// aWindowConstraints.weightx = 1;
3575
+// aWindowConstraints.gridwidth = 3;
3576
+// // aConstraints.gridheight = 3;
3577
+// aWindowConstraints.gridx = 1;
3578
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3579
+// bigThree.add(centralPanel, aWindowConstraints);
3580
+// aWindowConstraints.weightx = 0;
3581
+// aWindowConstraints.gridx = 4;
3582
+// aWindowConstraints.gridwidth = 1;
3583
+// // aConstraints.gridheight = 3;
3584
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3585
+// //bigThree.add(XYZPanel, aWindowConstraints);
3586
+// scenePanel.setVisible(false);
3587
+// centralPanel.setVisible(true);
3588
+// XYZPanel.setVisible(false);
3589
+ bigThree.ClearUI();
3590
+ bigThree.add(centralPanel);
3591
+ bigThree.FlushUI();
3592
+
3593
+ cameraView.requestFocusInWindow();
3594
+
3595
+// refreshContents(true);
3596
+//
3597
+// try
3598
+// {
3599
+// java.awt.Robot bot = new java.awt.Robot();
3600
+// int mask = InputEvent.BUTTON1_MASK;
3601
+// bot.mouseMove(100, 100);
3602
+// bot.mousePress(mask);
3603
+// bot.mouseRelease(mask);
3604
+// }
3605
+// catch (Exception e)
3606
+// {
3607
+//
3608
+// }
3609
+
25513610 } else
2552
- if (event.getSource() == threeButton)
3611
+ if (source == threeButton)
25533612 {
25543613 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2557
- bigThree.remove(XYZPanel);
2558
- aWindowConstraints.gridx = 0;
2559
- aWindowConstraints.gridy = 0;
2560
- aWindowConstraints.gridwidth = 1;
2561
- // aConstraints.gridheight = 3;
2562
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2563
- aWindowConstraints.weightx = 0;
2564
- aWindowConstraints.weighty = 1;
2565
- //bigThree.add(jtp, aWindowConstraints);
2566
- aWindowConstraints.weightx = 1;
2567
- aWindowConstraints.gridwidth = 3;
2568
- // aConstraints.gridheight = 3;
2569
- aWindowConstraints.gridx = 1;
2570
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2572
- aWindowConstraints.weightx = 0;
2573
- aWindowConstraints.gridx = 4;
2574
- aWindowConstraints.gridwidth = 1;
2575
- // aConstraints.gridheight = 3;
2576
- aConstraints.fill = GridBagConstraints.VERTICAL;
2577
- bigThree.add(XYZPanel, aWindowConstraints);
2578
- bigThree.revalidate();
3614
+
3615
+ if (CameraPane.FULLSCREEN)
3616
+ fullscreenLayout = radio.layout;
3617
+
3618
+// bigThree.remove(scenePanel);
3619
+// bigThree.remove(centralPanel);
3620
+// bigThree.remove(XYZPanel);
3621
+// aWindowConstraints.gridx = 0;
3622
+// aWindowConstraints.gridy = 0;
3623
+// aWindowConstraints.gridwidth = 1;
3624
+// // aConstraints.gridheight = 3;
3625
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3626
+// aWindowConstraints.weightx = 0;
3627
+// aWindowConstraints.weighty = 1;
3628
+// //bigThree.add(jtp, aWindowConstraints);
3629
+// aWindowConstraints.weightx = 1;
3630
+// aWindowConstraints.gridwidth = 3;
3631
+// // aConstraints.gridheight = 3;
3632
+// aWindowConstraints.gridx = 1;
3633
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3634
+// bigThree.add(centralPanel, aWindowConstraints);
3635
+// aWindowConstraints.weightx = 0;
3636
+// aWindowConstraints.gridx = 4;
3637
+// aWindowConstraints.gridwidth = 1;
3638
+// // aConstraints.gridheight = 3;
3639
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3640
+// bigThree.add(XYZPanel, aWindowConstraints);
3641
+// bigThree.validate();
3642
+// scenePanel.setVisible(false);
3643
+// centralPanel.setVisible(true);
3644
+// XYZPanel.setVisible(true);
3645
+ bigThree.ClearUI();
3646
+ bigThree.add(scenePanel);
3647
+ bigThree.add(centralPanel);
3648
+ bigThree.FlushUI();
3649
+
3650
+ cameraView.requestFocusInWindow();
25793651 } else
2580
- if (event.getSource() == fourButton)
3652
+ if (source == fourButton)
25813653 {
25823654 radio.layout = fourButton;
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aWindowConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2591
- aWindowConstraints.weightx = 1;
2592
- aWindowConstraints.weighty = 1;
2593
- bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- //bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aWindowConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
3655
+
3656
+ if (CameraPane.FULLSCREEN)
3657
+ fullscreenLayout = radio.layout;
3658
+
3659
+// bigThree.remove(scenePanel);
3660
+// bigThree.remove(centralPanel);
3661
+// bigThree.remove(XYZPanel);
3662
+// aWindowConstraints.gridx = 0;
3663
+// aWindowConstraints.gridy = 0;
3664
+// aWindowConstraints.gridwidth = 1;
3665
+// // aWindowConstraints.gridheight = 3;
3666
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3667
+// aWindowConstraints.weightx = 1;
3668
+// aWindowConstraints.weighty = 1;
3669
+// bigThree.add(scenePanel, aWindowConstraints);
3670
+// aWindowConstraints.weightx = 1;
3671
+// aWindowConstraints.gridwidth = 3;
3672
+// // aConstraints.gridheight = 3;
3673
+// aWindowConstraints.gridx = 1;
3674
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3675
+// //bigThree.add(cameraPanel, aWindowConstraints);
3676
+// aWindowConstraints.weightx = 0;
3677
+// aWindowConstraints.gridx = 4;
3678
+// aWindowConstraints.gridwidth = 1;
3679
+// // aWindowConstraints.gridheight = 3;
3680
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3681
+// //bigThree.add(XYZPanel, aWindowConstraints);
3682
+// bigThree.validate();
3683
+// scenePanel.setVisible(true);
3684
+// centralPanel.setVisible(false);
3685
+// XYZPanel.setVisible(false);
3686
+ bigThree.ClearUI();
3687
+ bigThree.add(scenePanel);
3688
+ bigThree.FlushUI();
3689
+
3690
+ cameraView.requestFocusInWindow();
26073691 } else
2608
- if (event.getSource() == sixButton)
3692
+ if (source == sixButton)
26093693 {
26103694 radio.layout = sixButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aWindowConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aWindowConstraints.gridheight = 3;
2632
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2633
- //bigThree.add(XYZPanel, aConstraints);
2634
- bigThree.revalidate();
3695
+
3696
+ if (CameraPane.FULLSCREEN)
3697
+ fullscreenLayout = radio.layout;
3698
+
3699
+// bigThree.remove(scenePanel);
3700
+// bigThree.remove(centralPanel);
3701
+// bigThree.remove(XYZPanel);
3702
+// aWindowConstraints.gridx = 0;
3703
+// aWindowConstraints.gridy = 0;
3704
+// aWindowConstraints.gridwidth = 1;
3705
+// // aConstraints.gridheight = 3;
3706
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3707
+// aWindowConstraints.weightx = 0;
3708
+// aWindowConstraints.weighty = 1;
3709
+// bigThree.add(scenePanel, aWindowConstraints);
3710
+// aWindowConstraints.weightx = 1;
3711
+// aWindowConstraints.gridwidth = 3;
3712
+// // aWindowConstraints.gridheight = 3;
3713
+// aWindowConstraints.gridx = 1;
3714
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3715
+// bigThree.add(centralPanel, aWindowConstraints);
3716
+// aWindowConstraints.weightx = 0;
3717
+// aWindowConstraints.gridx = 4;
3718
+// aWindowConstraints.gridwidth = 1;
3719
+// // aWindowConstraints.gridheight = 3;
3720
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3721
+// //bigThree.add(XYZPanel, aConstraints);
3722
+// bigThree.validate();
3723
+// scenePanel.setVisible(true);
3724
+// centralPanel.setVisible(true);
3725
+// XYZPanel.setVisible(false);
3726
+ bigThree.ClearUI();
3727
+ bigThree.add(centralPanel);
3728
+ bigThree.add(scenePanel);
3729
+ bigThree.FlushUI();
3730
+
3731
+ cameraView.requestFocusInWindow();
26353732 } else
2636
- if (event.getSource() == sevenButton)
3733
+ if (source == sevenButton)
26373734 {
26383735 radio.layout = sevenButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2647
- aWindowConstraints.weightx = 0;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aWindowConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
3736
+
3737
+ if (CameraPane.FULLSCREEN)
3738
+ fullscreenLayout = radio.layout;
3739
+
3740
+// bigThree.remove(scenePanel);
3741
+// bigThree.remove(centralPanel);
3742
+// bigThree.remove(XYZPanel);
3743
+// aWindowConstraints.gridx = 0;
3744
+// aWindowConstraints.gridy = 0;
3745
+// aWindowConstraints.gridwidth = 1;
3746
+// // aWindowConstraints.gridheight = 3;
3747
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3748
+// aWindowConstraints.weightx = 0;
3749
+// aWindowConstraints.weighty = 1;
3750
+// bigThree.add(scenePanel, aWindowConstraints);
3751
+// aWindowConstraints.weightx = 1;
3752
+// aWindowConstraints.gridwidth = 3;
3753
+// // aWindowConstraints.gridheight = 3;
3754
+// aWindowConstraints.gridx = 1;
3755
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3756
+// bigThree.add(centralPanel, aWindowConstraints);
3757
+// aWindowConstraints.weightx = 0;
3758
+// aWindowConstraints.gridx = 4;
3759
+// aWindowConstraints.gridwidth = 1;
3760
+// // aConstraints.gridheight = 3;
3761
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3762
+// bigThree.add(XYZPanel, aWindowConstraints);
3763
+// bigThree.validate();
3764
+// scenePanel.setVisible(true);
3765
+// centralPanel.setVisible(true);
3766
+// XYZPanel.setVisible(true);
3767
+ bigThree.ClearUI();
3768
+ bigThree.add(scenePanel);
3769
+ bigThree.add(centralPanel);
3770
+ bigThree.add(XYZPanel);
3771
+ bigThree.FlushUI();
3772
+
3773
+ cameraView.requestFocusInWindow();
26633774 } else
2664
- if (event.getSource() == rootButton)
3775
+ if (source == rootButton)
26653776 {
26663777 Object3D obj;
26673778 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3782,85 @@
26713782 EditObject(obj);
26723783 }
26733784
3785
+ cameraView.requestFocusInWindow();
26743786 refreshContents(true);
26753787 } else
2676
- if (event.getSource() == closeButton)
3788
+ if (source == closeButton)
26773789 {
26783790 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793791 cRadio ab;
26803792 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813793 {
26823794 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3795
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843796 {
3797
+ // Patch to avoid bug with transparency.
3798
+ if (!ab.hadMaterial)
3799
+ {
3800
+ ab.object.material = null;
3801
+ }
3802
+
26853803 buttonGroup.remove(ab);
26863804 radioPanel.remove(ab);
26873805
2688
- ab.GetObject().editWindow = null;
3806
+ //ab.GetObject().editWindow = null;
3807
+ ab.GetObject().manipWindow = null;
26893808 // ab.GetObject().objectUI = null; // ?????????
26903809
26913810 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923811 break;
26933812 }
26943813 }
3814
+
3815
+ cameraView.requestFocusInWindow();
26953816 refreshContents(true);
26963817 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3818
+ if (source == editItem || source == editButton)
26983819 {
3820
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3821
+ {
3822
+ Object3D child = (Object3D)e.nextElement();
3823
+ child.pinned = true;
3824
+ }
3825
+
26993826 EditSelection(false);
27003827 } else
2701
- if (event.getSource() == uneditButton)
3828
+ if (source == uneditButton)
27023829 {
27033830 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043831 {
27053832 Object3D child = (Object3D)e.nextElement();
27063833 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3834
+ child.pinned = false;
27083835 child.CloseUI();
27093836 listUI.remove(child);
3837
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27103838
2711
- child.editWindow = null; // ???????????
3839
+ //child.editWindow = null; // ???????????
27123840 }
2713
- objEditor.ctrlPanel.revalidate();
3841
+ objEditor.ctrlPanel.FlushUI();
27143842 //objEditor.jTree.clearSelection();
27153843 //objEditor.ResetSliders();
27163844 refreshContents(true);
27173845 } else
2718
- if (event.getSource() == clearPanelButton)
3846
+ if (source == clearPanelButton)
27193847 {
27203848 assert(copy == group);
27213849 //copy.ClearUI();
27223850 for (Object3D obj : listUI)
27233851 {
3852
+ obj.pinned = false;
27243853 obj.CloseUI();
27253854 }
27263855 listUI.clear();
3856
+ SetPinStates(group.selection.size() > 0);
27273857 refreshContents(true);
27283858 } else
2729
- if (event.getSource() == allParamsButton)
3859
+ if (source == allParamsButton)
27303860 {
27313861 assert(copy == group);
27323862
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3863
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343864
27353865 for (Object3D obj : listUI)
27363866 {
....@@ -2747,19 +3877,19 @@
27473877
27483878 refreshContents(true);
27493879 } else
2750
- if (event.getSource() == unselectButton)
3880
+ if (source == unselectButton)
27513881 {
27523882 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3883
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543884 objEditor.ResetSliders();
27553885 refreshContents(true);
27563886 } else
2757
- if(event.getSource() instanceof cRadio)
3887
+ if(source instanceof cRadio)
27583888 {
27593889 group.parent = keepparent;
27603890 group.attributes = 0;
27613891 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3892
+ /*cRadio*/ radio = (cRadio)source;
27633893 Object3D obj = radio.GetObject();
27643894 System.out.println("Edit " + obj);
27653895 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3909,10 @@
27793909 }
27803910
27813911 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3912
+
3913
+ SetUndoStates();
3914
+
3915
+ //Globals.theRenderer.object = group;
27833916 if(!useclient)
27843917 {
27853918 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +3921,55 @@
27883921 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893922 cameraView.targetLookAt.set(radio.camera.lookAt);
27903923 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3924
+ //cameraView.lighttouched = true;
3925
+ Globals.lighttouched = true;
27923926 topView.object = group;
27933927 frontView.object = group;
27943928 sideView.object = group;
27953929 }
2796
- group.editWindow = this;
3930
+
3931
+// fix "+" issue
3932
+ //group.editWindow = this;
3933
+ group.manipWindow = this;
3934
+
27973935 /*
27983936 currentLayout = radio.layout;
27993937 if (currentLayout == null)
28003938 currentLayout = sevenButton;
28013939 */
28023940 radio.layout.doClick();
3941
+
3942
+ ClearUnpinned();
3943
+
3944
+ //Grafreed.Assert(group != null);
3945
+ //Grafreed.Assert(group.selection != null);
3946
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3947
+ if (group.selection == null || group.selection.size() == 1)
3948
+ EditSelection(false);
28033949 keepparent = group.parent;
28043950 // PARENT = NULL or not???
28053951 //group.parent = null; // ROOT
28063952 //group.attributes = -1;
28073953 ResetModel();
3954
+
3955
+ cameraView.requestFocusInWindow();
28083956 refreshContents(true);
2809
- }
3957
+ } else if (event.getSource() == editCameraItem)
3958
+ {
3959
+ cameraView.ProtectCamera();
3960
+ cameraView.requestFocusInWindow();
3961
+ cameraView.repaint();
3962
+ return;
3963
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3964
+ {
3965
+ cameraView.RevertCamera();
3966
+ cameraView.requestFocusInWindow();
3967
+ cameraView.repaint();
3968
+ return;
3969
+ // } else if (event.getSource() == textureButton)
3970
+ // {
3971
+ // return; // true;
3972
+ }
28103973 else
28113974 {
28123975 //return super.action(event, arg);
....@@ -2815,7 +3978,6 @@
28153978 }
28163979
28173980 boolean useclient = false;
2818
- cRadio radio;
28193981
28203982 void ToggleRoot()
28213983 {
....@@ -2824,7 +3986,7 @@
28243986 if (useclient)
28253987 {
28263988 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3989
+ Globals.lighttouched = true;
28283990 //topView.object = client;
28293991 //frontView.object = client;
28303992 //sideView.object = client;
....@@ -2832,7 +3994,7 @@
28323994 else
28333995 {
28343996 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3997
+ Globals.lighttouched = true;
28363998 //topView.object = group;
28373999 //frontView.object = group;
28384000 //sideView.object = group;
....@@ -2867,6 +4029,28 @@
28674029 refreshContents();
28684030 }
28694031
4032
+ void TransformChildren()
4033
+ {
4034
+ Object3D obj;
4035
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4036
+ {
4037
+ obj = (Object3D)e.nextElement();
4038
+ obj.KeepTextureMatrices();
4039
+ obj.TransformChildren();
4040
+ obj.RestoreTextureMatrices();
4041
+
4042
+// if (obj.parent == null)
4043
+// {
4044
+// System.out.println("NULL PARENT!");
4045
+// new Exception().printStackTrace();
4046
+// }
4047
+// else
4048
+// TouchTransform(obj);
4049
+// //obj.parent.Touch();
4050
+ }
4051
+
4052
+ refreshContents();
4053
+ }
28704054
28714055 void ResetTransform()
28724056 {
....@@ -2979,7 +4163,7 @@
29794163 refreshContents();
29804164 }
29814165
2982
- void ResetCentroid()
4166
+ void ResetCentroid(boolean full)
29834167 {
29844168 Object3D obj;
29854169 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4178,16 @@
29944178 LA.matIdentity(Object3D.mat);
29954179 obj.getBounds(minima, maxima, false);
29964180 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4181
+ if (full)
4182
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984183 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994184 obj.TransformMesh(Object3D.mat);
4185
+
30004186 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4187
+ if (full)
4188
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024189 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4190
+
30034191 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044192 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054193 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4216,8 @@
30284216
30294217 int size = obj.MemorySize();
30304218
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4219
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4220
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324221 }
30334222 }
30344223 catch (Exception e)
....@@ -3065,9 +4254,9 @@
30654254 obj = (Object3D)e.nextElement();
30664255
30674256 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4257
+ Grafreed.AnalyzeObject(obj);
30694258 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4259
+ Grafreed.AnalyzeObject(obj.bRep);
30714260
30724261 // System.err.println((size/1024) + " KB is the size of " + obj);
30734262 }
....@@ -3109,6 +4298,20 @@
31094298 void GenNormals(boolean crease)
31104299 {
31114300 group.GenNormalsS(crease);
4301
+
4302
+ refreshContents();
4303
+ }
4304
+
4305
+ void GenNormalsMESH()
4306
+ {
4307
+ group.GenNormalsMeshS();
4308
+
4309
+ refreshContents();
4310
+ }
4311
+
4312
+ void GenNormalsMINE()
4313
+ {
4314
+ group.selection.GenNormalsMINE();
31124315
31134316 refreshContents();
31144317 }
....@@ -3157,104 +4360,259 @@
31574360
31584361 //Object3D buffer;
31594362 cVector temp = new cVector();
3160
- BoundaryRep temprep;
3161
- Object3D nodes;
3162
- Vector<Vertex> vertices;
3163
-
3164
- public void Vertex(Object3D node, Vertex v)
3165
- {
3166
- vertices.add(v);
3167
- nodes.addElement(node);
3168
-
3169
- if (temprep.GetCache(v) != null)
3170
- {
3171
- temprep.Remove(v);
3172
- }
3173
- else
3174
- {
3175
- temprep.Remember(v);
3176
- }
3177
- }
3178
-
3179
- public void Face(Object3D node, Face f)
3180
- {
3181
-
3182
- }
3183
-
4363
+// BoundaryRep temprep;
4364
+// Object3D nodes;
4365
+// Vector<Vertex> vertices;
4366
+//
4367
+// cGroup buffer;
4368
+//
4369
+// public void Vertex(Object3D node, Vertex v)
4370
+// {
4371
+//// vertices.add(v);
4372
+//// nodes.addElement(node);
4373
+////
4374
+//// if (temprep.GetCache(v) != null)
4375
+//// {
4376
+//// temprep.Remove(v);
4377
+//// } else
4378
+//// {
4379
+//// temprep.Remember(v);
4380
+//// }
4381
+//
4382
+// //Object3D node = nodes.get(index);
4383
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4384
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4385
+//
4386
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4387
+//
4388
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4389
+//
4390
+// cGroup g = new cGroup();
4391
+//
4392
+// if (g.toParent == null)
4393
+// {
4394
+// g.toParent = LA.newMatrix();
4395
+// g.fromParent = LA.newMatrix();
4396
+// }
4397
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4398
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4399
+//
4400
+// g.add(GrafreeD.clipboard);
4401
+//
4402
+// buffer.add(g);
4403
+// }
4404
+//
4405
+// public void Face(Object3D node, Face f)
4406
+// {
4407
+//
4408
+// }
4409
+//
4410
+// void ParseVerticesOld() // ??
4411
+// {
4412
+// //if (group.selection.size() != 1)
4413
+// // return;
4414
+//
4415
+// temprep = new BoundaryRep();
4416
+// nodes = new Object3D();
4417
+// vertices = new Vector<Vertex>();
4418
+//
4419
+// boolean epsequal = GrafreeD.epsequal;
4420
+// GrafreeD.epsequal = true;
4421
+//
4422
+// for (int i=0; i<group.selection.size(); i++)
4423
+// {
4424
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4425
+//
4426
+// group.selection.get(i).Parse(
4427
+//this );
4428
+//
4429
+// int repsize = temprep.VertexCount();
4430
+// int tablesize = temprep.vertextable.size();
4431
+// int nodesize = nodes.size();
4432
+//
4433
+// assert(vertices.size() == nodes.size());
4434
+//
4435
+// temprep.vertextable.elements();
4436
+//
4437
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4438
+//
4439
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4440
+// {
4441
+// cGroup g = new cGroup();
4442
+//
4443
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4444
+//
4445
+// Object3D node = nodes.get(index);
4446
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4447
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4448
+//
4449
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4450
+//
4451
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4452
+//
4453
+// if (g.toParent == null)
4454
+// {
4455
+// g.toParent = LA.newMatrix();
4456
+// g.fromParent = LA.newMatrix();
4457
+// }
4458
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4459
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4460
+//
4461
+// g.add(GrafreeD.clipboard);
4462
+//
4463
+// buffer.add(g);
4464
+// }
4465
+//
4466
+// makeSomething(buffer, i==group.selection.size()-1);
4467
+// }
4468
+//
4469
+// GrafreeD.epsequal = epsequal;
4470
+//
4471
+// //buffer = null;
4472
+// temprep = null;
4473
+// nodes = null;
4474
+//
4475
+// refreshContents();
4476
+// }
4477
+
31844478 void ParseVertices()
31854479 {
3186
- //if (group.selection.size() != 1)
3187
- // return;
3188
-
3189
- temprep = new BoundaryRep();
3190
- nodes = new Object3D();
3191
- vertices = new Vector<Vertex>();
3192
-
3193
- boolean epsequal = GraphreeD.epsequal;
3194
- GraphreeD.epsequal = true;
4480
+ boolean epsequal = Grafreed.epsequal;
4481
+ Grafreed.epsequal = true;
31954482
31964483 for (int i=0; i<group.selection.size(); i++)
31974484 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4485
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994486
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4487
+ group.selection.get(i).Parse(
4488
+
4489
+ new iParse()
4490
+ {
4491
+ public void Vertex(Object3D node, Vertex v)
4492
+ {
4493
+ temp.set(v);
4494
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054495
3206
- assert(vertices.size() == nodes.size());
3207
-
3208
- temprep.vertextable.elements();
3209
-
3210
- java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4496
+ cGroup g = new cGroup();
32114497
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4498
+ if (g.toParent == null)
4499
+ {
4500
+ g.toParent = LA.newMatrix();
4501
+ g.fromParent = LA.newMatrix();
4502
+ }
4503
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4504
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154505
3216
- int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3217
- Object3D node = nodes.get(index);
3218
- temp.set(vertices.get(index)); // temprep.GetVertex(k));
3219
- // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4506
+ g.add(Grafreed.clipboard);
32204507
3221
- LA.xformPos(temp, node.GlobalTransformInv(), temp);
3222
-
3223
- // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3224
-
3225
- if (g.toParent == null)
3226
- {
3227
- g.toParent = LA.newMatrix();
3228
- g.fromParent = LA.newMatrix();
3229
- }
3230
- LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3231
- LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4508
+ buffer.add(g);
4509
+ }
32324510
3233
- g.add(GraphreeD.clipboard);
4511
+ public void Face(Object3D node, Face f)
4512
+ {
32344513
3235
- buffer.add(g);
3236
- }
4514
+ }
4515
+ }
4516
+ );
32374517
32384518 makeSomething(buffer, i==group.selection.size()-1);
32394519 }
32404520
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4521
+ Grafreed.epsequal = epsequal;
32464522
32474523 refreshContents();
32484524 }
3249
-
4525
+
4526
+ void TextureVertices()
4527
+ {
4528
+ for (int i=0; i<group.selection.size(); i++)
4529
+ {
4530
+ group.selection.get(i).Parse(
4531
+ new iParse()
4532
+ {
4533
+ public void Vertex(Object3D node, Vertex v)
4534
+ {
4535
+ cTexture tex = node.GetTextures();
4536
+ String pigment = Object3D.GetPigment(tex);
4537
+ //String bump = Object3D.GetBump(tex);
4538
+
4539
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4540
+
4541
+ try
4542
+ {
4543
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4544
+ }
4545
+ catch (Exception e)
4546
+ {
4547
+ System.err.println("FAIL: " + node);
4548
+ }
4549
+
4550
+ double s = v.s;
4551
+
4552
+ if (s == 1)
4553
+ s = 0;
4554
+
4555
+ double t = v.t;
4556
+
4557
+ if (t == 1)
4558
+ t = 0;
4559
+
4560
+ int indexs = (int) (texturedata.getWidth() * s);
4561
+ int indext = (int) (texturedata.getHeight() * t);
4562
+
4563
+ int index = indext * texturedata.getWidth() + indexs;
4564
+
4565
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4566
+
4567
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4568
+
4569
+ float scale = bytebuf.get(index*slide) & 0xFF;
4570
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4571
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4572
+ scale /= 3;
4573
+
4574
+ scale /= 0xFF;
4575
+ // c'est quoi ca? scale /= 4;
4576
+
4577
+ //v.AO = scale;
4578
+
4579
+ v.x += v.norm.x * scale;
4580
+ v.y += v.norm.y * scale;
4581
+ v.z += v.norm.z * scale;
4582
+ }
4583
+
4584
+ public void Face(Object3D node, Face f)
4585
+ {
4586
+ }
4587
+ }
4588
+ );
4589
+ }
4590
+
4591
+ refreshContents();
4592
+ }
4593
+
32504594 void Align()
32514595 {
4596
+ if (group.selection.size() == 0)
4597
+ return;
4598
+
4599
+ cVector bbmin = new cVector();
4600
+ cVector bbmax = new cVector();
4601
+
4602
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4603
+
4604
+ double dx = bbmax.x - bbmin.x;
4605
+ double dy = bbmax.y - bbmin.y;
4606
+ double dz = bbmax.z - bbmin.z;
4607
+
4608
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4609
+
32524610 for (int i=0; i<group.selection.size(); i++)
32534611 {
32544612 Object3D obj = group.selection.get(i);
32554613
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4614
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4615
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584616 }
32594617
32604618 refreshContents();
....@@ -3267,7 +4625,7 @@
32674625 // ref.SaveSupports();
32684626 // Object3D par = ref.parent;
32694627 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4628
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714629 // ref.parent = par;
32724630 // ref.RestoreSupports();
32734631
....@@ -3275,11 +4633,11 @@
32754633
32764634 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774635
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4636
+ boolean random = CameraPane.SWITCH;
4637
+ CameraPane.SWITCH = false; // parse all random nodes
32804638 lowres.linkVerticesThis(null);
32814639 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4640
+ CameraPane.SWITCH = random;
32834641
32844642 System.err.flush();
32854643
....@@ -3297,7 +4655,7 @@
32974655 // lowres.SaveSupports();
32984656 // par = lowres.parent;
32994657 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4658
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014659 Object3D newlow = CloneObject(lowres, false);
33024660 newlow.name = sn.switchobject.get(i).name;
33034661 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4677,7 @@
33194677 return;
33204678
33214679 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4680
+ Object3D ref = Grafreed.clipboard.get(0);
33234681
33244682 Object3D newgroup = new Object3D("Po:" + poses.name);
33254683
....@@ -3488,7 +4846,7 @@
34884846 group.selection.RelinkToSupport(); // july 2014
34894847 System.out.println("DONE.");
34904848 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4849
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924850 }
34934851
34944852 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4871,20 @@
35134871
35144872 void ClipMesh()
35154873 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4874
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174875 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4876
+ Object3D content = Grafreed.clipboard.get(0);
35194877
35204878 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214879 content = ((cGroup)content).get(0);
35224880
35234881 // for (int i=0; i<group.selection.size(); i++)
35244882 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4883
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264884 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4885
+ group.selection.ClipMesh(Grafreed.clipboard);
35284886 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4887
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304888 System.out.println("DONE.");
35314889 refreshContents();
35324890 }
....@@ -3571,6 +4929,18 @@
35714929 void MarkLeaves(boolean hide)
35724930 {
35734931 group.selection.MarkLeaves(hide);
4932
+ refreshContents();
4933
+ }
4934
+
4935
+ void RewindLeaves(boolean hide)
4936
+ {
4937
+ group.selection.RewindLeaves(hide);
4938
+ refreshContents();
4939
+ }
4940
+
4941
+ void RandomLeaves(boolean hide)
4942
+ {
4943
+ group.selection.RandomLeaves(hide);
35744944 refreshContents();
35754945 }
35764946
....@@ -3645,28 +5015,25 @@
36455015 // }
36465016 // }
36475017
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525018 void EditSelection(boolean newWindow)
36535019 {
5020
+ if (group.selection == null)
5021
+ {
5022
+ EditElement(group, newWindow); // ? new
5023
+ return;
5024
+ }
5025
+
36545026 // aConstraints.gridy = 0;
36555027 for (int i=0; i<group.selection.size(); i++)
36565028 {
36575029 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585030 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5031
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605032
36615033 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5034
+ if(elem != group || !newWindow)
36635035 {
3664
- // if (!(elem instanceof Composite))
3665
- // newWindow = false;
3666
- listUI.add(elem);
3667
- elem.openEditWindow(this, newWindow); //, false);
3668
- System.out.println("edit : " + elem);
3669
- elem.editWindow.refreshContents(true); // ? new
5036
+ EditElement(elem, newWindow); // ? new
36705037 }
36715038 }
36725039 }
....@@ -3729,9 +5096,7 @@
37295096
37305097 freezemodel = false;
37315098 }
3732
-
3733
- boolean flashIt = true;
3734
-
5099
+
37355100 public void valueChanged(TreeSelectionEvent e)
37365101 //public boolean handleEvent(Event event)
37375102 {
....@@ -3741,7 +5106,8 @@
37415106 //new Exception().printStackTrace();
37425107
37435108 freezemodel = true;
3744
-
5109
+ ClearUnpinned();
5110
+
37455111 /**/
37465112 //switch (event.id)
37475113 {
....@@ -3749,7 +5115,6 @@
37495115 //case 702: // Event.LIST_DESELECT
37505116 group.deselectAll();
37515117 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535118 if (tps != null)
37545119 {
37555120 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5123,39 @@
37585123
37595124 //if (child.parent != null)
37605125 //child.parent.addSelectee(child);
5126
+ objEditor.SetMaterial(child);
37615127 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655128 }
37665129 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5130
+// else
5131
+// {
5132
+// objEditor.SetMaterial(group); // .GetMaterial());
5133
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5134
+// System.err.println("info : " + group.GetPath());
5135
+// }
37735136
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5137
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775138 CameraPane.flash = true;
37785139
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5140
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805141 // a camera
37815142 {
3782
- CameraPane.camerachangeframe = 0; // don't refuse it
3783
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3784
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3785
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5143
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5144
+ {
5145
+ CameraPane.camerachangeframe = 0; // don't refuse it
5146
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5147
+ }
5148
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5149
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865150 }
37875151
5152
+ if (tps != null && tps.length == 1)
5153
+ {
5154
+ EditSelection(false);
5155
+ }
5156
+
5157
+ SetPinStates(tps != null && tps.length > 0);
5158
+
37885159 refreshContents();
37895160 //return true;
37905161 }
....@@ -3793,6 +5164,37 @@
37935164
37945165 freezemodel = false;
37955166 }
5167
+
5168
+ void SetPinStates(boolean enabled)
5169
+ {
5170
+ editButton.setEnabled(enabled);
5171
+ uneditButton.setEnabled(enabled);
5172
+ unselectButton.setEnabled(enabled);
5173
+ flashSelectionButton.setEnabled(enabled);
5174
+
5175
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5176
+ }
5177
+
5178
+ void refreshContents(boolean cp)
5179
+ {
5180
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5181
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5182
+ {
5183
+ objEditor.ClearInfo(); // .GetMaterial());
5184
+
5185
+ for (int i=0; i < group.selection.Size(); i++)
5186
+ {
5187
+ Object3D child = (Object3D) group.selection.get(i);
5188
+
5189
+ objEditor.AddInfo(child, this, true);
5190
+ System.err.println("info : " + child.GetPath());
5191
+ }
5192
+
5193
+ objEditor.SetText(); // jan 2014
5194
+ }
5195
+
5196
+ super.refreshContents(cp);
5197
+ }
37965198
37975199 void linkSomething(Object3D thing)
37985200 {
....@@ -3864,16 +5266,19 @@
38645266 {
38655267 if (group.selection.isEmpty())
38665268 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5269
+
5270
+ Grafreed.clipboardIsTempGroup = false;
38685271 Composite tGroup = null;
38695272 if (group.selection.size() > 0) // 1)
38705273 {
38715274 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5275
+ Grafreed.clipboardIsTempGroup = true;
38735276 }
38745277
38755278 if (cut)
38765279 {
5280
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5281
+// Save();
38775282 //int indices[] = jList.getSelectedIndices();
38785283 //for (int i = indices.length - 1; i >= 0; i--)
38795284 //jList.remove(indices[i]);
....@@ -3909,16 +5314,16 @@
39095314 //System.out.println("cut " + child);
39105315 //System.out.println("parent = " + child.parent);
39115316 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5317
+ if (Grafreed.clipboardIsTempGroup)
39135318 tGroup.add/*Child*/(tmp);
39145319 else
3915
- GraphreeD.clipboard = tmp;
5320
+ Grafreed.clipboard = tmp;
39165321 }
39175322 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5323
+ if (Grafreed.clipboardIsTempGroup)
39195324 tGroup.add/*Child*/(child);
39205325 else
3921
- GraphreeD.clipboard = child;
5326
+ Grafreed.clipboard = child;
39225327 }
39235328
39245329 //ResetModel();
....@@ -3950,21 +5355,23 @@
39505355 //System.out.println("cut " + elem);
39515356 //System.out.println("parent = " + elem.parent);
39525357 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5358
+ if (Grafreed.clipboardIsTempGroup)
39545359 tGroup.add/*Child*/(tmp);
39555360 else
3956
- GraphreeD.clipboard = tmp;
5361
+ Grafreed.clipboard = tmp;
39575362 }
39585363 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5364
+ if (Grafreed.clipboardIsTempGroup)
39605365 tGroup.add/*Child*/(child);
39615366 else
3962
- GraphreeD.clipboard = child;
5367
+ Grafreed.clipboard = child;
39635368 }
39645369
39655370 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5371
+
5372
+ if (Grafreed.clipboardIsTempGroup)
5373
+ Grafreed.clipboard = tGroup;
5374
+
39685375 if (cut)
39695376 {
39705377 ResetModel();
....@@ -3974,11 +5381,15 @@
39745381
39755382 void paste(boolean expand)
39765383 {
3977
- // if (GraphreeD.clipboard == null)
5384
+ if (Globals.REPLACEONMAKE)
5385
+ Save();
5386
+ boolean keep = Globals.REPLACEONMAKE;
5387
+ Globals.REPLACEONMAKE = false;
5388
+ // if (GrafreeD.clipboard == null)
39785389 // return;
39795390 boolean first = true;
39805391
3981
- if (GraphreeD.clipboardIsTempGroup)
5392
+ if (Grafreed.clipboardIsTempGroup)
39825393 {
39835394 Composite temp;
39845395
....@@ -3989,7 +5400,7 @@
39895400 temp = (Composite)Applet3D.clipboard.deepCopy();
39905401 */
39915402 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5403
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935404 {
39945405 Object3D child = (Object3D)e.nextElement();
39955406
....@@ -4003,7 +5414,7 @@
40035414 else
40045415 elem = child.deepCopy(); // ?
40055416 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5417
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075418 // elem = elem.get(0);
40085419 makeSomething(elem, true); // ?? first);
40095420 //group.addChild(elem);
....@@ -4023,23 +5434,24 @@
40235434 //Object3D cb = Applet3D.clipboard;
40245435 //temp.addChild(cb);
40255436 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4026
- assert(GraphreeD.clipboard.parent == null);
4027
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4028
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4029
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4030
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
5437
+ assert(Grafreed.clipboard.parent == null);
5438
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5439
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5440
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5441
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315442 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5443
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5444
+ Grafreed.clipboard.get(0).parent = keepparent;
40345445 }
40355446
5447
+ Globals.REPLACEONMAKE = keep;
40365448 ResetModel();
40375449 refreshContents();
40385450 }
40395451
4040
- void pasteInto(boolean copyit)
5452
+ void pasteInto(boolean copyit, boolean clone)
40415453 {
4042
-// if (GraphreeD.clipboard == null)
5454
+// if (GrafreeD.clipboard == null)
40435455 // return;
40445456
40455457 if (group.selection.size() != 1)
....@@ -4066,15 +5478,22 @@
40665478 if (copyit)
40675479 {
40685480 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5481
+ if (clone)
5482
+ {
5483
+ CloneClipboard(false); // sept 2014
5484
+ }
5485
+ else
5486
+ {
5487
+ paste(false);
5488
+ }
40705489 }
40715490 else
40725491 {
40735492 boolean first = true;
40745493
4075
- if (GraphreeD.clipboardIsTempGroup)
5494
+ if (Grafreed.clipboardIsTempGroup)
40765495 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5496
+ Composite temp = (Composite)Grafreed.clipboard;
40785497 Object3D copy;
40795498 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805499 {
....@@ -4084,7 +5503,7 @@
40845503 }
40855504 } else
40865505 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5506
+ linkSomething(Grafreed.clipboard); //.get(0));
40885507 }
40895508 }
40905509 }
....@@ -4161,6 +5580,10 @@
41615580
41625581 void group(Object3D csg, boolean grab)
41635582 {
5583
+ if (Globals.REPLACEONMAKE)
5584
+ Save();
5585
+ boolean keep = Globals.REPLACEONMAKE;
5586
+ Globals.REPLACEONMAKE = false;
41645587 if (//false) // why??
41655588 !group.selection.isEmpty())
41665589 {
....@@ -4274,8 +5697,34 @@
42745697 //node.add(csg);
42755698 //makeSomething(node);
42765699 makeSomething(csg);
5700
+ Globals.REPLACEONMAKE = keep;
42775701 }
42785702
5703
+ void Ungroup(Object3D g)
5704
+ {
5705
+ if (Globals.REPLACEONMAKE)
5706
+ Save();
5707
+ boolean keep = Globals.REPLACEONMAKE;
5708
+ Globals.REPLACEONMAKE = false;
5709
+ if (g instanceof HiddenObject)
5710
+ {
5711
+ HiddenObject h = (HiddenObject) g;
5712
+
5713
+ for (int i=0; i<h.ActualSize(); i++)
5714
+ {
5715
+ objEditor.makeSomething(h.get(i), false);
5716
+ }
5717
+ }
5718
+ else
5719
+ {
5720
+ for (int i=0; i<g.Size(); i++)
5721
+ {
5722
+ objEditor.makeSomething(g.get(i), false);
5723
+ }
5724
+ }
5725
+ Globals.REPLACEONMAKE = keep;
5726
+ }
5727
+
42795728 void ungroup()
42805729 {
42815730 /*
....@@ -4469,21 +5918,6 @@
44695918 }
44705919 */
44715920
4472
- void ImportGFD()
4473
- {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4475
- browser.show();
4476
- String filename = browser.getFile();
4477
- if (filename != null && filename.length() > 0)
4478
- {
4479
- String fullname = browser.getDirectory() + filename;
4480
-
4481
- //Object3D readobj =
4482
- objEditor.ReadGFD(fullname, objEditor);
4483
- //makeSomething(readobj);
4484
- }
4485
- }
4486
-
44875921 /*
44885922 public void Callback(Object obj)
44895923 {
....@@ -4507,26 +5941,9 @@
45075941 }
45085942 */
45095943
4510
- void ImportVRMLX3D()
4511
- {
4512
- if (GraphreeD.standAlone)
4513
- {
4514
- /**/
4515
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4516
- browser.show();
4517
- String filename = browser.getFile();
4518
- if (filename != null && filename.length() > 0)
4519
- {
4520
- String fullname = browser.getDirectory() + filename;
4521
- LoadVRMLX3D(fullname);
4522
- }
4523
- /**/
4524
- }
4525
- }
4526
-
45275944 String GetFile(String dialogName)
45285945 {
4529
- if (GraphreeD.standAlone)
5946
+ if (Grafreed.standAlone)
45305947 {
45315948 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45325949 browser.show();
....@@ -4590,10 +6007,48 @@
45906007 cButton flashSelectionButton;
45916008 cButton editButton;
45926009 cButton uneditButton;
6010
+ JCheckBox allParamsButton;
45936011 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956012 cButton unselectButton;
45966013
6014
+ cButton restoreCameraButton;
6015
+
6016
+ cButton oneStepButton;
6017
+
6018
+ cButton groupButton;
6019
+ cButton ungroupButton;
6020
+ cButton compositeButton;
6021
+ cButton switchButton;
6022
+ cButton loopButton;
6023
+ cButton textureButton;
6024
+
6025
+ cButton skybox1Button;
6026
+ cButton skybox2Button;
6027
+ cButton skybox3Button;
6028
+ cButton skybox4Button;
6029
+ cButton skybox5Button;
6030
+ cButton skybox6Button;
6031
+ cButton skybox7Button;
6032
+
6033
+ cButton skybox11Button;
6034
+ cButton skybox12Button;
6035
+ cButton skybox13Button;
6036
+ cButton skybox14Button;
6037
+ cButton skybox15Button;
6038
+ cButton skybox16Button;
6039
+ cButton skybox17Button;
6040
+
6041
+ cButton gridButton;
6042
+ cButton boxButton;
6043
+ cButton sphereButton;
6044
+ cButton coneButton;
6045
+ cButton torusButton;
6046
+ cButton superButton;
6047
+ cButton kleinButton;
6048
+ cButton particlesButton;
6049
+ cButton overlayButton;
6050
+ cButton lightButton;
6051
+
45976052 cButton screenfitButton;
45986053 cButton screenfitpointButton;
45996054 cButton snapobjectButton;
....@@ -4605,14 +6060,6 @@
46056060
46066061 cButton setsupportButton;
46076062
4608
- cButton twoButton;
4609
- cButton sixButton;
4610
- cButton threeButton;
4611
- cButton sevenButton;
4612
- cButton fourButton; // full panel
4613
- cButton oneButton; // full XYZ
4614
- //cButton currentLayout;
4615
-
46166063 //
46176064 //Composite
46186065 Object3D // to do !!
....@@ -4622,9 +6069,11 @@
46226069 //JTree jTree;
46236070 private MenuItem lookAtItem;
46246071 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
6072
+ private MenuItem switchViewItem;
46266073 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
6074
+ private MenuItem undoItem;
6075
+ private MenuItem redoItem;
6076
+ private JMenuItem duplicateItem;
46286077 private MenuItem cloneItem;
46296078 private MenuItem cloneSupportItem;
46306079 private MenuItem overwriteGeoItem;
....@@ -4635,8 +6084,9 @@
46356084 private MenuItem resetsupportItem;
46366085 private MenuItem resetreferencesItem;
46376086 private MenuItem linkverticesItem;
6087
+ private MenuItem relinkverticesItem;
46386088 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6089
+ private MenuItem resetAllItem;
46406090 private MenuItem stepAllItem;
46416091 private MenuItem revertMeshItem;
46426092 private MenuItem poseMeshItem;
....@@ -4647,14 +6097,17 @@
46476097 private MenuItem mergeGeometriesItem;
46486098 private MenuItem copyItem;
46496099 private MenuItem pasteItem;
6100
+ private MenuItem pasteIntoItem;
46506101 private MenuItem pasteLinkItem;
46516102 private MenuItem pasteCloneItem;
46526103 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6104
+ private MenuItem deleteItem;
46546105 private MenuItem clearAllItem;
46556106 private MenuItem genUVItem;
6107
+ private MenuItem genNormalsMESHItem;
46566108 private MenuItem genNormalsCADItem;
46576109 private MenuItem genNormalsORGANItem;
6110
+ private MenuItem genNormalsMINEItem;
46586111 private MenuItem stripifyItem;
46596112 private MenuItem unstripifyItem;
46606113 private MenuItem trimItem;
....@@ -4683,6 +6136,10 @@
46836136 private MenuItem showleavesItem;
46846137 private MenuItem markleavesItem;
46856138 private MenuItem unmarkleavesItem;
6139
+ private MenuItem rewindleavesItem;
6140
+ private MenuItem unrewindleavesItem;
6141
+ private MenuItem randomleavesItem;
6142
+ private MenuItem unrandomleavesItem;
46866143
46876144 private MenuItem flipVItem;
46886145 private MenuItem unflipVItem;
....@@ -4694,14 +6151,17 @@
46946151 private MenuItem panoTexturesItem;
46956152
46966153 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6154
+ private MenuItem resetCentroidXZItem;
46986155 private MenuItem resetTransformItem;
6156
+ private MenuItem transformGeometryItem;
6157
+ private MenuItem transformChildrenItem;
6158
+ private MenuItem hideItem;
46996159 private MenuItem grabItem;
47006160 private MenuItem backItem;
47016161 private MenuItem frontItem;
47026162 private MenuItem cameraItem;
47036163 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6164
+ private MenuItem switchItem;
47056165 private MenuItem physicsItem;
47066166 private MenuItem frameselectorItem;
47076167 private MenuItem scriptNodeItem;
....@@ -4716,6 +6176,7 @@
47166176
47176177 private MenuItem resetParentItem;
47186178 private MenuItem repairParentItem;
6179
+ private MenuItem repairShadowItem;
47196180 private MenuItem sortbysizeItem;
47206181 private MenuItem sortbynameItem;
47216182
....@@ -4724,20 +6185,25 @@
47246185 private MenuItem attachBumpItem;
47256186 private MenuItem detachBumpItem;
47266187 private MenuItem pigmentBumpItem;
6188
+ private MenuItem embedTexturesItem;
6189
+ private MenuItem deEmbedTexturesItem;
47276190
47286191 private MenuItem particleItem;
47296192 private MenuItem ragdollItem;
47306193 private MenuItem ragdoll2Item;
6194
+ private MenuItem heightFieldItem;
6195
+ private MenuItem textureFieldItem;
47316196 private MenuItem gridItem;
47326197 private MenuItem rectoidItem;
47336198 private MenuItem ellipsoidItem;
47346199 private MenuItem coneItem;
47356200 private MenuItem torusItem;
47366201 private MenuItem superItem;
6202
+ private MenuItem kleinItem;
47376203 private MenuItem blobItem;
47386204 private MenuItem latheItem;
47396205 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6206
+ private MenuItem overlayItem;
47416207 private MenuItem meshItem;
47426208 // private MenuItem meshGroupItem;
47436209 private MenuItem springItem;
....@@ -4746,6 +6212,7 @@
47466212 private MenuItem csgItem;
47476213 private MenuItem templateItem;
47486214 private MenuItem textureItem;
6215
+ private MenuItem billboardItem;
47496216 private MenuItem shadowXItem;
47506217 private MenuItem shadowYItem;
47516218 private MenuItem shadowZItem;
....@@ -4758,11 +6225,6 @@
47586225 private MenuItem doubleItem;
47596226 private MenuItem tripleItem;
47606227
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666228 private MenuItem computeAOItem;
47676229 private MenuItem recompileItem;
47686230 private MenuItem editScriptItem;
....@@ -4772,4 +6234,8 @@
47726234 private MenuItem analyzeItem;
47736235 private MenuItem dumpItem;
47746236 //boolean freezemodel = false;
6237
+
6238
+ Menu cameraMenu;
6239
+ MenuItem editCameraItem;
6240
+ MenuItem restoreCameraItem;
47756241 }