Normand Briere
2019-05-01 25cef97465f0bfa8959663754e9243006324c81c
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
....@@ -188,8 +189,9 @@
188189 clearItem.addActionListener(this);
189190 clearAllItem = menu.add(new MenuItem("Clear All"));
190191 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
192
+
193
+ oe.menuBar.add(menu = new Menu("Setting"));
194
+ resetMeshItem = menu.add(new MenuItem("Reset All"));
193195 resetMeshItem.addActionListener(this);
194196 stepAllItem = menu.add(new MenuItem("Step All"));
195197 stepAllItem.addActionListener(this);
....@@ -218,18 +220,24 @@
218220 resetsupportItem.addActionListener(this);
219221 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220222 linkverticesItem.addActionListener(this);
223
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224
+ relinkverticesItem.addActionListener(this);
221225 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222226 setMasterItem.addActionListener(this);
223227
224
- oe.menuBar.add(menu = new Menu("Object"));
228
+ oe.menuBar.add(menu = new Menu("Group"));
225229 grabItem = menu.add(new MenuItem("Grab"));
226230 grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
229231 backItem = menu.add(new MenuItem("Back"));
230232 backItem.addActionListener(this);
233
+ frontItem = menu.add(new MenuItem("Front"));
234
+ frontItem.addActionListener(this);
231235 compositeItem = menu.add(new MenuItem("Composite"));
232236 compositeItem.addActionListener(this);
237
+ hideItem = menu.add(new MenuItem("Hide"));
238
+ hideItem.addActionListener(this);
239
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
240
+ ungroupItem.addActionListener(this);
233241 menu.add("-");
234242 randomItem = menu.add(new MenuItem("Random"));
235243 randomItem.addActionListener(this);
....@@ -247,9 +255,12 @@
247255 scriptNodeItem.addActionListener(this);
248256 cameraItem = menu.add(new MenuItem("Camera"));
249257 cameraItem.addActionListener(this);
250
- menu.add("-");
258
+
259
+ oe.menuBar.add(menu = new Menu("Object"));
251260 textureItem = menu.add(new MenuItem("Texture"));
252261 textureItem.addActionListener(this);
262
+ billboardItem = menu.add(new MenuItem("Billboard"));
263
+ billboardItem.addActionListener(this);
253264 csgItem = menu.add(new MenuItem("CSG"));
254265 csgItem.addActionListener(this);
255266 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -267,14 +278,12 @@
267278 pointflowItem = menu.add(new MenuItem("Point Flow"));
268279 pointflowItem.addActionListener(this);
269280 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272281 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273282 resetTransformItem.addActionListener(this);
274283 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275284 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
285
+ transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
+ transformgeometryItem.addActionListener(this);
278287
279288 oe.menuBar.add(menu = new Menu("Geometry"));
280289 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +292,10 @@
283292 genNormalsORGANItem.addActionListener(this);
284293 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285294 genNormalsCADItem.addActionListener(this);
295
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296
+ genNormalsMESHItem.addActionListener(this);
297
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
298
+ genNormalsMINEItem.addActionListener(this);
286299 stripifyItem = menu.add(new MenuItem("Stripify"));
287300 stripifyItem.addActionListener(this);
288301 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +305,6 @@
292305 untrimItem = menu.add(new MenuItem("Untrim"));
293306 untrimItem.addActionListener(this);
294307 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297308 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298309 clearColorsItem.addActionListener(this);
299310 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -310,6 +321,10 @@
310321 smoothMeshItem.addActionListener(this);
311322 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312323 clipMeshItem.addActionListener(this);
324
+
325
+ oe.menuBar.add(menu = new Menu("Attributes"));
326
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327
+ clearMaterialsItem.addActionListener(this);
313328 menu.add("-");
314329 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315330 liveleavesItem.addActionListener(this);
....@@ -332,27 +347,18 @@
332347 flipVItem.addActionListener(this);
333348 unflipVItem = menu.add(new MenuItem("Unflip V"));
334349 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
350
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336351 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
352
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338353 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
354
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340355 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
356
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342357 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
358
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344359 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
360
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346361 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);
356362
357363 oe.menuBar.add(menu = new Menu("Selection"));
358364 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,9 +376,31 @@
370376 sortbysizeItem.addActionListener(this);
371377 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372378 sortbynameItem.addActionListener(this);
379
+ menu.add("-");
380
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381
+ extractGeometriesItem.addActionListener(this);
382
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383
+ cloneGeometriesItem.addActionListener(this);
384
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
+ shareGeometriesItem.addActionListener(this);
386
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
+ mergeGeometriesItem.addActionListener(this);
388
+
373389 oe.menuBar.add(menu = new Menu("Insert"));
374390 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
391
+
392
+
393
+ oe.menuBar.add(menu = new Menu("Include"));
394
+ importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
+ importGFDItem.addActionListener(this);
396
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
+ importVRMLX3DItem.addActionListener(this);
398
+ importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
+ importOBJItem.addActionListener(this);
400
+ import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
+ import3DSItem.addActionListener(this);
402
+
403
+ oe.menuBar.add(menu = new Menu("Tools"));
376404 buildToolsMenu(menu);
377405 }
378406
....@@ -406,84 +434,26 @@
406434 oe.radioPanel.add(dummyButton);
407435 oe.buttonGroup.add(dummyButton);
408436 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
437
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
412438
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
439
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
440
+ liveCB.setToolTipText("Enabled animation");
414441 liveCB.addItemListener(this);
415442
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);
434
- 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);
443
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
444
+ trackCB.setToolTipText("Enable tracking");
476445 trackCB.addItemListener(this);
477446
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
447
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
448
+ screenfitButton.setToolTipText("Screen fit");
480449 screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
450
+
482451 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
483452 // screenfitpointButton.addActionListener(this);
484453 // oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
454
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
486455 snapobjectButton.addActionListener(this);
456
+ snapobjectButton.setToolTipText("Snap Object");
487457 oe.aConstraints.gridx += 1;
488458
489459 //aConstraints.gridx = 0;
....@@ -491,29 +461,35 @@
491461 oe.aConstraints.weighty = 0;
492462 oe.aConstraints.gridwidth = 1;
493463
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
464
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
465
+ flashSelectionButton.setToolTipText("Show selection");
495466 flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499467
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
468
+ oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469
+
470
+ oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
471
+ twoButton.setToolTipText("Show center view only");
502472 twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
473
+ oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504474 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
475
+ fourButton.setToolTipText("Show left panel only");
476
+ oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
477
+ sixButton.setToolTipText("2-column layout left");
506478 sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
479
+ oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
480
+ threeButton.setToolTipText("2-column layout right");
508481 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
482
+ oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
483
+ sevenButton.setToolTipText("3-column layout");
510484 sevenButton.addActionListener(this);
511485 //
512486
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
487
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
488
+ rootButton.setToolTipText("Edit object in new tab");
514489 rootButton.addActionListener(this);
515490 oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
491
+ oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
492
+ closeButton.setToolTipText("Close tab");
517493 closeButton.addActionListener(this);
518494 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519495 //clearButton.addActionListener(this);
....@@ -616,17 +592,91 @@
616592 radio.layout = sevenButton;
617593 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618594 }
595
+
596
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
597
+ {
598
+ //constraints.gridx = 0;
599
+ //constraints.gridy = 0;
600
+ panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
601
+ fastCB.setToolTipText("Fast mode");
602
+ fastCB.addItemListener(this);
603
+ //constraints.gridy += 1;
604
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
605
+ supportCB.setToolTipText("Enabled rigging");
606
+ supportCB.addItemListener(this);
607
+
608
+ // constraints.gridy += 1;
609
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
610
+ // localCB.addItemListener(this);
611
+
612
+ //constraints.gridy += 1;
613
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
614
+ crowdCB.setToolTipText("Used for crowds");
615
+ crowdCB.addItemListener(this);
616
+
617
+ //constraints.gridy += 1;
618
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
619
+ smoothCB.setToolTipText("Snapping delay");
620
+ smoothCB.addItemListener(this);
621
+
622
+ //constraints.gridy += 1;
623
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
624
+ slowCB.setToolTipText("Smooth interpolation");
625
+ slowCB.addItemListener(this);
626
+ //constraints.gridy += 1;
627
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
628
+ boxCB.setToolTipText("Display bounding boxes");
629
+ boxCB.addItemListener(this);
630
+ //constraints.gridy += 1;
631
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
632
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
633
+ zoomBoxCB.addItemListener(this);
634
+
635
+// constraints.gridy += 1;
636
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
637
+// speakerMocapCB.addItemListener(this);
638
+
639
+ if (false)
640
+ {
641
+ // handled in scripts
642
+ //constraints.gridy += 1;
643
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
644
+ speakerCameraCB.addItemListener(this);
645
+
646
+ //constraints.gridy += 1;
647
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
648
+ speakerFocusCB.addItemListener(this);
649
+
650
+ //constraints.gridy += 1;
651
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
652
+ smoothfocusCB.addItemListener(this);
653
+ }
654
+
655
+//constraints.gridx += 1;
656
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
657
+// debugCB.addItemListener(this);
658
+
659
+ //constraints.gridy += 1;
660
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
661
+ oeilCB.addItemListener(this);
662
+
663
+ //constraints.gridy += 1;
664
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
665
+ lookAtCB.setToolTipText("Look-at target");
666
+ lookAtCB.addItemListener(this);
667
+
668
+ }
619669
620670 void EditObject(Object3D obj)
621671 {
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();
672
+ cRadio radioButton = new cRadio(obj.name);
673
+ radioButton.SetObject(obj);
674
+ radioButton.layout = sevenButton;
675
+ radioButton.SetCamera(cameraView.renderCamera, false);
676
+ radioButton.addActionListener(this);
677
+ radioPanel.add(radioButton);
678
+ buttonGroup.add(radioButton);
679
+ radioButton.doClick();
630680 }
631681 void SetupViews(ObjEditor oe)
632682 {
....@@ -646,6 +696,7 @@
646696 JCheckBox fastCB;
647697 JCheckBox slowCB;
648698 JCheckBox boxCB;
699
+ JCheckBox zoomBoxCB;
649700 JCheckBox trackCB;
650701 JCheckBox smoothfocusCB;
651702 // JCheckBox speakerMocapCB;
....@@ -688,8 +739,7 @@
688739 dropAttributes |= Object3D.TEXTURE;
689740 else
690741 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
742
+ } else if(e.getSource() == liveCB)
693743 {
694744 cameraView.ToggleLive();
695745 }
....@@ -726,6 +776,10 @@
726776 Recompile();
727777 cameraView.repaint();
728778 // refreshContents();
779
+ }
780
+ else if(e.getSource() == zoomBoxCB)
781
+ {
782
+ cameraView.ToggleZoomBoxMode();
729783 }
730784 else if(e.getSource() == smoothfocusCB)
731785 {
....@@ -1002,6 +1056,8 @@
10021056
10031057 void buildCreateMenu(Menu menu)
10041058 {
1059
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1060
+ //heightFieldItem.addActionListener(this);
10051061 gridItem = menu.add(new MenuItem("Grid"));
10061062 gridItem.addActionListener(this);
10071063 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,6 +1070,8 @@
10141070 torusItem.addActionListener(this);
10151071 superItem = menu.add(new MenuItem("Superellipsoid"));
10161072 superItem.addActionListener(this);
1073
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1074
+ kleinItem.addActionListener(this);
10171075 particleItem = menu.add(new MenuItem("Particle system"));
10181076 particleItem.addActionListener(this);
10191077 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1048,15 +1106,6 @@
10481106 doubleItem.addActionListener(this);
10491107 tripleItem = menu.add(new MenuItem("Trident"));
10501108 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);
10601109 }
10611110
10621111 void buildToolsMenu(Menu menu)
....@@ -1068,6 +1117,8 @@
10681117 menu.add("-");
10691118 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701119 parseverticesItem.addActionListener(this);
1120
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1121
+ textureFieldItem.addActionListener(this);
10711122 alignItem = menu.add(new MenuItem("Align"));
10721123 alignItem.addActionListener(this);
10731124 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
....@@ -1094,6 +1145,8 @@
10941145 resetParentItem.addActionListener(this);
10951146 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961147 repairParentItem.addActionListener(this);
1148
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1149
+ repairShadowItem.addActionListener(this);
10971150 menu.add(invariantsItem = new MenuItem("Invariants"));
10981151 invariantsItem.addActionListener(this);
10991152 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1429,9 +1482,9 @@
14291482
14301483 void Overwrite(int mask)
14311484 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1485
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14331486 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1487
+ Object3D content = GrafreeD.clipboard.get(0);
14351488
14361489 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371490 content = ((cGroup)content).get(0);
....@@ -1454,6 +1507,7 @@
14541507 //
14551508 public void actionPerformed(ActionEvent event) // , Object arg)
14561509 {
1510
+ Object source = event.getSource();
14571511 /*
14581512 if (event.getSource() == nameField)
14591513 {
....@@ -1465,11 +1519,11 @@
14651519 }
14661520 else
14671521 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1522
+ if (source == lookAtItem || source == lookFromItem)
14691523 {
14701524 ScreenFit();
14711525 } else
1472
- if (event.getSource() == switchItem)
1526
+ if (source == switchItem)
14731527 {
14741528 cVector v1 = new cVector();
14751529 cVector v2 = new cVector();
....@@ -1478,11 +1532,11 @@
14781532 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791533 objEditor.cameraView.repaint();
14801534 } else
1481
- if (event.getSource() == rectoidItem)
1535
+ if (source == rectoidItem)
14821536 {
14831537 makeSomething(new Box());
14841538 } else
1485
- if (event.getSource() == particleItem)
1539
+ if (source == particleItem)
14861540 {
14871541 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881542 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1557,9 @@
15031557 applyExample(particleGeom, "SMOKE");
15041558 makeSomething(particleGeom);
15051559 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1560
+ if (source == ragdollItem || source == ragdoll2Item)
15071561 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1562
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091563
15101564 ragdoll.toParent = LA.newMatrix();
15111565 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1575,71 @@
15211575 makeSomething(ragdoll);
15221576 //makeSomething(new VehicleDemo());
15231577 } else
1524
- if (event.getSource() == gridItem)
1578
+ /*
1579
+ */
1580
+ if (source == heightFieldItem)
1581
+ {
1582
+ Object3D obj = new Object3D();
1583
+
1584
+ obj.CreateMaterial();
1585
+ obj.bRep = new BoundaryRep();
1586
+
1587
+ obj.bRep.CreateMesh(new iHeightField()
1588
+ {
1589
+ public double f(double x, double y)
1590
+ {
1591
+ // The Mandelbrot set is represented by coloring
1592
+ // each point (x,y) according to the number of
1593
+ // iterations it takes before the while loop in
1594
+ // this method ends. For points that are actually
1595
+ // in the Mandelbrot set, or very close to it, the
1596
+ // count will reach the maximum value, 80. These
1597
+ // points will be colored purple. All other colors
1598
+ // represent points that are definitely NOT in the set.
1599
+ x -= 600;
1600
+ y -= 500;
1601
+ x /= 200;
1602
+ y /= 200;
1603
+ int count = 0;
1604
+ double zx = x;
1605
+ double zy = y;
1606
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1607
+ double new_zx = zx*zx - zy*zy + x;
1608
+ zy = 2*zx*zy + y;
1609
+ zx = new_zx;
1610
+ count++;
1611
+ }
1612
+ return count; // Math.sqrt(count);
1613
+ }
1614
+ }, 1000,1000);
1615
+
1616
+ makeSomething(obj);
1617
+ } else
1618
+ if (source == gridItem)
15251619 {
15261620 makeSomething(new Grid());
15271621 } else
1528
- if (event.getSource() == ellipsoidItem)
1622
+ if (source == ellipsoidItem)
15291623 {
15301624 makeSomething(new Sphere());
15311625 } else
1532
- if (event.getSource() == coneItem)
1626
+ if (source == coneItem)
15331627 {
15341628 makeSomething(new Cone());
15351629 } else
1536
- if (event.getSource() == torusItem)
1630
+ if (source == torusItem)
15371631 {
15381632 makeSomething(new Torus());
15391633 } else
1540
- if (event.getSource() == superItem)
1634
+ if (source == superItem)
15411635 {
15421636 makeSomething(new Superellipsoid());
15431637 } else
1544
- if (event.getSource() == blobItem)
1638
+ if (source == kleinItem)
1639
+ {
1640
+ makeSomething(new Klein());
1641
+ } else
1642
+ if (source == blobItem)
15451643 {
15461644 Blob blob = new Blob();
15471645 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1647,15 @@
15491647 //blob.retile();
15501648 makeSomething(blob);
15511649 } else
1552
- if (event.getSource() == latheItem)
1650
+ if (source == latheItem)
15531651 {
15541652 makeSomething(new Lathe());
15551653 } else
1556
- if (event.getSource() == bezierItem)
1654
+ if (source == bezierItem)
15571655 {
15581656 makeSomething(new BezierSurface());
15591657 } else
1560
- if (event.getSource() == checkerItem)
1658
+ if (source == checkerItem)
15611659 {
15621660 /*
15631661 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1668,9 @@
15701668 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711669 LA.matInvert(obj.toParent, obj.fromParent);
15721670 */
1573
- makeSomething(new CheckerIG());
1671
+ makeSomething(new Checker());
15741672 } else
1575
- if (event.getSource() == meshItem)
1673
+ if (source == meshItem)
15761674 {
15771675 Object3D itemtomake = new Object3D();
15781676 Object3D child;
....@@ -1593,35 +1691,35 @@
15931691 makeSomething(child);
15941692 }
15951693 } else
1596
- if (event.getSource() == springItem)
1694
+ if (source == springItem)
15971695 {
15981696 cSpring s = new cSpring();
15991697 s.setup();
16001698 makeSomething(s);
16011699 } else
1602
- if (event.getSource() == flagItem)
1700
+ if (source == flagItem)
16031701 {
16041702 cSpring s = new cFlag();
16051703 s.setup();
16061704 makeSomething(s);
16071705 } else
1608
- if (event.getSource() == lightItem)
1706
+ if (source == lightItem)
16091707 {
16101708 makeSomething(new Light());
16111709 } else
1612
- if (event.getSource() == csgItem)
1710
+ if (source == csgItem)
16131711 {
16141712 group(new CSG());
16151713 } else
1616
- if (event.getSource() == templateItem)
1714
+ if (source == templateItem)
16171715 {
16181716 group(new cTemplate());
16191717 } else
1620
- if (event.getSource() == attributeItem)
1718
+ if (source == attributeItem)
16211719 {
16221720 makeSomething(new Attribute());
16231721 } else
1624
- if (event.getSource() == pointflowItem)
1722
+ if (source == pointflowItem)
16251723 {
16261724 makeSomething(new PointFlow());
16271725 } else
....@@ -1633,7 +1731,7 @@
16331731 } else
16341732 */
16351733
1636
- if (event.getSource() == superLoopItem)
1734
+ if (source == superLoopItem)
16371735 {
16381736 Composite g = new cGroup();
16391737 for (int i=0; i<15; i++)
....@@ -1655,7 +1753,7 @@
16551753
16561754 group(g);
16571755 } else
1658
- if (event.getSource() == loopItem)
1756
+ if (source == loopItem)
16591757 {
16601758 Composite csg = new GroupLeaf();
16611759 csg.count = 5;
....@@ -1664,7 +1762,7 @@
16641762 csg.addChild(child);
16651763 child.addChild(csg);
16661764 } else
1667
- if (event.getSource() == doubleItem)
1765
+ if (source == doubleItem)
16681766 {
16691767 Composite csg = new GroupLeaf();
16701768 csg.count = 5;
....@@ -1676,7 +1774,7 @@
16761774 csg.addChild(child);
16771775 child.addChild(csg);
16781776 } else
1679
- if (event.getSource() == tripleItem)
1777
+ if (source == tripleItem)
16801778 {
16811779 Composite csg = new GroupLeaf();
16821780 csg.count = 4;
....@@ -1692,70 +1790,70 @@
16921790 child.addChild(csg);
16931791 } else
16941792
1695
- if (event.getSource() == importGFDItem)
1793
+ if (source == importGFDItem)
16961794 {
16971795 ImportGFD();
16981796 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1797
+ if (source == importVRMLX3DItem)
17001798 {
17011799 ImportVRMLX3D();
17021800 } else
1703
- if (event.getSource() == import3DSItem)
1801
+ if (source == import3DSItem)
17041802 {
17051803 objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
17061804 } else
1707
- if (event.getSource() == importOBJItem)
1805
+ if (source == importOBJItem)
17081806 {
17091807 objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
17101808 } else
1711
- if (event.getSource() == computeAOItem)
1809
+ if (source == computeAOItem)
17121810 {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1811
+ Globals.drawMode = CameraPane.OCCLUSION;
1812
+ Globals.theRenderer.repaint();
17151813 } else
1716
- if (event.getSource() == recompileItem)
1814
+ if (source == recompileItem)
17171815 {
17181816 Recompile();
17191817 refreshContents();
17201818 } else
1721
- if (event.getSource() == editScriptItem)
1819
+ if (source == editScriptItem)
17221820 {
17231821 OpenDialog();
17241822 refreshContents();
17251823 } else
1726
- if (event.getSource() == invariantsItem)
1824
+ if (source == invariantsItem)
17271825 {
17281826 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1827
+ GrafreeD.grafreeD.universe.invariants();
17301828 } else
1731
- if (event.getSource() == memoryItem)
1829
+ if (source == memoryItem)
17321830 {
17331831 //System.out.println("Invariants:");
17341832 PrintMemory();
17351833 } else
1736
- if (event.getSource() == pathItem)
1834
+ if (source == pathItem)
17371835 {
17381836 PrintPath();
17391837 } else
1740
- if (event.getSource() == analyzeItem)
1838
+ if (source == analyzeItem)
17411839 {
17421840 AnalyzeObject();
17431841 } else
1744
- if (event.getSource() == dumpItem)
1842
+ if (source == dumpItem)
17451843 {
17461844 DumpObject();
17471845 } else
1748
- if (event.getSource() == screenfitButton)
1846
+ if (source == screenfitButton)
17491847 {
17501848 //Reload(lastConverter, lastFilename, true);
17511849 ScreenFit();
17521850 } else
1753
- if (event.getSource() == screenfitpointButton)
1851
+ if (source == screenfitpointButton)
17541852 {
17551853 //Reload(lastConverter, lastFilename, true);
17561854 ScreenFitPoint();
17571855 } else
1758
- if (event.getSource() == snapobjectButton)
1856
+ if (source == snapobjectButton)
17591857 {
17601858 //Reload(lastConverter, lastFilename, true);
17611859 SnapObject();
....@@ -1766,13 +1864,13 @@
17661864 // Recompile();
17671865 // refreshContents();
17681866 // } else
1769
- if (event.getSource() == gcButton)
1867
+ if (source == gcButton)
17701868 {
17711869 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17721870 System.gc();
17731871 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17741872 } else
1775
- if (event.getSource() == editLeafItem)
1873
+ if (source == editLeafItem)
17761874 {
17771875 Object3D obj;
17781876 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +1884,66 @@
17861884 }
17871885 refreshContents(true);
17881886 } else
1789
- if (event.getSource() == openWindowItem)
1887
+ if (source == openWindowItem)
17901888 {
17911889 EditSelection(true);
17921890 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
1891
+ if (source == cutItem || source == clearButton)
17941892 {
17951893 loadClipboard(true);
17961894 } else
1797
- if (event.getSource() == duplicateItem)
1895
+ if (source == duplicateItem)
17981896 {
1799
- Object3D keep = GraphreeD.clipboard;
1897
+ Object3D keep = GrafreeD.clipboard;
18001898 loadClipboard(false);
18011899 paste(false);
1802
- GraphreeD.clipboard = keep;
1900
+ GrafreeD.clipboard = keep;
18031901 } else
1804
- if (event.getSource() == cloneItem)
1902
+ if (source == cloneItem)
18051903 {
18061904 CloneSelection(false);
18071905 } else
1808
- if (event.getSource() == cloneSupportItem)
1906
+ if (source == cloneSupportItem)
18091907 {
18101908 CloneSelection(true);
18111909 } else
1812
- if (event.getSource() == copyItem)
1910
+ if (source == copyItem)
18131911 {
18141912 loadClipboard(false);
18151913 } else
1816
- if (event.getSource() == pasteItem)
1914
+ if (source == pasteItem)
18171915 {
18181916 paste(false);
18191917 } else
1820
- if (event.getSource() == pasteLinkItem)
1918
+ if (source == pasteLinkItem)
18211919 {
18221920 pasteInto(false);
18231921 } else
1824
- if (event.getSource() == pasteCloneItem)
1922
+ if (source == pasteCloneItem)
18251923 {
18261924 pasteInto(true);
18271925 } else
1828
- if (event.getSource() == pasteExpandItem)
1926
+ if (source == pasteExpandItem)
18291927 {
18301928 paste(true);
18311929 } else
1832
- if (event.getSource() == synchronizeItem)
1930
+ if (source == synchronizeItem)
18331931 {
18341932 Overwrite(Object3D.TRANSFORM);
18351933 } else
1836
- if (event.getSource() == overwriteNameItem)
1934
+ if (source == overwriteNameItem)
18371935 {
18381936 Overwrite(Object3D.NAME);
18391937 } else
1840
- if (event.getSource() == overwriteUVItem)
1938
+ if (source == overwriteUVItem)
18411939 {
18421940 Overwrite(Object3D.UV);
18431941 } else
1844
- if (event.getSource() == overwriteMatItem)
1942
+ if (source == overwriteMatItem)
18451943 {
1944
+ /* july 2015
18461945 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
1946
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18481947 else
18491948 {
18501949 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +1955,16 @@
18561955 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18571956 }
18581957 }
1958
+ */
1959
+
1960
+ Overwrite(dropAttributes);
18591961 }
1860
- if (event.getSource() == overwriteGeoItem)
1962
+ if (source == overwriteGeoItem)
18611963 {
18621964 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1965
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18641966 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
1967
+// Object3D content = GrafreeD.clipboard.get(0);
18661968 //
18671969 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18681970 // content = ((cGroup)content).get(0);
....@@ -1874,7 +1976,7 @@
18741976 // refreshContents();
18751977 // }
18761978 } else
1877
- if (event.getSource() == generateMeshItem)
1979
+ if (source == generateMeshItem)
18781980 {
18791981 //if (group.selection.size() == 1)
18801982 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +1987,7 @@
18851987 ResetModel();
18861988 refreshContents();
18871989 } else
1888
- if (event.getSource() == extractGeometriesItem)
1990
+ if (source == extractGeometriesItem)
18891991 {
18901992 boolean one = false;
18911993
....@@ -1912,7 +2014,7 @@
19122014 ResetModel();
19132015 refreshContents();
19142016 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2017
+ if (source == cloneGeometriesItem)
19162018 {
19172019 boolean one = false;
19182020
....@@ -1938,32 +2040,37 @@
19382040 ResetModel();
19392041 refreshContents();
19402042 } else
1941
- if (event.getSource() == shareGeometriesItem)
2043
+ if (source == shareGeometriesItem)
19422044 {
19432045 boolean one = false;
19442046
19452047 if (group.selection.size() == 1)
19462048 one = true;
19472049
2050
+ Object3D merge = null;
2051
+
19482052 Object3D content = new cGroup();
19492053
19502054 for (int i=0; i<group.selection.size(); i++)
19512055 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2056
+ merge = new Merge(group.selection.get(i));
19532057
19542058 if (one)
1955
- makeSomething(sel, false);
2059
+ makeSomething(merge, false);
19562060 else
1957
- content.addChild(sel);
2061
+ content.addChild(merge);
19582062 }
19592063
19602064 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2065
+ makeSomething(content, true);
2066
+ else
2067
+ {
2068
+ ResetModel();
2069
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2070
+ refreshContents();
2071
+ }
19652072 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2073
+ if (source == mergeGeometriesItem)
19672074 {
19682075 boolean one = false;
19692076
....@@ -1993,11 +2100,11 @@
19932100 ResetModel();
19942101 refreshContents();
19952102 } else
1996
- if (event.getSource() == linkverticesItem)
2103
+ if (source == linkverticesItem)
19972104 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2105
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992106 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2107
+// Object3D content = GrafreeD.clipboard.get(0);
20012108 //
20022109 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032110 // content = ((cGroup)content).get(0);
....@@ -2006,14 +2113,14 @@
20062113 // group.selection.get(0).setMasterThis(content); // should be identity
20072114 // refreshContents();
20082115 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2116
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20102117 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2118
+ Object3D content = GrafreeD.clipboard.get(0);
20122119
20132120 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142121 content = ((cGroup)content).get(0);
20152122
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2123
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172124 for (int i=0; i<group.selection.size(); i++)
20182125 {
20192126 boolean random = CameraPane.RANDOM;
....@@ -2022,11 +2129,11 @@
20222129 // group.selection.get(i).setMasterThis(content); // should be identity
20232130 CameraPane.RANDOM = random;
20242131 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2132
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262133 refreshContents();
20272134 }
20282135 } else
2029
- if (event.getSource() == resetsupportItem)
2136
+ if (source == resetsupportItem)
20302137 {
20312138 for (int i=0; i<group.selection.size(); i++)
20322139 {
....@@ -2038,7 +2145,16 @@
20382145
20392146 refreshContents();
20402147 } else
2041
- if (event.getSource() == resetreferencesItem)
2148
+ if (source == relinkverticesItem)
2149
+ {
2150
+ boolean random = CameraPane.RANDOM;
2151
+ CameraPane.RANDOM = false; // parse all random nodes
2152
+ group.selection.RelinkToSupport();
2153
+ CameraPane.RANDOM = random;
2154
+
2155
+ refreshContents();
2156
+ } else
2157
+ if (source == resetreferencesItem)
20422158 {
20432159 for (int i=0; i<group.selection.size(); i++)
20442160 {
....@@ -2047,11 +2163,11 @@
20472163
20482164 refreshContents();
20492165 } else
2050
- if (event.getSource() == setMasterItem)
2166
+ if (source == setMasterItem)
20512167 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2168
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20532169 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2170
+ Object3D content = GrafreeD.clipboard.get(0);
20552171
20562172 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572173 content = ((cGroup)content).get(0);
....@@ -2060,13 +2176,13 @@
20602176 refreshContents();
20612177 }
20622178 } else
2063
- if (event.getSource() == poseMeshItem)
2179
+ if (source == poseMeshItem)
20642180 {
20652181 if (group.selection.size() == 1)
20662182 {
2067
- if (GraphreeD.clipboard.size() == 1)
2183
+ if (GrafreeD.clipboard.size() == 1)
20682184 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2185
+ Object3D content = GrafreeD.clipboard.get(0);
20702186
20712187 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722188 content = ((cGroup)content).get(0);
....@@ -2079,19 +2195,19 @@
20792195 }
20802196
20812197 } else
2082
- if (event.getSource() == revertMeshItem)
2198
+ if (source == revertMeshItem)
20832199 {
20842200 RevertMeshes();
20852201 } else
2086
- if (event.getSource() == resetMeshItem)
2202
+ if (source == resetMeshItem)
20872203 {
20882204 ResetAll();
20892205 } else
2090
- if (event.getSource() == stepAllItem)
2206
+ if (source == stepAllItem)
20912207 {
20922208 StepAll();
20932209 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2210
+ if (source == clearItem) // || event.getSource() == clearButton)
20952211 {
20962212 //int indices[] = jList.getSelectedIndices();
20972213 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2215,46 @@
20992215
21002216 ClearSelection(false);
21012217 } else
2102
- if (event.getSource() == clearAllItem)
2218
+ if (source == clearAllItem)
21032219 {
21042220 ClearSelection(true);
21052221 } else
2106
- if (event.getSource() == grabItem)
2222
+ if (source == grabItem)
21072223 {
21082224 group(new cGroup(), true);
21092225 } else
2110
- if (event.getSource() == frontItem)
2226
+ if (source == hideItem)
2227
+ {
2228
+ group(new HiddenObject());
2229
+ } else
2230
+ if (source == frontItem)
21112231 {
21122232 front();
21132233 } else
2114
- if (event.getSource() == backItem)
2234
+ if (source == backItem)
21152235 {
21162236 back();
21172237 } else
2118
- if (event.getSource() == cameraItem)
2238
+ if (source == cameraItem)
21192239 {
21202240 makeSomething(new Camera());
21212241 } else
2122
- if (event.getSource() == compositeItem)
2242
+ if (source == compositeItem)
21232243 {
21242244 group(new Composite());
21252245 } else
2126
- if (event.getSource() == randomItem)
2246
+ if (source == randomItem)
21272247 {
21282248 RandomNode random = new RandomNode();
21292249 group(random);
21302250 if (random.size() > 0)
21312251 random.name = random.get(0).name + "Rnd";
21322252 } else
2133
- if (event.getSource() == physicsItem)
2253
+ if (source == physicsItem)
21342254 {
21352255 group(new PhysicsNode());
21362256 } else
2137
- if (event.getSource() == frameselectorItem)
2257
+ if (source == frameselectorItem)
21382258 {
21392259 for (int i=0; i<group.selection.size(); i++)
21402260 {
....@@ -2146,7 +2266,7 @@
21462266 ResetModel();
21472267 refreshContents();
21482268 } else
2149
- if (event.getSource() == switchGeoItem)
2269
+ if (source == switchGeoItem)
21502270 {
21512271 for (int i=0; i<group.selection.size(); i++)
21522272 {
....@@ -2158,7 +2278,7 @@
21582278 ResetModel();
21592279 refreshContents();
21602280 } else
2161
- if (event.getSource() == switchTransfoItem)
2281
+ if (source == switchTransfoItem)
21622282 {
21632283 for (int i=0; i<group.selection.size(); i++)
21642284 {
....@@ -2170,7 +2290,7 @@
21702290 ResetModel();
21712291 refreshContents();
21722292 } else
2173
- if (event.getSource() == morphItem)
2293
+ if (source == morphItem)
21742294 {
21752295 for (int i=0; i<group.selection.size(); i++)
21762296 {
....@@ -2182,7 +2302,7 @@
21822302 ResetModel();
21832303 refreshContents();
21842304 } else
2185
- if (event.getSource() == scriptNodeItem)
2305
+ if (source == scriptNodeItem)
21862306 {
21872307 boolean atleastone = false;
21882308
....@@ -2221,191 +2341,215 @@
22212341 }
22222342 }
22232343 } else
2224
- if (event.getSource() == linkerItem)
2344
+ if (source == linkerItem)
22252345 {
22262346 group(new cLinker());
22272347 } else
2228
- if (event.getSource() == textureItem)
2348
+ if (source == textureItem)
22292349 {
22302350 group(new TextureNode());
22312351 } else
2232
- if (event.getSource() == shadowXItem)
2352
+ if (source == billboardItem)
2353
+ {
2354
+ group(new BillboardNode());
2355
+ } else
2356
+ if (source == shadowXItem)
22332357 {
22342358 CastShadow(0);
22352359 } else
2236
- if (event.getSource() == shadowYItem)
2360
+ if (source == shadowYItem)
22372361 {
22382362 CastShadow(1);
22392363 } else
2240
- if (event.getSource() == shadowZItem)
2364
+ if (source == shadowZItem)
22412365 {
22422366 CastShadow(2);
22432367 } else
2244
- if (event.getSource() == ungroupItem)
2368
+ if (source == ungroupItem)
22452369 {
2246
- ungroup();
2370
+ //ungroup();
2371
+ for (int i=0; i<group.selection.size(); i++)
2372
+ {
2373
+ Ungroup(group.selection.get(i));
2374
+ }
2375
+
2376
+ ClearSelection(false);
2377
+
2378
+ refreshContents();
22472379 } else
2248
- if (event.getSource() == genUVItem)
2380
+ if (source == genUVItem)
22492381 {
22502382 GenUV();
22512383 } else
2252
- if (event.getSource() == genNormalsCADItem)
2384
+ if (source == genNormalsCADItem)
22532385 {
22542386 GenNormals(true);
22552387 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2388
+ if (source == genNormalsMESHItem)
2389
+ {
2390
+ GenNormals(true); // TODO
2391
+ } else
2392
+ if (source == genNormalsORGANItem)
22572393 {
22582394 GenNormals(false);
22592395 } else
2260
- if (event.getSource() == stripifyItem)
2396
+ if (source == genNormalsMINEItem)
2397
+ {
2398
+ GenNormalsMINE();
2399
+ } else
2400
+ if (source == stripifyItem)
22612401 {
22622402 Stripify();
22632403 } else
2264
- if (event.getSource() == unstripifyItem)
2404
+ if (source == unstripifyItem)
22652405 {
22662406 Unstripify();
22672407 } else
2268
- if (event.getSource() == trimItem)
2408
+ if (source == trimItem)
22692409 {
22702410 Trim();
22712411 } else
2272
- if (event.getSource() == untrimItem)
2412
+ if (source == untrimItem)
22732413 {
22742414 Untrim();
22752415 } else
2276
- if (event.getSource() == clearColorsItem)
2416
+ if (source == clearColorsItem)
22772417 {
22782418 ClearColors();
22792419 } else
2280
- if (event.getSource() == clearMaterialsItem)
2420
+ if (source == clearMaterialsItem)
22812421 {
22822422 ClearMaterials();
22832423 } else
2284
- if (event.getSource() == liveleavesItem)
2424
+ if (source == liveleavesItem)
22852425 {
22862426 LiveLeaves(true);
22872427 } else
2288
- if (event.getSource() == unliveleavesItem)
2428
+ if (source == unliveleavesItem)
22892429 {
22902430 LiveLeaves(false);
22912431 } else
2292
- if (event.getSource() == supportleavesItem)
2432
+ if (source == supportleavesItem)
22932433 {
22942434 SupportLeaves(true);
22952435 } else
2296
- if (event.getSource() == unsupportleavesItem)
2436
+ if (source == unsupportleavesItem)
22972437 {
22982438 SupportLeaves(false);
22992439 } else
2300
- if (event.getSource() == hideleavesItem)
2440
+ if (source == hideleavesItem)
23012441 {
23022442 HideLeaves(true);
23032443 } else
2304
- if (event.getSource() == showleavesItem)
2444
+ if (source == showleavesItem)
23052445 {
23062446 HideLeaves(false);
23072447 } else
2308
- if (event.getSource() == markleavesItem)
2448
+ if (source == markleavesItem)
23092449 {
23102450 MarkLeaves(true);
23112451 } else
2312
- if (event.getSource() == unmarkleavesItem)
2452
+ if (source == unmarkleavesItem)
23132453 {
23142454 MarkLeaves(false);
23152455 } else
2316
- if (event.getSource() == flipVItem)
2456
+ if (source == flipVItem)
23172457 {
23182458 FlipV(true);
23192459 } else
2320
- if (event.getSource() == unflipVItem)
2460
+ if (source == unflipVItem)
23212461 {
23222462 FlipV(false);
23232463 } else
2324
- if (event.getSource() == lowTexturesItem)
2464
+ if (source == lowTexturesItem)
23252465 {
23262466 SetTexRes(0);
23272467 } else
2328
- if (event.getSource() == normalTexturesItem)
2468
+ if (source == normalTexturesItem)
23292469 {
23302470 SetTexRes(1);
23312471 } else
2332
- if (event.getSource() == highTexturesItem)
2472
+ if (source == highTexturesItem)
23332473 {
23342474 SetTexRes(2);
23352475 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2476
+ if (source == veryhighTexturesItem)
23372477 {
23382478 SetTexRes(3);
23392479 } else
2340
- if (event.getSource() == maxTexturesItem)
2480
+ if (source == maxTexturesItem)
23412481 {
23422482 SetTexRes(4);
23432483 } else
2344
- if (event.getSource() == panoTexturesItem)
2484
+ if (source == panoTexturesItem)
23452485 {
23462486 SetTexRes(5);
23472487 } else
2348
- if (event.getSource() == reverseNormalsItem)
2488
+ if (source == reverseNormalsItem)
23492489 {
23502490 ReverseNormals();
23512491 } else
2352
- if (event.getSource() == parseverticesItem)
2492
+ if (source == parseverticesItem)
23532493 {
23542494 ParseVertices();
23552495 } else
2356
- if (event.getSource() == alignItem)
2496
+ if (source == textureFieldItem)
2497
+ {
2498
+ TextureVertices();
2499
+ } else
2500
+ if (source == alignItem)
23572501 {
23582502 Align();
23592503 } else
2360
- if (event.getSource() == mirrorItem)
2504
+ if (source == mirrorItem)
23612505 {
23622506 MirrorPoses();
23632507 } else
2364
- if (event.getSource() == reduceMorphItem)
2508
+ if (source == reduceMorphItem)
23652509 {
23662510 MeshReduction(false);
23672511 } else
2368
- if (event.getSource() == reduce34MorphItem)
2512
+ if (source == reduce34MorphItem)
23692513 {
23702514 MeshReduction(true);
23712515 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2516
+ if (source == reverseTrianglesItem)
23732517 {
23742518 ReverseTriangles();
23752519 } else
2376
- if (event.getSource() == reduceMeshItem)
2520
+ if (source == reduceMeshItem)
23772521 {
23782522 ReduceMesh(false);
23792523 } else
2380
- if (event.getSource() == reduce34MeshItem)
2524
+ if (source == reduce34MeshItem)
23812525 {
23822526 ReduceMesh(true);
23832527 } else
2384
- if (event.getSource() == increaseMeshItem)
2528
+ if (source == increaseMeshItem)
23852529 {
23862530 IncreaseMesh();
23872531 } else
2388
- if (event.getSource() == clipMeshItem)
2532
+ if (source == clipMeshItem)
23892533 {
23902534 ClipMesh();
23912535 } else
2392
- if (event.getSource() == smoothMeshItem)
2536
+ if (source == smoothMeshItem)
23932537 {
23942538 SmoothMesh();
23952539 } else
2396
- if (event.getSource() == transformgeometryItem)
2540
+ if (source == transformgeometryItem)
23972541 {
23982542 TransformGeometry();
23992543 } else
2400
- if (event.getSource() == resetTransformItem)
2544
+ if (source == resetTransformItem)
24012545 {
24022546 ResetTransform();
24032547 } else
2404
- if (event.getSource() == resetCentroidItem)
2548
+ if (source == resetCentroidItem)
24052549 {
24062550 ResetCentroid();
24072551 } else
2408
- if (event.getSource() == resetParentItem)
2552
+ if (source == resetParentItem)
24092553 {
24102554 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112555 {
....@@ -2415,7 +2559,7 @@
24152559
24162560 refreshContents();
24172561 } else
2418
- if (event.getSource() == repairParentItem)
2562
+ if (source == repairParentItem)
24192563 {
24202564 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212565 {
....@@ -2429,7 +2573,21 @@
24292573
24302574 refreshContents();
24312575 } else
2432
- if (event.getSource() == sortbysizeItem)
2576
+ if (source == repairShadowItem)
2577
+ {
2578
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2579
+ {
2580
+ Object3D obj = (Object3D)e.nextElement();
2581
+ obj.RepairShadow();
2582
+// for (int i=0; i<obj.size(); i++)
2583
+// {
2584
+// obj.get(i).parent = obj;
2585
+// }
2586
+ }
2587
+
2588
+ refreshContents();
2589
+ } else
2590
+ if (source == sortbysizeItem)
24332591 {
24342592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352593 {
....@@ -2441,7 +2599,7 @@
24412599 ResetModel();
24422600 refreshContents();
24432601 } else
2444
- if (event.getSource() == sortbynameItem)
2602
+ if (source == sortbynameItem)
24452603 {
24462604 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472605 {
....@@ -2453,7 +2611,7 @@
24532611 ResetModel();
24542612 refreshContents();
24552613 } else
2456
- if (event.getSource() == attachPigmentItem)
2614
+ if (source == attachPigmentItem)
24572615 {
24582616 String texture = GetFile("Attach pigment");
24592617 Object3D obj;
....@@ -2465,7 +2623,7 @@
24652623
24662624 refreshContents();
24672625 } else
2468
- if (event.getSource() == detachPigmentItem)
2626
+ if (source == detachPigmentItem)
24692627 {
24702628 Object3D obj;
24712629 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2634,7 @@
24762634
24772635 refreshContents();
24782636 } else
2479
- if (event.getSource() == attachBumpItem)
2637
+ if (source == attachBumpItem)
24802638 {
24812639 String texture = GetFile("Attach bump");
24822640 Object3D obj;
....@@ -2488,7 +2646,7 @@
24882646
24892647 refreshContents();
24902648 } else
2491
- if (event.getSource() == detachBumpItem)
2649
+ if (source == detachBumpItem)
24922650 {
24932651 Object3D obj;
24942652 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2657,7 @@
24992657
25002658 refreshContents();
25012659 } else
2502
- if (event.getSource() == pigmentBumpItem)
2660
+ if (source == pigmentBumpItem)
25032661 {
25042662 Object3D obj;
25052663 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2668,195 @@
25102668
25112669 refreshContents();
25122670 } else
2513
- if (event.getSource() == flashSelectionButton)
2671
+ if (source == flashSelectionButton)
25142672 {
25152673 CameraPane.flash = true;
25162674 refreshContents();
25172675 } else
2518
- if (event.getSource() == oneButton)
2676
+ if (source == oneButton)
25192677 {
25202678 } else
2521
- if (event.getSource() == twoButton)
2679
+ if (source == twoButton)
25222680 {
25232681 radio.layout = twoButton;
25242682 // bug
25252683 //gridPanel.setDividerLocation(1.0);
25262684 //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();
2685
+// bigThree.remove(scenePanel);
2686
+// bigThree.remove(centralPanel);
2687
+// bigThree.remove(XYZPanel);
2688
+// aWindowConstraints.gridx = 0;
2689
+// aWindowConstraints.gridy = 0;
2690
+// aWindowConstraints.gridwidth = 1;
2691
+// // aConstraints.gridheight = 3;
2692
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2693
+// aWindowConstraints.weightx = 0;
2694
+// aWindowConstraints.weighty = 1;
2695
+// //bigThree.add(jtp, aWindowConstraints);
2696
+// aWindowConstraints.weightx = 1;
2697
+// aWindowConstraints.gridwidth = 3;
2698
+// // aConstraints.gridheight = 3;
2699
+// aWindowConstraints.gridx = 1;
2700
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2701
+// bigThree.add(centralPanel, aWindowConstraints);
2702
+// aWindowConstraints.weightx = 0;
2703
+// aWindowConstraints.gridx = 4;
2704
+// aWindowConstraints.gridwidth = 1;
2705
+// // aConstraints.gridheight = 3;
2706
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2707
+// //bigThree.add(XYZPanel, aWindowConstraints);
2708
+// scenePanel.setVisible(false);
2709
+// centralPanel.setVisible(true);
2710
+// XYZPanel.setVisible(false);
2711
+ bigThree.ClearUI();
2712
+ bigThree.add(centralPanel);
2713
+ bigThree.FlushUI();
25512714 } else
2552
- if (event.getSource() == threeButton)
2715
+ if (source == threeButton)
25532716 {
25542717 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();
2718
+
2719
+// bigThree.remove(scenePanel);
2720
+// bigThree.remove(centralPanel);
2721
+// bigThree.remove(XYZPanel);
2722
+// aWindowConstraints.gridx = 0;
2723
+// aWindowConstraints.gridy = 0;
2724
+// aWindowConstraints.gridwidth = 1;
2725
+// // aConstraints.gridheight = 3;
2726
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
+// aWindowConstraints.weightx = 0;
2728
+// aWindowConstraints.weighty = 1;
2729
+// //bigThree.add(jtp, aWindowConstraints);
2730
+// aWindowConstraints.weightx = 1;
2731
+// aWindowConstraints.gridwidth = 3;
2732
+// // aConstraints.gridheight = 3;
2733
+// aWindowConstraints.gridx = 1;
2734
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2735
+// bigThree.add(centralPanel, aWindowConstraints);
2736
+// aWindowConstraints.weightx = 0;
2737
+// aWindowConstraints.gridx = 4;
2738
+// aWindowConstraints.gridwidth = 1;
2739
+// // aConstraints.gridheight = 3;
2740
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2741
+// bigThree.add(XYZPanel, aWindowConstraints);
2742
+// bigThree.validate();
2743
+// scenePanel.setVisible(false);
2744
+// centralPanel.setVisible(true);
2745
+// XYZPanel.setVisible(true);
2746
+ bigThree.ClearUI();
2747
+ bigThree.add(centralPanel);
2748
+ bigThree.add(XYZPanel);
2749
+ bigThree.FlushUI();
25792750 } else
2580
- if (event.getSource() == fourButton)
2751
+ if (source == fourButton)
25812752 {
25822753 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();
2754
+
2755
+// bigThree.remove(scenePanel);
2756
+// bigThree.remove(centralPanel);
2757
+// bigThree.remove(XYZPanel);
2758
+// aWindowConstraints.gridx = 0;
2759
+// aWindowConstraints.gridy = 0;
2760
+// aWindowConstraints.gridwidth = 1;
2761
+// // aWindowConstraints.gridheight = 3;
2762
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2763
+// aWindowConstraints.weightx = 1;
2764
+// aWindowConstraints.weighty = 1;
2765
+// bigThree.add(scenePanel, aWindowConstraints);
2766
+// aWindowConstraints.weightx = 1;
2767
+// aWindowConstraints.gridwidth = 3;
2768
+// // aConstraints.gridheight = 3;
2769
+// aWindowConstraints.gridx = 1;
2770
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2771
+// //bigThree.add(cameraPanel, aWindowConstraints);
2772
+// aWindowConstraints.weightx = 0;
2773
+// aWindowConstraints.gridx = 4;
2774
+// aWindowConstraints.gridwidth = 1;
2775
+// // aWindowConstraints.gridheight = 3;
2776
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2777
+// //bigThree.add(XYZPanel, aWindowConstraints);
2778
+// bigThree.validate();
2779
+// scenePanel.setVisible(true);
2780
+// centralPanel.setVisible(false);
2781
+// XYZPanel.setVisible(false);
2782
+ bigThree.ClearUI();
2783
+ bigThree.add(scenePanel);
2784
+ bigThree.FlushUI();
26072785 } else
2608
- if (event.getSource() == sixButton)
2786
+ if (source == sixButton)
26092787 {
26102788 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();
2789
+
2790
+// bigThree.remove(scenePanel);
2791
+// bigThree.remove(centralPanel);
2792
+// bigThree.remove(XYZPanel);
2793
+// aWindowConstraints.gridx = 0;
2794
+// aWindowConstraints.gridy = 0;
2795
+// aWindowConstraints.gridwidth = 1;
2796
+// // aConstraints.gridheight = 3;
2797
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2798
+// aWindowConstraints.weightx = 0;
2799
+// aWindowConstraints.weighty = 1;
2800
+// bigThree.add(scenePanel, aWindowConstraints);
2801
+// aWindowConstraints.weightx = 1;
2802
+// aWindowConstraints.gridwidth = 3;
2803
+// // aWindowConstraints.gridheight = 3;
2804
+// aWindowConstraints.gridx = 1;
2805
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2806
+// bigThree.add(centralPanel, aWindowConstraints);
2807
+// aWindowConstraints.weightx = 0;
2808
+// aWindowConstraints.gridx = 4;
2809
+// aWindowConstraints.gridwidth = 1;
2810
+// // aWindowConstraints.gridheight = 3;
2811
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2812
+// //bigThree.add(XYZPanel, aConstraints);
2813
+// bigThree.validate();
2814
+// scenePanel.setVisible(true);
2815
+// centralPanel.setVisible(true);
2816
+// XYZPanel.setVisible(false);
2817
+ bigThree.ClearUI();
2818
+ bigThree.add(scenePanel);
2819
+ bigThree.add(centralPanel);
2820
+ bigThree.FlushUI();
26352821 } else
2636
- if (event.getSource() == sevenButton)
2822
+ if (source == sevenButton)
26372823 {
26382824 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();
2825
+
2826
+// bigThree.remove(scenePanel);
2827
+// bigThree.remove(centralPanel);
2828
+// bigThree.remove(XYZPanel);
2829
+// aWindowConstraints.gridx = 0;
2830
+// aWindowConstraints.gridy = 0;
2831
+// aWindowConstraints.gridwidth = 1;
2832
+// // aWindowConstraints.gridheight = 3;
2833
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2834
+// aWindowConstraints.weightx = 0;
2835
+// aWindowConstraints.weighty = 1;
2836
+// bigThree.add(scenePanel, aWindowConstraints);
2837
+// aWindowConstraints.weightx = 1;
2838
+// aWindowConstraints.gridwidth = 3;
2839
+// // aWindowConstraints.gridheight = 3;
2840
+// aWindowConstraints.gridx = 1;
2841
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2842
+// bigThree.add(centralPanel, aWindowConstraints);
2843
+// aWindowConstraints.weightx = 0;
2844
+// aWindowConstraints.gridx = 4;
2845
+// aWindowConstraints.gridwidth = 1;
2846
+// // aConstraints.gridheight = 3;
2847
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2848
+// bigThree.add(XYZPanel, aWindowConstraints);
2849
+// bigThree.validate();
2850
+// scenePanel.setVisible(true);
2851
+// centralPanel.setVisible(true);
2852
+// XYZPanel.setVisible(true);
2853
+ bigThree.ClearUI();
2854
+ bigThree.add(scenePanel);
2855
+ bigThree.add(centralPanel);
2856
+ bigThree.add(XYZPanel);
2857
+ bigThree.FlushUI();
26632858 } else
2664
- if (event.getSource() == rootButton)
2859
+ if (source == rootButton)
26652860 {
26662861 Object3D obj;
26672862 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2673,7 +2868,7 @@
26732868
26742869 refreshContents(true);
26752870 } else
2676
- if (event.getSource() == closeButton)
2871
+ if (source == closeButton)
26772872 {
26782873 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26792874 cRadio ab;
....@@ -2694,11 +2889,11 @@
26942889 }
26952890 refreshContents(true);
26962891 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
2892
+ if (source == editItem || source == editButton)
26982893 {
26992894 EditSelection(false);
27002895 } else
2701
- if (event.getSource() == uneditButton)
2896
+ if (source == uneditButton)
27022897 {
27032898 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27042899 {
....@@ -2710,12 +2905,12 @@
27102905
27112906 child.editWindow = null; // ???????????
27122907 }
2713
- objEditor.ctrlPanel.revalidate();
2908
+ objEditor.ctrlPanel.validate();
27142909 //objEditor.jTree.clearSelection();
27152910 //objEditor.ResetSliders();
27162911 refreshContents(true);
27172912 } else
2718
- if (event.getSource() == clearPanelButton)
2913
+ if (source == clearPanelButton)
27192914 {
27202915 assert(copy == group);
27212916 //copy.ClearUI();
....@@ -2726,7 +2921,7 @@
27262921 listUI.clear();
27272922 refreshContents(true);
27282923 } else
2729
- if (event.getSource() == allParamsButton)
2924
+ if (source == allParamsButton)
27302925 {
27312926 assert(copy == group);
27322927
....@@ -2747,19 +2942,19 @@
27472942
27482943 refreshContents(true);
27492944 } else
2750
- if (event.getSource() == unselectButton)
2945
+ if (source == unselectButton)
27512946 {
27522947 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
2948
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27542949 objEditor.ResetSliders();
27552950 refreshContents(true);
27562951 } else
2757
- if(event.getSource() instanceof cRadio)
2952
+ if(source instanceof cRadio)
27582953 {
27592954 group.parent = keepparent;
27602955 group.attributes = 0;
27612956 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
2957
+ /*cRadio*/ radio = (cRadio)source;
27632958 Object3D obj = radio.GetObject();
27642959 System.out.println("Edit " + obj);
27652960 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +2974,7 @@
27792974 }
27802975
27812976 copy = group;
2782
- //CameraPane.theRenderer.object = group;
2977
+ //Globals.theRenderer.object = group;
27832978 if(!useclient)
27842979 {
27852980 cameraView.renderCamera = radio.camera;
....@@ -2788,7 +2983,8 @@
27882983 cameraView.cameras[cameraView.cameracount] = radio.camera;
27892984 cameraView.targetLookAt.set(radio.camera.lookAt);
27902985 cameraView.object = group;
2791
- cameraView.lighttouched = true;
2986
+ //cameraView.lighttouched = true;
2987
+ Globals.lighttouched = true;
27922988 topView.object = group;
27932989 frontView.object = group;
27942990 sideView.object = group;
....@@ -2824,7 +3020,7 @@
28243020 if (useclient)
28253021 {
28263022 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3023
+ Globals.lighttouched = true;
28283024 //topView.object = client;
28293025 //frontView.object = client;
28303026 //sideView.object = client;
....@@ -2832,7 +3028,7 @@
28323028 else
28333029 {
28343030 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3031
+ Globals.lighttouched = true;
28363032 //topView.object = group;
28373033 //frontView.object = group;
28383034 //sideView.object = group;
....@@ -3065,9 +3261,9 @@
30653261 obj = (Object3D)e.nextElement();
30663262
30673263 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3264
+ GrafreeD.AnalyzeObject(obj);
30693265 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3266
+ GrafreeD.AnalyzeObject(obj.bRep);
30713267
30723268 // System.err.println((size/1024) + " KB is the size of " + obj);
30733269 }
....@@ -3109,6 +3305,13 @@
31093305 void GenNormals(boolean crease)
31103306 {
31113307 group.GenNormalsS(crease);
3308
+
3309
+ refreshContents();
3310
+ }
3311
+
3312
+ void GenNormalsMINE()
3313
+ {
3314
+ group.selection.GenNormalsMINE();
31123315
31133316 refreshContents();
31143317 }
....@@ -3157,104 +3360,250 @@
31573360
31583361 //Object3D buffer;
31593362 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
-
3363
+// BoundaryRep temprep;
3364
+// Object3D nodes;
3365
+// Vector<Vertex> vertices;
3366
+//
3367
+// cGroup buffer;
3368
+//
3369
+// public void Vertex(Object3D node, Vertex v)
3370
+// {
3371
+//// vertices.add(v);
3372
+//// nodes.addElement(node);
3373
+////
3374
+//// if (temprep.GetCache(v) != null)
3375
+//// {
3376
+//// temprep.Remove(v);
3377
+//// } else
3378
+//// {
3379
+//// temprep.Remember(v);
3380
+//// }
3381
+//
3382
+// //Object3D node = nodes.get(index);
3383
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3384
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3385
+//
3386
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3387
+//
3388
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3389
+//
3390
+// cGroup g = new cGroup();
3391
+//
3392
+// if (g.toParent == null)
3393
+// {
3394
+// g.toParent = LA.newMatrix();
3395
+// g.fromParent = LA.newMatrix();
3396
+// }
3397
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3398
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3399
+//
3400
+// g.add(GrafreeD.clipboard);
3401
+//
3402
+// buffer.add(g);
3403
+// }
3404
+//
3405
+// public void Face(Object3D node, Face f)
3406
+// {
3407
+//
3408
+// }
3409
+//
3410
+// void ParseVerticesOld() // ??
3411
+// {
3412
+// //if (group.selection.size() != 1)
3413
+// // return;
3414
+//
3415
+// temprep = new BoundaryRep();
3416
+// nodes = new Object3D();
3417
+// vertices = new Vector<Vertex>();
3418
+//
3419
+// boolean epsequal = GrafreeD.epsequal;
3420
+// GrafreeD.epsequal = true;
3421
+//
3422
+// for (int i=0; i<group.selection.size(); i++)
3423
+// {
3424
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3425
+//
3426
+// group.selection.get(i).Parse(
3427
+//this );
3428
+//
3429
+// int repsize = temprep.VertexCount();
3430
+// int tablesize = temprep.vertextable.size();
3431
+// int nodesize = nodes.size();
3432
+//
3433
+// assert(vertices.size() == nodes.size());
3434
+//
3435
+// temprep.vertextable.elements();
3436
+//
3437
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3438
+//
3439
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3440
+// {
3441
+// cGroup g = new cGroup();
3442
+//
3443
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3444
+//
3445
+// Object3D node = nodes.get(index);
3446
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3447
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3448
+//
3449
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3450
+//
3451
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3452
+//
3453
+// if (g.toParent == null)
3454
+// {
3455
+// g.toParent = LA.newMatrix();
3456
+// g.fromParent = LA.newMatrix();
3457
+// }
3458
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3459
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3460
+//
3461
+// g.add(GrafreeD.clipboard);
3462
+//
3463
+// buffer.add(g);
3464
+// }
3465
+//
3466
+// makeSomething(buffer, i==group.selection.size()-1);
3467
+// }
3468
+//
3469
+// GrafreeD.epsequal = epsequal;
3470
+//
3471
+// //buffer = null;
3472
+// temprep = null;
3473
+// nodes = null;
3474
+//
3475
+// refreshContents();
3476
+// }
3477
+
31843478 void ParseVertices()
31853479 {
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;
3480
+ boolean epsequal = GrafreeD.epsequal;
3481
+ GrafreeD.epsequal = true;
31953482
31963483 for (int i=0; i<group.selection.size(); i++)
31973484 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3485
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993486
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3487
+ group.selection.get(i).Parse(
3488
+
3489
+ new iParse()
3490
+ {
3491
+ public void Vertex(Object3D node, Vertex v)
3492
+ {
3493
+ temp.set(v);
3494
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053495
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();
3496
+ cGroup g = new cGroup();
32113497
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3498
+ if (g.toParent == null)
3499
+ {
3500
+ g.toParent = LA.newMatrix();
3501
+ g.fromParent = LA.newMatrix();
3502
+ }
3503
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3504
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153505
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);
3506
+ g.add(GrafreeD.clipboard);
32203507
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);
3508
+ buffer.add(g);
3509
+ }
32323510
3233
- g.add(GraphreeD.clipboard);
3511
+ public void Face(Object3D node, Face f)
3512
+ {
32343513
3235
- buffer.add(g);
3236
- }
3514
+ }
3515
+ }
3516
+ );
32373517
32383518 makeSomething(buffer, i==group.selection.size()-1);
32393519 }
32403520
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3521
+ GrafreeD.epsequal = epsequal;
32463522
32473523 refreshContents();
32483524 }
3249
-
3525
+
3526
+ void TextureVertices()
3527
+ {
3528
+ for (int i=0; i<group.selection.size(); i++)
3529
+ {
3530
+ group.selection.get(i).Parse(
3531
+ new iParse()
3532
+ {
3533
+ public void Vertex(Object3D node, Vertex v)
3534
+ {
3535
+ cTexture tex = node.GetTextures();
3536
+ String pigment = Object3D.GetPigment(tex);
3537
+ //String bump = Object3D.GetBump(tex);
3538
+
3539
+ com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3540
+
3541
+ double s = v.s;
3542
+
3543
+ if (s == 1)
3544
+ s = 0;
3545
+
3546
+ double t = v.t;
3547
+
3548
+ if (t == 1)
3549
+ t = 0;
3550
+
3551
+ int indexs = (int) (texturedata.getWidth() * s);
3552
+ int indext = (int) (texturedata.getHeight() * t);
3553
+
3554
+ int index = indext * texturedata.getWidth() + indexs;
3555
+
3556
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3557
+
3558
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3559
+
3560
+ float scale = bytebuf.get(index*slide) & 0xFF;
3561
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3562
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3563
+ scale /= 3;
3564
+
3565
+ scale /= 0xFF;
3566
+ // c'est quoi ca? scale /= 4;
3567
+
3568
+ //v.AO = scale;
3569
+
3570
+ v.x += v.norm.x * scale;
3571
+ v.y += v.norm.y * scale;
3572
+ v.z += v.norm.z * scale;
3573
+ }
3574
+
3575
+ public void Face(Object3D node, Face f)
3576
+ {
3577
+ }
3578
+ }
3579
+ );
3580
+ }
3581
+
3582
+ refreshContents();
3583
+ }
3584
+
32503585 void Align()
32513586 {
3587
+ if (group.selection.size() == 0)
3588
+ return;
3589
+
3590
+ cVector bbmin = new cVector();
3591
+ cVector bbmax = new cVector();
3592
+
3593
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3594
+
3595
+ double dx = bbmax.x - bbmin.x;
3596
+ double dy = bbmax.y - bbmin.y;
3597
+ double dz = bbmax.z - bbmin.z;
3598
+
3599
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3600
+
32523601 for (int i=0; i<group.selection.size(); i++)
32533602 {
32543603 Object3D obj = group.selection.get(i);
32553604
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3605
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3606
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583607 }
32593608
32603609 refreshContents();
....@@ -3267,7 +3616,7 @@
32673616 // ref.SaveSupports();
32683617 // Object3D par = ref.parent;
32693618 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3619
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713620 // ref.parent = par;
32723621 // ref.RestoreSupports();
32733622
....@@ -3297,7 +3646,7 @@
32973646 // lowres.SaveSupports();
32983647 // par = lowres.parent;
32993648 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3649
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013650 Object3D newlow = CloneObject(lowres, false);
33023651 newlow.name = sn.switchobject.get(i).name;
33033652 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3668,7 @@
33193668 return;
33203669
33213670 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3671
+ Object3D ref = GrafreeD.clipboard.get(0);
33233672
33243673 Object3D newgroup = new Object3D("Po:" + poses.name);
33253674
....@@ -3488,7 +3837,7 @@
34883837 group.selection.RelinkToSupport(); // july 2014
34893838 System.out.println("DONE.");
34903839 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3840
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34923841 }
34933842
34943843 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +3862,20 @@
35133862
35143863 void ClipMesh()
35153864 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3865
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
35173866 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3867
+ Object3D content = GrafreeD.clipboard.get(0);
35193868
35203869 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213870 content = ((cGroup)content).get(0);
35223871
35233872 // for (int i=0; i<group.selection.size(); i++)
35243873 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3874
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35263875 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
3876
+ group.selection.ClipMesh(GrafreeD.clipboard);
35283877 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
3878
+// group.selection.ClipMesh(GrafreeD.clipboard);
35303879 System.out.println("DONE.");
35313880 refreshContents();
35323881 }
....@@ -3773,16 +4122,16 @@
37734122
37744123 objEditor.SetText(); // jan 2014
37754124
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4125
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
37774126 CameraPane.flash = true;
37784127
37794128 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
37804129 // a camera
37814130 {
37824131 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;
4132
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4133
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4134
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864135 }
37874136
37884137 refreshContents();
....@@ -3864,12 +4213,12 @@
38644213 {
38654214 if (group.selection.isEmpty())
38664215 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4216
+ GrafreeD.clipboardIsTempGroup = false;
38684217 Composite tGroup = null;
38694218 if (group.selection.size() > 0) // 1)
38704219 {
38714220 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4221
+ GrafreeD.clipboardIsTempGroup = true;
38734222 }
38744223
38754224 if (cut)
....@@ -3909,16 +4258,16 @@
39094258 //System.out.println("cut " + child);
39104259 //System.out.println("parent = " + child.parent);
39114260 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4261
+ if (GrafreeD.clipboardIsTempGroup)
39134262 tGroup.add/*Child*/(tmp);
39144263 else
3915
- GraphreeD.clipboard = tmp;
4264
+ GrafreeD.clipboard = tmp;
39164265 }
39174266 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4267
+ if (GrafreeD.clipboardIsTempGroup)
39194268 tGroup.add/*Child*/(child);
39204269 else
3921
- GraphreeD.clipboard = child;
4270
+ GrafreeD.clipboard = child;
39224271 }
39234272
39244273 //ResetModel();
....@@ -3950,21 +4299,21 @@
39504299 //System.out.println("cut " + elem);
39514300 //System.out.println("parent = " + elem.parent);
39524301 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4302
+ if (GrafreeD.clipboardIsTempGroup)
39544303 tGroup.add/*Child*/(tmp);
39554304 else
3956
- GraphreeD.clipboard = tmp;
4305
+ GrafreeD.clipboard = tmp;
39574306 }
39584307 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4308
+ if (GrafreeD.clipboardIsTempGroup)
39604309 tGroup.add/*Child*/(child);
39614310 else
3962
- GraphreeD.clipboard = child;
4311
+ GrafreeD.clipboard = child;
39634312 }
39644313
39654314 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4315
+ if (GrafreeD.clipboardIsTempGroup)
4316
+ GrafreeD.clipboard = tGroup;
39684317 if (cut)
39694318 {
39704319 ResetModel();
....@@ -3974,11 +4323,11 @@
39744323
39754324 void paste(boolean expand)
39764325 {
3977
- // if (GraphreeD.clipboard == null)
4326
+ // if (GrafreeD.clipboard == null)
39784327 // return;
39794328 boolean first = true;
39804329
3981
- if (GraphreeD.clipboardIsTempGroup)
4330
+ if (GrafreeD.clipboardIsTempGroup)
39824331 {
39834332 Composite temp;
39844333
....@@ -3989,7 +4338,7 @@
39894338 temp = (Composite)Applet3D.clipboard.deepCopy();
39904339 */
39914340 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4341
+ for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934342 {
39944343 Object3D child = (Object3D)e.nextElement();
39954344
....@@ -4003,7 +4352,7 @@
40034352 else
40044353 elem = child.deepCopy(); // ?
40054354 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4355
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074356 // elem = elem.get(0);
40084357 makeSomething(elem, true); // ?? first);
40094358 //group.addChild(elem);
....@@ -4023,14 +4372,14 @@
40234372 //Object3D cb = Applet3D.clipboard;
40244373 //temp.addChild(cb);
40254374 //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());
4375
+ assert(GrafreeD.clipboard.parent == null);
4376
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4377
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4378
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
4379
+ makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
40314380 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4381
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4382
+ GrafreeD.clipboard.get(0).parent = keepparent;
40344383 }
40354384
40364385 ResetModel();
....@@ -4039,7 +4388,7 @@
40394388
40404389 void pasteInto(boolean copyit)
40414390 {
4042
-// if (GraphreeD.clipboard == null)
4391
+// if (GrafreeD.clipboard == null)
40434392 // return;
40444393
40454394 if (group.selection.size() != 1)
....@@ -4072,9 +4421,9 @@
40724421 {
40734422 boolean first = true;
40744423
4075
- if (GraphreeD.clipboardIsTempGroup)
4424
+ if (GrafreeD.clipboardIsTempGroup)
40764425 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4426
+ Composite temp = (Composite)GrafreeD.clipboard;
40784427 Object3D copy;
40794428 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804429 {
....@@ -4084,7 +4433,7 @@
40844433 }
40854434 } else
40864435 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4436
+ linkSomething(GrafreeD.clipboard); //.get(0));
40884437 }
40894438 }
40904439 }
....@@ -4276,6 +4625,26 @@
42764625 makeSomething(csg);
42774626 }
42784627
4628
+ void Ungroup(Object3D g)
4629
+ {
4630
+ if (g instanceof HiddenObject)
4631
+ {
4632
+ HiddenObject h = (HiddenObject) g;
4633
+
4634
+ for (int i=0; i<h.ActualSize(); i++)
4635
+ {
4636
+ objEditor.makeSomething(h.get(i), false);
4637
+ }
4638
+ }
4639
+ else
4640
+ {
4641
+ for (int i=0; i<g.Size(); i++)
4642
+ {
4643
+ objEditor.makeSomething(g.get(i), false);
4644
+ }
4645
+ }
4646
+ }
4647
+
42794648 void ungroup()
42804649 {
42814650 /*
....@@ -4471,7 +4840,7 @@
44714840
44724841 void ImportGFD()
44734842 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4843
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754844 browser.show();
44764845 String filename = browser.getFile();
44774846 if (filename != null && filename.length() > 0)
....@@ -4509,7 +4878,7 @@
45094878
45104879 void ImportVRMLX3D()
45114880 {
4512
- if (GraphreeD.standAlone)
4881
+ if (GrafreeD.standAlone)
45134882 {
45144883 /**/
45154884 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +4895,7 @@
45264895
45274896 String GetFile(String dialogName)
45284897 {
4529
- if (GraphreeD.standAlone)
4898
+ if (GrafreeD.standAlone)
45304899 {
45314900 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45324901 browser.show();
....@@ -4635,6 +5004,7 @@
46355004 private MenuItem resetsupportItem;
46365005 private MenuItem resetreferencesItem;
46375006 private MenuItem linkverticesItem;
5007
+ private MenuItem relinkverticesItem;
46385008 private MenuItem setMasterItem;
46395009 private MenuItem resetMeshItem;
46405010 private MenuItem stepAllItem;
....@@ -4653,8 +5023,10 @@
46535023 private MenuItem clearItem;
46545024 private MenuItem clearAllItem;
46555025 private MenuItem genUVItem;
5026
+ private MenuItem genNormalsMESHItem;
46565027 private MenuItem genNormalsCADItem;
46575028 private MenuItem genNormalsORGANItem;
5029
+ private MenuItem genNormalsMINEItem;
46585030 private MenuItem stripifyItem;
46595031 private MenuItem unstripifyItem;
46605032 private MenuItem trimItem;
....@@ -4696,6 +5068,7 @@
46965068 private MenuItem resetCentroidItem;
46975069 private MenuItem transformgeometryItem;
46985070 private MenuItem resetTransformItem;
5071
+ private MenuItem hideItem;
46995072 private MenuItem grabItem;
47005073 private MenuItem backItem;
47015074 private MenuItem frontItem;
....@@ -4716,6 +5089,7 @@
47165089
47175090 private MenuItem resetParentItem;
47185091 private MenuItem repairParentItem;
5092
+ private MenuItem repairShadowItem;
47195093 private MenuItem sortbysizeItem;
47205094 private MenuItem sortbynameItem;
47215095
....@@ -4728,12 +5102,15 @@
47285102 private MenuItem particleItem;
47295103 private MenuItem ragdollItem;
47305104 private MenuItem ragdoll2Item;
5105
+ private MenuItem heightFieldItem;
5106
+ private MenuItem textureFieldItem;
47315107 private MenuItem gridItem;
47325108 private MenuItem rectoidItem;
47335109 private MenuItem ellipsoidItem;
47345110 private MenuItem coneItem;
47355111 private MenuItem torusItem;
47365112 private MenuItem superItem;
5113
+ private MenuItem kleinItem;
47375114 private MenuItem blobItem;
47385115 private MenuItem latheItem;
47395116 private MenuItem bezierItem;
....@@ -4746,6 +5123,7 @@
47465123 private MenuItem csgItem;
47475124 private MenuItem templateItem;
47485125 private MenuItem textureItem;
5126
+ private MenuItem billboardItem;
47495127 private MenuItem shadowXItem;
47505128 private MenuItem shadowYItem;
47515129 private MenuItem shadowZItem;