Normand Briere
2019-05-05 44b1501b5c4cd60ea67cc3d0971ed53f53b594e6
GroupEditor.java
....@@ -12,9 +12,10 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1819 ObjectUI,
1920 Runnable,
2021 ActionListener,
....@@ -83,7 +84,7 @@
8384
8485 void CloneSelection(boolean supports)
8586 {
86
- // Object3D keep = GraphreeD.clipboard;
87
+ // Object3D keep = GrafreeD.clipboard;
8788 //Object3D obj;
8889 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8990 {
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
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));
101
+ assert(GrafreeD.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
+ makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
105106 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(GrafreeD.clipboard, false));
108
+ GrafreeD.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
122
+ Object3D clone = (Object3D)GrafreeD.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -149,6 +150,8 @@
149150
150151 void SetupMenu2(ObjEditor oe)
151152 {
153
+ if (Globals.ADVANCED)
154
+ {
152155 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153156 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154157 //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
....@@ -160,17 +163,21 @@
160163 lookAtItem.addActionListener(this);
161164 //lookFromItem.addActinoListener(this);
162165 //switchItem.addActionListener(this);
166
+ }
167
+
163168 Menu menu;
164169 oe.menuBar.add(menu = new Menu("Edit"));
165170 //editItem = menu.add(new MenuItem("Edit"));
166171 //editItem.addActionListener(this);
167172 duplicateItem = menu.add(new MenuItem("Duplicate"));
168173 duplicateItem.addActionListener(this);
169
- menu.add("-");
170174 cloneItem = menu.add(new MenuItem("Clone"));
171175 cloneItem.addActionListener(this);
176
+ if (Globals.ADVANCED)
177
+ {
172178 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173179 cloneSupportItem.addActionListener(this);
180
+ }
174181 menu.add("-");
175182 cutItem = menu.add(new MenuItem("Cut"));
176183 cutItem.addActionListener(this);
....@@ -178,18 +185,32 @@
178185 copyItem.addActionListener(this);
179186 pasteItem = menu.add(new MenuItem("Paste"));
180187 pasteItem.addActionListener(this);
188
+ menu.add("-");
189
+
190
+ menu.add("-");
191
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
192
+ pasteIntoItem.addActionListener(this);
181193 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182194 pasteLinkItem.addActionListener(this);
183195 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184196 pasteCloneItem.addActionListener(this);
185197 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186198 // pasteExpandItem.addActionListener(this);
199
+ menu.add("-");
187200 clearItem = menu.add(new MenuItem("Clear"));
188201 clearItem.addActionListener(this);
202
+
203
+ if (Globals.ADVANCED)
204
+ {
205
+ // Deletes the cameras...
189206 clearAllItem = menu.add(new MenuItem("Clear All"));
190207 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
208
+ }
209
+
210
+ oe.menuBar.add(menu = new Menu("Setting"));
211
+ if (Globals.ADVANCED)
212
+ {
213
+ resetMeshItem = menu.add(new MenuItem("Reset All"));
193214 resetMeshItem.addActionListener(this);
194215 stepAllItem = menu.add(new MenuItem("Step All"));
195216 stepAllItem.addActionListener(this);
....@@ -198,6 +219,7 @@
198219 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199220 resetreferencesItem.addActionListener(this);
200221 menu.add("-");
222
+ }
201223 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202224 overwriteGeoItem.addActionListener(this);
203225 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,47 +231,68 @@
209231 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210232 overwriteUVItem.addActionListener(this);
211233 menu.add("-");
234
+ if (Globals.ADVANCED)
235
+ {
212236 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213237 generateMeshItem.addActionListener(this);
214238 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215239 poseMeshItem.addActionListener(this);
216240 menu.add("-");
241
+ }
217242 resetsupportItem = menu.add(new MenuItem("Reset support"));
218243 resetsupportItem.addActionListener(this);
219244 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220245 linkverticesItem.addActionListener(this);
246
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
247
+ relinkverticesItem.addActionListener(this);
248
+
249
+ if (Globals.ADVANCED)
250
+ {
221251 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222252 setMasterItem.addActionListener(this);
253
+ }
223254
224
- oe.menuBar.add(menu = new Menu("Object"));
255
+ oe.menuBar.add(menu = new Menu("Group"));
225256 grabItem = menu.add(new MenuItem("Grab"));
226257 grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
229258 backItem = menu.add(new MenuItem("Back"));
230259 backItem.addActionListener(this);
260
+ frontItem = menu.add(new MenuItem("Front"));
261
+ frontItem.addActionListener(this);
231262 compositeItem = menu.add(new MenuItem("Composite"));
232263 compositeItem.addActionListener(this);
264
+ hideItem = menu.add(new MenuItem("Hidden Group"));
265
+ hideItem.addActionListener(this);
266
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
267
+ ungroupItem.addActionListener(this);
233268 menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
269
+ randomItem = menu.add(new MenuItem("Switch node"));
235270 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);
240271 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241272 switchGeoItem.addActionListener(this);
242273 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243274 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
275
+ morphItem = menu.add(new MenuItem("Morph Group"));
245276 morphItem.addActionListener(this);
277
+
278
+ if (Globals.ADVANCED)
279
+ {
280
+ menu.add("-");
281
+ physicsItem = menu.add(new MenuItem("Physics"));
282
+ physicsItem.addActionListener(this);
283
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
284
+ frameselectorItem.addActionListener(this);
246285 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247286 scriptNodeItem.addActionListener(this);
248287 cameraItem = menu.add(new MenuItem("Camera"));
249288 cameraItem.addActionListener(this);
250
- menu.add("-");
289
+ }
290
+
291
+ oe.menuBar.add(menu = new Menu("Object"));
251292 textureItem = menu.add(new MenuItem("Texture"));
252293 textureItem.addActionListener(this);
294
+ billboardItem = menu.add(new MenuItem("Billboard"));
295
+ billboardItem.addActionListener(this);
253296 csgItem = menu.add(new MenuItem("CSG"));
254297 csgItem.addActionListener(this);
255298 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -258,23 +301,25 @@
258301 shadowYItem.addActionListener(this);
259302 shadowZItem = menu.add(new MenuItem("Shadow Z"));
260303 shadowZItem.addActionListener(this);
304
+ if (Globals.ADVANCED)
305
+ {
306
+ menu.add("-");
261307 linkerItem = menu.add(new MenuItem("Linker"));
262308 linkerItem.addActionListener(this);
263
- templateItem = menu.add(new MenuItem("Template"));
264
- templateItem.addActionListener(this);
265309 attributeItem = menu.add(new MenuItem("Attribute"));
266310 attributeItem.addActionListener(this);
311
+ templateItem = menu.add(new MenuItem("Template"));
312
+ templateItem.addActionListener(this);
267313 pointflowItem = menu.add(new MenuItem("Point Flow"));
268314 pointflowItem.addActionListener(this);
315
+ }
269316 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272317 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273318 resetTransformItem.addActionListener(this);
274319 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275320 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
321
+ transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
+ transformgeometryItem.addActionListener(this);
278323
279324 oe.menuBar.add(menu = new Menu("Geometry"));
280325 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +328,13 @@
283328 genNormalsORGANItem.addActionListener(this);
284329 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285330 genNormalsCADItem.addActionListener(this);
331
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
332
+ genNormalsMESHItem.addActionListener(this);
333
+ if (Globals.ADVANCED)
334
+ {
335
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
336
+ genNormalsMINEItem.addActionListener(this);
337
+ }
286338 stripifyItem = menu.add(new MenuItem("Stripify"));
287339 stripifyItem.addActionListener(this);
288340 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +344,6 @@
292344 untrimItem = menu.add(new MenuItem("Untrim"));
293345 untrimItem.addActionListener(this);
294346 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297347 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298348 clearColorsItem.addActionListener(this);
299349 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +356,30 @@
306356 reduce34MeshItem.addActionListener(this);
307357 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308358 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311359 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312360 clipMeshItem.addActionListener(this);
361
+
362
+ if (Globals.ADVANCED)
363
+ {
364
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
365
+ smoothMeshItem.addActionListener(this);
366
+ }
367
+
368
+ oe.menuBar.add(menu = new Menu("Attributes"));
369
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370
+ clearMaterialsItem.addActionListener(this);
313371 menu.add("-");
314372 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315373 liveleavesItem.addActionListener(this);
316374 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317375 unliveleavesItem.addActionListener(this);
376
+ if (Globals.ADVANCED)
377
+ {
318378 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319379 supportleavesItem.addActionListener(this);
320380 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321381 unsupportleavesItem.addActionListener(this);
382
+ }
322383 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323384 hideleavesItem.addActionListener(this);
324385 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -332,27 +393,18 @@
332393 flipVItem.addActionListener(this);
333394 unflipVItem = menu.add(new MenuItem("Unflip V"));
334395 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
396
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336397 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
398
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338399 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
400
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340401 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
402
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342403 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
404
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344405 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
406
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346407 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);
356408
357409 oe.menuBar.add(menu = new Menu("Selection"));
358410 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,9 +422,36 @@
370422 sortbysizeItem.addActionListener(this);
371423 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372424 sortbynameItem.addActionListener(this);
425
+ if (Globals.ADVANCED)
426
+ {
427
+ menu.add("-");
428
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429
+ extractGeometriesItem.addActionListener(this);
430
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431
+ cloneGeometriesItem.addActionListener(this);
432
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
+ shareGeometriesItem.addActionListener(this);
434
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
+ mergeGeometriesItem.addActionListener(this);
436
+ }
437
+
373438 oe.menuBar.add(menu = new Menu("Insert"));
374439 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
440
+
441
+ oe.menuBar.add(menu = new Menu("Include"));
442
+ importOBJItem = menu.add(new MenuItem("OBJ file..."));
443
+ importOBJItem.addActionListener(this);
444
+ menu.add("-");
445
+ import3DSItem = menu.add(new MenuItem("3DS file..."));
446
+ import3DSItem.addActionListener(this);
447
+ menu.add("-");
448
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
+ importVRMLX3DItem.addActionListener(this);
450
+ menu.add("-");
451
+ importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
452
+ importGFDItem.addActionListener(this);
453
+
454
+ oe.menuBar.add(menu = new Menu("Tools"));
376455 buildToolsMenu(menu);
377456 }
378457
....@@ -406,150 +485,98 @@
406485 oe.radioPanel.add(dummyButton);
407486 oe.buttonGroup.add(dummyButton);
408487 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
488
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
412489
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
490
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
+ liveCB.setToolTipText("Enabled animation");
414492 liveCB.addItemListener(this);
415493
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);
494
+ oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
495
+ oneStepButton.setToolTipText("Animate one step forward");
496
+ oneStepButton.addActionListener(this);
497
+
498
+ oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
499
+ fastCB.setToolTipText("Fast mode");
434500 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);
441
-
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);
501
+
502
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
503
+ trackCB.setToolTipText("Enable tracking");
476504 trackCB.addItemListener(this);
477505
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
506
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
507
+ screenfitButton.setToolTipText("Screen fit");
480508 screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
509
+
482510 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483511 // 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;
488512
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);
513
+ if (Globals.ADVANCED)
514
+ {
515
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
516
+ snapobjectButton.addActionListener(this);
517
+ snapobjectButton.setToolTipText("Snap Object");
518
+ }
519
+
520
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
521
+ flashSelectionButton.setToolTipText("Show selection");
495522 flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499523
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
524
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525
+
526
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
527
+ twoButton.setToolTipText("Show center view only");
502528 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
529
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504530 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
531
+ fourButton.setToolTipText("Show left panel only");
532
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
533
+ sixButton.setToolTipText("2-column layout left");
506534 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
535
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
536
+ threeButton.setToolTipText("2-column layout right");
508537 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
538
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
539
+ sevenButton.setToolTipText("3-column layout");
510540 sevenButton.addActionListener(this);
511541 //
512542
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
543
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
544
+ rootButton.setToolTipText("Edit selection in new tab");
514545 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
546
+
547
+ oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
548
+ closeButton.setToolTipText("Close tab");
517549 closeButton.addActionListener(this);
518550 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519551 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521552
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
553
+ cGridBag commandsPanel = new cGridBag();
554
+
555
+ commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
556
+ editButton.setToolTipText("Edit selection");
524557 editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
528558
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
559
+ commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
560
+ uneditButton.setToolTipText("Unedit selection");
530561 uneditButton.addActionListener(this);
531562
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);
563
+ commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
564
+ allParamsButton.setToolTipText("Edit all params");
544565 allParamsButton.addActionListener(this);
545566
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);
567
+ commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
568
+ clearPanelButton.setToolTipText("Clear edit panel");
569
+ clearPanelButton.addActionListener(this);
570
+
571
+ commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
572
+ unselectButton.setToolTipText("Unselect");
551573 unselectButton.addActionListener(this);
552574
575
+ commandsPanel.preferredHeight = 1;
576
+
577
+ oe.treePanel.add(commandsPanel);
578
+ oe.treePanel.Return();
579
+
553580 // oe.aConstraints.gridx += 1;
554581 // oe.aConstraints.weighty = 0;
555582 // oe.aConstraints.gridwidth = 1;
....@@ -561,40 +588,37 @@
561588 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
562589 // gcButton.addActionListener(this);
563590
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;
591
+ cGridBag jSPPanel = new cGridBag();
592
+
593
+ JScrollPane jSP;
575594 //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);
595
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
577596 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
597
+
598
+ oe.treePanel.add(jSPPanel);
599
+ oe.treePanel.Return();
582600
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);
601
+ cGridBag copyOptionsPanel = new cGridBag();
602
+
603
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
604
+ colorCB.setToolTipText("Copy color when dropped");
587605 colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
606
+
607
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
608
+ materialCB.setToolTipText("Copy material when dropped");
590609 materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
+
611
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
612
+ textureCB.setToolTipText("Copy texture when dropped");
593613 textureCB.addItemListener(this);
594614
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
615
+ copyOptionsPanel.preferredHeight = 1;
616
+ oe.treePanel.add(copyOptionsPanel);
617
+ oe.treePanel.Return();
597618
619
+// mainPanel.setDividerLocation(0.5); //1.0);
620
+// mainPanel.setResizeWeight(0.5);
621
+
598622 //jList.addListSelectionListener(this);
599623 oe.jTree.addTreeSelectionListener(this);
600624 //jTree.setRootVisible(false);
....@@ -616,17 +640,89 @@
616640 radio.layout = sevenButton;
617641 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618642 }
643
+
644
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
645
+ {
646
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
647
+ boxCB.setToolTipText("Display bounding boxes");
648
+ boxCB.addItemListener(this);
649
+
650
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
651
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
652
+ zoomBoxCB.addItemListener(this);
653
+
654
+ if (Globals.ADVANCED)
655
+ {
656
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657
+ supportCB.setToolTipText("Enable rigging");
658
+ supportCB.addItemListener(this);
659
+
660
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
661
+ // localCB.addItemListener(this);
662
+
663
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
664
+ crowdCB.setToolTipText("Used for crowds");
665
+ crowdCB.addItemListener(this);
666
+
667
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
668
+ smoothCB.setToolTipText("Snapping delay");
669
+ smoothCB.addItemListener(this);
670
+
671
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
672
+ slowCB.setToolTipText("Smooth interpolation");
673
+ slowCB.addItemListener(this);
674
+
675
+// constraints.gridy += 1;
676
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
677
+// speakerMocapCB.addItemListener(this);
678
+
679
+ if (false)
680
+ {
681
+ // handled in scripts
682
+ //constraints.gridy += 1;
683
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
684
+ speakerCameraCB.addItemListener(this);
685
+
686
+ //constraints.gridy += 1;
687
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
688
+ speakerFocusCB.addItemListener(this);
689
+
690
+ //constraints.gridy += 1;
691
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
692
+ smoothfocusCB.addItemListener(this);
693
+ }
694
+
695
+//constraints.gridx += 1;
696
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
697
+// debugCB.addItemListener(this);
698
+
699
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
700
+ oeilCB.addItemListener(this);
701
+
702
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
703
+ lookAtCB.setToolTipText("Look-at target");
704
+ lookAtCB.addItemListener(this);
705
+
706
+ }
707
+
708
+ cGridBag fill = new cGridBag();
709
+
710
+ fill.preferredHeight = 200;
711
+
712
+ panel.add(fill);
713
+
714
+ }
619715
620716 void EditObject(Object3D obj)
621717 {
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();
718
+ cRadio radioButton = new cRadio(obj.name);
719
+ radioButton.SetObject(obj);
720
+ radioButton.layout = sevenButton;
721
+ radioButton.SetCamera(cameraView.renderCamera, false);
722
+ radioButton.addActionListener(this);
723
+ radioPanel.add(radioButton);
724
+ buttonGroup.add(radioButton);
725
+ radioButton.doClick();
630726 }
631727 void SetupViews(ObjEditor oe)
632728 {
....@@ -646,6 +742,7 @@
646742 JCheckBox fastCB;
647743 JCheckBox slowCB;
648744 JCheckBox boxCB;
745
+ JCheckBox zoomBoxCB;
649746 JCheckBox trackCB;
650747 JCheckBox smoothfocusCB;
651748 // JCheckBox speakerMocapCB;
....@@ -688,8 +785,7 @@
688785 dropAttributes |= Object3D.TEXTURE;
689786 else
690787 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
788
+ } else if(e.getSource() == liveCB)
693789 {
694790 cameraView.ToggleLive();
695791 }
....@@ -726,6 +822,10 @@
726822 Recompile();
727823 cameraView.repaint();
728824 // refreshContents();
825
+ }
826
+ else if(e.getSource() == zoomBoxCB)
827
+ {
828
+ cameraView.ToggleZoomBoxMode();
729829 }
730830 else if(e.getSource() == smoothfocusCB)
731831 {
....@@ -840,7 +940,9 @@
840940 // objEditor.DropFile((java.io.File[]) object, true);
841941 // return;
842942 // }
843
- if (string.charAt(0) == '/')
943
+
944
+ // File path for Mac and Windows
945
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
844946 {
845947 // file(s)
846948 String[] names = string.split("\n");
....@@ -867,7 +969,7 @@
867969
868970 flashIt = false;
869971 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
972
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
871973 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
872974
873975 if (group.selection.size() == 1)
....@@ -894,11 +996,11 @@
894996 {
895997 loadClipboard(true);
896998 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
999
+ pasteInto(false, false);
8981000 } else {
8991001 loadClipboard(false);
9001002 objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
1003
+ pasteInto(false, false); // true); // ???
9021004 }
9031005 }
9041006 public void dropActionChanged(DropTargetDragEvent dtde)
....@@ -1002,6 +1104,8 @@
10021104
10031105 void buildCreateMenu(Menu menu)
10041106 {
1107
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1108
+ //heightFieldItem.addActionListener(this);
10051109 gridItem = menu.add(new MenuItem("Grid"));
10061110 gridItem.addActionListener(this);
10071111 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,29 +1118,37 @@
10141118 torusItem.addActionListener(this);
10151119 superItem = menu.add(new MenuItem("Superellipsoid"));
10161120 superItem.addActionListener(this);
1121
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1122
+ kleinItem.addActionListener(this);
10171123 particleItem = menu.add(new MenuItem("Particle system"));
10181124 particleItem.addActionListener(this);
1125
+ if (Globals.ADVANCED)
1126
+ {
10191127 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201128 ragdollItem.addActionListener(this);
10211129 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221130 ragdoll2Item.addActionListener(this);
1131
+ }
10231132 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1133
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251134 meshItem.addActionListener(this);
10261135 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271136 // meshGroupItem.addActionListener(this);
1137
+ if (Globals.ADVANCED)
1138
+ {
10281139 springItem = menu.add(new MenuItem("Spring"));
10291140 springItem.addActionListener(this);
10301141 flagItem = menu.add(new MenuItem("Flag"));
10311142 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);
10361143 blobItem = menu.add(new MenuItem("Blob"));
10371144 blobItem.addActionListener(this);
10381145 latheItem = menu.add(new MenuItem("Lathe"));
10391146 latheItem.addActionListener(this);
1147
+ }
1148
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1149
+ bezierItem.addActionListener(this);
1150
+ overlayItem = menu.add(new MenuItem("Overlay"));
1151
+ overlayItem.addActionListener(this);
10401152 lightItem = menu.add(new MenuItem("Light"));
10411153 lightItem.addActionListener(this);
10421154 menu.add("-");
....@@ -1046,41 +1158,39 @@
10461158 loopItem.addActionListener(this);
10471159 doubleItem = menu.add(new MenuItem("Fork"));
10481160 doubleItem.addActionListener(this);
1161
+ if (Globals.ADVANCED)
1162
+ {
10491163 tripleItem = menu.add(new MenuItem("Trident"));
10501164 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);
1165
+ }
10601166 }
10611167
10621168 void buildToolsMenu(Menu menu)
10631169 {
10641170 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651171 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1172
+ animationItem.setState(Globals.ANIMATION);
10671173
10681174 menu.add("-");
10691175 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701176 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1177
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1178
+ textureFieldItem.addActionListener(this);
1179
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721180 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751181 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761182 reduceMorphItem.addActionListener(this);
10771183 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781184 reduce34MorphItem.addActionListener(this);
1079
-
1185
+ menu.add("-");
10801186 menu.add(computeAOItem = new MenuItem("Compute AO"));
10811187 computeAOItem.addActionListener(this);
1082
- menu.add("-");
10831188
1189
+ if (Globals.ADVANCED)
1190
+ {
1191
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1192
+ mirrorItem.addActionListener(this);
1193
+ menu.add("-");
10841194 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851195 memoryItem.addActionListener(this);
10861196 menu.add(analyzeItem = new MenuItem("Analyze"));
....@@ -1094,6 +1204,8 @@
10941204 resetParentItem.addActionListener(this);
10951205 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961206 repairParentItem.addActionListener(this);
1207
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1208
+ repairShadowItem.addActionListener(this);
10971209 menu.add(invariantsItem = new MenuItem("Invariants"));
10981210 invariantsItem.addActionListener(this);
10991211 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1213,7 @@
11011213 menu.add("-");
11021214 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031215 editScriptItem.addActionListener(this);
1216
+ }
11041217 }
11051218
11061219 void ScreenFit()
....@@ -1429,9 +1542,9 @@
14291542
14301543 void Overwrite(int mask)
14311544 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1545
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14331546 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1547
+ Object3D content = GrafreeD.clipboard.get(0);
14351548
14361549 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371550 content = ((cGroup)content).get(0);
....@@ -1454,6 +1567,7 @@
14541567 //
14551568 public void actionPerformed(ActionEvent event) // , Object arg)
14561569 {
1570
+ Object source = event.getSource();
14571571 /*
14581572 if (event.getSource() == nameField)
14591573 {
....@@ -1465,11 +1579,11 @@
14651579 }
14661580 else
14671581 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1582
+ if (source == lookAtItem || source == lookFromItem)
14691583 {
14701584 ScreenFit();
14711585 } else
1472
- if (event.getSource() == switchItem)
1586
+ if (source == switchItem)
14731587 {
14741588 cVector v1 = new cVector();
14751589 cVector v2 = new cVector();
....@@ -1478,11 +1592,11 @@
14781592 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791593 objEditor.cameraView.repaint();
14801594 } else
1481
- if (event.getSource() == rectoidItem)
1595
+ if (source == rectoidItem)
14821596 {
14831597 makeSomething(new Box());
14841598 } else
1485
- if (event.getSource() == particleItem)
1599
+ if (source == particleItem)
14861600 {
14871601 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881602 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1617,9 @@
15031617 applyExample(particleGeom, "SMOKE");
15041618 makeSomething(particleGeom);
15051619 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1620
+ if (source == ragdollItem || source == ragdoll2Item)
15071621 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1622
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091623
15101624 ragdoll.toParent = LA.newMatrix();
15111625 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1635,71 @@
15211635 makeSomething(ragdoll);
15221636 //makeSomething(new VehicleDemo());
15231637 } else
1524
- if (event.getSource() == gridItem)
1638
+ /*
1639
+ */
1640
+ if (source == heightFieldItem)
1641
+ {
1642
+ Object3D obj = new Object3D();
1643
+
1644
+ obj.CreateMaterial();
1645
+ obj.bRep = new BoundaryRep();
1646
+
1647
+ obj.bRep.CreateMesh(new iHeightField()
1648
+ {
1649
+ public double f(double x, double y)
1650
+ {
1651
+ // The Mandelbrot set is represented by coloring
1652
+ // each point (x,y) according to the number of
1653
+ // iterations it takes before the while loop in
1654
+ // this method ends. For points that are actually
1655
+ // in the Mandelbrot set, or very close to it, the
1656
+ // count will reach the maximum value, 80. These
1657
+ // points will be colored purple. All other colors
1658
+ // represent points that are definitely NOT in the set.
1659
+ x -= 600;
1660
+ y -= 500;
1661
+ x /= 200;
1662
+ y /= 200;
1663
+ int count = 0;
1664
+ double zx = x;
1665
+ double zy = y;
1666
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1667
+ double new_zx = zx*zx - zy*zy + x;
1668
+ zy = 2*zx*zy + y;
1669
+ zx = new_zx;
1670
+ count++;
1671
+ }
1672
+ return count; // Math.sqrt(count);
1673
+ }
1674
+ }, 1000,1000);
1675
+
1676
+ makeSomething(obj);
1677
+ } else
1678
+ if (source == gridItem)
15251679 {
15261680 makeSomething(new Grid());
15271681 } else
1528
- if (event.getSource() == ellipsoidItem)
1682
+ if (source == ellipsoidItem)
15291683 {
15301684 makeSomething(new Sphere());
15311685 } else
1532
- if (event.getSource() == coneItem)
1686
+ if (source == coneItem)
15331687 {
15341688 makeSomething(new Cone());
15351689 } else
1536
- if (event.getSource() == torusItem)
1690
+ if (source == torusItem)
15371691 {
15381692 makeSomething(new Torus());
15391693 } else
1540
- if (event.getSource() == superItem)
1694
+ if (source == superItem)
15411695 {
15421696 makeSomething(new Superellipsoid());
15431697 } else
1544
- if (event.getSource() == blobItem)
1698
+ if (source == kleinItem)
1699
+ {
1700
+ makeSomething(new Klein());
1701
+ } else
1702
+ if (source == blobItem)
15451703 {
15461704 Blob blob = new Blob();
15471705 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1707,15 @@
15491707 //blob.retile();
15501708 makeSomething(blob);
15511709 } else
1552
- if (event.getSource() == latheItem)
1710
+ if (source == latheItem)
15531711 {
15541712 makeSomething(new Lathe());
15551713 } else
1556
- if (event.getSource() == bezierItem)
1714
+ if (source == bezierItem)
15571715 {
15581716 makeSomething(new BezierSurface());
15591717 } else
1560
- if (event.getSource() == checkerItem)
1718
+ if (source == overlayItem)
15611719 {
15621720 /*
15631721 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1728,9 @@
15701728 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711729 LA.matInvert(obj.toParent, obj.fromParent);
15721730 */
1573
- makeSomething(new CheckerIG());
1731
+ makeSomething(new Checker());
15741732 } else
1575
- if (event.getSource() == meshItem)
1733
+ if (source == meshItem)
15761734 {
15771735 Object3D itemtomake = new Object3D();
15781736 Object3D child;
....@@ -1593,35 +1751,35 @@
15931751 makeSomething(child);
15941752 }
15951753 } else
1596
- if (event.getSource() == springItem)
1754
+ if (source == springItem)
15971755 {
15981756 cSpring s = new cSpring();
15991757 s.setup();
16001758 makeSomething(s);
16011759 } else
1602
- if (event.getSource() == flagItem)
1760
+ if (source == flagItem)
16031761 {
16041762 cSpring s = new cFlag();
16051763 s.setup();
16061764 makeSomething(s);
16071765 } else
1608
- if (event.getSource() == lightItem)
1766
+ if (source == lightItem)
16091767 {
16101768 makeSomething(new Light());
16111769 } else
1612
- if (event.getSource() == csgItem)
1770
+ if (source == csgItem)
16131771 {
16141772 group(new CSG());
16151773 } else
1616
- if (event.getSource() == templateItem)
1774
+ if (source == templateItem)
16171775 {
16181776 group(new cTemplate());
16191777 } else
1620
- if (event.getSource() == attributeItem)
1778
+ if (source == attributeItem)
16211779 {
16221780 makeSomething(new Attribute());
16231781 } else
1624
- if (event.getSource() == pointflowItem)
1782
+ if (source == pointflowItem)
16251783 {
16261784 makeSomething(new PointFlow());
16271785 } else
....@@ -1633,7 +1791,7 @@
16331791 } else
16341792 */
16351793
1636
- if (event.getSource() == superLoopItem)
1794
+ if (source == superLoopItem)
16371795 {
16381796 Composite g = new cGroup();
16391797 for (int i=0; i<15; i++)
....@@ -1655,7 +1813,7 @@
16551813
16561814 group(g);
16571815 } else
1658
- if (event.getSource() == loopItem)
1816
+ if (source == loopItem)
16591817 {
16601818 Composite csg = new GroupLeaf();
16611819 csg.count = 5;
....@@ -1664,7 +1822,7 @@
16641822 csg.addChild(child);
16651823 child.addChild(csg);
16661824 } else
1667
- if (event.getSource() == doubleItem)
1825
+ if (source == doubleItem)
16681826 {
16691827 Composite csg = new GroupLeaf();
16701828 csg.count = 5;
....@@ -1676,7 +1834,7 @@
16761834 csg.addChild(child);
16771835 child.addChild(csg);
16781836 } else
1679
- if (event.getSource() == tripleItem)
1837
+ if (source == tripleItem)
16801838 {
16811839 Composite csg = new GroupLeaf();
16821840 csg.count = 4;
....@@ -1692,70 +1850,83 @@
16921850 child.addChild(csg);
16931851 } else
16941852
1695
- if (event.getSource() == importGFDItem)
1853
+ if (source == importGFDItem)
16961854 {
16971855 ImportGFD();
16981856 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1857
+ if (source == importVRMLX3DItem)
17001858 {
17011859 ImportVRMLX3D();
17021860 } else
1703
- if (event.getSource() == import3DSItem)
1861
+ if (source == import3DSItem)
17041862 {
17051863 objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
17061864 } else
1707
- if (event.getSource() == importOBJItem)
1865
+ if (source == importOBJItem)
17081866 {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1867
+ //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1868
+ FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1869
+ browser.setVisible(true);
1870
+ String filename = browser.getFile();
1871
+ if (filename != null && filename.length() > 0)
1872
+ {
1873
+ String fullname = browser.getDirectory() + filename;
1874
+ makeSomething(ReadOBJ(fullname), true);
1875
+ }
17101876 } else
1711
- if (event.getSource() == computeAOItem)
1877
+ if (source == computeAOItem)
17121878 {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1879
+ Globals.drawMode = CameraPane.OCCLUSION;
1880
+ Globals.theRenderer.repaint();
17151881 } else
1716
- if (event.getSource() == recompileItem)
1882
+ if (source == recompileItem)
17171883 {
17181884 Recompile();
17191885 refreshContents();
17201886 } else
1721
- if (event.getSource() == editScriptItem)
1887
+ if (source == editScriptItem)
17221888 {
17231889 OpenDialog();
17241890 refreshContents();
17251891 } else
1726
- if (event.getSource() == invariantsItem)
1892
+ if (source == invariantsItem)
17271893 {
17281894 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1895
+ GrafreeD.grafreeD.universe.invariants();
17301896 } else
1731
- if (event.getSource() == memoryItem)
1897
+ if (source == memoryItem)
17321898 {
17331899 //System.out.println("Invariants:");
17341900 PrintMemory();
17351901 } else
1736
- if (event.getSource() == pathItem)
1902
+ if (source == pathItem)
17371903 {
17381904 PrintPath();
17391905 } else
1740
- if (event.getSource() == analyzeItem)
1906
+ if (source == analyzeItem)
17411907 {
17421908 AnalyzeObject();
17431909 } else
1744
- if (event.getSource() == dumpItem)
1910
+ if (source == dumpItem)
17451911 {
17461912 DumpObject();
17471913 } else
1748
- if (event.getSource() == screenfitButton)
1914
+ if (source == oneStepButton)
1915
+ {
1916
+ Globals.ONESTEP = true;
1917
+ cameraView.repaint();
1918
+ } else
1919
+ if (source == screenfitButton)
17491920 {
17501921 //Reload(lastConverter, lastFilename, true);
17511922 ScreenFit();
17521923 } else
1753
- if (event.getSource() == screenfitpointButton)
1924
+ if (source == screenfitpointButton)
17541925 {
17551926 //Reload(lastConverter, lastFilename, true);
17561927 ScreenFitPoint();
17571928 } else
1758
- if (event.getSource() == snapobjectButton)
1929
+ if (source == snapobjectButton)
17591930 {
17601931 //Reload(lastConverter, lastFilename, true);
17611932 SnapObject();
....@@ -1766,13 +1937,13 @@
17661937 // Recompile();
17671938 // refreshContents();
17681939 // } else
1769
- if (event.getSource() == gcButton)
1940
+ if (source == gcButton)
17701941 {
17711942 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17721943 System.gc();
17731944 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17741945 } else
1775
- if (event.getSource() == editLeafItem)
1946
+ if (source == editLeafItem)
17761947 {
17771948 Object3D obj;
17781949 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +1957,70 @@
17861957 }
17871958 refreshContents(true);
17881959 } else
1789
- if (event.getSource() == openWindowItem)
1960
+ if (source == openWindowItem)
17901961 {
17911962 EditSelection(true);
17921963 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
1964
+ if (source == cutItem || source == clearButton)
17941965 {
17951966 loadClipboard(true);
17961967 } else
1797
- if (event.getSource() == duplicateItem)
1968
+ if (source == duplicateItem)
17981969 {
1799
- Object3D keep = GraphreeD.clipboard;
1970
+ Object3D keep = GrafreeD.clipboard;
18001971 loadClipboard(false);
18011972 paste(false);
1802
- GraphreeD.clipboard = keep;
1973
+ GrafreeD.clipboard = keep;
18031974 } else
1804
- if (event.getSource() == cloneItem)
1975
+ if (source == cloneItem)
18051976 {
18061977 CloneSelection(false);
18071978 } else
1808
- if (event.getSource() == cloneSupportItem)
1979
+ if (source == cloneSupportItem)
18091980 {
18101981 CloneSelection(true);
18111982 } else
1812
- if (event.getSource() == copyItem)
1983
+ if (source == copyItem)
18131984 {
18141985 loadClipboard(false);
18151986 } else
1816
- if (event.getSource() == pasteItem)
1987
+ if (source == pasteItem)
18171988 {
18181989 paste(false);
18191990 } else
1820
- if (event.getSource() == pasteLinkItem)
1991
+ if (source == pasteIntoItem)
18211992 {
1822
- pasteInto(false);
1993
+ pasteInto(true, false);
18231994 } else
1824
- if (event.getSource() == pasteCloneItem)
1995
+ if (source == pasteLinkItem)
18251996 {
1826
- pasteInto(true);
1997
+ pasteInto(false, false);
18271998 } else
1828
- if (event.getSource() == pasteExpandItem)
1999
+ if (source == pasteCloneItem)
2000
+ {
2001
+ pasteInto(true, true);
2002
+ } else
2003
+ if (source == pasteExpandItem)
18292004 {
18302005 paste(true);
18312006 } else
1832
- if (event.getSource() == synchronizeItem)
2007
+ if (source == synchronizeItem)
18332008 {
18342009 Overwrite(Object3D.TRANSFORM);
18352010 } else
1836
- if (event.getSource() == overwriteNameItem)
2011
+ if (source == overwriteNameItem)
18372012 {
18382013 Overwrite(Object3D.NAME);
18392014 } else
1840
- if (event.getSource() == overwriteUVItem)
2015
+ if (source == overwriteUVItem)
18412016 {
18422017 Overwrite(Object3D.UV);
18432018 } else
1844
- if (event.getSource() == overwriteMatItem)
2019
+ if (source == overwriteMatItem)
18452020 {
2021
+ /* july 2015
18462022 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2023
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482024 else
18492025 {
18502026 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2032,16 @@
18562032 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572033 }
18582034 }
2035
+ */
2036
+
2037
+ Overwrite(dropAttributes);
18592038 }
1860
- if (event.getSource() == overwriteGeoItem)
2039
+ if (source == overwriteGeoItem)
18612040 {
18622041 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2042
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642043 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2044
+// Object3D content = GrafreeD.clipboard.get(0);
18662045 //
18672046 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682047 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2053,7 @@
18742053 // refreshContents();
18752054 // }
18762055 } else
1877
- if (event.getSource() == generateMeshItem)
2056
+ if (source == generateMeshItem)
18782057 {
18792058 //if (group.selection.size() == 1)
18802059 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2064,7 @@
18852064 ResetModel();
18862065 refreshContents();
18872066 } else
1888
- if (event.getSource() == extractGeometriesItem)
2067
+ if (source == extractGeometriesItem)
18892068 {
18902069 boolean one = false;
18912070
....@@ -1912,7 +2091,7 @@
19122091 ResetModel();
19132092 refreshContents();
19142093 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2094
+ if (source == cloneGeometriesItem)
19162095 {
19172096 boolean one = false;
19182097
....@@ -1938,32 +2117,37 @@
19382117 ResetModel();
19392118 refreshContents();
19402119 } else
1941
- if (event.getSource() == shareGeometriesItem)
2120
+ if (source == shareGeometriesItem)
19422121 {
19432122 boolean one = false;
19442123
19452124 if (group.selection.size() == 1)
19462125 one = true;
19472126
2127
+ Object3D merge = null;
2128
+
19482129 Object3D content = new cGroup();
19492130
19502131 for (int i=0; i<group.selection.size(); i++)
19512132 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2133
+ merge = new Merge(group.selection.get(i));
19532134
19542135 if (one)
1955
- makeSomething(sel, false);
2136
+ makeSomething(merge, false);
19562137 else
1957
- content.addChild(sel);
2138
+ content.addChild(merge);
19582139 }
19592140
19602141 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2142
+ makeSomething(content, true);
2143
+ else
2144
+ {
2145
+ ResetModel();
2146
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2147
+ refreshContents();
2148
+ }
19652149 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2150
+ if (source == mergeGeometriesItem)
19672151 {
19682152 boolean one = false;
19692153
....@@ -1993,11 +2177,11 @@
19932177 ResetModel();
19942178 refreshContents();
19952179 } else
1996
- if (event.getSource() == linkverticesItem)
2180
+ if (source == linkverticesItem)
19972181 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2182
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992183 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2184
+// Object3D content = GrafreeD.clipboard.get(0);
20012185 //
20022186 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032187 // content = ((cGroup)content).get(0);
....@@ -2006,39 +2190,48 @@
20062190 // group.selection.get(0).setMasterThis(content); // should be identity
20072191 // refreshContents();
20082192 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2193
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20102194 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2195
+ Object3D content = GrafreeD.clipboard.get(0);
20122196
20132197 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142198 content = ((cGroup)content).get(0);
20152199
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2200
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172201 for (int i=0; i<group.selection.size(); i++)
20182202 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
2203
+ boolean random = CameraPane.SWITCH;
2204
+ CameraPane.SWITCH = false; // parse all random nodes
20212205 group.selection.get(i).linkVerticesThis(content);
20222206 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
2207
+ CameraPane.SWITCH = random;
20242208 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2209
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262210 refreshContents();
20272211 }
20282212 } else
2029
- if (event.getSource() == resetsupportItem)
2213
+ if (source == resetsupportItem)
20302214 {
20312215 for (int i=0; i<group.selection.size(); i++)
20322216 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
2217
+ boolean random = CameraPane.SWITCH;
2218
+ CameraPane.SWITCH = false; // parse all random nodes
20352219 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
2220
+ CameraPane.SWITCH = random;
20372221 }
20382222
20392223 refreshContents();
20402224 } else
2041
- if (event.getSource() == resetreferencesItem)
2225
+ if (source == relinkverticesItem)
2226
+ {
2227
+ boolean random = CameraPane.SWITCH;
2228
+ CameraPane.SWITCH = false; // parse all random nodes
2229
+ group.selection.RelinkToSupport();
2230
+ CameraPane.SWITCH = random;
2231
+
2232
+ refreshContents();
2233
+ } else
2234
+ if (source == resetreferencesItem)
20422235 {
20432236 for (int i=0; i<group.selection.size(); i++)
20442237 {
....@@ -2047,11 +2240,11 @@
20472240
20482241 refreshContents();
20492242 } else
2050
- if (event.getSource() == setMasterItem)
2243
+ if (source == setMasterItem)
20512244 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2245
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20532246 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2247
+ Object3D content = GrafreeD.clipboard.get(0);
20552248
20562249 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572250 content = ((cGroup)content).get(0);
....@@ -2060,13 +2253,13 @@
20602253 refreshContents();
20612254 }
20622255 } else
2063
- if (event.getSource() == poseMeshItem)
2256
+ if (source == poseMeshItem)
20642257 {
20652258 if (group.selection.size() == 1)
20662259 {
2067
- if (GraphreeD.clipboard.size() == 1)
2260
+ if (GrafreeD.clipboard.size() == 1)
20682261 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2262
+ Object3D content = GrafreeD.clipboard.get(0);
20702263
20712264 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722265 content = ((cGroup)content).get(0);
....@@ -2079,19 +2272,19 @@
20792272 }
20802273
20812274 } else
2082
- if (event.getSource() == revertMeshItem)
2275
+ if (source == revertMeshItem)
20832276 {
20842277 RevertMeshes();
20852278 } else
2086
- if (event.getSource() == resetMeshItem)
2279
+ if (source == resetMeshItem)
20872280 {
20882281 ResetAll();
20892282 } else
2090
- if (event.getSource() == stepAllItem)
2283
+ if (source == stepAllItem)
20912284 {
20922285 StepAll();
20932286 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2287
+ if (source == clearItem) // || event.getSource() == clearButton)
20952288 {
20962289 //int indices[] = jList.getSelectedIndices();
20972290 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2292,46 @@
20992292
21002293 ClearSelection(false);
21012294 } else
2102
- if (event.getSource() == clearAllItem)
2295
+ if (source == clearAllItem)
21032296 {
21042297 ClearSelection(true);
21052298 } else
2106
- if (event.getSource() == grabItem)
2299
+ if (source == grabItem)
21072300 {
21082301 group(new cGroup(), true);
21092302 } else
2110
- if (event.getSource() == frontItem)
2303
+ if (source == hideItem)
2304
+ {
2305
+ group(new HiddenObject());
2306
+ } else
2307
+ if (source == frontItem)
21112308 {
21122309 front();
21132310 } else
2114
- if (event.getSource() == backItem)
2311
+ if (source == backItem)
21152312 {
21162313 back();
21172314 } else
2118
- if (event.getSource() == cameraItem)
2315
+ if (source == cameraItem)
21192316 {
21202317 makeSomething(new Camera());
21212318 } else
2122
- if (event.getSource() == compositeItem)
2319
+ if (source == compositeItem)
21232320 {
21242321 group(new Composite());
21252322 } else
2126
- if (event.getSource() == randomItem)
2323
+ if (source == randomItem)
21272324 {
21282325 RandomNode random = new RandomNode();
21292326 group(random);
21302327 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
2328
+ random.name = random.get(0).name + "Switch";
21322329 } else
2133
- if (event.getSource() == physicsItem)
2330
+ if (source == physicsItem)
21342331 {
21352332 group(new PhysicsNode());
21362333 } else
2137
- if (event.getSource() == frameselectorItem)
2334
+ if (source == frameselectorItem)
21382335 {
21392336 for (int i=0; i<group.selection.size(); i++)
21402337 {
....@@ -2146,7 +2343,7 @@
21462343 ResetModel();
21472344 refreshContents();
21482345 } else
2149
- if (event.getSource() == switchGeoItem)
2346
+ if (source == switchGeoItem)
21502347 {
21512348 for (int i=0; i<group.selection.size(); i++)
21522349 {
....@@ -2158,7 +2355,7 @@
21582355 ResetModel();
21592356 refreshContents();
21602357 } else
2161
- if (event.getSource() == switchTransfoItem)
2358
+ if (source == switchTransfoItem)
21622359 {
21632360 for (int i=0; i<group.selection.size(); i++)
21642361 {
....@@ -2170,7 +2367,7 @@
21702367 ResetModel();
21712368 refreshContents();
21722369 } else
2173
- if (event.getSource() == morphItem)
2370
+ if (source == morphItem)
21742371 {
21752372 for (int i=0; i<group.selection.size(); i++)
21762373 {
....@@ -2182,7 +2379,7 @@
21822379 ResetModel();
21832380 refreshContents();
21842381 } else
2185
- if (event.getSource() == scriptNodeItem)
2382
+ if (source == scriptNodeItem)
21862383 {
21872384 boolean atleastone = false;
21882385
....@@ -2221,191 +2418,215 @@
22212418 }
22222419 }
22232420 } else
2224
- if (event.getSource() == linkerItem)
2421
+ if (source == linkerItem)
22252422 {
22262423 group(new cLinker());
22272424 } else
2228
- if (event.getSource() == textureItem)
2425
+ if (source == textureItem)
22292426 {
22302427 group(new TextureNode());
22312428 } else
2232
- if (event.getSource() == shadowXItem)
2429
+ if (source == billboardItem)
2430
+ {
2431
+ group(new BillboardNode());
2432
+ } else
2433
+ if (source == shadowXItem)
22332434 {
22342435 CastShadow(0);
22352436 } else
2236
- if (event.getSource() == shadowYItem)
2437
+ if (source == shadowYItem)
22372438 {
22382439 CastShadow(1);
22392440 } else
2240
- if (event.getSource() == shadowZItem)
2441
+ if (source == shadowZItem)
22412442 {
22422443 CastShadow(2);
22432444 } else
2244
- if (event.getSource() == ungroupItem)
2445
+ if (source == ungroupItem)
22452446 {
2246
- ungroup();
2447
+ //ungroup();
2448
+ for (int i=0; i<group.selection.size(); i++)
2449
+ {
2450
+ Ungroup(group.selection.get(i));
2451
+ }
2452
+
2453
+ ClearSelection(false);
2454
+
2455
+ refreshContents();
22472456 } else
2248
- if (event.getSource() == genUVItem)
2457
+ if (source == genUVItem)
22492458 {
22502459 GenUV();
22512460 } else
2252
- if (event.getSource() == genNormalsCADItem)
2461
+ if (source == genNormalsCADItem)
22532462 {
22542463 GenNormals(true);
22552464 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2465
+ if (source == genNormalsMESHItem)
2466
+ {
2467
+ GenNormals(true); // TODO
2468
+ } else
2469
+ if (source == genNormalsORGANItem)
22572470 {
22582471 GenNormals(false);
22592472 } else
2260
- if (event.getSource() == stripifyItem)
2473
+ if (source == genNormalsMINEItem)
2474
+ {
2475
+ GenNormalsMINE();
2476
+ } else
2477
+ if (source == stripifyItem)
22612478 {
22622479 Stripify();
22632480 } else
2264
- if (event.getSource() == unstripifyItem)
2481
+ if (source == unstripifyItem)
22652482 {
22662483 Unstripify();
22672484 } else
2268
- if (event.getSource() == trimItem)
2485
+ if (source == trimItem)
22692486 {
22702487 Trim();
22712488 } else
2272
- if (event.getSource() == untrimItem)
2489
+ if (source == untrimItem)
22732490 {
22742491 Untrim();
22752492 } else
2276
- if (event.getSource() == clearColorsItem)
2493
+ if (source == clearColorsItem)
22772494 {
22782495 ClearColors();
22792496 } else
2280
- if (event.getSource() == clearMaterialsItem)
2497
+ if (source == clearMaterialsItem)
22812498 {
22822499 ClearMaterials();
22832500 } else
2284
- if (event.getSource() == liveleavesItem)
2501
+ if (source == liveleavesItem)
22852502 {
22862503 LiveLeaves(true);
22872504 } else
2288
- if (event.getSource() == unliveleavesItem)
2505
+ if (source == unliveleavesItem)
22892506 {
22902507 LiveLeaves(false);
22912508 } else
2292
- if (event.getSource() == supportleavesItem)
2509
+ if (source == supportleavesItem)
22932510 {
22942511 SupportLeaves(true);
22952512 } else
2296
- if (event.getSource() == unsupportleavesItem)
2513
+ if (source == unsupportleavesItem)
22972514 {
22982515 SupportLeaves(false);
22992516 } else
2300
- if (event.getSource() == hideleavesItem)
2517
+ if (source == hideleavesItem)
23012518 {
23022519 HideLeaves(true);
23032520 } else
2304
- if (event.getSource() == showleavesItem)
2521
+ if (source == showleavesItem)
23052522 {
23062523 HideLeaves(false);
23072524 } else
2308
- if (event.getSource() == markleavesItem)
2525
+ if (source == markleavesItem)
23092526 {
23102527 MarkLeaves(true);
23112528 } else
2312
- if (event.getSource() == unmarkleavesItem)
2529
+ if (source == unmarkleavesItem)
23132530 {
23142531 MarkLeaves(false);
23152532 } else
2316
- if (event.getSource() == flipVItem)
2533
+ if (source == flipVItem)
23172534 {
23182535 FlipV(true);
23192536 } else
2320
- if (event.getSource() == unflipVItem)
2537
+ if (source == unflipVItem)
23212538 {
23222539 FlipV(false);
23232540 } else
2324
- if (event.getSource() == lowTexturesItem)
2541
+ if (source == lowTexturesItem)
23252542 {
23262543 SetTexRes(0);
23272544 } else
2328
- if (event.getSource() == normalTexturesItem)
2545
+ if (source == normalTexturesItem)
23292546 {
23302547 SetTexRes(1);
23312548 } else
2332
- if (event.getSource() == highTexturesItem)
2549
+ if (source == highTexturesItem)
23332550 {
23342551 SetTexRes(2);
23352552 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2553
+ if (source == veryhighTexturesItem)
23372554 {
23382555 SetTexRes(3);
23392556 } else
2340
- if (event.getSource() == maxTexturesItem)
2557
+ if (source == maxTexturesItem)
23412558 {
23422559 SetTexRes(4);
23432560 } else
2344
- if (event.getSource() == panoTexturesItem)
2561
+ if (source == panoTexturesItem)
23452562 {
23462563 SetTexRes(5);
23472564 } else
2348
- if (event.getSource() == reverseNormalsItem)
2565
+ if (source == reverseNormalsItem)
23492566 {
23502567 ReverseNormals();
23512568 } else
2352
- if (event.getSource() == parseverticesItem)
2569
+ if (source == parseverticesItem)
23532570 {
23542571 ParseVertices();
23552572 } else
2356
- if (event.getSource() == alignItem)
2573
+ if (source == textureFieldItem)
2574
+ {
2575
+ TextureVertices();
2576
+ } else
2577
+ if (source == alignItem)
23572578 {
23582579 Align();
23592580 } else
2360
- if (event.getSource() == mirrorItem)
2581
+ if (source == mirrorItem)
23612582 {
23622583 MirrorPoses();
23632584 } else
2364
- if (event.getSource() == reduceMorphItem)
2585
+ if (source == reduceMorphItem)
23652586 {
23662587 MeshReduction(false);
23672588 } else
2368
- if (event.getSource() == reduce34MorphItem)
2589
+ if (source == reduce34MorphItem)
23692590 {
23702591 MeshReduction(true);
23712592 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2593
+ if (source == reverseTrianglesItem)
23732594 {
23742595 ReverseTriangles();
23752596 } else
2376
- if (event.getSource() == reduceMeshItem)
2597
+ if (source == reduceMeshItem)
23772598 {
23782599 ReduceMesh(false);
23792600 } else
2380
- if (event.getSource() == reduce34MeshItem)
2601
+ if (source == reduce34MeshItem)
23812602 {
23822603 ReduceMesh(true);
23832604 } else
2384
- if (event.getSource() == increaseMeshItem)
2605
+ if (source == increaseMeshItem)
23852606 {
23862607 IncreaseMesh();
23872608 } else
2388
- if (event.getSource() == clipMeshItem)
2609
+ if (source == clipMeshItem)
23892610 {
23902611 ClipMesh();
23912612 } else
2392
- if (event.getSource() == smoothMeshItem)
2613
+ if (source == smoothMeshItem)
23932614 {
23942615 SmoothMesh();
23952616 } else
2396
- if (event.getSource() == transformgeometryItem)
2617
+ if (source == transformgeometryItem)
23972618 {
23982619 TransformGeometry();
23992620 } else
2400
- if (event.getSource() == resetTransformItem)
2621
+ if (source == resetTransformItem)
24012622 {
24022623 ResetTransform();
24032624 } else
2404
- if (event.getSource() == resetCentroidItem)
2625
+ if (source == resetCentroidItem)
24052626 {
24062627 ResetCentroid();
24072628 } else
2408
- if (event.getSource() == resetParentItem)
2629
+ if (source == resetParentItem)
24092630 {
24102631 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112632 {
....@@ -2415,7 +2636,7 @@
24152636
24162637 refreshContents();
24172638 } else
2418
- if (event.getSource() == repairParentItem)
2639
+ if (source == repairParentItem)
24192640 {
24202641 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212642 {
....@@ -2429,7 +2650,21 @@
24292650
24302651 refreshContents();
24312652 } else
2432
- if (event.getSource() == sortbysizeItem)
2653
+ if (source == repairShadowItem)
2654
+ {
2655
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2656
+ {
2657
+ Object3D obj = (Object3D)e.nextElement();
2658
+ obj.RepairShadow();
2659
+// for (int i=0; i<obj.size(); i++)
2660
+// {
2661
+// obj.get(i).parent = obj;
2662
+// }
2663
+ }
2664
+
2665
+ refreshContents();
2666
+ } else
2667
+ if (source == sortbysizeItem)
24332668 {
24342669 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352670 {
....@@ -2441,7 +2676,7 @@
24412676 ResetModel();
24422677 refreshContents();
24432678 } else
2444
- if (event.getSource() == sortbynameItem)
2679
+ if (source == sortbynameItem)
24452680 {
24462681 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472682 {
....@@ -2453,7 +2688,7 @@
24532688 ResetModel();
24542689 refreshContents();
24552690 } else
2456
- if (event.getSource() == attachPigmentItem)
2691
+ if (source == attachPigmentItem)
24572692 {
24582693 String texture = GetFile("Attach pigment");
24592694 Object3D obj;
....@@ -2465,7 +2700,7 @@
24652700
24662701 refreshContents();
24672702 } else
2468
- if (event.getSource() == detachPigmentItem)
2703
+ if (source == detachPigmentItem)
24692704 {
24702705 Object3D obj;
24712706 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2711,7 @@
24762711
24772712 refreshContents();
24782713 } else
2479
- if (event.getSource() == attachBumpItem)
2714
+ if (source == attachBumpItem)
24802715 {
24812716 String texture = GetFile("Attach bump");
24822717 Object3D obj;
....@@ -2488,7 +2723,7 @@
24882723
24892724 refreshContents();
24902725 } else
2491
- if (event.getSource() == detachBumpItem)
2726
+ if (source == detachBumpItem)
24922727 {
24932728 Object3D obj;
24942729 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2734,7 @@
24992734
25002735 refreshContents();
25012736 } else
2502
- if (event.getSource() == pigmentBumpItem)
2737
+ if (source == pigmentBumpItem)
25032738 {
25042739 Object3D obj;
25052740 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2745,195 @@
25102745
25112746 refreshContents();
25122747 } else
2513
- if (event.getSource() == flashSelectionButton)
2748
+ if (source == flashSelectionButton)
25142749 {
25152750 CameraPane.flash = true;
25162751 refreshContents();
25172752 } else
2518
- if (event.getSource() == oneButton)
2753
+ if (source == oneButton)
25192754 {
25202755 } else
2521
- if (event.getSource() == twoButton)
2756
+ if (source == twoButton)
25222757 {
25232758 radio.layout = twoButton;
25242759 // bug
25252760 //gridPanel.setDividerLocation(1.0);
25262761 //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();
2762
+// bigThree.remove(scenePanel);
2763
+// bigThree.remove(centralPanel);
2764
+// bigThree.remove(XYZPanel);
2765
+// aWindowConstraints.gridx = 0;
2766
+// aWindowConstraints.gridy = 0;
2767
+// aWindowConstraints.gridwidth = 1;
2768
+// // aConstraints.gridheight = 3;
2769
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2770
+// aWindowConstraints.weightx = 0;
2771
+// aWindowConstraints.weighty = 1;
2772
+// //bigThree.add(jtp, aWindowConstraints);
2773
+// aWindowConstraints.weightx = 1;
2774
+// aWindowConstraints.gridwidth = 3;
2775
+// // aConstraints.gridheight = 3;
2776
+// aWindowConstraints.gridx = 1;
2777
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2778
+// bigThree.add(centralPanel, aWindowConstraints);
2779
+// aWindowConstraints.weightx = 0;
2780
+// aWindowConstraints.gridx = 4;
2781
+// aWindowConstraints.gridwidth = 1;
2782
+// // aConstraints.gridheight = 3;
2783
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2784
+// //bigThree.add(XYZPanel, aWindowConstraints);
2785
+// scenePanel.setVisible(false);
2786
+// centralPanel.setVisible(true);
2787
+// XYZPanel.setVisible(false);
2788
+ bigThree.ClearUI();
2789
+ bigThree.add(centralPanel);
2790
+ bigThree.FlushUI();
25512791 } else
2552
- if (event.getSource() == threeButton)
2792
+ if (source == threeButton)
25532793 {
25542794 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();
2795
+
2796
+// bigThree.remove(scenePanel);
2797
+// bigThree.remove(centralPanel);
2798
+// bigThree.remove(XYZPanel);
2799
+// aWindowConstraints.gridx = 0;
2800
+// aWindowConstraints.gridy = 0;
2801
+// aWindowConstraints.gridwidth = 1;
2802
+// // aConstraints.gridheight = 3;
2803
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2804
+// aWindowConstraints.weightx = 0;
2805
+// aWindowConstraints.weighty = 1;
2806
+// //bigThree.add(jtp, aWindowConstraints);
2807
+// aWindowConstraints.weightx = 1;
2808
+// aWindowConstraints.gridwidth = 3;
2809
+// // aConstraints.gridheight = 3;
2810
+// aWindowConstraints.gridx = 1;
2811
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2812
+// bigThree.add(centralPanel, aWindowConstraints);
2813
+// aWindowConstraints.weightx = 0;
2814
+// aWindowConstraints.gridx = 4;
2815
+// aWindowConstraints.gridwidth = 1;
2816
+// // aConstraints.gridheight = 3;
2817
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2818
+// bigThree.add(XYZPanel, aWindowConstraints);
2819
+// bigThree.validate();
2820
+// scenePanel.setVisible(false);
2821
+// centralPanel.setVisible(true);
2822
+// XYZPanel.setVisible(true);
2823
+ bigThree.ClearUI();
2824
+ bigThree.add(centralPanel);
2825
+ bigThree.add(XYZPanel);
2826
+ bigThree.FlushUI();
25792827 } else
2580
- if (event.getSource() == fourButton)
2828
+ if (source == fourButton)
25812829 {
25822830 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();
2831
+
2832
+// bigThree.remove(scenePanel);
2833
+// bigThree.remove(centralPanel);
2834
+// bigThree.remove(XYZPanel);
2835
+// aWindowConstraints.gridx = 0;
2836
+// aWindowConstraints.gridy = 0;
2837
+// aWindowConstraints.gridwidth = 1;
2838
+// // aWindowConstraints.gridheight = 3;
2839
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2840
+// aWindowConstraints.weightx = 1;
2841
+// aWindowConstraints.weighty = 1;
2842
+// bigThree.add(scenePanel, aWindowConstraints);
2843
+// aWindowConstraints.weightx = 1;
2844
+// aWindowConstraints.gridwidth = 3;
2845
+// // aConstraints.gridheight = 3;
2846
+// aWindowConstraints.gridx = 1;
2847
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2848
+// //bigThree.add(cameraPanel, aWindowConstraints);
2849
+// aWindowConstraints.weightx = 0;
2850
+// aWindowConstraints.gridx = 4;
2851
+// aWindowConstraints.gridwidth = 1;
2852
+// // aWindowConstraints.gridheight = 3;
2853
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2854
+// //bigThree.add(XYZPanel, aWindowConstraints);
2855
+// bigThree.validate();
2856
+// scenePanel.setVisible(true);
2857
+// centralPanel.setVisible(false);
2858
+// XYZPanel.setVisible(false);
2859
+ bigThree.ClearUI();
2860
+ bigThree.add(scenePanel);
2861
+ bigThree.FlushUI();
26072862 } else
2608
- if (event.getSource() == sixButton)
2863
+ if (source == sixButton)
26092864 {
26102865 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();
2866
+
2867
+// bigThree.remove(scenePanel);
2868
+// bigThree.remove(centralPanel);
2869
+// bigThree.remove(XYZPanel);
2870
+// aWindowConstraints.gridx = 0;
2871
+// aWindowConstraints.gridy = 0;
2872
+// aWindowConstraints.gridwidth = 1;
2873
+// // aConstraints.gridheight = 3;
2874
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2875
+// aWindowConstraints.weightx = 0;
2876
+// aWindowConstraints.weighty = 1;
2877
+// bigThree.add(scenePanel, aWindowConstraints);
2878
+// aWindowConstraints.weightx = 1;
2879
+// aWindowConstraints.gridwidth = 3;
2880
+// // aWindowConstraints.gridheight = 3;
2881
+// aWindowConstraints.gridx = 1;
2882
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2883
+// bigThree.add(centralPanel, aWindowConstraints);
2884
+// aWindowConstraints.weightx = 0;
2885
+// aWindowConstraints.gridx = 4;
2886
+// aWindowConstraints.gridwidth = 1;
2887
+// // aWindowConstraints.gridheight = 3;
2888
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2889
+// //bigThree.add(XYZPanel, aConstraints);
2890
+// bigThree.validate();
2891
+// scenePanel.setVisible(true);
2892
+// centralPanel.setVisible(true);
2893
+// XYZPanel.setVisible(false);
2894
+ bigThree.ClearUI();
2895
+ bigThree.add(scenePanel);
2896
+ bigThree.add(centralPanel);
2897
+ bigThree.FlushUI();
26352898 } else
2636
- if (event.getSource() == sevenButton)
2899
+ if (source == sevenButton)
26372900 {
26382901 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();
2902
+
2903
+// bigThree.remove(scenePanel);
2904
+// bigThree.remove(centralPanel);
2905
+// bigThree.remove(XYZPanel);
2906
+// aWindowConstraints.gridx = 0;
2907
+// aWindowConstraints.gridy = 0;
2908
+// aWindowConstraints.gridwidth = 1;
2909
+// // aWindowConstraints.gridheight = 3;
2910
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2911
+// aWindowConstraints.weightx = 0;
2912
+// aWindowConstraints.weighty = 1;
2913
+// bigThree.add(scenePanel, aWindowConstraints);
2914
+// aWindowConstraints.weightx = 1;
2915
+// aWindowConstraints.gridwidth = 3;
2916
+// // aWindowConstraints.gridheight = 3;
2917
+// aWindowConstraints.gridx = 1;
2918
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2919
+// bigThree.add(centralPanel, aWindowConstraints);
2920
+// aWindowConstraints.weightx = 0;
2921
+// aWindowConstraints.gridx = 4;
2922
+// aWindowConstraints.gridwidth = 1;
2923
+// // aConstraints.gridheight = 3;
2924
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2925
+// bigThree.add(XYZPanel, aWindowConstraints);
2926
+// bigThree.validate();
2927
+// scenePanel.setVisible(true);
2928
+// centralPanel.setVisible(true);
2929
+// XYZPanel.setVisible(true);
2930
+ bigThree.ClearUI();
2931
+ bigThree.add(scenePanel);
2932
+ bigThree.add(centralPanel);
2933
+ bigThree.add(XYZPanel);
2934
+ bigThree.FlushUI();
26632935 } else
2664
- if (event.getSource() == rootButton)
2936
+ if (source == rootButton)
26652937 {
26662938 Object3D obj;
26672939 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2673,7 +2945,7 @@
26732945
26742946 refreshContents(true);
26752947 } else
2676
- if (event.getSource() == closeButton)
2948
+ if (source == closeButton)
26772949 {
26782950 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26792951 cRadio ab;
....@@ -2694,11 +2966,11 @@
26942966 }
26952967 refreshContents(true);
26962968 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
2969
+ if (source == editItem || source == editButton)
26982970 {
26992971 EditSelection(false);
27002972 } else
2701
- if (event.getSource() == uneditButton)
2973
+ if (source == uneditButton)
27022974 {
27032975 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27042976 {
....@@ -2710,12 +2982,12 @@
27102982
27112983 child.editWindow = null; // ???????????
27122984 }
2713
- objEditor.ctrlPanel.revalidate();
2985
+ objEditor.ctrlPanel.FlushUI();
27142986 //objEditor.jTree.clearSelection();
27152987 //objEditor.ResetSliders();
27162988 refreshContents(true);
27172989 } else
2718
- if (event.getSource() == clearPanelButton)
2990
+ if (source == clearPanelButton)
27192991 {
27202992 assert(copy == group);
27212993 //copy.ClearUI();
....@@ -2726,7 +2998,7 @@
27262998 listUI.clear();
27272999 refreshContents(true);
27283000 } else
2729
- if (event.getSource() == allParamsButton)
3001
+ if (source == allParamsButton)
27303002 {
27313003 assert(copy == group);
27323004
....@@ -2747,19 +3019,19 @@
27473019
27483020 refreshContents(true);
27493021 } else
2750
- if (event.getSource() == unselectButton)
3022
+ if (source == unselectButton)
27513023 {
27523024 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3025
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543026 objEditor.ResetSliders();
27553027 refreshContents(true);
27563028 } else
2757
- if(event.getSource() instanceof cRadio)
3029
+ if(source instanceof cRadio)
27583030 {
27593031 group.parent = keepparent;
27603032 group.attributes = 0;
27613033 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3034
+ /*cRadio*/ radio = (cRadio)source;
27633035 Object3D obj = radio.GetObject();
27643036 System.out.println("Edit " + obj);
27653037 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +3051,7 @@
27793051 }
27803052
27813053 copy = group;
2782
- //CameraPane.theRenderer.object = group;
3054
+ //Globals.theRenderer.object = group;
27833055 if(!useclient)
27843056 {
27853057 cameraView.renderCamera = radio.camera;
....@@ -2788,7 +3060,8 @@
27883060 cameraView.cameras[cameraView.cameracount] = radio.camera;
27893061 cameraView.targetLookAt.set(radio.camera.lookAt);
27903062 cameraView.object = group;
2791
- cameraView.lighttouched = true;
3063
+ //cameraView.lighttouched = true;
3064
+ Globals.lighttouched = true;
27923065 topView.object = group;
27933066 frontView.object = group;
27943067 sideView.object = group;
....@@ -2824,7 +3097,7 @@
28243097 if (useclient)
28253098 {
28263099 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3100
+ Globals.lighttouched = true;
28283101 //topView.object = client;
28293102 //frontView.object = client;
28303103 //sideView.object = client;
....@@ -2832,7 +3105,7 @@
28323105 else
28333106 {
28343107 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3108
+ Globals.lighttouched = true;
28363109 //topView.object = group;
28373110 //frontView.object = group;
28383111 //sideView.object = group;
....@@ -3065,9 +3338,9 @@
30653338 obj = (Object3D)e.nextElement();
30663339
30673340 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3341
+ GrafreeD.AnalyzeObject(obj);
30693342 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3343
+ GrafreeD.AnalyzeObject(obj.bRep);
30713344
30723345 // System.err.println((size/1024) + " KB is the size of " + obj);
30733346 }
....@@ -3109,6 +3382,13 @@
31093382 void GenNormals(boolean crease)
31103383 {
31113384 group.GenNormalsS(crease);
3385
+
3386
+ refreshContents();
3387
+ }
3388
+
3389
+ void GenNormalsMINE()
3390
+ {
3391
+ group.selection.GenNormalsMINE();
31123392
31133393 refreshContents();
31143394 }
....@@ -3157,104 +3437,250 @@
31573437
31583438 //Object3D buffer;
31593439 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
-
3440
+// BoundaryRep temprep;
3441
+// Object3D nodes;
3442
+// Vector<Vertex> vertices;
3443
+//
3444
+// cGroup buffer;
3445
+//
3446
+// public void Vertex(Object3D node, Vertex v)
3447
+// {
3448
+//// vertices.add(v);
3449
+//// nodes.addElement(node);
3450
+////
3451
+//// if (temprep.GetCache(v) != null)
3452
+//// {
3453
+//// temprep.Remove(v);
3454
+//// } else
3455
+//// {
3456
+//// temprep.Remember(v);
3457
+//// }
3458
+//
3459
+// //Object3D node = nodes.get(index);
3460
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3461
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3462
+//
3463
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3464
+//
3465
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3466
+//
3467
+// cGroup g = new cGroup();
3468
+//
3469
+// if (g.toParent == null)
3470
+// {
3471
+// g.toParent = LA.newMatrix();
3472
+// g.fromParent = LA.newMatrix();
3473
+// }
3474
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3475
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3476
+//
3477
+// g.add(GrafreeD.clipboard);
3478
+//
3479
+// buffer.add(g);
3480
+// }
3481
+//
3482
+// public void Face(Object3D node, Face f)
3483
+// {
3484
+//
3485
+// }
3486
+//
3487
+// void ParseVerticesOld() // ??
3488
+// {
3489
+// //if (group.selection.size() != 1)
3490
+// // return;
3491
+//
3492
+// temprep = new BoundaryRep();
3493
+// nodes = new Object3D();
3494
+// vertices = new Vector<Vertex>();
3495
+//
3496
+// boolean epsequal = GrafreeD.epsequal;
3497
+// GrafreeD.epsequal = true;
3498
+//
3499
+// for (int i=0; i<group.selection.size(); i++)
3500
+// {
3501
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3502
+//
3503
+// group.selection.get(i).Parse(
3504
+//this );
3505
+//
3506
+// int repsize = temprep.VertexCount();
3507
+// int tablesize = temprep.vertextable.size();
3508
+// int nodesize = nodes.size();
3509
+//
3510
+// assert(vertices.size() == nodes.size());
3511
+//
3512
+// temprep.vertextable.elements();
3513
+//
3514
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3515
+//
3516
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3517
+// {
3518
+// cGroup g = new cGroup();
3519
+//
3520
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3521
+//
3522
+// Object3D node = nodes.get(index);
3523
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3524
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3525
+//
3526
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3527
+//
3528
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3529
+//
3530
+// if (g.toParent == null)
3531
+// {
3532
+// g.toParent = LA.newMatrix();
3533
+// g.fromParent = LA.newMatrix();
3534
+// }
3535
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3536
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3537
+//
3538
+// g.add(GrafreeD.clipboard);
3539
+//
3540
+// buffer.add(g);
3541
+// }
3542
+//
3543
+// makeSomething(buffer, i==group.selection.size()-1);
3544
+// }
3545
+//
3546
+// GrafreeD.epsequal = epsequal;
3547
+//
3548
+// //buffer = null;
3549
+// temprep = null;
3550
+// nodes = null;
3551
+//
3552
+// refreshContents();
3553
+// }
3554
+
31843555 void ParseVertices()
31853556 {
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;
3557
+ boolean epsequal = GrafreeD.epsequal;
3558
+ GrafreeD.epsequal = true;
31953559
31963560 for (int i=0; i<group.selection.size(); i++)
31973561 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3562
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993563
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3564
+ group.selection.get(i).Parse(
3565
+
3566
+ new iParse()
3567
+ {
3568
+ public void Vertex(Object3D node, Vertex v)
3569
+ {
3570
+ temp.set(v);
3571
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053572
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();
3573
+ cGroup g = new cGroup();
32113574
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3575
+ if (g.toParent == null)
3576
+ {
3577
+ g.toParent = LA.newMatrix();
3578
+ g.fromParent = LA.newMatrix();
3579
+ }
3580
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3581
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153582
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);
3583
+ g.add(GrafreeD.clipboard);
32203584
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);
3585
+ buffer.add(g);
3586
+ }
32323587
3233
- g.add(GraphreeD.clipboard);
3588
+ public void Face(Object3D node, Face f)
3589
+ {
32343590
3235
- buffer.add(g);
3236
- }
3591
+ }
3592
+ }
3593
+ );
32373594
32383595 makeSomething(buffer, i==group.selection.size()-1);
32393596 }
32403597
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3598
+ GrafreeD.epsequal = epsequal;
32463599
32473600 refreshContents();
32483601 }
3249
-
3602
+
3603
+ void TextureVertices()
3604
+ {
3605
+ for (int i=0; i<group.selection.size(); i++)
3606
+ {
3607
+ group.selection.get(i).Parse(
3608
+ new iParse()
3609
+ {
3610
+ public void Vertex(Object3D node, Vertex v)
3611
+ {
3612
+ cTexture tex = node.GetTextures();
3613
+ String pigment = Object3D.GetPigment(tex);
3614
+ //String bump = Object3D.GetBump(tex);
3615
+
3616
+ com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3617
+
3618
+ double s = v.s;
3619
+
3620
+ if (s == 1)
3621
+ s = 0;
3622
+
3623
+ double t = v.t;
3624
+
3625
+ if (t == 1)
3626
+ t = 0;
3627
+
3628
+ int indexs = (int) (texturedata.getWidth() * s);
3629
+ int indext = (int) (texturedata.getHeight() * t);
3630
+
3631
+ int index = indext * texturedata.getWidth() + indexs;
3632
+
3633
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3634
+
3635
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3636
+
3637
+ float scale = bytebuf.get(index*slide) & 0xFF;
3638
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3639
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3640
+ scale /= 3;
3641
+
3642
+ scale /= 0xFF;
3643
+ // c'est quoi ca? scale /= 4;
3644
+
3645
+ //v.AO = scale;
3646
+
3647
+ v.x += v.norm.x * scale;
3648
+ v.y += v.norm.y * scale;
3649
+ v.z += v.norm.z * scale;
3650
+ }
3651
+
3652
+ public void Face(Object3D node, Face f)
3653
+ {
3654
+ }
3655
+ }
3656
+ );
3657
+ }
3658
+
3659
+ refreshContents();
3660
+ }
3661
+
32503662 void Align()
32513663 {
3664
+ if (group.selection.size() == 0)
3665
+ return;
3666
+
3667
+ cVector bbmin = new cVector();
3668
+ cVector bbmax = new cVector();
3669
+
3670
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3671
+
3672
+ double dx = bbmax.x - bbmin.x;
3673
+ double dy = bbmax.y - bbmin.y;
3674
+ double dz = bbmax.z - bbmin.z;
3675
+
3676
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3677
+
32523678 for (int i=0; i<group.selection.size(); i++)
32533679 {
32543680 Object3D obj = group.selection.get(i);
32553681
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3682
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3683
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583684 }
32593685
32603686 refreshContents();
....@@ -3267,7 +3693,7 @@
32673693 // ref.SaveSupports();
32683694 // Object3D par = ref.parent;
32693695 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3696
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713697 // ref.parent = par;
32723698 // ref.RestoreSupports();
32733699
....@@ -3275,11 +3701,11 @@
32753701
32763702 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32773703
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
3704
+ boolean random = CameraPane.SWITCH;
3705
+ CameraPane.SWITCH = false; // parse all random nodes
32803706 lowres.linkVerticesThis(null);
32813707 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
3708
+ CameraPane.SWITCH = random;
32833709
32843710 System.err.flush();
32853711
....@@ -3297,7 +3723,7 @@
32973723 // lowres.SaveSupports();
32983724 // par = lowres.parent;
32993725 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3726
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013727 Object3D newlow = CloneObject(lowres, false);
33023728 newlow.name = sn.switchobject.get(i).name;
33033729 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3745,7 @@
33193745 return;
33203746
33213747 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3748
+ Object3D ref = GrafreeD.clipboard.get(0);
33233749
33243750 Object3D newgroup = new Object3D("Po:" + poses.name);
33253751
....@@ -3488,7 +3914,7 @@
34883914 group.selection.RelinkToSupport(); // july 2014
34893915 System.out.println("DONE.");
34903916 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3917
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34923918 }
34933919
34943920 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +3939,20 @@
35133939
35143940 void ClipMesh()
35153941 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3942
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
35173943 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3944
+ Object3D content = GrafreeD.clipboard.get(0);
35193945
35203946 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213947 content = ((cGroup)content).get(0);
35223948
35233949 // for (int i=0; i<group.selection.size(); i++)
35243950 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3951
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35263952 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
3953
+ group.selection.ClipMesh(GrafreeD.clipboard);
35283954 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
3955
+// group.selection.ClipMesh(GrafreeD.clipboard);
35303956 System.out.println("DONE.");
35313957 refreshContents();
35323958 }
....@@ -3764,25 +4190,25 @@
37644190 System.err.println("info : " + child.GetPath());
37654191 }
37664192 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
4193
+// else
4194
+// {
4195
+// objEditor.SetMaterial(group); // .GetMaterial());
4196
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4197
+// System.err.println("info : " + group.GetPath());
4198
+// }
37734199
37744200 objEditor.SetText(); // jan 2014
37754201
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4202
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
37774203 CameraPane.flash = true;
37784204
37794205 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
37804206 // a camera
37814207 {
37824208 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;
4209
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4210
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4211
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864212 }
37874213
37884214 refreshContents();
....@@ -3864,12 +4290,12 @@
38644290 {
38654291 if (group.selection.isEmpty())
38664292 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4293
+ GrafreeD.clipboardIsTempGroup = false;
38684294 Composite tGroup = null;
38694295 if (group.selection.size() > 0) // 1)
38704296 {
38714297 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4298
+ GrafreeD.clipboardIsTempGroup = true;
38734299 }
38744300
38754301 if (cut)
....@@ -3909,16 +4335,16 @@
39094335 //System.out.println("cut " + child);
39104336 //System.out.println("parent = " + child.parent);
39114337 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4338
+ if (GrafreeD.clipboardIsTempGroup)
39134339 tGroup.add/*Child*/(tmp);
39144340 else
3915
- GraphreeD.clipboard = tmp;
4341
+ GrafreeD.clipboard = tmp;
39164342 }
39174343 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4344
+ if (GrafreeD.clipboardIsTempGroup)
39194345 tGroup.add/*Child*/(child);
39204346 else
3921
- GraphreeD.clipboard = child;
4347
+ GrafreeD.clipboard = child;
39224348 }
39234349
39244350 //ResetModel();
....@@ -3950,21 +4376,21 @@
39504376 //System.out.println("cut " + elem);
39514377 //System.out.println("parent = " + elem.parent);
39524378 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4379
+ if (GrafreeD.clipboardIsTempGroup)
39544380 tGroup.add/*Child*/(tmp);
39554381 else
3956
- GraphreeD.clipboard = tmp;
4382
+ GrafreeD.clipboard = tmp;
39574383 }
39584384 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4385
+ if (GrafreeD.clipboardIsTempGroup)
39604386 tGroup.add/*Child*/(child);
39614387 else
3962
- GraphreeD.clipboard = child;
4388
+ GrafreeD.clipboard = child;
39634389 }
39644390
39654391 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4392
+ if (GrafreeD.clipboardIsTempGroup)
4393
+ GrafreeD.clipboard = tGroup;
39684394 if (cut)
39694395 {
39704396 ResetModel();
....@@ -3974,11 +4400,11 @@
39744400
39754401 void paste(boolean expand)
39764402 {
3977
- // if (GraphreeD.clipboard == null)
4403
+ // if (GrafreeD.clipboard == null)
39784404 // return;
39794405 boolean first = true;
39804406
3981
- if (GraphreeD.clipboardIsTempGroup)
4407
+ if (GrafreeD.clipboardIsTempGroup)
39824408 {
39834409 Composite temp;
39844410
....@@ -3989,7 +4415,7 @@
39894415 temp = (Composite)Applet3D.clipboard.deepCopy();
39904416 */
39914417 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4418
+ for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934419 {
39944420 Object3D child = (Object3D)e.nextElement();
39954421
....@@ -4003,7 +4429,7 @@
40034429 else
40044430 elem = child.deepCopy(); // ?
40054431 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4432
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074433 // elem = elem.get(0);
40084434 makeSomething(elem, true); // ?? first);
40094435 //group.addChild(elem);
....@@ -4023,23 +4449,23 @@
40234449 //Object3D cb = Applet3D.clipboard;
40244450 //temp.addChild(cb);
40254451 //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());
4452
+ assert(GrafreeD.clipboard.parent == null);
4453
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4454
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4455
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
4456
+ makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
40314457 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4458
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4459
+ GrafreeD.clipboard.get(0).parent = keepparent;
40344460 }
40354461
40364462 ResetModel();
40374463 refreshContents();
40384464 }
40394465
4040
- void pasteInto(boolean copyit)
4466
+ void pasteInto(boolean copyit, boolean clone)
40414467 {
4042
-// if (GraphreeD.clipboard == null)
4468
+// if (GrafreeD.clipboard == null)
40434469 // return;
40444470
40454471 if (group.selection.size() != 1)
....@@ -4066,15 +4492,22 @@
40664492 if (copyit)
40674493 {
40684494 // paste(false);
4069
- CloneClipboard(false); // sept 2014
4495
+ if (clone)
4496
+ {
4497
+ CloneClipboard(false); // sept 2014
4498
+ }
4499
+ else
4500
+ {
4501
+ paste(false);
4502
+ }
40704503 }
40714504 else
40724505 {
40734506 boolean first = true;
40744507
4075
- if (GraphreeD.clipboardIsTempGroup)
4508
+ if (GrafreeD.clipboardIsTempGroup)
40764509 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4510
+ Composite temp = (Composite)GrafreeD.clipboard;
40784511 Object3D copy;
40794512 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804513 {
....@@ -4084,7 +4517,7 @@
40844517 }
40854518 } else
40864519 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4520
+ linkSomething(GrafreeD.clipboard); //.get(0));
40884521 }
40894522 }
40904523 }
....@@ -4276,6 +4709,26 @@
42764709 makeSomething(csg);
42774710 }
42784711
4712
+ void Ungroup(Object3D g)
4713
+ {
4714
+ if (g instanceof HiddenObject)
4715
+ {
4716
+ HiddenObject h = (HiddenObject) g;
4717
+
4718
+ for (int i=0; i<h.ActualSize(); i++)
4719
+ {
4720
+ objEditor.makeSomething(h.get(i), false);
4721
+ }
4722
+ }
4723
+ else
4724
+ {
4725
+ for (int i=0; i<g.Size(); i++)
4726
+ {
4727
+ objEditor.makeSomething(g.get(i), false);
4728
+ }
4729
+ }
4730
+ }
4731
+
42794732 void ungroup()
42804733 {
42814734 /*
....@@ -4471,7 +4924,7 @@
44714924
44724925 void ImportGFD()
44734926 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4927
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754928 browser.show();
44764929 String filename = browser.getFile();
44774930 if (filename != null && filename.length() > 0)
....@@ -4509,7 +4962,7 @@
45094962
45104963 void ImportVRMLX3D()
45114964 {
4512
- if (GraphreeD.standAlone)
4965
+ if (GrafreeD.standAlone)
45134966 {
45144967 /**/
45154968 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +4979,7 @@
45264979
45274980 String GetFile(String dialogName)
45284981 {
4529
- if (GraphreeD.standAlone)
4982
+ if (GrafreeD.standAlone)
45304983 {
45314984 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45324985 browser.show();
....@@ -4590,10 +5043,12 @@
45905043 cButton flashSelectionButton;
45915044 cButton editButton;
45925045 cButton uneditButton;
5046
+ JCheckBox allParamsButton;
45935047 cButton clearpanelButton;
4594
- cButton allParamsButton;
45955048 cButton unselectButton;
45965049
5050
+ cButton oneStepButton;
5051
+
45975052 cButton screenfitButton;
45985053 cButton screenfitpointButton;
45995054 cButton snapobjectButton;
....@@ -4635,6 +5090,7 @@
46355090 private MenuItem resetsupportItem;
46365091 private MenuItem resetreferencesItem;
46375092 private MenuItem linkverticesItem;
5093
+ private MenuItem relinkverticesItem;
46385094 private MenuItem setMasterItem;
46395095 private MenuItem resetMeshItem;
46405096 private MenuItem stepAllItem;
....@@ -4647,14 +5103,17 @@
46475103 private MenuItem mergeGeometriesItem;
46485104 private MenuItem copyItem;
46495105 private MenuItem pasteItem;
5106
+ private MenuItem pasteIntoItem;
46505107 private MenuItem pasteLinkItem;
46515108 private MenuItem pasteCloneItem;
46525109 private MenuItem pasteExpandItem;
46535110 private MenuItem clearItem;
46545111 private MenuItem clearAllItem;
46555112 private MenuItem genUVItem;
5113
+ private MenuItem genNormalsMESHItem;
46565114 private MenuItem genNormalsCADItem;
46575115 private MenuItem genNormalsORGANItem;
5116
+ private MenuItem genNormalsMINEItem;
46585117 private MenuItem stripifyItem;
46595118 private MenuItem unstripifyItem;
46605119 private MenuItem trimItem;
....@@ -4696,6 +5155,7 @@
46965155 private MenuItem resetCentroidItem;
46975156 private MenuItem transformgeometryItem;
46985157 private MenuItem resetTransformItem;
5158
+ private MenuItem hideItem;
46995159 private MenuItem grabItem;
47005160 private MenuItem backItem;
47015161 private MenuItem frontItem;
....@@ -4716,6 +5176,7 @@
47165176
47175177 private MenuItem resetParentItem;
47185178 private MenuItem repairParentItem;
5179
+ private MenuItem repairShadowItem;
47195180 private MenuItem sortbysizeItem;
47205181 private MenuItem sortbynameItem;
47215182
....@@ -4728,16 +5189,19 @@
47285189 private MenuItem particleItem;
47295190 private MenuItem ragdollItem;
47305191 private MenuItem ragdoll2Item;
5192
+ private MenuItem heightFieldItem;
5193
+ private MenuItem textureFieldItem;
47315194 private MenuItem gridItem;
47325195 private MenuItem rectoidItem;
47335196 private MenuItem ellipsoidItem;
47345197 private MenuItem coneItem;
47355198 private MenuItem torusItem;
47365199 private MenuItem superItem;
5200
+ private MenuItem kleinItem;
47375201 private MenuItem blobItem;
47385202 private MenuItem latheItem;
47395203 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
5204
+ private MenuItem overlayItem;
47415205 private MenuItem meshItem;
47425206 // private MenuItem meshGroupItem;
47435207 private MenuItem springItem;
....@@ -4746,6 +5210,7 @@
47465210 private MenuItem csgItem;
47475211 private MenuItem templateItem;
47485212 private MenuItem textureItem;
5213
+ private MenuItem billboardItem;
47495214 private MenuItem shadowXItem;
47505215 private MenuItem shadowYItem;
47515216 private MenuItem shadowZItem;