Normand Briere
2019-08-12 8f1afe25ea8fc8801aab66331c32a50859a758c2
GroupEditor.java
....@@ -12,9 +12,11 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1820 ObjectUI,
1921 Runnable,
2022 ActionListener,
....@@ -22,6 +24,351 @@
2224 DragGestureListener, DragSourceListener, DropTargetListener,
2325 ItemListener // ListSelectionListener
2426 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(s);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "rgb", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ for (int i=0; i<group.selection.size(); i++)
354
+ {
355
+ Object3D obj = group.selection.get(i);
356
+ obj.SetPigmentTexture("@" + texture);
357
+ }
358
+
359
+ refreshContents();
360
+ }
361
+
362
+ public void Show3DView()
363
+ {
364
+ // bug
365
+ //gridPanel.setDividerLocation(1.0);
366
+ //bigPanel.setDividerLocation(0.0);
367
+ bigThree.ClearUI();
368
+ bigThree.add(centralPanel);
369
+ bigThree.FlushUI();
370
+ }
371
+
25372 //ObjEditor objEditor;
26373 public void closeUI2()
27374 {
....@@ -59,6 +406,14 @@
59406 this.copy = this.group = group;
60407 //selectees = this.group.selectees;
61408
409
+ if (copy.versionlist == null)
410
+ {
411
+ copy.versionlist = new Object3D[100];
412
+ copy.versionindex = -1;
413
+
414
+ Save(true);
415
+ }
416
+
62417 if(ui)
63418 SetupUI(objEditor);
64419 }
....@@ -73,17 +428,29 @@
73428 this.copy = this.group = copy;
74429 //selectees = this.group.selectees;
75430
76
- SetupMenu2(objEditor);
431
+ SetupMenu2(this); //objEditor);
77432 SetupUI2(objEditor);
78433 objEditor.SetupUI(true);
79434 SetupViews(objEditor);
80435
81436 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
437
+
438
+ if (copy.versionlist == null)
439
+ {
440
+ copy.versionlist = new Object3D[100];
441
+ copy.versionindex = -1;
442
+
443
+ Save(true);
444
+ }
82445 }
83446
84447 void CloneSelection(boolean supports)
85448 {
86
- // Object3D keep = GraphreeD.clipboard;
449
+ if (Globals.REPLACEONMAKE)
450
+ Save();
451
+ boolean keep = Globals.REPLACEONMAKE;
452
+ Globals.REPLACEONMAKE = false;
453
+ // Object3D keep = GrafreeD.clipboard;
87454 //Object3D obj;
88455 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89456 {
....@@ -93,18 +460,19 @@
93460
94461 makeSomething(clone, i==group.selection.size()-1);
95462 }
463
+ Globals.REPLACEONMAKE = keep;
96464 }
97465
98466 void CloneClipboard(boolean supports)
99467 {
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));
468
+ assert(Grafreed.clipboard.parent == null);
469
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
470
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
471
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
472
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105473 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
474
+ makeSomething(CloneObject(Grafreed.clipboard, false));
475
+ Grafreed.clipboard.get(0).parent = keepparent;
108476 }
109477
110478 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +486,7 @@
118486 // obj.support = null;
119487 if (!supports)
120488 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
489
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122490 obj.parent = parent;
123491 // obj.support = support;
124492 // clone.support = support; // aout 2013
....@@ -147,30 +515,29 @@
147515
148516 //JTextField nameField;
149517
150
- void SetupMenu2(ObjEditor oe)
518
+ void SetupMenu2(GroupEditor oe)
151519 {
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);
520
+ oe.jTree = new cTree();
521
+
163522 Menu menu;
164523 oe.menuBar.add(menu = new Menu("Edit"));
165524 //editItem = menu.add(new MenuItem("Edit"));
166525 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
526
+
527
+// undoItem = menu.add(new MenuItem("Undo"));
528
+// undoItem.addActionListener(this);
529
+// redoItem = menu.add(new MenuItem("Redo"));
530
+// redoItem.addActionListener(this);
531
+// menu.add("-");
532
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168533 duplicateItem.addActionListener(this);
169
- menu.add("-");
170534 cloneItem = menu.add(new MenuItem("Clone"));
171535 cloneItem.addActionListener(this);
536
+ if (Globals.ADVANCED)
537
+ {
172538 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173539 cloneSupportItem.addActionListener(this);
540
+ }
174541 menu.add("-");
175542 cutItem = menu.add(new MenuItem("Cut"));
176543 cutItem.addActionListener(this);
....@@ -178,26 +545,121 @@
178545 copyItem.addActionListener(this);
179546 pasteItem = menu.add(new MenuItem("Paste"));
180547 pasteItem.addActionListener(this);
548
+
549
+ menu.add("-");
550
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
551
+ pasteIntoItem.addActionListener(this);
181552 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182553 pasteLinkItem.addActionListener(this);
183554 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184555 pasteCloneItem.addActionListener(this);
185556 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186557 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
558
+ menu.add("-");
559
+ deleteItem = menu.add(new MenuItem("Delete"));
560
+ deleteItem.addActionListener(this);
561
+
562
+ if (Globals.ADVANCED)
563
+ {
564
+ // Deletes the cameras...
189565 clearAllItem = menu.add(new MenuItem("Clear All"));
190566 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);
567
+ }
568
+
569
+ menuBar.add(cameraMenu = new Menu("View"));
570
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
571
+ //zBufferItem.addActionListener(this);
572
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
573
+ //normalLensItem.addActionListener(this);
574
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
575
+ restoreCameraItem.addActionListener(this);
576
+
577
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
578
+// toggleFullScreenItem.addItemListener(this);
579
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
580
+// cameraMenu.add("-");
581
+//
582
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
583
+// toggleTextureItem.addItemListener(this);
584
+// toggleTextureItem.setState(CameraPane.textureon);
585
+//
586
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
587
+// toggleSwitchItem.addItemListener(this);
588
+// toggleSwitchItem.setState(CameraPane.SWITCH);
589
+
590
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
591
+ toggleHandleItem.addItemListener(this);
592
+ toggleHandleItem.setState(CameraPane.HANDLES);
593
+
594
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
595
+ togglePaintItem.addItemListener(this);
596
+ togglePaintItem.setState(CameraPane.PAINTMODE);
597
+
598
+ if (Globals.ADVANCED)
599
+ {
600
+ cameraMenu.add("-");
601
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
602
+ toggleLiveItem.addItemListener(this);
603
+ toggleLiveItem.setState(Globals.isLIVE());
604
+
605
+ cameraMenu.add(stepItem = new MenuItem("Step"));
606
+ stepItem.addActionListener(this);
607
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
608
+ // toggleDLItem.addItemListener(this);
609
+ // toggleDLItem.setState(false);
610
+
611
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
612
+ toggleRenderItem.addItemListener(this);
613
+ toggleRenderItem.setState(!CameraPane.frozen);
614
+
615
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
616
+ toggleDebugItem.addItemListener(this);
617
+ toggleDebugItem.setState(Globals.DEBUG);
618
+
619
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
620
+ toggleFrustumItem.addItemListener(this);
621
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
622
+
623
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
624
+ toggleFootContactItem.addItemListener(this);
625
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
626
+
627
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
628
+ toggleTimelineItem.addItemListener(this);
629
+ }
630
+
631
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
632
+// toggleRootItem.addItemListener(this);
633
+// toggleRootItem.setState(false);
634
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
635
+// animationItem.addItemListener(this);
636
+// animationItem.setState(CameraPane.ANIMATION);
637
+ cameraMenu.add("-");
638
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
639
+ editCameraItem.addActionListener(this);
640
+
641
+ if (Globals.ADVANCED)
642
+ {
643
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
644
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
645
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
646
+ oe.cameraMenu.add("-");
647
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
648
+ openWindowItem.addActionListener(this);
649
+ lookAtItem.addActionListener(this);
650
+ //lookFromItem.addActinoListener(this);
651
+ //switchViewItem.addActionListener(this);
652
+ }
653
+
654
+ oe.menuBar.add(menu = new Menu("Setting"));
655
+ if (Globals.ADVANCED)
656
+ {
196657 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197658 revertMeshItem.addActionListener(this);
198659 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199660 resetreferencesItem.addActionListener(this);
200661 menu.add("-");
662
+ }
201663 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202664 overwriteGeoItem.addActionListener(this);
203665 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +671,104 @@
209671 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210672 overwriteUVItem.addActionListener(this);
211673 menu.add("-");
674
+ if (Globals.ADVANCED)
675
+ {
212676 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213677 generateMeshItem.addActionListener(this);
214678 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215679 poseMeshItem.addActionListener(this);
216680 menu.add("-");
681
+ }
217682 resetsupportItem = menu.add(new MenuItem("Reset support"));
218683 resetsupportItem.addActionListener(this);
219684 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220685 linkverticesItem.addActionListener(this);
686
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
687
+ relinkverticesItem.addActionListener(this);
688
+
689
+ if (Globals.ADVANCED)
690
+ {
221691 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222692 setMasterItem.addActionListener(this);
693
+ }
223694
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);
695
+ oe.menuBar.add(menu = new Menu("Group"));
696
+// grabItem = menu.add(new MenuItem("Grab"));
697
+// grabItem.addActionListener(this);
229698 backItem = menu.add(new MenuItem("Back"));
230699 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);
700
+ frontItem = menu.add(new MenuItem("Front"));
701
+ frontItem.addActionListener(this);
702
+// compositeItem = menu.add(new MenuItem("Composite"));
703
+// compositeItem.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ hideItem = menu.add(new MenuItem("Hidden Group"));
708
+ hideItem.addActionListener(this);
709
+ }
710
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
711
+ ungroupItem.addActionListener(this);
712
+
713
+// menu.add("-");
714
+//
715
+// switchItem = menu.add(new MenuItem("Switch node"));
716
+// switchItem.addActionListener(this);
717
+ if (Globals.ADVANCED)
718
+ {
240719 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241720 switchGeoItem.addActionListener(this);
242721 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243722 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
723
+ morphItem = menu.add(new MenuItem("Morph Group"));
245724 morphItem.addActionListener(this);
725
+
726
+ menu.add("-");
727
+ physicsItem = menu.add(new MenuItem("Physics"));
728
+ physicsItem.addActionListener(this);
729
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
730
+ frameselectorItem.addActionListener(this);
246731 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247732 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);
733
+ }
734
+
735
+ oe.menuBar.add(menu = new Menu("Object"));
736
+// textureItem = menu.add(new MenuItem("Texture"));
737
+// textureItem.addActionListener(this);
738
+ billboardItem = menu.add(new MenuItem("Billboard"));
739
+ billboardItem.addActionListener(this);
253740 csgItem = menu.add(new MenuItem("CSG"));
254741 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
742
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256743 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
744
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258745 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
746
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260747 shadowZItem.addActionListener(this);
748
+ attributeItem = menu.add(new MenuItem("Attribute"));
749
+ attributeItem.addActionListener(this);
750
+
751
+ if (Globals.ADVANCED)
752
+ {
753
+ menu.add("-");
261754 linkerItem = menu.add(new MenuItem("Linker"));
262755 linkerItem.addActionListener(this);
263756 templateItem = menu.add(new MenuItem("Template"));
264757 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267758 pointflowItem = menu.add(new MenuItem("Point Flow"));
268759 pointflowItem.addActionListener(this);
760
+ }
269761 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272762 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273763 resetTransformItem.addActionListener(this);
274764 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275765 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
766
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
767
+ resetCentroidXZItem.addActionListener(this);
768
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
769
+ transformGeometryItem.addActionListener(this);
770
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
771
+ transformChildrenItem.addActionListener(this);
278772
279773 oe.menuBar.add(menu = new Menu("Geometry"));
280774 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +777,13 @@
283777 genNormalsORGANItem.addActionListener(this);
284778 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285779 genNormalsCADItem.addActionListener(this);
780
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
781
+ genNormalsMESHItem.addActionListener(this);
782
+ if (Globals.ADVANCED)
783
+ {
784
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
785
+ genNormalsMINEItem.addActionListener(this);
786
+ }
286787 stripifyItem = menu.add(new MenuItem("Stripify"));
287788 stripifyItem.addActionListener(this);
288789 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +793,6 @@
292793 untrimItem = menu.add(new MenuItem("Untrim"));
293794 untrimItem.addActionListener(this);
294795 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297796 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298797 clearColorsItem.addActionListener(this);
299798 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +805,34 @@
306805 reduce34MeshItem.addActionListener(this);
307806 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308807 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311808 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312809 clipMeshItem.addActionListener(this);
810
+
811
+ if (Globals.ADVANCED)
812
+ {
813
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
814
+ smoothMeshItem.addActionListener(this);
815
+ }
816
+
817
+ oe.menuBar.add(menu = new Menu("Attributes"));
818
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
819
+ clearMaterialsItem.addActionListener(this);
820
+ resetAllItem = menu.add(new MenuItem("Reset All"));
821
+ resetAllItem.addActionListener(this);
822
+ stepAllItem = menu.add(new MenuItem("Step All"));
823
+ stepAllItem.addActionListener(this);
313824 menu.add("-");
314825 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315826 liveleavesItem.addActionListener(this);
316827 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317828 unliveleavesItem.addActionListener(this);
829
+ if (Globals.ADVANCED)
830
+ {
318831 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319832 supportleavesItem.addActionListener(this);
320833 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321834 unsupportleavesItem.addActionListener(this);
835
+ }
322836 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323837 hideleavesItem.addActionListener(this);
324838 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +841,31 @@
327841 markleavesItem.addActionListener(this);
328842 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329843 unmarkleavesItem.addActionListener(this);
844
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
845
+ rewindleavesItem.addActionListener(this);
846
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
847
+ unrewindleavesItem.addActionListener(this);
848
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
849
+ randomleavesItem.addActionListener(this);
850
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
851
+ unrandomleavesItem.addActionListener(this);
330852 menu.add("-");
331853 flipVItem = menu.add(new MenuItem("Flip V"));
332854 flipVItem.addActionListener(this);
333855 unflipVItem = menu.add(new MenuItem("Unflip V"));
334856 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
857
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336858 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
859
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338860 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
861
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340862 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
863
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342864 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
865
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344866 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
867
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346868 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);
356869
357870 oe.menuBar.add(menu = new Menu("Selection"));
358871 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -361,31 +874,129 @@
361874 attachBumpItem.addActionListener(this);
362875 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
363876 pigmentBumpItem.addActionListener(this);
877
+ //embedTexturesItem
364878 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
365879 detachPigmentItem.addActionListener(this);
366880 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
367881 detachBumpItem.addActionListener(this);
882
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
883
+ embedTexturesItem.addActionListener(this);
884
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
885
+ deEmbedTexturesItem.addActionListener(this);
368886 menu.add("-");
369887 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
370888 sortbysizeItem.addActionListener(this);
371889 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372890 sortbynameItem.addActionListener(this);
891
+ menu.add("-");
892
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
893
+ shareGeometriesItem.addActionListener(this);
894
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
895
+ mergeGeometriesItem.addActionListener(this);
896
+ menu.add("-");
897
+ editLeafItem = menu.add(new MenuItem("Edit leaf..."));
898
+ editLeafItem.addActionListener(this);
899
+ if (Globals.ADVANCED)
900
+ {
901
+ // Pretty much the same as duplicate and clone.
902
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
903
+ extractGeometriesItem.addActionListener(this);
904
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
905
+ cloneGeometriesItem.addActionListener(this);
906
+ }
907
+
373908 oe.menuBar.add(menu = new Menu("Insert"));
374909 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
910
+
911
+ oe.menuBar.add(menu = new Menu("Tools"));
376912 buildToolsMenu(menu);
377913 }
378914
915
+ JTabbedPane resourcecontainer;
916
+ cGridBag currenttab;
917
+ boolean added; // patch for jar
918
+
919
+ int tabcount = 0;
920
+ int colcount = 0;
921
+ int rowcount = 0;
922
+ int texturecount = 0;
923
+
924
+ int columns = 5;
925
+ int rows = 7;
926
+
927
+ public void ResourceCallBack(String[] path)
928
+ {
929
+// for (int i = 0; i < path.length; i++)
930
+// System.out.print(path[i] + "/");
931
+// System.out.println();
932
+
933
+ if (//rowcount == 0 ||
934
+ path.length == 1)
935
+ {
936
+ currenttab = new cGridBag();
937
+ added = false;
938
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
+ currenttab.setName(tabname);
940
+ rowcount = 1;
941
+ colcount = 0;
942
+ texturecount = 0;
943
+ }
944
+
945
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
946
+ {
947
+ if (!added)
948
+ {
949
+ added = true;
950
+ resourcecontainer.add(currenttab);
951
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
952
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
953
+ }
954
+
955
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
956
+
957
+ if (++colcount >= columns)
958
+ {
959
+ colcount = 0;
960
+ currenttab.Return();
961
+
962
+ if (rowcount++ >= rows)
963
+ {
964
+ rowcount = 0;
965
+ }
966
+ }
967
+ }
968
+ else
969
+ {
970
+// if (!path[path.length-1].equals("icons"))
971
+// resourcecontainer.Return();
972
+ }
973
+ }
974
+
975
+ void CreateTexturePanel(cGridBag container)
976
+ {
977
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
978
+ container.add(resourcecontainer);
979
+
980
+ Grafreed.ParseResources("textures", this);
981
+ }
982
+
379983 void SetupUI2(ObjEditor oe)
380984 {
985
+ // June 2019
986
+ if (oe == null)
987
+ {
988
+ //super.SetupUI2(this);
989
+ //return;
990
+ }
991
+
992
+ if (copy != group)
993
+ {
994
+ //super.SetupUI2(this);
995
+ }
996
+
381997 //new Exception().printStackTrace();
382998
383999 oe.radioPanel = new JPanel(new GridBagLayout());
384
- oe.aConstraints.weightx = 1;
385
- oe.aConstraints.weighty = 0;
386
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
387
- oe.aConstraints.gridwidth = 100;
388
- oe.aConstraints.gridheight = 1;
3891000 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
3901001
3911002 oe.buttonGroup = new ButtonGroup();
....@@ -406,150 +1017,263 @@
4061017 oe.radioPanel.add(dummyButton);
4071018 oe.buttonGroup.add(dummyButton);
4081019 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
1020
+ cGridBag copyOptionsPanel = new cGridBag();
1021
+
1022
+ copyOptionsPanel.preferredHeight = 2;
4121023
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
1024
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1025
+
1026
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1027
+ //minButton.setToolTipText("Minimize window");
1028
+ //minButton.addActionListener(this);
1029
+
1030
+ if (Globals.ADVANCED)
1031
+ {
1032
+// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+// maxButton.setToolTipText("Maximize window");
1034
+// maxButton.addActionListener(this);
1035
+ }
1036
+
1037
+// cButton gcButton;
1038
+//
1039
+// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1040
+// gcButton.setToolTipText("Garbage collect");
1041
+// gcButton.addActionListener(new ActionListener()
1042
+// {
1043
+// public void actionPerformed(ActionEvent e)
1044
+// {
1045
+// System.gc();
1046
+// }
1047
+// });
1048
+
1049
+ oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ collapseButton.setToolTipText("Collapse toolbar");
1051
+ collapseButton.addActionListener(this);
1052
+
1053
+ oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ maximize3DButton.setToolTipText("Maximize 3D view");
1055
+ maximize3DButton.addActionListener(this);
1056
+
1057
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ twoButton.setToolTipText("Show 3D view only");
1059
+ twoButton.addActionListener(this);
1060
+ this.fullscreenLayout = twoButton;
1061
+
1062
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ threeButton.setToolTipText("Show controls and 3D view");
1064
+ threeButton.addActionListener(this);
1065
+ if (Globals.ADVANCED)
1066
+ {
1067
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ sixButton.setToolTipText("Show 3D view and controls");
1069
+ sixButton.addActionListener(this);
1070
+ }
1071
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+// sevenButton.setToolTipText("3-column layout");
1073
+// sevenButton.addActionListener(this);
1074
+ //
1075
+
1076
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ fullButton.setToolTipText("Full-screen window");
1078
+ fullButton.addActionListener(this);
1079
+
1080
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ screenfitButton.setToolTipText("Screen fit");
1082
+ screenfitButton.addActionListener(this);
1083
+
1084
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1085
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1086
+ restoreCameraButton.addActionListener(this);
1087
+
1088
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ saveVersionButton.setToolTipText("Duplicate current version");
1090
+ saveVersionButton.addActionListener(this);
1091
+
1092
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ deleteVersionButton.setToolTipText("Delete current version");
1094
+ deleteVersionButton.addActionListener(this);
1095
+
1096
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ previousVersionButton.setToolTipText("Previous version");
1098
+ previousVersionButton.addActionListener(this);
1099
+ previousVersionButton.setEnabled(false);
1100
+
1101
+ cGridBag updown = new cGridBag().setVertical(true);
1102
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ restoreButton.setToolTipText("Undo (restore current version)");
1104
+ restoreButton.addActionListener(this);
1105
+ //restoreButton.setEnabled(false);
1106
+
1107
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1108
+ replaceButton.setToolTipText("Save (replace current version)");
1109
+ replaceButton.addActionListener(this);
1110
+ //replaceButton.setEnabled(false);
1111
+
1112
+ copyOptionsPanel.add(updown);
1113
+
1114
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ nextVersionButton.setToolTipText("Next version");
1116
+ nextVersionButton.addActionListener(this);
1117
+ nextVersionButton.setEnabled(false);
1118
+
1119
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ oneStepButton.setToolTipText("Animate one step forward");
1121
+ oneStepButton.addActionListener(this);
1122
+
1123
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1124
+ liveCB.setToolTipText("Enable animation");
4141125 liveCB.addItemListener(this);
4151126
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);
1127
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1128
+ fastCB.setToolTipText("Fast mode");
4341129 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);
1130
+
1131
+ //oe.toolboxPanel.Return();
1132
+
1133
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1134
+// trackCB.setToolTipText("Enable tracking");
1135
+// trackCB.addItemListener(this);
4411136
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;
4821137 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
4831138 // 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;
4881139
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);
1140
+ if (Globals.ADVANCED)
1141
+ {
1142
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1143
+ snapobjectButton.addActionListener(this);
1144
+ snapobjectButton.setToolTipText("Snap Object");
1145
+
1146
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5041147 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);
508
- threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
511
- //
1148
+ fourButton.setToolTipText("Show control panel only");
1149
+ }
5121150
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1151
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1152
+
1153
+
1154
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ rootButton.setToolTipText("Open selection in new tab");
5141156 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1157
+
1158
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1159
+ closeButton.setToolTipText("Close tab");
5171160 closeButton.addActionListener(this);
5181161 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5191162 //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;
5281163
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1164
+ cGridBag row1 = new cGridBag();
1165
+
1166
+ // INSERT
1167
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1168
+ gridButton.setToolTipText("Create ground");
1169
+ gridButton.addActionListener(this);
1170
+
1171
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1172
+ boxButton.setToolTipText("Create box");
1173
+ boxButton.addActionListener(this);
1174
+
1175
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1176
+ sphereButton.setToolTipText("Create sphere");
1177
+ sphereButton.addActionListener(this);
1178
+
1179
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1180
+ coneButton.setToolTipText("Create cone");
1181
+ coneButton.addActionListener(this);
1182
+
1183
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1184
+ torusButton.setToolTipText("Create torus");
1185
+ torusButton.addActionListener(this);
1186
+
1187
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1188
+ superButton.setToolTipText("Create superellipsoid");
1189
+ superButton.addActionListener(this);
1190
+
1191
+ if (Globals.ADVANCED)
1192
+ {
1193
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1194
+ kleinButton.setToolTipText("Create Klein bottle");
1195
+ kleinButton.addActionListener(this);
1196
+ }
1197
+
1198
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
+ particlesButton.setToolTipText("Create particle system");
1200
+ particlesButton.addActionListener(this);
1201
+
1202
+ oe.toolboxPanel.add(row1);
1203
+
1204
+ cGridBag row2 = new cGridBag();
1205
+
1206
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1207
+ groupButton.setToolTipText("Create group");
1208
+ groupButton.addActionListener(this);
1209
+
1210
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1211
+ compositeButton.setToolTipText("Create composite");
1212
+ compositeButton.addActionListener(this);
1213
+
1214
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1215
+ switchButton.setToolTipText("Create item switcher");
1216
+ switchButton.addActionListener(this);
1217
+
1218
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1219
+ loopButton.setToolTipText("Create loop");
1220
+ loopButton.addActionListener(this);
1221
+
1222
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1223
+ textureButton.setToolTipText("Create texture");
1224
+ textureButton.addActionListener(this);
1225
+
1226
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1227
+ overlayButton.setToolTipText("Create overlay");
1228
+ overlayButton.addActionListener(this);
1229
+
1230
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1231
+ lightButton.setToolTipText("Create light");
1232
+ lightButton.addActionListener(this);
1233
+
1234
+ oe.toolboxPanel.add(row2);
1235
+
1236
+ cGridBag textures = new cGridBag();
1237
+
1238
+ CreateTexturePanel(textures);
1239
+
1240
+ oe.toolboxPanel.add(textures);
1241
+
1242
+ textures.preferredHeight = 100;
1243
+
1244
+ CreateSkyboxPanel(oe.skyboxPanel);
1245
+
1246
+ // EDIT panel
1247
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1248
+ editButton.setToolTipText("Pin selection controls");
1249
+ editButton.addActionListener(this);
1250
+
1251
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1252
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5301253 uneditButton.addActionListener(this);
5311254
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);
1255
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1256
+ allParamsButton.setToolTipText("Show all controls");
5441257 allParamsButton.addActionListener(this);
5451258
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);
551
- unselectButton.addActionListener(this);
1259
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1260
+ clearPanelButton.setToolTipText("Clear all controls");
1261
+ clearPanelButton.addActionListener(this);
5521262
1263
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1264
+ //unselectButton.setToolTipText("Unselect");
1265
+ //unselectButton.addActionListener(this);
1266
+
1267
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1268
+ flashSelectionButton.setToolTipText("Highlight selection");
1269
+ flashSelectionButton.addActionListener(this);
1270
+
1271
+ editCommandsPanel.preferredHeight = 1;
1272
+
1273
+ SetPinStates(false);
1274
+// oe.treePanel.add(commandsPanel);
1275
+// oe.treePanel.Return();
1276
+
5531277 // oe.aConstraints.gridx += 1;
5541278 // oe.aConstraints.weighty = 0;
5551279 // oe.aConstraints.gridwidth = 1;
....@@ -561,47 +1285,32 @@
5611285 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5621286 // gcButton.addActionListener(this);
5631287
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;
1288
+ cGridBag jSPPanel = new cGridBag();
1289
+
1290
+ JScrollPane jSP;
5751291 //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);
1292
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5771293 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;
5971294
1295
+ oe.treePanel.add(jSPPanel);
1296
+ oe.treePanel.Return();
1297
+
1298
+ oe.treePanel.add(copyOptionsPanel);
1299
+ oe.treePanel.Return();
1300
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1301
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1302
+ sliderPane.preferredHeight = 1;
1303
+
1304
+// mainPanel.setDividerLocation(0.1); //1.0);
1305
+ mainPanel.setResizeWeight(0.4);
1306
+
5981307 //jList.addListSelectionListener(this);
5991308 oe.jTree.addTreeSelectionListener(this);
6001309 //jTree.setRootVisible(false);
6011310 //jTree.setEditable(true);
6021311 oe.jTree.setDragEnabled(true);
6031312 //jTree.setPreferredSize(new Dimension(10,10));
604
- jSP.setPreferredSize(new Dimension(100,200));
1313
+ //jSP.setPreferredSize(new Dimension(100,200));
6051314
6061315 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6071316
....@@ -613,23 +1322,171 @@
6131322 dgr.addDragGestureListener(this);
6141323 }catch(Exception e) {}
6151324 */
616
- radio.layout = sevenButton;
1325
+ radio.layout = threeButton; // sixButton;
6171326 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6181327 }
1328
+
1329
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1330
+ {
1331
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1332
+ colorCB.setToolTipText("Copy color when dropped");
1333
+ colorCB.addItemListener(this);
1334
+
1335
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1336
+ materialCB.setToolTipText("Copy material when dropped");
1337
+ materialCB.addItemListener(this);
1338
+
1339
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1340
+ textureCB.setToolTipText("Copy texture when dropped");
1341
+ textureCB.addItemListener(this);
1342
+
1343
+ panel.Return();
1344
+
1345
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1346
+ boxCB.setToolTipText("Display bounding boxes");
1347
+ boxCB.addItemListener(this);
1348
+
1349
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1350
+ zoomBoxCB.setToolTipText("Display only for wheel");
1351
+ zoomBoxCB.addItemListener(this);
1352
+
1353
+ if (true) // Globals.ADVANCED)
1354
+ {
1355
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1356
+// supportCB.setToolTipText("Enable rigging");
1357
+// supportCB.addItemListener(this);
1358
+
1359
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1360
+ freezeCB.setToolTipText("Fast moving camera");
1361
+ freezeCB.addItemListener(this);
1362
+
1363
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1364
+ // localCB.addItemListener(this);
1365
+
1366
+ panel.Return();
1367
+
1368
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1369
+ crowdCB.setToolTipText("Used for crowds");
1370
+ crowdCB.addItemListener(this);
1371
+
1372
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1373
+ smoothCB.setToolTipText("Snapping delay");
1374
+ smoothCB.addItemListener(this);
1375
+
1376
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1377
+// slowCB.setToolTipText("Smooth interpolation");
1378
+// slowCB.addItemListener(this);
1379
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1380
+ minshaderCB.setToolTipText("Minimal fast shader");
1381
+ minshaderCB.addItemListener(this);
1382
+
1383
+// constraints.gridy += 1;
1384
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1385
+// speakerMocapCB.addItemListener(this);
1386
+
1387
+ panel.Return();
1388
+
1389
+ if (false)
1390
+ {
1391
+ // handled in scripts
1392
+ //constraints.gridy += 1;
1393
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1394
+ speakerCameraCB.addItemListener(this);
1395
+
1396
+ //constraints.gridy += 1;
1397
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1398
+ speakerFocusCB.addItemListener(this);
1399
+
1400
+ //constraints.gridy += 1;
1401
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1402
+ smoothfocusCB.addItemListener(this);
1403
+ panel.Return();
1404
+ }
1405
+
1406
+//constraints.gridx += 1;
1407
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1408
+// debugCB.addItemListener(this);
1409
+
1410
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1411
+ trackCB.setToolTipText("Enable tracking target");
1412
+ trackCB.addItemListener(this);
1413
+
1414
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1415
+ oeilCB.setToolTipText("Move camera when tracking");
1416
+ oeilCB.addItemListener(this);
1417
+
1418
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1419
+ shadowCB.setToolTipText("When live compute shadows");
1420
+ shadowCB.addItemListener(this);
1421
+
1422
+ panel.Return();
1423
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1424
+ toggleTextureCB.setToolTipText("Load textures");
1425
+ toggleTextureCB.addItemListener(this);
1426
+
1427
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1428
+ toggleSwitchCB.setToolTipText("Choose a single item");
1429
+ toggleSwitchCB.addItemListener(this);
1430
+
1431
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1432
+ autokeepCB.setToolTipText("On structure change");
1433
+ autokeepCB.addItemListener(this);
1434
+
1435
+ panel.Return();
1436
+ if (Globals.ADVANCED)
1437
+ {
1438
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1439
+ lookAtCB.setToolTipText("Look-at target");
1440
+ lookAtCB.addItemListener(this);
1441
+ }
1442
+
1443
+ }
1444
+
1445
+ cGridBag fill = new cGridBag();
1446
+ fill.preferredHeight = 200;
1447
+ cGridBag fill2 = new cGridBag();
1448
+ fill2.preferredHeight = 200;
1449
+ cGridBag fill3 = new cGridBag();
1450
+ fill3.preferredHeight = 200;
1451
+
1452
+ panel.add(fill);
1453
+ panel.add(fill2);
1454
+ panel.add(fill3);
1455
+
1456
+ }
6191457
6201458 void EditObject(Object3D obj)
6211459 {
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();
1460
+ assert(obj instanceof Composite);
1461
+
1462
+ if (obj.versionlist == null)
1463
+ {
1464
+ obj.versionlist = new Object3D[100];
1465
+ obj.versionindex = -1;
1466
+ }
1467
+
1468
+ cRadio radioButton = new cRadio(obj.name);
1469
+
1470
+ // June 2019. Patch to avoid bug with transparency.
1471
+ radioButton.hadMaterial = obj.material != null;
1472
+ if (!radioButton.hadMaterial)
1473
+ {
1474
+ obj.material = new cMaterial();
1475
+ }
1476
+
1477
+ radioButton.SetObject(obj);
1478
+ radioButton.layout = threeButton; // sixButton;
1479
+ radioButton.SetCamera(cameraView.renderCamera, false);
1480
+ radioButton.addActionListener(this);
1481
+ radioPanel.add(radioButton);
1482
+ buttonGroup.add(radioButton);
1483
+ radioButton.doClick();
6301484 }
1485
+
6311486 void SetupViews(ObjEditor oe)
6321487 {
1488
+ theFrame = this;
1489
+
6331490 oe.SetupViews();
6341491
6351492 System.out.println("SetupViews");
....@@ -638,22 +1495,30 @@
6381495 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391496 }
6401497
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;
1498
+ cToggleButton liveCB;
1499
+ cCheckBox supportCB;
1500
+ cCheckBox localCB;
1501
+ cCheckBox crowdCB;
1502
+ cCheckBox smoothCB;
1503
+ cCheckBox minshaderCB;
1504
+
1505
+ cToggleButton fastCB;
1506
+ cCheckBox slowCB;
1507
+ cCheckBox boxCB;
1508
+ cCheckBox zoomBoxCB;
1509
+ cCheckBox freezeCB;
1510
+ //cToggleButton trackCB;
1511
+ cCheckBox trackCB;
1512
+ cCheckBox smoothfocusCB;
6511513 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1514
+ cCheckBox speakerCameraCB;
1515
+ cCheckBox speakerFocusCB;
1516
+ cCheckBox debugCB;
1517
+
1518
+ cCheckBox oeilCB;
1519
+ cCheckBox shadowCB;
1520
+ cCheckBox autokeepCB;
1521
+ cCheckBox lookAtCB;
6571522
6581523 // static int COLOR = 1;
6591524 // static int MATERIAL = 2;
....@@ -661,9 +1526,9 @@
6611526
6621527 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631528
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1529
+ cCheckBox colorCB;
1530
+ cCheckBox materialCB;
1531
+ cCheckBox textureCB;
6671532
6681533 public void itemStateChanged(ItemEvent e)
6691534 {
....@@ -688,10 +1553,10 @@
6881553 dropAttributes |= Object3D.TEXTURE;
6891554 else
6901555 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1556
+ } else if(e.getSource() == liveCB)
6931557 {
6941558 cameraView.ToggleLive();
1559
+ refreshContents(false);
6951560 }
6961561 else if(e.getSource() == supportCB)
6971562 {
....@@ -707,6 +1572,12 @@
7071572 {
7081573 cameraView.ToggleInertia();
7091574 cameraView.repaint();
1575
+ }
1576
+ else if(e.getSource() == minshaderCB)
1577
+ {
1578
+ Globals.MINSHADER ^= true;
1579
+ cameraView.programInitialized = false;
1580
+ cameraView.repaint();
7101581 }
7111582 else if(e.getSource() == localCB)
7121583 {
....@@ -726,6 +1597,10 @@
7261597 Recompile();
7271598 cameraView.repaint();
7281599 // refreshContents();
1600
+ }
1601
+ else if(e.getSource() == zoomBoxCB)
1602
+ {
1603
+ cameraView.ToggleZoomBoxMode();
7291604 }
7301605 else if(e.getSource() == smoothfocusCB)
7311606 {
....@@ -752,6 +1627,18 @@
7521627 {
7531628 cameraView.ToggleOeil();
7541629 }
1630
+ else if(e.getSource() == shadowCB)
1631
+ {
1632
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1633
+ }
1634
+ else if(e.getSource() == freezeCB)
1635
+ {
1636
+ Globals.FREEZEONMOVE ^= true;
1637
+ }
1638
+ else if(e.getSource() == autokeepCB)
1639
+ {
1640
+ Globals.REPLACEONMAKE ^= true;
1641
+ }
7551642 else if(e.getSource() == lookAtCB)
7561643 {
7571644 cameraView.ToggleLookAt();
....@@ -768,7 +1655,8 @@
7681655
7691656 /**/
7701657 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1658
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1659
+ TreePath path = objEditor.jTree.getSelectionPath();
7721660 if ((path == null) || (path.getPathCount() <= 1)) {
7731661 // We can't move the root node or an empty selection
7741662 return;
....@@ -831,8 +1719,6 @@
8311719 }
8321720 }
8331721
834
- String string = (String) object;
835
-
8361722 System.out.println("Transfer = " + object + "; drop : " + target);
8371723 // if( object instanceof java.io.File[])
8381724 // {
....@@ -840,7 +1726,11 @@
8401726 // objEditor.DropFile((java.io.File[]) object, true);
8411727 // return;
8421728 // }
843
- if (string.charAt(0) == '/')
1729
+
1730
+ String string = object.toString();
1731
+
1732
+ // File path for Mac and Windows
1733
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441734 {
8451735 // file(s)
8461736 String[] names = string.split("\n");
....@@ -867,7 +1757,7 @@
8671757
8681758 flashIt = false;
8691759 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1760
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711761 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721762
8731763 if (group.selection.size() == 1)
....@@ -883,23 +1773,33 @@
8831773
8841774 assert target == objEditor.jTree;
8851775 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1776
+ Object3D destinationLeaf;
8861777 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1778
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881779 } catch (Exception e) {
8891780 System.out.println("destinationPath : " + destinationPath);
8901781 return;
8911782 }
8921783
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1784
+ for (int i=group.selection.size(); --i>=0;)
8941785 {
1786
+ Object3D child = (Object3D)group.selection.elementAt(i);
1787
+
1788
+ // Cannot move into itself
1789
+ if (child == destinationLeaf)
1790
+ return;
1791
+ }
1792
+
1793
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1794
+// {
8951795 loadClipboard(true);
8961796 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1797
+ pasteInto(false, false);
1798
+// } else {
1799
+// loadClipboard(false);
1800
+// objEditor.jTree.setSelectionPath(destinationPath);
1801
+// pasteInto(false, false); // true); // ???
1802
+// }
9031803 }
9041804 public void dropActionChanged(DropTargetDragEvent dtde)
9051805 // Called if the user has modified the current drop gesture
....@@ -955,7 +1855,12 @@
9551855 TreePath path;
9561856
9571857 public TransferableTreePath(TreePath tp) {
958
- path = tp;
1858
+ Object[] objs = new Object[tp.getPathCount()];
1859
+ for (int i=0; i<objs.length; i++)
1860
+ {
1861
+ objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID();
1862
+ }
1863
+ path = new TreePath(objs);
9591864 }
9601865
9611866 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -1002,90 +1907,109 @@
10021907
10031908 void buildCreateMenu(Menu menu)
10041909 {
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);
1910
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1911
+ //heightFieldItem.addActionListener(this);
1912
+// gridItem = menu.add(new MenuItem("Grid"));
1913
+// gridItem.addActionListener(this);
1914
+// rectoidItem = menu.add(new MenuItem("Box"));
1915
+// rectoidItem.addActionListener(this);
1916
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1917
+// ellipsoidItem.addActionListener(this);
1918
+// coneItem = menu.add(new MenuItem("Cone"));
1919
+// coneItem.addActionListener(this);
1920
+// torusItem = menu.add(new MenuItem("Torus"));
1921
+// torusItem.addActionListener(this);
1922
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1923
+// superItem.addActionListener(this);
1924
+
1925
+ cameraItem = menu.add(new MenuItem("Camera"));
1926
+ cameraItem.addActionListener(this);
1927
+
1928
+ if (!Globals.ADVANCED)
1929
+ {
1930
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1931
+ kleinItem.addActionListener(this);
1932
+ }
1933
+
1934
+// particleItem = menu.add(new MenuItem("Particle system"));
1935
+// particleItem.addActionListener(this);
1936
+ if (Globals.ADVANCED)
1937
+ {
10191938 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201939 ragdollItem.addActionListener(this);
10211940 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221941 ragdoll2Item.addActionListener(this);
1942
+ }
10231943 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1944
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251945 meshItem.addActionListener(this);
10261946 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271947 // meshGroupItem.addActionListener(this);
1948
+ if (Globals.ADVANCED)
1949
+ {
10281950 springItem = menu.add(new MenuItem("Spring"));
10291951 springItem.addActionListener(this);
10301952 flagItem = menu.add(new MenuItem("Flag"));
10311953 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);
10361954 blobItem = menu.add(new MenuItem("Blob"));
10371955 blobItem.addActionListener(this);
10381956 latheItem = menu.add(new MenuItem("Lathe"));
10391957 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1958
+ }
1959
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1960
+ bezierItem.addActionListener(this);
1961
+// overlayItem = menu.add(new MenuItem("Overlay"));
1962
+// overlayItem.addActionListener(this);
1963
+// lightItem = menu.add(new MenuItem("Light"));
1964
+// lightItem.addActionListener(this);
10421965 menu.add("-");
10431966 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441967 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1968
+// loopItem = menu.add(new MenuItem("Loop"));
1969
+// loopItem.addActionListener(this);
10471970 doubleItem = menu.add(new MenuItem("Fork"));
10481971 doubleItem.addActionListener(this);
1972
+ if (Globals.ADVANCED)
1973
+ {
10491974 tripleItem = menu.add(new MenuItem("Trident"));
10501975 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);
1976
+ }
10601977 }
10611978
10621979 void buildToolsMenu(Menu menu)
10631980 {
10641981 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651982 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1983
+ animationItem.setState(Globals.ANIMATION);
1984
+
1985
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1986
+ archiveItem.addActionListener(this);
10671987
10681988 menu.add("-");
10691989 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701990 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1991
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1992
+ textureFieldItem.addActionListener(this);
1993
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721994 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751995 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761996 reduceMorphItem.addActionListener(this);
10771997 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781998 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821999 menu.add("-");
1083
-
10842000 menu.add(memoryItem = new MenuItem("Memory Usage"));
10852001 memoryItem.addActionListener(this);
2002
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
2003
+ computeAOItem.addActionListener(this);
2004
+
2005
+ if (Globals.ADVANCED)
2006
+ {
2007
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
2008
+ mirrorItem.addActionListener(this);
2009
+ menu.add("-");
10862010 menu.add(analyzeItem = new MenuItem("Analyze"));
10872011 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
2012
+ menu.add(dumpItem = new MenuItem("Print"));
10892013 dumpItem.addActionListener(this);
10902014 // menu.add(pathItem = new MenuItem("From-to path"));
10912015 // pathItem.addActionListener(this);
....@@ -1094,6 +2018,8 @@
10942018 resetParentItem.addActionListener(this);
10952019 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10962020 repairParentItem.addActionListener(this);
2021
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
2022
+ repairShadowItem.addActionListener(this);
10972023 menu.add(invariantsItem = new MenuItem("Invariants"));
10982024 invariantsItem.addActionListener(this);
10992025 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +2027,7 @@
11012027 menu.add("-");
11022028 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11032029 editScriptItem.addActionListener(this);
2030
+ }
11042031 }
11052032
11062033 void ScreenFit()
....@@ -1223,9 +2150,34 @@
12232150 shadow.material = new cMaterial(obj.material);
12242151 shadow.material.diffuse = 0.0001f;
12252152 shadow.material.specular = 0.0001f;
2153
+ //shadow.projectedVertices[1].x = 300;
12262154
12272155 makeSomething(shadow);
12282156 }
2157
+
2158
+ private void ClearUnpinned()
2159
+ {
2160
+ //for (Object3D obj : listUI)
2161
+ for (int i=listUI.size(); --i>=0;)
2162
+ {
2163
+ Object3D obj = listUI.elementAt(i);
2164
+ if (!obj.pinned)
2165
+ {
2166
+ obj.CloseUI();
2167
+ listUI.remove(i);
2168
+ }
2169
+ }
2170
+ }
2171
+
2172
+ private void EditElement(Object3D elem, boolean newWindow)
2173
+ {
2174
+ // if (!(elem instanceof Composite))
2175
+ // newWindow = false;
2176
+ listUI.add(elem);
2177
+ elem.openEditWindow(this, newWindow); //, false);
2178
+ System.out.println("edit : " + elem);
2179
+ elem.editWindow.refreshContents(true); // ? new
2180
+ }
12292181
12302182 /**
12312183 * applyExample
....@@ -1429,9 +2381,9 @@
14292381
14302382 void Overwrite(int mask)
14312383 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2384
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332385 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2386
+ Object3D content = Grafreed.clipboard.get(0);
14352387
14362388 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372389 content = ((cGroup)content).get(0);
....@@ -1454,6 +2406,7 @@
14542406 //
14552407 public void actionPerformed(ActionEvent event) // , Object arg)
14562408 {
2409
+ Object source = event.getSource();
14572410 /*
14582411 if (event.getSource() == nameField)
14592412 {
....@@ -1465,11 +2418,11 @@
14652418 }
14662419 else
14672420 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2421
+ if (source == lookAtItem || source == lookFromItem)
14692422 {
14702423 ScreenFit();
14712424 } else
1472
- if (event.getSource() == switchItem)
2425
+ if (source == switchViewItem)
14732426 {
14742427 cVector v1 = new cVector();
14752428 cVector v2 = new cVector();
....@@ -1478,11 +2431,11 @@
14782431 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792432 objEditor.cameraView.repaint();
14802433 } else
1481
- if (event.getSource() == rectoidItem)
2434
+ if (source == rectoidItem || source == boxButton)
14822435 {
14832436 makeSomething(new Box());
14842437 } else
1485
- if (event.getSource() == particleItem)
2438
+ if (source == particleItem || source == particlesButton)
14862439 {
14872440 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882441 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2456,9 @@
15032456 applyExample(particleGeom, "SMOKE");
15042457 makeSomething(particleGeom);
15052458 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2459
+ if (source == ragdollItem || source == ragdoll2Item)
15072460 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2461
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092462
15102463 ragdoll.toParent = LA.newMatrix();
15112464 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2474,71 @@
15212474 makeSomething(ragdoll);
15222475 //makeSomething(new VehicleDemo());
15232476 } else
1524
- if (event.getSource() == gridItem)
2477
+ /*
2478
+ */
2479
+ if (source == heightFieldItem)
2480
+ {
2481
+ Object3D obj = new Object3D();
2482
+
2483
+ obj.CreateMaterial();
2484
+ obj.bRep = new BoundaryRep();
2485
+
2486
+ obj.bRep.CreateMesh(new iHeightField()
2487
+ {
2488
+ public double f(double x, double y)
2489
+ {
2490
+ // The Mandelbrot set is represented by coloring
2491
+ // each point (x,y) according to the number of
2492
+ // iterations it takes before the while loop in
2493
+ // this method ends. For points that are actually
2494
+ // in the Mandelbrot set, or very close to it, the
2495
+ // count will reach the maximum value, 80. These
2496
+ // points will be colored purple. All other colors
2497
+ // represent points that are definitely NOT in the set.
2498
+ x -= 600;
2499
+ y -= 500;
2500
+ x /= 200;
2501
+ y /= 200;
2502
+ int count = 0;
2503
+ double zx = x;
2504
+ double zy = y;
2505
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2506
+ double new_zx = zx*zx - zy*zy + x;
2507
+ zy = 2*zx*zy + y;
2508
+ zx = new_zx;
2509
+ count++;
2510
+ }
2511
+ return count; // Math.sqrt(count);
2512
+ }
2513
+ }, 1000,1000);
2514
+
2515
+ makeSomething(obj);
2516
+ } else
2517
+ if (source == gridItem || source == gridButton)
15252518 {
15262519 makeSomething(new Grid());
15272520 } else
1528
- if (event.getSource() == ellipsoidItem)
2521
+ if (source == ellipsoidItem || source == sphereButton)
15292522 {
15302523 makeSomething(new Sphere());
15312524 } else
1532
- if (event.getSource() == coneItem)
2525
+ if (source == coneItem || source == coneButton)
15332526 {
15342527 makeSomething(new Cone());
15352528 } else
1536
- if (event.getSource() == torusItem)
2529
+ if (source == torusItem || source == torusButton)
15372530 {
15382531 makeSomething(new Torus());
15392532 } else
1540
- if (event.getSource() == superItem)
2533
+ if (source == superItem || source == superButton)
15412534 {
15422535 makeSomething(new Superellipsoid());
15432536 } else
1544
- if (event.getSource() == blobItem)
2537
+ if (source == kleinItem || source == kleinButton)
2538
+ {
2539
+ makeSomething(new Klein());
2540
+ } else
2541
+ if (source == blobItem)
15452542 {
15462543 Blob blob = new Blob();
15472544 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2546,15 @@
15492546 //blob.retile();
15502547 makeSomething(blob);
15512548 } else
1552
- if (event.getSource() == latheItem)
2549
+ if (source == latheItem)
15532550 {
15542551 makeSomething(new Lathe());
15552552 } else
1556
- if (event.getSource() == bezierItem)
2553
+ if (source == bezierItem)
15572554 {
15582555 makeSomething(new BezierSurface());
15592556 } else
1560
- if (event.getSource() == checkerItem)
2557
+ if (source == overlayItem || source == overlayButton)
15612558 {
15622559 /*
15632560 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2567,9 @@
15702567 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712568 LA.matInvert(obj.toParent, obj.fromParent);
15722569 */
1573
- makeSomething(new CheckerIG());
2570
+ makeSomething(new Checker());
15742571 } else
1575
- if (event.getSource() == meshItem)
2572
+ if (source == meshItem)
15762573 {
15772574 Object3D itemtomake = new Object3D();
15782575 Object3D child;
....@@ -1593,35 +2590,52 @@
15932590 makeSomething(child);
15942591 }
15952592 } else
1596
- if (event.getSource() == springItem)
2593
+ if (source == springItem)
15972594 {
15982595 cSpring s = new cSpring();
15992596 s.setup();
16002597 makeSomething(s);
16012598 } else
1602
- if (event.getSource() == flagItem)
2599
+ if (source == flagItem)
16032600 {
16042601 cSpring s = new cFlag();
16052602 s.setup();
16062603 makeSomething(s);
16072604 } else
1608
- if (event.getSource() == lightItem)
2605
+ if (source == lightItem || source == lightButton)
16092606 {
16102607 makeSomething(new Light());
16112608 } else
1612
- if (event.getSource() == csgItem)
2609
+// if (source == skybox1Button ||
2610
+// source == skybox2Button ||
2611
+// source == skybox3Button ||
2612
+// source == skybox4Button ||
2613
+// source == skybox5Button ||
2614
+// source == skybox6Button ||
2615
+// source == skybox7Button ||
2616
+// source == skybox11Button ||
2617
+// source == skybox12Button ||
2618
+// source == skybox13Button ||
2619
+// source == skybox14Button ||
2620
+// source == skybox15Button ||
2621
+// source == skybox16Button ||
2622
+// source == skybox17Button)
2623
+// {
2624
+// ChangeSkybox(source);
2625
+// } else
2626
+ if (source == csgItem)
16132627 {
16142628 group(new CSG());
16152629 } else
1616
- if (event.getSource() == templateItem)
2630
+ if (source == templateItem)
16172631 {
16182632 group(new cTemplate());
16192633 } else
1620
- if (event.getSource() == attributeItem)
2634
+ if (source == attributeItem)
16212635 {
16222636 makeSomething(new Attribute());
16232637 } else
1624
- if (event.getSource() == pointflowItem)
2638
+ if (source == pointflowItem)
16252639 {
16262640 makeSomething(new PointFlow());
16272641 } else
....@@ -1633,7 +2647,7 @@
16332647 } else
16342648 */
16352649
1636
- if (event.getSource() == superLoopItem)
2650
+ if (source == superLoopItem)
16372651 {
16382652 Composite g = new cGroup();
16392653 for (int i=0; i<15; i++)
....@@ -1655,30 +2669,30 @@
16552669
16562670 group(g);
16572671 } else
1658
- if (event.getSource() == loopItem)
2672
+ if (source == loopItem || source == loopButton)
16592673 {
16602674 Composite csg = new GroupLeaf();
16612675 csg.count = 5;
16622676 group(csg);
1663
- Composite child = new cGroup();
2677
+ Composite child = new cGroup("Branch");
16642678 csg.addChild(child);
16652679 child.addChild(csg);
16662680 } else
1667
- if (event.getSource() == doubleItem)
2681
+ if (source == doubleItem)
16682682 {
1669
- Composite csg = new GroupLeaf();
2683
+ Composite csg = new GroupLeaf("Fork");
16702684 csg.count = 5;
16712685 group(csg);
1672
- Composite child = new cGroup();
2686
+ Composite child = new cGroup("Branch A");
16732687 csg.addChild(child);
16742688 child.addChild(csg);
1675
- child = new cGroup();
2689
+ child = new cGroup("Branch B");
16762690 csg.addChild(child);
16772691 child.addChild(csg);
16782692 } else
1679
- if (event.getSource() == tripleItem)
2693
+ if (source == tripleItem)
16802694 {
1681
- Composite csg = new GroupLeaf();
2695
+ Composite csg = new GroupLeaf("Trident");
16822696 csg.count = 4;
16832697 group(csg);
16842698 Composite child = new cGroup();
....@@ -1691,73 +2705,117 @@
16912705 csg.addChild(child);
16922706 child.addChild(csg);
16932707 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2708
+ if (source == computeAOItem)
16962709 {
1697
- ImportGFD();
2710
+ Globals.drawMode = CameraPane.OCCLUSION;
2711
+ cameraView.repaint();
16982712 } 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)
2713
+ if (source == recompileItem)
17172714 {
17182715 Recompile();
17192716 refreshContents();
17202717 } else
1721
- if (event.getSource() == editScriptItem)
2718
+ if (source == editScriptItem)
17222719 {
17232720 OpenDialog();
17242721 refreshContents();
17252722 } else
1726
- if (event.getSource() == invariantsItem)
2723
+ if (source == invariantsItem)
17272724 {
17282725 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2726
+ Grafreed.grafreed.universe.invariants();
17302727 } else
1731
- if (event.getSource() == memoryItem)
2728
+ if (source == memoryItem)
17322729 {
17332730 //System.out.println("Invariants:");
17342731 PrintMemory();
17352732 } else
1736
- if (event.getSource() == pathItem)
2733
+ if (source == pathItem)
17372734 {
17382735 PrintPath();
17392736 } else
1740
- if (event.getSource() == analyzeItem)
2737
+ if (source == analyzeItem)
17412738 {
17422739 AnalyzeObject();
17432740 } else
1744
- if (event.getSource() == dumpItem)
2741
+ if (source == dumpItem)
17452742 {
17462743 DumpObject();
17472744 } else
1748
- if (event.getSource() == screenfitButton)
2745
+ if (source == minButton)
17492746 {
1750
- //Reload(lastConverter, lastFilename, true);
2747
+ Minimize();
2748
+ } else
2749
+ if (source == maxButton)
2750
+ {
2751
+ Maximize();
2752
+ } else
2753
+ if (source == fullButton)
2754
+ {
2755
+ ToggleFullScreen();
2756
+ } else
2757
+ if (source == collapseButton)
2758
+ {
2759
+ this.expandedLayout = radio.layout;
2760
+ CollapseToolbar();
2761
+ } else
2762
+ if (source == maximize3DButton)
2763
+ {
2764
+ this.expandedLayout = radio.layout;
2765
+ radio.layout = twoButton;
2766
+ Show3DView();
2767
+ CollapseToolbar();
2768
+ } else
2769
+ if (source == previousVersionButton)
2770
+ {
2771
+ // Go to previous version
2772
+ //if (!Undo())
2773
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2774
+ PreviousVersion();
2775
+ } else
2776
+ if (source == restoreButton)
2777
+ {
2778
+ // Restore current version
2779
+ Restore();
2780
+ //restoreButton.setEnabled(false);
2781
+ } else
2782
+ if (source == replaceButton)
2783
+ {
2784
+ // Overwrite current version
2785
+ Replace();
2786
+ //replaceButton.setEnabled(false);
2787
+ } else
2788
+ if (source == nextVersionButton)
2789
+ {
2790
+ // Go to next version
2791
+ NextVersion();
2792
+ } else
2793
+ if (source == saveVersionButton)
2794
+ {
2795
+ // Save a new version
2796
+ if (!Save(true))
2797
+ java.awt.Toolkit.getDefaultToolkit().beep();
2798
+ } else
2799
+ if (source == deleteVersionButton)
2800
+ {
2801
+ // Delete a new version
2802
+ DeleteVersion();
2803
+ } else
2804
+ if (source == oneStepButton)
2805
+ {
2806
+ Globals.ONESTEP = true;
2807
+ cameraView.repaint();
2808
+ } else
2809
+ if (source == screenfitButton)
2810
+ {
17512811 ScreenFit();
17522812 } else
1753
- if (event.getSource() == screenfitpointButton)
2813
+ if (source == screenfitpointButton)
17542814 {
1755
- //Reload(lastConverter, lastFilename, true);
17562815 ScreenFitPoint();
17572816 } else
1758
- if (event.getSource() == snapobjectButton)
2817
+ if (source == snapobjectButton)
17592818 {
1760
- //Reload(lastConverter, lastFilename, true);
17612819 SnapObject();
17622820 } else
17632821 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2824,13 @@
17662824 // Recompile();
17672825 // refreshContents();
17682826 // } else
1769
- if (event.getSource() == gcButton)
2827
+ if (source == gcButton)
17702828 {
17712829 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722830 System.gc();
17732831 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742832 } else
1775
- if (event.getSource() == editLeafItem)
2833
+ if (source == editLeafItem)
17762834 {
17772835 Object3D obj;
17782836 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2844,78 @@
17862844 }
17872845 refreshContents(true);
17882846 } else
1789
- if (event.getSource() == openWindowItem)
2847
+ if (source == openWindowItem)
17902848 {
17912849 EditSelection(true);
17922850 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2851
+ if (source == cutItem || source == clearButton)
17942852 {
17952853 loadClipboard(true);
17962854 } else
1797
- if (event.getSource() == duplicateItem)
2855
+ if (source == undoItem)
17982856 {
1799
- Object3D keep = GraphreeD.clipboard;
2857
+ PreviousVersion();
2858
+ } else
2859
+ if (source == redoItem)
2860
+ {
2861
+ NextVersion();
2862
+ } else
2863
+ if (source == duplicateItem)
2864
+ {
2865
+ Object3D keep = Grafreed.clipboard;
18002866 loadClipboard(false);
18012867 paste(false);
1802
- GraphreeD.clipboard = keep;
2868
+ Grafreed.clipboard = keep;
18032869 } else
1804
- if (event.getSource() == cloneItem)
2870
+ if (source == cloneItem)
18052871 {
18062872 CloneSelection(false);
18072873 } else
1808
- if (event.getSource() == cloneSupportItem)
2874
+ if (source == cloneSupportItem)
18092875 {
18102876 CloneSelection(true);
18112877 } else
1812
- if (event.getSource() == copyItem)
2878
+ if (source == copyItem)
18132879 {
18142880 loadClipboard(false);
18152881 } else
1816
- if (event.getSource() == pasteItem)
2882
+ if (source == pasteItem)
18172883 {
18182884 paste(false);
18192885 } else
1820
- if (event.getSource() == pasteLinkItem)
2886
+ if (source == pasteIntoItem)
18212887 {
1822
- pasteInto(false);
2888
+ pasteInto(true, false);
18232889 } else
1824
- if (event.getSource() == pasteCloneItem)
2890
+ if (source == pasteLinkItem)
18252891 {
1826
- pasteInto(true);
2892
+ pasteInto(false, false);
18272893 } else
1828
- if (event.getSource() == pasteExpandItem)
2894
+ if (source == pasteCloneItem)
2895
+ {
2896
+ pasteInto(true, true);
2897
+ } else
2898
+ if (source == pasteExpandItem)
18292899 {
18302900 paste(true);
18312901 } else
1832
- if (event.getSource() == synchronizeItem)
2902
+ if (source == synchronizeItem)
18332903 {
18342904 Overwrite(Object3D.TRANSFORM);
18352905 } else
1836
- if (event.getSource() == overwriteNameItem)
2906
+ if (source == overwriteNameItem)
18372907 {
18382908 Overwrite(Object3D.NAME);
18392909 } else
1840
- if (event.getSource() == overwriteUVItem)
2910
+ if (source == overwriteUVItem)
18412911 {
18422912 Overwrite(Object3D.UV);
18432913 } else
1844
- if (event.getSource() == overwriteMatItem)
2914
+ if (source == overwriteMatItem)
18452915 {
2916
+ /* july 2015
18462917 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2918
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482919 else
18492920 {
18502921 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2927,16 @@
18562927 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572928 }
18582929 }
2930
+ */
2931
+
2932
+ Overwrite(dropAttributes);
18592933 }
1860
- if (event.getSource() == overwriteGeoItem)
2934
+ if (source == overwriteGeoItem)
18612935 {
18622936 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2937
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642938 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2939
+// Object3D content = GrafreeD.clipboard.get(0);
18662940 //
18672941 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682942 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2948,7 @@
18742948 // refreshContents();
18752949 // }
18762950 } else
1877
- if (event.getSource() == generateMeshItem)
2951
+ if (source == generateMeshItem)
18782952 {
18792953 //if (group.selection.size() == 1)
18802954 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2959,7 @@
18852959 ResetModel();
18862960 refreshContents();
18872961 } else
1888
- if (event.getSource() == extractGeometriesItem)
2962
+ if (source == extractGeometriesItem)
18892963 {
18902964 boolean one = false;
18912965
....@@ -1912,7 +2986,7 @@
19122986 ResetModel();
19132987 refreshContents();
19142988 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2989
+ if (source == cloneGeometriesItem)
19162990 {
19172991 boolean one = false;
19182992
....@@ -1938,32 +3012,37 @@
19383012 ResetModel();
19393013 refreshContents();
19403014 } else
1941
- if (event.getSource() == shareGeometriesItem)
3015
+ if (source == shareGeometriesItem)
19423016 {
19433017 boolean one = false;
19443018
19453019 if (group.selection.size() == 1)
19463020 one = true;
19473021
3022
+ Object3D merge = null;
3023
+
19483024 Object3D content = new cGroup();
19493025
19503026 for (int i=0; i<group.selection.size(); i++)
19513027 {
1952
- Object3D sel = new Merge(group.selection.get(i));
3028
+ merge = new Merge(group.selection.get(i));
19533029
19543030 if (one)
1955
- makeSomething(sel, false);
3031
+ makeSomething(merge, false);
19563032 else
1957
- content.addChild(sel);
3033
+ content.addChild(merge);
19583034 }
19593035
19603036 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
3037
+ makeSomething(content, true);
3038
+ else
3039
+ {
3040
+ ResetModel();
3041
+ Select(merge.GetTreePath(), true, false); // unselect... false);
3042
+ refreshContents();
3043
+ }
19653044 } else
1966
- if (event.getSource() == mergeGeometriesItem)
3045
+ if (source == mergeGeometriesItem)
19673046 {
19683047 boolean one = false;
19693048
....@@ -1993,11 +3072,11 @@
19933072 ResetModel();
19943073 refreshContents();
19953074 } else
1996
- if (event.getSource() == linkverticesItem)
3075
+ if (source == linkverticesItem)
19973076 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3077
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19993078 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
3079
+// Object3D content = GrafreeD.clipboard.get(0);
20013080 //
20023081 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20033082 // content = ((cGroup)content).get(0);
....@@ -2006,39 +3085,48 @@
20063085 // group.selection.get(0).setMasterThis(content); // should be identity
20073086 // refreshContents();
20083087 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3088
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20103089 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
3090
+ Object3D content = Grafreed.clipboard.get(0);
20123091
20133092 if (content instanceof cGroup && ((cGroup)content).transientlink )
20143093 content = ((cGroup)content).get(0);
20153094
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3095
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20173096 for (int i=0; i<group.selection.size(); i++)
20183097 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
3098
+ boolean random = CameraPane.SWITCH;
3099
+ CameraPane.SWITCH = false; // parse all random nodes
20213100 group.selection.get(i).linkVerticesThis(content);
20223101 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
3102
+ CameraPane.SWITCH = random;
20243103 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3104
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20263105 refreshContents();
20273106 }
20283107 } else
2029
- if (event.getSource() == resetsupportItem)
3108
+ if (source == resetsupportItem)
20303109 {
20313110 for (int i=0; i<group.selection.size(); i++)
20323111 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
3112
+ boolean random = CameraPane.SWITCH;
3113
+ CameraPane.SWITCH = false; // parse all random nodes
20353114 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
3115
+ CameraPane.SWITCH = random;
20373116 }
20383117
20393118 refreshContents();
20403119 } else
2041
- if (event.getSource() == resetreferencesItem)
3120
+ if (source == relinkverticesItem)
3121
+ {
3122
+ boolean random = CameraPane.SWITCH;
3123
+ CameraPane.SWITCH = false; // parse all random nodes
3124
+ group.selection.RelinkToSupport();
3125
+ CameraPane.SWITCH = random;
3126
+
3127
+ refreshContents();
3128
+ } else
3129
+ if (source == resetreferencesItem)
20423130 {
20433131 for (int i=0; i<group.selection.size(); i++)
20443132 {
....@@ -2047,11 +3135,11 @@
20473135
20483136 refreshContents();
20493137 } else
2050
- if (event.getSource() == setMasterItem)
3138
+ if (source == setMasterItem)
20513139 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3140
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20533141 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
3142
+ Object3D content = Grafreed.clipboard.get(0);
20553143
20563144 if (content instanceof cGroup && ((cGroup)content).transientlink )
20573145 content = ((cGroup)content).get(0);
....@@ -2060,13 +3148,13 @@
20603148 refreshContents();
20613149 }
20623150 } else
2063
- if (event.getSource() == poseMeshItem)
3151
+ if (source == poseMeshItem)
20643152 {
20653153 if (group.selection.size() == 1)
20663154 {
2067
- if (GraphreeD.clipboard.size() == 1)
3155
+ if (Grafreed.clipboard.size() == 1)
20683156 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
3157
+ Object3D content = Grafreed.clipboard.get(0);
20703158
20713159 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723160 content = ((cGroup)content).get(0);
....@@ -2079,19 +3167,19 @@
20793167 }
20803168
20813169 } else
2082
- if (event.getSource() == revertMeshItem)
3170
+ if (source == revertMeshItem)
20833171 {
20843172 RevertMeshes();
20853173 } else
2086
- if (event.getSource() == resetMeshItem)
3174
+ if (source == resetAllItem)
20873175 {
20883176 ResetAll();
20893177 } else
2090
- if (event.getSource() == stepAllItem)
3178
+ if (source == stepAllItem)
20913179 {
20923180 StepAll();
20933181 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3182
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953183 {
20963184 //int indices[] = jList.getSelectedIndices();
20973185 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3187,46 @@
20993187
21003188 ClearSelection(false);
21013189 } else
2102
- if (event.getSource() == clearAllItem)
3190
+ if (source == clearAllItem)
21033191 {
21043192 ClearSelection(true);
21053193 } else
2106
- if (event.getSource() == grabItem)
3194
+ if (source == grabItem || source == groupButton)
21073195 {
2108
- group(new cGroup(), true);
3196
+ group(new cGroup(), false); // true);
21093197 } else
2110
- if (event.getSource() == frontItem)
3198
+ if (source == hideItem)
3199
+ {
3200
+ group(new HiddenObject());
3201
+ } else
3202
+ if (source == frontItem)
21113203 {
21123204 front();
21133205 } else
2114
- if (event.getSource() == backItem)
3206
+ if (source == backItem)
21153207 {
21163208 back();
21173209 } else
2118
- if (event.getSource() == cameraItem)
3210
+ if (source == cameraItem)
21193211 {
21203212 makeSomething(new Camera());
21213213 } else
2122
- if (event.getSource() == compositeItem)
3214
+ if (source == compositeItem || source == compositeButton)
21233215 {
21243216 group(new Composite());
21253217 } else
2126
- if (event.getSource() == randomItem)
3218
+ if (source == switchItem || source == switchButton)
21273219 {
21283220 RandomNode random = new RandomNode();
21293221 group(random);
21303222 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3223
+ random.name = random.get(0).name + "Switch";
21323224 } else
2133
- if (event.getSource() == physicsItem)
3225
+ if (source == physicsItem)
21343226 {
21353227 group(new PhysicsNode());
21363228 } else
2137
- if (event.getSource() == frameselectorItem)
3229
+ if (source == frameselectorItem)
21383230 {
21393231 for (int i=0; i<group.selection.size(); i++)
21403232 {
....@@ -2146,7 +3238,7 @@
21463238 ResetModel();
21473239 refreshContents();
21483240 } else
2149
- if (event.getSource() == switchGeoItem)
3241
+ if (source == switchGeoItem)
21503242 {
21513243 for (int i=0; i<group.selection.size(); i++)
21523244 {
....@@ -2158,7 +3250,7 @@
21583250 ResetModel();
21593251 refreshContents();
21603252 } else
2161
- if (event.getSource() == switchTransfoItem)
3253
+ if (source == switchTransfoItem)
21623254 {
21633255 for (int i=0; i<group.selection.size(); i++)
21643256 {
....@@ -2170,7 +3262,7 @@
21703262 ResetModel();
21713263 refreshContents();
21723264 } else
2173
- if (event.getSource() == morphItem)
3265
+ if (source == morphItem)
21743266 {
21753267 for (int i=0; i<group.selection.size(); i++)
21763268 {
....@@ -2182,7 +3274,7 @@
21823274 ResetModel();
21833275 refreshContents();
21843276 } else
2185
- if (event.getSource() == scriptNodeItem)
3277
+ if (source == scriptNodeItem)
21863278 {
21873279 boolean atleastone = false;
21883280
....@@ -2221,191 +3313,252 @@
22213313 }
22223314 }
22233315 } else
2224
- if (event.getSource() == linkerItem)
3316
+ if (source == linkerItem)
22253317 {
22263318 group(new cLinker());
22273319 } else
2228
- if (event.getSource() == textureItem)
3320
+ if (source == textureItem || source == textureButton)
22293321 {
22303322 group(new TextureNode());
22313323 } else
2232
- if (event.getSource() == shadowXItem)
3324
+ if (source == billboardItem)
3325
+ {
3326
+ group(new BillboardNode());
3327
+ } else
3328
+ if (source == shadowXItem)
22333329 {
22343330 CastShadow(0);
22353331 } else
2236
- if (event.getSource() == shadowYItem)
3332
+ if (source == shadowYItem)
22373333 {
22383334 CastShadow(1);
22393335 } else
2240
- if (event.getSource() == shadowZItem)
3336
+ if (source == shadowZItem)
22413337 {
22423338 CastShadow(2);
22433339 } else
2244
- if (event.getSource() == ungroupItem)
3340
+ if (source == ungroupItem || source == ungroupButton)
22453341 {
2246
- ungroup();
3342
+ boolean hasRoot = false;
3343
+
3344
+ for (int i=0; i<group.selection.size(); i++)
3345
+ {
3346
+ if (group.selection.get(i) == group)
3347
+ {
3348
+ hasRoot = true;
3349
+ break;
3350
+ }
3351
+ }
3352
+
3353
+ if (!hasRoot)
3354
+ {
3355
+ for (int i=0; i<group.selection.size(); i++)
3356
+ {
3357
+ Ungroup(group.selection.get(i));
3358
+ }
3359
+
3360
+ ClearSelection(false);
3361
+
3362
+ refreshContents();
3363
+ }
22473364 } else
2248
- if (event.getSource() == genUVItem)
3365
+ if (source == genUVItem)
22493366 {
22503367 GenUV();
22513368 } else
2252
- if (event.getSource() == genNormalsCADItem)
3369
+ if (source == genNormalsCADItem)
22533370 {
22543371 GenNormals(true);
22553372 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3373
+ if (source == genNormalsMESHItem)
3374
+ {
3375
+ GenNormalsMESH();
3376
+ } else
3377
+ if (source == genNormalsORGANItem)
22573378 {
22583379 GenNormals(false);
22593380 } else
2260
- if (event.getSource() == stripifyItem)
3381
+ if (source == genNormalsMINEItem)
3382
+ {
3383
+ GenNormalsMINE();
3384
+ } else
3385
+ if (source == stripifyItem)
22613386 {
22623387 Stripify();
22633388 } else
2264
- if (event.getSource() == unstripifyItem)
3389
+ if (source == unstripifyItem)
22653390 {
22663391 Unstripify();
22673392 } else
2268
- if (event.getSource() == trimItem)
3393
+ if (source == trimItem)
22693394 {
22703395 Trim();
22713396 } else
2272
- if (event.getSource() == untrimItem)
3397
+ if (source == untrimItem)
22733398 {
22743399 Untrim();
22753400 } else
2276
- if (event.getSource() == clearColorsItem)
3401
+ if (source == clearColorsItem)
22773402 {
22783403 ClearColors();
22793404 } else
2280
- if (event.getSource() == clearMaterialsItem)
3405
+ if (source == clearMaterialsItem)
22813406 {
22823407 ClearMaterials();
22833408 } else
2284
- if (event.getSource() == liveleavesItem)
3409
+ if (source == liveleavesItem)
22853410 {
22863411 LiveLeaves(true);
22873412 } else
2288
- if (event.getSource() == unliveleavesItem)
3413
+ if (source == unliveleavesItem)
22893414 {
22903415 LiveLeaves(false);
22913416 } else
2292
- if (event.getSource() == supportleavesItem)
3417
+ if (source == supportleavesItem)
22933418 {
22943419 SupportLeaves(true);
22953420 } else
2296
- if (event.getSource() == unsupportleavesItem)
3421
+ if (source == unsupportleavesItem)
22973422 {
22983423 SupportLeaves(false);
22993424 } else
2300
- if (event.getSource() == hideleavesItem)
3425
+ if (source == hideleavesItem)
23013426 {
23023427 HideLeaves(true);
23033428 } else
2304
- if (event.getSource() == showleavesItem)
3429
+ if (source == showleavesItem)
23053430 {
23063431 HideLeaves(false);
23073432 } else
2308
- if (event.getSource() == markleavesItem)
3433
+ if (source == markleavesItem)
23093434 {
23103435 MarkLeaves(true);
23113436 } else
2312
- if (event.getSource() == unmarkleavesItem)
3437
+ if (source == unmarkleavesItem)
23133438 {
23143439 MarkLeaves(false);
23153440 } else
2316
- if (event.getSource() == flipVItem)
3441
+ if (source == rewindleavesItem)
3442
+ {
3443
+ RewindLeaves(true);
3444
+ } else
3445
+ if (source == unrewindleavesItem)
3446
+ {
3447
+ RewindLeaves(false);
3448
+ } else
3449
+ if (source == randomleavesItem)
3450
+ {
3451
+ RandomLeaves(true);
3452
+ } else
3453
+ if (source == unrandomleavesItem)
3454
+ {
3455
+ RandomLeaves(false);
3456
+ } else
3457
+ if (source == flipVItem)
23173458 {
23183459 FlipV(true);
23193460 } else
2320
- if (event.getSource() == unflipVItem)
3461
+ if (source == unflipVItem)
23213462 {
23223463 FlipV(false);
23233464 } else
2324
- if (event.getSource() == lowTexturesItem)
3465
+ if (source == lowTexturesItem)
23253466 {
23263467 SetTexRes(0);
23273468 } else
2328
- if (event.getSource() == normalTexturesItem)
3469
+ if (source == normalTexturesItem)
23293470 {
23303471 SetTexRes(1);
23313472 } else
2332
- if (event.getSource() == highTexturesItem)
3473
+ if (source == highTexturesItem)
23333474 {
23343475 SetTexRes(2);
23353476 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3477
+ if (source == veryhighTexturesItem)
23373478 {
23383479 SetTexRes(3);
23393480 } else
2340
- if (event.getSource() == maxTexturesItem)
3481
+ if (source == maxTexturesItem)
23413482 {
23423483 SetTexRes(4);
23433484 } else
2344
- if (event.getSource() == panoTexturesItem)
3485
+ if (source == panoTexturesItem)
23453486 {
23463487 SetTexRes(5);
23473488 } else
2348
- if (event.getSource() == reverseNormalsItem)
3489
+ if (source == reverseNormalsItem)
23493490 {
23503491 ReverseNormals();
23513492 } else
2352
- if (event.getSource() == parseverticesItem)
3493
+ if (source == parseverticesItem)
23533494 {
23543495 ParseVertices();
23553496 } else
2356
- if (event.getSource() == alignItem)
3497
+ if (source == textureFieldItem)
3498
+ {
3499
+ TextureVertices();
3500
+ } else
3501
+ if (source == alignItem)
23573502 {
23583503 Align();
23593504 } else
2360
- if (event.getSource() == mirrorItem)
3505
+ if (source == mirrorItem)
23613506 {
23623507 MirrorPoses();
23633508 } else
2364
- if (event.getSource() == reduceMorphItem)
3509
+ if (source == reduceMorphItem)
23653510 {
23663511 MeshReduction(false);
23673512 } else
2368
- if (event.getSource() == reduce34MorphItem)
3513
+ if (source == reduce34MorphItem)
23693514 {
23703515 MeshReduction(true);
23713516 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3517
+ if (source == reverseTrianglesItem)
23733518 {
23743519 ReverseTriangles();
23753520 } else
2376
- if (event.getSource() == reduceMeshItem)
3521
+ if (source == reduceMeshItem)
23773522 {
23783523 ReduceMesh(false);
23793524 } else
2380
- if (event.getSource() == reduce34MeshItem)
3525
+ if (source == reduce34MeshItem)
23813526 {
23823527 ReduceMesh(true);
23833528 } else
2384
- if (event.getSource() == increaseMeshItem)
3529
+ if (source == increaseMeshItem)
23853530 {
23863531 IncreaseMesh();
23873532 } else
2388
- if (event.getSource() == clipMeshItem)
3533
+ if (source == clipMeshItem)
23893534 {
23903535 ClipMesh();
23913536 } else
2392
- if (event.getSource() == smoothMeshItem)
3537
+ if (source == smoothMeshItem)
23933538 {
23943539 SmoothMesh();
23953540 } else
2396
- if (event.getSource() == transformgeometryItem)
3541
+ if (source == transformGeometryItem)
23973542 {
23983543 TransformGeometry();
23993544 } else
2400
- if (event.getSource() == resetTransformItem)
3545
+ if (source == transformChildrenItem)
3546
+ {
3547
+ TransformChildren();
3548
+ } else
3549
+ if (source == resetTransformItem)
24013550 {
24023551 ResetTransform();
24033552 } else
2404
- if (event.getSource() == resetCentroidItem)
3553
+ if (source == resetCentroidItem)
24053554 {
2406
- ResetCentroid();
3555
+ ResetCentroid(true);
24073556 } else
2408
- if (event.getSource() == resetParentItem)
3557
+ if (source == resetCentroidXZItem)
3558
+ {
3559
+ ResetCentroid(false);
3560
+ } else
3561
+ if (source == resetParentItem)
24093562 {
24103563 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113564 {
....@@ -2415,7 +3568,7 @@
24153568
24163569 refreshContents();
24173570 } else
2418
- if (event.getSource() == repairParentItem)
3571
+ if (source == repairParentItem)
24193572 {
24203573 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213574 {
....@@ -2429,7 +3582,21 @@
24293582
24303583 refreshContents();
24313584 } else
2432
- if (event.getSource() == sortbysizeItem)
3585
+ if (source == repairShadowItem)
3586
+ {
3587
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3588
+ {
3589
+ Object3D obj = (Object3D)e.nextElement();
3590
+ obj.RepairShadow();
3591
+// for (int i=0; i<obj.size(); i++)
3592
+// {
3593
+// obj.get(i).parent = obj;
3594
+// }
3595
+ }
3596
+
3597
+ refreshContents();
3598
+ } else
3599
+ if (source == sortbysizeItem)
24333600 {
24343601 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353602 {
....@@ -2441,7 +3608,7 @@
24413608 ResetModel();
24423609 refreshContents();
24433610 } else
2444
- if (event.getSource() == sortbynameItem)
3611
+ if (source == sortbynameItem)
24453612 {
24463613 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473614 {
....@@ -2453,7 +3620,7 @@
24533620 ResetModel();
24543621 refreshContents();
24553622 } else
2456
- if (event.getSource() == attachPigmentItem)
3623
+ if (source == attachPigmentItem)
24573624 {
24583625 String texture = GetFile("Attach pigment");
24593626 Object3D obj;
....@@ -2465,7 +3632,7 @@
24653632
24663633 refreshContents();
24673634 } else
2468
- if (event.getSource() == detachPigmentItem)
3635
+ if (source == detachPigmentItem)
24693636 {
24703637 Object3D obj;
24713638 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3643,7 @@
24763643
24773644 refreshContents();
24783645 } else
2479
- if (event.getSource() == attachBumpItem)
3646
+ if (source == attachBumpItem)
24803647 {
24813648 String texture = GetFile("Attach bump");
24823649 Object3D obj;
....@@ -2488,18 +3655,18 @@
24883655
24893656 refreshContents();
24903657 } else
2491
- if (event.getSource() == detachBumpItem)
3658
+ if (source == detachBumpItem)
24923659 {
24933660 Object3D obj;
24943661 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953662 {
24963663 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3664
+ obj.ResetBumpTexture();
24983665 }
24993666
25003667 refreshContents();
25013668 } else
2502
- if (event.getSource() == pigmentBumpItem)
3669
+ if (source == pigmentBumpItem)
25033670 {
25043671 Object3D obj;
25053672 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,159 +3677,233 @@
25103677
25113678 refreshContents();
25123679 } else
2513
- if (event.getSource() == flashSelectionButton)
3680
+ if (source == embedTexturesItem)
3681
+ {
3682
+ Object3D obj;
3683
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3684
+ {
3685
+ obj = (Object3D)e.nextElement();
3686
+ obj.EmbedTextures(true);
3687
+ }
3688
+
3689
+ refreshContents();
3690
+ } else
3691
+ if (source == deEmbedTexturesItem)
3692
+ {
3693
+ Object3D obj;
3694
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3695
+ {
3696
+ obj = (Object3D)e.nextElement();
3697
+ obj.EmbedTextures(false);
3698
+ }
3699
+
3700
+ CameraPane.texturepigment.clear();
3701
+ CameraPane.texturebump.clear();
3702
+
3703
+ refreshContents();
3704
+ } else
3705
+ if (source == flashSelectionButton)
25143706 {
25153707 CameraPane.flash = true;
25163708 refreshContents();
25173709 } else
2518
- if (event.getSource() == oneButton)
3710
+ if (source == oneButton)
25193711 {
25203712 } else
2521
- if (event.getSource() == twoButton)
3713
+ if (source == twoButton)
25223714 {
25233715 radio.layout = twoButton;
2524
- // bug
2525
- //gridPanel.setDividerLocation(1.0);
2526
- //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();
3716
+
3717
+ if (CameraPane.FULLSCREEN)
3718
+ fullscreenLayout = radio.layout;
3719
+
3720
+ Show3DView();
3721
+
3722
+ cameraView.requestFocusInWindow();
3723
+
3724
+// refreshContents(true);
3725
+//
3726
+// try
3727
+// {
3728
+// java.awt.Robot bot = new java.awt.Robot();
3729
+// int mask = InputEvent.BUTTON1_MASK;
3730
+// bot.mouseMove(100, 100);
3731
+// bot.mousePress(mask);
3732
+// bot.mouseRelease(mask);
3733
+// }
3734
+// catch (Exception e)
3735
+// {
3736
+//
3737
+// }
3738
+
25513739 } else
2552
- if (event.getSource() == threeButton)
3740
+ if (source == threeButton)
25533741 {
25543742 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();
3743
+
3744
+ if (CameraPane.FULLSCREEN)
3745
+ fullscreenLayout = radio.layout;
3746
+
3747
+// bigThree.remove(scenePanel);
3748
+// bigThree.remove(centralPanel);
3749
+// bigThree.remove(XYZPanel);
3750
+// aWindowConstraints.gridx = 0;
3751
+// aWindowConstraints.gridy = 0;
3752
+// aWindowConstraints.gridwidth = 1;
3753
+// // aConstraints.gridheight = 3;
3754
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3755
+// aWindowConstraints.weightx = 0;
3756
+// aWindowConstraints.weighty = 1;
3757
+// //bigThree.add(jtp, aWindowConstraints);
3758
+// aWindowConstraints.weightx = 1;
3759
+// aWindowConstraints.gridwidth = 3;
3760
+// // aConstraints.gridheight = 3;
3761
+// aWindowConstraints.gridx = 1;
3762
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3763
+// bigThree.add(centralPanel, aWindowConstraints);
3764
+// aWindowConstraints.weightx = 0;
3765
+// aWindowConstraints.gridx = 4;
3766
+// aWindowConstraints.gridwidth = 1;
3767
+// // aConstraints.gridheight = 3;
3768
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3769
+// bigThree.add(XYZPanel, aWindowConstraints);
3770
+// bigThree.validate();
3771
+// scenePanel.setVisible(false);
3772
+// centralPanel.setVisible(true);
3773
+// XYZPanel.setVisible(true);
3774
+ bigThree.ClearUI();
3775
+ bigThree.add(scenePanel);
3776
+ bigThree.add(centralPanel);
3777
+ bigThree.FlushUI();
3778
+
3779
+ cameraView.requestFocusInWindow();
25793780 } else
2580
- if (event.getSource() == fourButton)
3781
+ if (source == fourButton)
25813782 {
25823783 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();
3784
+
3785
+ if (CameraPane.FULLSCREEN)
3786
+ fullscreenLayout = radio.layout;
3787
+
3788
+// bigThree.remove(scenePanel);
3789
+// bigThree.remove(centralPanel);
3790
+// bigThree.remove(XYZPanel);
3791
+// aWindowConstraints.gridx = 0;
3792
+// aWindowConstraints.gridy = 0;
3793
+// aWindowConstraints.gridwidth = 1;
3794
+// // aWindowConstraints.gridheight = 3;
3795
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3796
+// aWindowConstraints.weightx = 1;
3797
+// aWindowConstraints.weighty = 1;
3798
+// bigThree.add(scenePanel, aWindowConstraints);
3799
+// aWindowConstraints.weightx = 1;
3800
+// aWindowConstraints.gridwidth = 3;
3801
+// // aConstraints.gridheight = 3;
3802
+// aWindowConstraints.gridx = 1;
3803
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3804
+// //bigThree.add(cameraPanel, aWindowConstraints);
3805
+// aWindowConstraints.weightx = 0;
3806
+// aWindowConstraints.gridx = 4;
3807
+// aWindowConstraints.gridwidth = 1;
3808
+// // aWindowConstraints.gridheight = 3;
3809
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3810
+// //bigThree.add(XYZPanel, aWindowConstraints);
3811
+// bigThree.validate();
3812
+// scenePanel.setVisible(true);
3813
+// centralPanel.setVisible(false);
3814
+// XYZPanel.setVisible(false);
3815
+ bigThree.ClearUI();
3816
+ bigThree.add(scenePanel);
3817
+ bigThree.FlushUI();
3818
+
3819
+ cameraView.requestFocusInWindow();
26073820 } else
2608
- if (event.getSource() == sixButton)
3821
+ if (source == sixButton)
26093822 {
26103823 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();
3824
+
3825
+ if (CameraPane.FULLSCREEN)
3826
+ fullscreenLayout = radio.layout;
3827
+
3828
+// bigThree.remove(scenePanel);
3829
+// bigThree.remove(centralPanel);
3830
+// bigThree.remove(XYZPanel);
3831
+// aWindowConstraints.gridx = 0;
3832
+// aWindowConstraints.gridy = 0;
3833
+// aWindowConstraints.gridwidth = 1;
3834
+// // aConstraints.gridheight = 3;
3835
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3836
+// aWindowConstraints.weightx = 0;
3837
+// aWindowConstraints.weighty = 1;
3838
+// bigThree.add(scenePanel, aWindowConstraints);
3839
+// aWindowConstraints.weightx = 1;
3840
+// aWindowConstraints.gridwidth = 3;
3841
+// // aWindowConstraints.gridheight = 3;
3842
+// aWindowConstraints.gridx = 1;
3843
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3844
+// bigThree.add(centralPanel, aWindowConstraints);
3845
+// aWindowConstraints.weightx = 0;
3846
+// aWindowConstraints.gridx = 4;
3847
+// aWindowConstraints.gridwidth = 1;
3848
+// // aWindowConstraints.gridheight = 3;
3849
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3850
+// //bigThree.add(XYZPanel, aConstraints);
3851
+// bigThree.validate();
3852
+// scenePanel.setVisible(true);
3853
+// centralPanel.setVisible(true);
3854
+// XYZPanel.setVisible(false);
3855
+ bigThree.ClearUI();
3856
+ bigThree.add(centralPanel);
3857
+ bigThree.add(scenePanel);
3858
+ bigThree.FlushUI();
3859
+
3860
+ cameraView.requestFocusInWindow();
26353861 } else
2636
- if (event.getSource() == sevenButton)
3862
+ if (source == sevenButton)
26373863 {
26383864 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();
3865
+
3866
+ if (CameraPane.FULLSCREEN)
3867
+ fullscreenLayout = radio.layout;
3868
+
3869
+// bigThree.remove(scenePanel);
3870
+// bigThree.remove(centralPanel);
3871
+// bigThree.remove(XYZPanel);
3872
+// aWindowConstraints.gridx = 0;
3873
+// aWindowConstraints.gridy = 0;
3874
+// aWindowConstraints.gridwidth = 1;
3875
+// // aWindowConstraints.gridheight = 3;
3876
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3877
+// aWindowConstraints.weightx = 0;
3878
+// aWindowConstraints.weighty = 1;
3879
+// bigThree.add(scenePanel, aWindowConstraints);
3880
+// aWindowConstraints.weightx = 1;
3881
+// aWindowConstraints.gridwidth = 3;
3882
+// // aWindowConstraints.gridheight = 3;
3883
+// aWindowConstraints.gridx = 1;
3884
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3885
+// bigThree.add(centralPanel, aWindowConstraints);
3886
+// aWindowConstraints.weightx = 0;
3887
+// aWindowConstraints.gridx = 4;
3888
+// aWindowConstraints.gridwidth = 1;
3889
+// // aConstraints.gridheight = 3;
3890
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3891
+// bigThree.add(XYZPanel, aWindowConstraints);
3892
+// bigThree.validate();
3893
+// scenePanel.setVisible(true);
3894
+// centralPanel.setVisible(true);
3895
+// XYZPanel.setVisible(true);
3896
+ bigThree.ClearUI();
3897
+ bigThree.add(scenePanel);
3898
+ bigThree.add(centralPanel);
3899
+ bigThree.add(XYZPanel);
3900
+ bigThree.FlushUI();
3901
+
3902
+ cameraView.requestFocusInWindow();
26633903 } else
2664
- if (event.getSource() == rootButton)
3904
+ if (source == rootButton)
26653905 {
3906
+ Replace();
26663907 Object3D obj;
26673908 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26683909 {
....@@ -2671,66 +3912,85 @@
26713912 EditObject(obj);
26723913 }
26733914
3915
+ cameraView.requestFocusInWindow();
26743916 refreshContents(true);
26753917 } else
2676
- if (event.getSource() == closeButton)
3918
+ if (source == closeButton)
26773919 {
26783920 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793921 cRadio ab;
26803922 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813923 {
26823924 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3925
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843926 {
3927
+ // Patch to avoid bug with transparency.
3928
+ if (!ab.hadMaterial)
3929
+ {
3930
+ ab.object.material = null;
3931
+ }
3932
+
26853933 buttonGroup.remove(ab);
26863934 radioPanel.remove(ab);
26873935
2688
- ab.GetObject().editWindow = null;
3936
+ //ab.GetObject().editWindow = null;
3937
+ ab.GetObject().manipWindow = null;
26893938 // ab.GetObject().objectUI = null; // ?????????
26903939
26913940 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923941 break;
26933942 }
26943943 }
3944
+
3945
+ cameraView.requestFocusInWindow();
26953946 refreshContents(true);
26963947 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3948
+ if (source == editItem || source == editButton)
26983949 {
3950
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3951
+ {
3952
+ Object3D child = (Object3D)e.nextElement();
3953
+ child.pinned = true;
3954
+ }
3955
+
26993956 EditSelection(false);
27003957 } else
2701
- if (event.getSource() == uneditButton)
3958
+ if (source == uneditButton)
27023959 {
27033960 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043961 {
27053962 Object3D child = (Object3D)e.nextElement();
27063963 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3964
+ child.pinned = false;
27083965 child.CloseUI();
27093966 listUI.remove(child);
3967
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27103968
2711
- child.editWindow = null; // ???????????
3969
+ //child.editWindow = null; // ???????????
27123970 }
2713
- objEditor.ctrlPanel.revalidate();
3971
+ objEditor.ctrlPanel.FlushUI();
27143972 //objEditor.jTree.clearSelection();
27153973 //objEditor.ResetSliders();
27163974 refreshContents(true);
27173975 } else
2718
- if (event.getSource() == clearPanelButton)
3976
+ if (source == clearPanelButton)
27193977 {
27203978 assert(copy == group);
27213979 //copy.ClearUI();
27223980 for (Object3D obj : listUI)
27233981 {
3982
+ obj.pinned = false;
27243983 obj.CloseUI();
27253984 }
27263985 listUI.clear();
3986
+ SetPinStates(group.selection.size() > 0);
27273987 refreshContents(true);
27283988 } else
2729
- if (event.getSource() == allParamsButton)
3989
+ if (source == allParamsButton)
27303990 {
27313991 assert(copy == group);
27323992
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3993
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343994
27353995 for (Object3D obj : listUI)
27363996 {
....@@ -2747,19 +4007,19 @@
27474007
27484008 refreshContents(true);
27494009 } else
2750
- if (event.getSource() == unselectButton)
4010
+ if (source == unselectButton)
27514011 {
27524012 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
4013
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27544014 objEditor.ResetSliders();
27554015 refreshContents(true);
27564016 } else
2757
- if(event.getSource() instanceof cRadio)
4017
+ if(source instanceof cRadio)
27584018 {
27594019 group.parent = keepparent;
27604020 group.attributes = 0;
27614021 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
4022
+ /*cRadio*/ radio = (cRadio)source;
27634023 Object3D obj = radio.GetObject();
27644024 System.out.println("Edit " + obj);
27654025 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +4039,8 @@
27794039 }
27804040
27814041 copy = group;
2782
- //CameraPane.theRenderer.object = group;
4042
+
4043
+ //Globals.theRenderer.object = group;
27834044 if(!useclient)
27844045 {
27854046 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +4049,57 @@
27884049 cameraView.cameras[cameraView.cameracount] = radio.camera;
27894050 cameraView.targetLookAt.set(radio.camera.lookAt);
27904051 cameraView.object = group;
2791
- cameraView.lighttouched = true;
4052
+ //cameraView.lighttouched = true;
4053
+ Globals.lighttouched = true;
27924054 topView.object = group;
27934055 frontView.object = group;
27944056 sideView.object = group;
27954057 }
2796
- group.editWindow = this;
4058
+
4059
+// fix "+" issue
4060
+ //group.editWindow = this;
4061
+ group.manipWindow = this;
4062
+
27974063 /*
27984064 currentLayout = radio.layout;
27994065 if (currentLayout == null)
28004066 currentLayout = sevenButton;
28014067 */
28024068 radio.layout.doClick();
4069
+
4070
+ SetUndoStates();
4071
+
4072
+ ClearUnpinned();
4073
+
4074
+ //Grafreed.Assert(group != null);
4075
+ //Grafreed.Assert(group.selection != null);
4076
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4077
+ if (group.selection == null || group.selection.size() == 1)
4078
+ EditSelection(false);
28034079 keepparent = group.parent;
28044080 // PARENT = NULL or not???
28054081 //group.parent = null; // ROOT
28064082 //group.attributes = -1;
28074083 ResetModel();
4084
+
4085
+ cameraView.requestFocusInWindow();
28084086 refreshContents(true);
2809
- }
4087
+ } else if (event.getSource() == editCameraItem)
4088
+ {
4089
+ cameraView.ProtectCamera();
4090
+ cameraView.requestFocusInWindow();
4091
+ cameraView.repaint();
4092
+ return;
4093
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4094
+ {
4095
+ cameraView.RevertCamera();
4096
+ cameraView.requestFocusInWindow();
4097
+ cameraView.repaint();
4098
+ return;
4099
+ // } else if (event.getSource() == textureButton)
4100
+ // {
4101
+ // return; // true;
4102
+ }
28104103 else
28114104 {
28124105 //return super.action(event, arg);
....@@ -2815,7 +4108,6 @@
28154108 }
28164109
28174110 boolean useclient = false;
2818
- cRadio radio;
28194111
28204112 void ToggleRoot()
28214113 {
....@@ -2824,7 +4116,7 @@
28244116 if (useclient)
28254117 {
28264118 cameraView.object = client;
2827
- cameraView.lighttouched = true;
4119
+ Globals.lighttouched = true;
28284120 //topView.object = client;
28294121 //frontView.object = client;
28304122 //sideView.object = client;
....@@ -2832,7 +4124,7 @@
28324124 else
28334125 {
28344126 cameraView.object = group;
2835
- cameraView.lighttouched = true;
4127
+ Globals.lighttouched = true;
28364128 //topView.object = group;
28374129 //frontView.object = group;
28384130 //sideView.object = group;
....@@ -2867,6 +4159,28 @@
28674159 refreshContents();
28684160 }
28694161
4162
+ void TransformChildren()
4163
+ {
4164
+ Object3D obj;
4165
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4166
+ {
4167
+ obj = (Object3D)e.nextElement();
4168
+ obj.KeepTextureMatrices();
4169
+ obj.TransformChildren();
4170
+ obj.RestoreTextureMatrices();
4171
+
4172
+// if (obj.parent == null)
4173
+// {
4174
+// System.out.println("NULL PARENT!");
4175
+// new Exception().printStackTrace();
4176
+// }
4177
+// else
4178
+// TouchTransform(obj);
4179
+// //obj.parent.Touch();
4180
+ }
4181
+
4182
+ refreshContents();
4183
+ }
28704184
28714185 void ResetTransform()
28724186 {
....@@ -2979,7 +4293,7 @@
29794293 refreshContents();
29804294 }
29814295
2982
- void ResetCentroid()
4296
+ void ResetCentroid(boolean full)
29834297 {
29844298 Object3D obj;
29854299 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4308,16 @@
29944308 LA.matIdentity(Object3D.mat);
29954309 obj.getBounds(minima, maxima, false);
29964310 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4311
+ if (full)
4312
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984313 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994314 obj.TransformMesh(Object3D.mat);
4315
+
30004316 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4317
+ if (full)
4318
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024319 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4320
+
30034321 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044322 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054323 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4346,8 @@
30284346
30294347 int size = obj.MemorySize();
30304348
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4349
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4350
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324351 }
30334352 }
30344353 catch (Exception e)
....@@ -3065,9 +4384,9 @@
30654384 obj = (Object3D)e.nextElement();
30664385
30674386 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4387
+ Grafreed.AnalyzeObject(obj);
30694388 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4389
+ Grafreed.AnalyzeObject(obj.bRep);
30714390
30724391 // System.err.println((size/1024) + " KB is the size of " + obj);
30734392 }
....@@ -3109,6 +4428,20 @@
31094428 void GenNormals(boolean crease)
31104429 {
31114430 group.GenNormalsS(crease);
4431
+
4432
+ refreshContents();
4433
+ }
4434
+
4435
+ void GenNormalsMESH()
4436
+ {
4437
+ group.GenNormalsMeshS();
4438
+
4439
+ refreshContents();
4440
+ }
4441
+
4442
+ void GenNormalsMINE()
4443
+ {
4444
+ group.selection.GenNormalsMINE();
31124445
31134446 refreshContents();
31144447 }
....@@ -3157,104 +4490,259 @@
31574490
31584491 //Object3D buffer;
31594492 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
-
4493
+// BoundaryRep temprep;
4494
+// Object3D nodes;
4495
+// Vector<Vertex> vertices;
4496
+//
4497
+// cGroup buffer;
4498
+//
4499
+// public void Vertex(Object3D node, Vertex v)
4500
+// {
4501
+//// vertices.add(v);
4502
+//// nodes.addElement(node);
4503
+////
4504
+//// if (temprep.GetCache(v) != null)
4505
+//// {
4506
+//// temprep.Remove(v);
4507
+//// } else
4508
+//// {
4509
+//// temprep.Remember(v);
4510
+//// }
4511
+//
4512
+// //Object3D node = nodes.get(index);
4513
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4514
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4515
+//
4516
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4517
+//
4518
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4519
+//
4520
+// cGroup g = new cGroup();
4521
+//
4522
+// if (g.toParent == null)
4523
+// {
4524
+// g.toParent = LA.newMatrix();
4525
+// g.fromParent = LA.newMatrix();
4526
+// }
4527
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4528
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4529
+//
4530
+// g.add(GrafreeD.clipboard);
4531
+//
4532
+// buffer.add(g);
4533
+// }
4534
+//
4535
+// public void Face(Object3D node, Face f)
4536
+// {
4537
+//
4538
+// }
4539
+//
4540
+// void ParseVerticesOld() // ??
4541
+// {
4542
+// //if (group.selection.size() != 1)
4543
+// // return;
4544
+//
4545
+// temprep = new BoundaryRep();
4546
+// nodes = new Object3D();
4547
+// vertices = new Vector<Vertex>();
4548
+//
4549
+// boolean epsequal = GrafreeD.epsequal;
4550
+// GrafreeD.epsequal = true;
4551
+//
4552
+// for (int i=0; i<group.selection.size(); i++)
4553
+// {
4554
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4555
+//
4556
+// group.selection.get(i).Parse(
4557
+//this );
4558
+//
4559
+// int repsize = temprep.VertexCount();
4560
+// int tablesize = temprep.vertextable.size();
4561
+// int nodesize = nodes.size();
4562
+//
4563
+// assert(vertices.size() == nodes.size());
4564
+//
4565
+// temprep.vertextable.elements();
4566
+//
4567
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4568
+//
4569
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4570
+// {
4571
+// cGroup g = new cGroup();
4572
+//
4573
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4574
+//
4575
+// Object3D node = nodes.get(index);
4576
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4577
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4578
+//
4579
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4580
+//
4581
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4582
+//
4583
+// if (g.toParent == null)
4584
+// {
4585
+// g.toParent = LA.newMatrix();
4586
+// g.fromParent = LA.newMatrix();
4587
+// }
4588
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4589
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4590
+//
4591
+// g.add(GrafreeD.clipboard);
4592
+//
4593
+// buffer.add(g);
4594
+// }
4595
+//
4596
+// makeSomething(buffer, i==group.selection.size()-1);
4597
+// }
4598
+//
4599
+// GrafreeD.epsequal = epsequal;
4600
+//
4601
+// //buffer = null;
4602
+// temprep = null;
4603
+// nodes = null;
4604
+//
4605
+// refreshContents();
4606
+// }
4607
+
31844608 void ParseVertices()
31854609 {
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;
4610
+ boolean epsequal = Grafreed.epsequal;
4611
+ Grafreed.epsequal = true;
31954612
31964613 for (int i=0; i<group.selection.size(); i++)
31974614 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4615
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994616
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4617
+ group.selection.get(i).Parse(
4618
+
4619
+ new iParse()
4620
+ {
4621
+ public void Vertex(Object3D node, Vertex v)
4622
+ {
4623
+ temp.set(v);
4624
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054625
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();
4626
+ cGroup g = new cGroup();
32114627
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4628
+ if (g.toParent == null)
4629
+ {
4630
+ g.toParent = LA.newMatrix();
4631
+ g.fromParent = LA.newMatrix();
4632
+ }
4633
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4634
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154635
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);
4636
+ g.add(Grafreed.clipboard);
32204637
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);
4638
+ buffer.add(g);
4639
+ }
32324640
3233
- g.add(GraphreeD.clipboard);
4641
+ public void Face(Object3D node, Face f)
4642
+ {
32344643
3235
- buffer.add(g);
3236
- }
4644
+ }
4645
+ }
4646
+ );
32374647
32384648 makeSomething(buffer, i==group.selection.size()-1);
32394649 }
32404650
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4651
+ Grafreed.epsequal = epsequal;
32464652
32474653 refreshContents();
32484654 }
3249
-
4655
+
4656
+ void TextureVertices()
4657
+ {
4658
+ for (int i=0; i<group.selection.size(); i++)
4659
+ {
4660
+ group.selection.get(i).Parse(
4661
+ new iParse()
4662
+ {
4663
+ public void Vertex(Object3D node, Vertex v)
4664
+ {
4665
+ cTexture tex = node.GetTextures();
4666
+ String pigment = Object3D.GetPigment(tex);
4667
+ //String bump = Object3D.GetBump(tex);
4668
+
4669
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4670
+
4671
+ try
4672
+ {
4673
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4674
+ }
4675
+ catch (Exception e)
4676
+ {
4677
+ System.err.println("FAIL: " + node);
4678
+ }
4679
+
4680
+ double s = v.s;
4681
+
4682
+ if (s == 1)
4683
+ s = 0;
4684
+
4685
+ double t = v.t;
4686
+
4687
+ if (t == 1)
4688
+ t = 0;
4689
+
4690
+ int indexs = (int) (texturedata.getWidth() * s);
4691
+ int indext = (int) (texturedata.getHeight() * t);
4692
+
4693
+ int index = indext * texturedata.getWidth() + indexs;
4694
+
4695
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4696
+
4697
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4698
+
4699
+ float scale = bytebuf.get(index*slide) & 0xFF;
4700
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4701
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4702
+ scale /= 3;
4703
+
4704
+ scale /= 0xFF;
4705
+ // c'est quoi ca? scale /= 4;
4706
+
4707
+ //v.AO = scale;
4708
+
4709
+ v.x += v.norm.x * scale;
4710
+ v.y += v.norm.y * scale;
4711
+ v.z += v.norm.z * scale;
4712
+ }
4713
+
4714
+ public void Face(Object3D node, Face f)
4715
+ {
4716
+ }
4717
+ }
4718
+ );
4719
+ }
4720
+
4721
+ refreshContents();
4722
+ }
4723
+
32504724 void Align()
32514725 {
4726
+ if (group.selection.size() == 0)
4727
+ return;
4728
+
4729
+ cVector bbmin = new cVector();
4730
+ cVector bbmax = new cVector();
4731
+
4732
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4733
+
4734
+ double dx = bbmax.x - bbmin.x;
4735
+ double dy = bbmax.y - bbmin.y;
4736
+ double dz = bbmax.z - bbmin.z;
4737
+
4738
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4739
+
32524740 for (int i=0; i<group.selection.size(); i++)
32534741 {
32544742 Object3D obj = group.selection.get(i);
32554743
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4744
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4745
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584746 }
32594747
32604748 refreshContents();
....@@ -3267,7 +4755,7 @@
32674755 // ref.SaveSupports();
32684756 // Object3D par = ref.parent;
32694757 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4758
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714759 // ref.parent = par;
32724760 // ref.RestoreSupports();
32734761
....@@ -3275,11 +4763,11 @@
32754763
32764764 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774765
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4766
+ boolean random = CameraPane.SWITCH;
4767
+ CameraPane.SWITCH = false; // parse all random nodes
32804768 lowres.linkVerticesThis(null);
32814769 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4770
+ CameraPane.SWITCH = random;
32834771
32844772 System.err.flush();
32854773
....@@ -3297,7 +4785,7 @@
32974785 // lowres.SaveSupports();
32984786 // par = lowres.parent;
32994787 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4788
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014789 Object3D newlow = CloneObject(lowres, false);
33024790 newlow.name = sn.switchobject.get(i).name;
33034791 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4807,7 @@
33194807 return;
33204808
33214809 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4810
+ Object3D ref = Grafreed.clipboard.get(0);
33234811
33244812 Object3D newgroup = new Object3D("Po:" + poses.name);
33254813
....@@ -3488,7 +4976,7 @@
34884976 group.selection.RelinkToSupport(); // july 2014
34894977 System.out.println("DONE.");
34904978 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4979
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924980 }
34934981
34944982 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +5001,20 @@
35135001
35145002 void ClipMesh()
35155003 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
5004
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35175005 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
5006
+ Object3D content = Grafreed.clipboard.get(0);
35195007
35205008 if (content instanceof cGroup && ((cGroup)content).transientlink )
35215009 content = ((cGroup)content).get(0);
35225010
35235011 // for (int i=0; i<group.selection.size(); i++)
35245012 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
5013
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35265014 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
5015
+ group.selection.ClipMesh(Grafreed.clipboard);
35285016 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
5017
+// group.selection.ClipMesh(GrafreeD.clipboard);
35305018 System.out.println("DONE.");
35315019 refreshContents();
35325020 }
....@@ -3571,6 +5059,18 @@
35715059 void MarkLeaves(boolean hide)
35725060 {
35735061 group.selection.MarkLeaves(hide);
5062
+ refreshContents();
5063
+ }
5064
+
5065
+ void RewindLeaves(boolean hide)
5066
+ {
5067
+ group.selection.RewindLeaves(hide);
5068
+ refreshContents();
5069
+ }
5070
+
5071
+ void RandomLeaves(boolean hide)
5072
+ {
5073
+ group.selection.RandomLeaves(hide);
35745074 refreshContents();
35755075 }
35765076
....@@ -3645,28 +5145,25 @@
36455145 // }
36465146 // }
36475147
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525148 void EditSelection(boolean newWindow)
36535149 {
5150
+ if (group.selection == null)
5151
+ {
5152
+ EditElement(group, newWindow); // ? new
5153
+ return;
5154
+ }
5155
+
36545156 // aConstraints.gridy = 0;
36555157 for (int i=0; i<group.selection.size(); i++)
36565158 {
36575159 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585160 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5161
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605162
36615163 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5164
+ if(elem != group || !newWindow)
36635165 {
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
5166
+ EditElement(elem, newWindow); // ? new
36705167 }
36715168 }
36725169 }
....@@ -3729,9 +5226,7 @@
37295226
37305227 freezemodel = false;
37315228 }
3732
-
3733
- boolean flashIt = true;
3734
-
5229
+
37355230 public void valueChanged(TreeSelectionEvent e)
37365231 //public boolean handleEvent(Event event)
37375232 {
....@@ -3741,7 +5236,8 @@
37415236 //new Exception().printStackTrace();
37425237
37435238 freezemodel = true;
3744
-
5239
+ ClearUnpinned();
5240
+
37455241 /**/
37465242 //switch (event.id)
37475243 {
....@@ -3749,7 +5245,6 @@
37495245 //case 702: // Event.LIST_DESELECT
37505246 group.deselectAll();
37515247 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535248 if (tps != null)
37545249 {
37555250 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5253,39 @@
37585253
37595254 //if (child.parent != null)
37605255 //child.parent.addSelectee(child);
5256
+ objEditor.SetMaterial(child);
37615257 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655258 }
37665259 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5260
+// else
5261
+// {
5262
+// objEditor.SetMaterial(group); // .GetMaterial());
5263
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5264
+// System.err.println("info : " + group.GetPath());
5265
+// }
37735266
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5267
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775268 CameraPane.flash = true;
37785269
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5270
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805271 // a camera
37815272 {
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;
5273
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5274
+ {
5275
+ CameraPane.camerachangeframe = 0; // don't refuse it
5276
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5277
+ }
5278
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5279
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865280 }
37875281
5282
+ if (tps != null && tps.length == 1)
5283
+ {
5284
+ EditSelection(false);
5285
+ }
5286
+
5287
+ SetPinStates(tps != null && tps.length > 0);
5288
+
37885289 refreshContents();
37895290 //return true;
37905291 }
....@@ -3793,6 +5294,50 @@
37935294
37945295 freezemodel = false;
37955296 }
5297
+
5298
+ void SetPinStates(boolean enabled)
5299
+ {
5300
+ editButton.setEnabled(enabled);
5301
+ uneditButton.setEnabled(enabled);
5302
+ //unselectButton.setEnabled(enabled);
5303
+ flashSelectionButton.setEnabled(enabled);
5304
+
5305
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5306
+
5307
+ boolean allComposites = true;
5308
+
5309
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
5310
+ {
5311
+ if (!(e.nextElement() instanceof Composite))
5312
+ {
5313
+ allComposites = false;
5314
+ break;
5315
+ }
5316
+ }
5317
+
5318
+ rootButton.setEnabled(allComposites);
5319
+ }
5320
+
5321
+ void refreshContents(boolean cp)
5322
+ {
5323
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5324
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5325
+ {
5326
+ objEditor.ClearInfo(); // .GetMaterial());
5327
+
5328
+ for (int i=0; i < group.selection.Size(); i++)
5329
+ {
5330
+ Object3D child = (Object3D) group.selection.get(i);
5331
+
5332
+ objEditor.AddInfo(child, this, true);
5333
+// System.err.println("info : " + child.GetPath());
5334
+ }
5335
+
5336
+ objEditor.SetText(); // jan 2014
5337
+ }
5338
+
5339
+ super.refreshContents(cp);
5340
+ }
37965341
37975342 void linkSomething(Object3D thing)
37985343 {
....@@ -3864,16 +5409,19 @@
38645409 {
38655410 if (group.selection.isEmpty())
38665411 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5412
+
5413
+ Grafreed.clipboardIsTempGroup = false;
38685414 Composite tGroup = null;
38695415 if (group.selection.size() > 0) // 1)
38705416 {
38715417 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5418
+ Grafreed.clipboardIsTempGroup = true;
38735419 }
38745420
38755421 if (cut)
38765422 {
5423
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5424
+// Save();
38775425 //int indices[] = jList.getSelectedIndices();
38785426 //for (int i = indices.length - 1; i >= 0; i--)
38795427 //jList.remove(indices[i]);
....@@ -3909,16 +5457,16 @@
39095457 //System.out.println("cut " + child);
39105458 //System.out.println("parent = " + child.parent);
39115459 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5460
+ if (Grafreed.clipboardIsTempGroup)
39135461 tGroup.add/*Child*/(tmp);
39145462 else
3915
- GraphreeD.clipboard = tmp;
5463
+ Grafreed.clipboard = tmp;
39165464 }
39175465 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5466
+ if (Grafreed.clipboardIsTempGroup)
39195467 tGroup.add/*Child*/(child);
39205468 else
3921
- GraphreeD.clipboard = child;
5469
+ Grafreed.clipboard = child;
39225470 }
39235471
39245472 //ResetModel();
....@@ -3950,21 +5498,23 @@
39505498 //System.out.println("cut " + elem);
39515499 //System.out.println("parent = " + elem.parent);
39525500 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5501
+ if (Grafreed.clipboardIsTempGroup)
39545502 tGroup.add/*Child*/(tmp);
39555503 else
3956
- GraphreeD.clipboard = tmp;
5504
+ Grafreed.clipboard = tmp;
39575505 }
39585506 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5507
+ if (Grafreed.clipboardIsTempGroup)
39605508 tGroup.add/*Child*/(child);
39615509 else
3962
- GraphreeD.clipboard = child;
5510
+ Grafreed.clipboard = child;
39635511 }
39645512
39655513 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5514
+
5515
+ if (Grafreed.clipboardIsTempGroup)
5516
+ Grafreed.clipboard = tGroup;
5517
+
39685518 if (cut)
39695519 {
39705520 ResetModel();
....@@ -3974,11 +5524,15 @@
39745524
39755525 void paste(boolean expand)
39765526 {
3977
- // if (GraphreeD.clipboard == null)
5527
+ if (Globals.REPLACEONMAKE)
5528
+ Save();
5529
+ boolean keep = Globals.REPLACEONMAKE;
5530
+ Globals.REPLACEONMAKE = false;
5531
+ // if (GrafreeD.clipboard == null)
39785532 // return;
39795533 boolean first = true;
39805534
3981
- if (GraphreeD.clipboardIsTempGroup)
5535
+ if (Grafreed.clipboardIsTempGroup)
39825536 {
39835537 Composite temp;
39845538
....@@ -3989,7 +5543,7 @@
39895543 temp = (Composite)Applet3D.clipboard.deepCopy();
39905544 */
39915545 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5546
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935547 {
39945548 Object3D child = (Object3D)e.nextElement();
39955549
....@@ -4003,7 +5557,7 @@
40035557 else
40045558 elem = child.deepCopy(); // ?
40055559 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5560
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075561 // elem = elem.get(0);
40085562 makeSomething(elem, true); // ?? first);
40095563 //group.addChild(elem);
....@@ -4023,23 +5577,24 @@
40235577 //Object3D cb = Applet3D.clipboard;
40245578 //temp.addChild(cb);
40255579 //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());
5580
+ assert(Grafreed.clipboard.parent == null);
5581
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5582
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5583
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5584
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315585 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5586
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5587
+ Grafreed.clipboard.get(0).parent = keepparent;
40345588 }
40355589
5590
+ Globals.REPLACEONMAKE = keep;
40365591 ResetModel();
40375592 refreshContents();
40385593 }
40395594
4040
- void pasteInto(boolean copyit)
5595
+ void pasteInto(boolean copyit, boolean clone)
40415596 {
4042
-// if (GraphreeD.clipboard == null)
5597
+// if (GrafreeD.clipboard == null)
40435598 // return;
40445599
40455600 if (group.selection.size() != 1)
....@@ -4066,15 +5621,22 @@
40665621 if (copyit)
40675622 {
40685623 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5624
+ if (clone)
5625
+ {
5626
+ CloneClipboard(false); // sept 2014
5627
+ }
5628
+ else
5629
+ {
5630
+ paste(false);
5631
+ }
40705632 }
40715633 else
40725634 {
40735635 boolean first = true;
40745636
4075
- if (GraphreeD.clipboardIsTempGroup)
5637
+ if (Grafreed.clipboardIsTempGroup)
40765638 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5639
+ Composite temp = (Composite)Grafreed.clipboard;
40785640 Object3D copy;
40795641 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805642 {
....@@ -4084,7 +5646,7 @@
40845646 }
40855647 } else
40865648 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5649
+ linkSomething(Grafreed.clipboard); //.get(0));
40885650 }
40895651 }
40905652 }
....@@ -4161,6 +5723,10 @@
41615723
41625724 void group(Object3D csg, boolean grab)
41635725 {
5726
+ if (Globals.REPLACEONMAKE)
5727
+ Save();
5728
+ boolean keep = Globals.REPLACEONMAKE;
5729
+ Globals.REPLACEONMAKE = false;
41645730 if (//false) // why??
41655731 !group.selection.isEmpty())
41665732 {
....@@ -4274,8 +5840,34 @@
42745840 //node.add(csg);
42755841 //makeSomething(node);
42765842 makeSomething(csg);
5843
+ Globals.REPLACEONMAKE = keep;
42775844 }
42785845
5846
+ void Ungroup(Object3D g)
5847
+ {
5848
+ if (Globals.REPLACEONMAKE)
5849
+ Save();
5850
+ boolean keep = Globals.REPLACEONMAKE;
5851
+ Globals.REPLACEONMAKE = false;
5852
+ if (g instanceof HiddenObject)
5853
+ {
5854
+ HiddenObject h = (HiddenObject) g;
5855
+
5856
+ for (int i=0; i<h.ActualSize(); i++)
5857
+ {
5858
+ objEditor.makeSomething(h.get(i), false);
5859
+ }
5860
+ }
5861
+ else
5862
+ {
5863
+ for (int i=0; i<g.Size(); i++)
5864
+ {
5865
+ objEditor.makeSomething(g.get(i), false);
5866
+ }
5867
+ }
5868
+ Globals.REPLACEONMAKE = keep;
5869
+ }
5870
+
42795871 void ungroup()
42805872 {
42815873 /*
....@@ -4469,21 +6061,6 @@
44696061 }
44706062 */
44716063
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
-
44876064 /*
44886065 public void Callback(Object obj)
44896066 {
....@@ -4507,26 +6084,9 @@
45076084 }
45086085 */
45096086
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
-
45276087 String GetFile(String dialogName)
45286088 {
4529
- if (GraphreeD.standAlone)
6089
+ if (Grafreed.standAlone)
45306090 {
45316091 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45326092 browser.show();
....@@ -4590,10 +6150,48 @@
45906150 cButton flashSelectionButton;
45916151 cButton editButton;
45926152 cButton uneditButton;
6153
+ JCheckBox allParamsButton;
45936154 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956155 cButton unselectButton;
45966156
6157
+ cButton restoreCameraButton;
6158
+
6159
+ cButton oneStepButton;
6160
+
6161
+ cButton groupButton;
6162
+ cButton ungroupButton;
6163
+ cButton compositeButton;
6164
+ cButton switchButton;
6165
+ cButton loopButton;
6166
+ cButton textureButton;
6167
+
6168
+ cButton skybox1Button;
6169
+ cButton skybox2Button;
6170
+ cButton skybox3Button;
6171
+ cButton skybox4Button;
6172
+ cButton skybox5Button;
6173
+ cButton skybox6Button;
6174
+ cButton skybox7Button;
6175
+
6176
+ cButton skybox11Button;
6177
+ cButton skybox12Button;
6178
+ cButton skybox13Button;
6179
+ cButton skybox14Button;
6180
+ cButton skybox15Button;
6181
+ cButton skybox16Button;
6182
+ cButton skybox17Button;
6183
+
6184
+ cButton gridButton;
6185
+ cButton boxButton;
6186
+ cButton sphereButton;
6187
+ cButton coneButton;
6188
+ cButton torusButton;
6189
+ cButton superButton;
6190
+ cButton kleinButton;
6191
+ cButton particlesButton;
6192
+ cButton overlayButton;
6193
+ cButton lightButton;
6194
+
45976195 cButton screenfitButton;
45986196 cButton screenfitpointButton;
45996197 cButton snapobjectButton;
....@@ -4605,14 +6203,6 @@
46056203
46066204 cButton setsupportButton;
46076205
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
-
46166206 //
46176207 //Composite
46186208 Object3D // to do !!
....@@ -4622,9 +6212,11 @@
46226212 //JTree jTree;
46236213 private MenuItem lookAtItem;
46246214 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
6215
+ private MenuItem switchViewItem;
46266216 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
6217
+ private MenuItem undoItem;
6218
+ private MenuItem redoItem;
6219
+ private JMenuItem duplicateItem;
46286220 private MenuItem cloneItem;
46296221 private MenuItem cloneSupportItem;
46306222 private MenuItem overwriteGeoItem;
....@@ -4635,8 +6227,9 @@
46356227 private MenuItem resetsupportItem;
46366228 private MenuItem resetreferencesItem;
46376229 private MenuItem linkverticesItem;
6230
+ private MenuItem relinkverticesItem;
46386231 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6232
+ private MenuItem resetAllItem;
46406233 private MenuItem stepAllItem;
46416234 private MenuItem revertMeshItem;
46426235 private MenuItem poseMeshItem;
....@@ -4647,14 +6240,17 @@
46476240 private MenuItem mergeGeometriesItem;
46486241 private MenuItem copyItem;
46496242 private MenuItem pasteItem;
6243
+ private MenuItem pasteIntoItem;
46506244 private MenuItem pasteLinkItem;
46516245 private MenuItem pasteCloneItem;
46526246 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6247
+ private MenuItem deleteItem;
46546248 private MenuItem clearAllItem;
46556249 private MenuItem genUVItem;
6250
+ private MenuItem genNormalsMESHItem;
46566251 private MenuItem genNormalsCADItem;
46576252 private MenuItem genNormalsORGANItem;
6253
+ private MenuItem genNormalsMINEItem;
46586254 private MenuItem stripifyItem;
46596255 private MenuItem unstripifyItem;
46606256 private MenuItem trimItem;
....@@ -4683,6 +6279,10 @@
46836279 private MenuItem showleavesItem;
46846280 private MenuItem markleavesItem;
46856281 private MenuItem unmarkleavesItem;
6282
+ private MenuItem rewindleavesItem;
6283
+ private MenuItem unrewindleavesItem;
6284
+ private MenuItem randomleavesItem;
6285
+ private MenuItem unrandomleavesItem;
46866286
46876287 private MenuItem flipVItem;
46886288 private MenuItem unflipVItem;
....@@ -4694,14 +6294,17 @@
46946294 private MenuItem panoTexturesItem;
46956295
46966296 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6297
+ private MenuItem resetCentroidXZItem;
46986298 private MenuItem resetTransformItem;
6299
+ private MenuItem transformGeometryItem;
6300
+ private MenuItem transformChildrenItem;
6301
+ private MenuItem hideItem;
46996302 private MenuItem grabItem;
47006303 private MenuItem backItem;
47016304 private MenuItem frontItem;
47026305 private MenuItem cameraItem;
47036306 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6307
+ private MenuItem switchItem;
47056308 private MenuItem physicsItem;
47066309 private MenuItem frameselectorItem;
47076310 private MenuItem scriptNodeItem;
....@@ -4716,6 +6319,7 @@
47166319
47176320 private MenuItem resetParentItem;
47186321 private MenuItem repairParentItem;
6322
+ private MenuItem repairShadowItem;
47196323 private MenuItem sortbysizeItem;
47206324 private MenuItem sortbynameItem;
47216325
....@@ -4724,20 +6328,25 @@
47246328 private MenuItem attachBumpItem;
47256329 private MenuItem detachBumpItem;
47266330 private MenuItem pigmentBumpItem;
6331
+ private MenuItem embedTexturesItem;
6332
+ private MenuItem deEmbedTexturesItem;
47276333
47286334 private MenuItem particleItem;
47296335 private MenuItem ragdollItem;
47306336 private MenuItem ragdoll2Item;
6337
+ private MenuItem heightFieldItem;
6338
+ private MenuItem textureFieldItem;
47316339 private MenuItem gridItem;
47326340 private MenuItem rectoidItem;
47336341 private MenuItem ellipsoidItem;
47346342 private MenuItem coneItem;
47356343 private MenuItem torusItem;
47366344 private MenuItem superItem;
6345
+ private MenuItem kleinItem;
47376346 private MenuItem blobItem;
47386347 private MenuItem latheItem;
47396348 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6349
+ private MenuItem overlayItem;
47416350 private MenuItem meshItem;
47426351 // private MenuItem meshGroupItem;
47436352 private MenuItem springItem;
....@@ -4746,6 +6355,7 @@
47466355 private MenuItem csgItem;
47476356 private MenuItem templateItem;
47486357 private MenuItem textureItem;
6358
+ private MenuItem billboardItem;
47496359 private MenuItem shadowXItem;
47506360 private MenuItem shadowYItem;
47516361 private MenuItem shadowZItem;
....@@ -4758,11 +6368,6 @@
47586368 private MenuItem doubleItem;
47596369 private MenuItem tripleItem;
47606370
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666371 private MenuItem computeAOItem;
47676372 private MenuItem recompileItem;
47686373 private MenuItem editScriptItem;
....@@ -4772,4 +6377,8 @@
47726377 private MenuItem analyzeItem;
47736378 private MenuItem dumpItem;
47746379 //boolean freezemodel = false;
6380
+
6381
+ Menu cameraMenu;
6382
+ MenuItem editCameraItem;
6383
+ MenuItem restoreCameraItem;
47756384 }