Normand Briere
2019-04-29 6c2c00ee7f33ec46f79eba11c349f766cb207ec0
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
....@@ -407,76 +435,24 @@
407435 oe.buttonGroup.add(dummyButton);
408436 */
409437 aConstraints.gridy += 1;
438
+
439
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440
+
410441 oe.aConstraints.gridwidth = 1;
411442 oe.aConstraints.gridx = 0;
412443
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
444
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
+ liveCB.setToolTipText("Enabled animation");
414446 liveCB.addItemListener(this);
415447
416448 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);
449
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
450
+ trackCB.setToolTipText("Enable tracking");
476451 trackCB.addItemListener(this);
477452
478453 oe.aConstraints.gridx += 1;
479454 oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
455
+ screenfitButton.setToolTipText("Screen fit");
480456 screenfitButton.addActionListener(this);
481457 oe.aConstraints.gridx += 1;
482458 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
....@@ -484,6 +460,7 @@
484460 // oe.aConstraints.gridx += 1;
485461 oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486462 snapobjectButton.addActionListener(this);
463
+ snapobjectButton.setToolTipText("Snap Object");
487464 oe.aConstraints.gridx += 1;
488465
489466 //aConstraints.gridx = 0;
....@@ -492,28 +469,39 @@
492469 oe.aConstraints.gridwidth = 1;
493470
494471 oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
+ flashSelectionButton.setToolTipText("Show selection");
495473 flashSelectionButton.addActionListener(this);
474
+
475
+ oe.toolbarPanel.add(new cButton(" ", false));
476
+
496477 oe.aConstraints.gridx += 1;
497478 oe.aConstraints.weighty = 0;
498479 oe.aConstraints.gridwidth = 1;
499480
500481 //
501482 oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
483
+ twoButton.setToolTipText("Show center view only");
502484 twoButton.addActionListener(this);
503485 oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
504486 fourButton.addActionListener(this);
487
+ fourButton.setToolTipText("Show left panel only");
505488 oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
489
+ sixButton.setToolTipText("2-column layout left");
506490 sixButton.addActionListener(this);
507491 oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
492
+ threeButton.setToolTipText("2-column layout right");
508493 threeButton.addActionListener(this);
509494 oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
495
+ sevenButton.setToolTipText("3-column layout");
510496 sevenButton.addActionListener(this);
511497 //
512498
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
499
+ oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
+ rootButton.setToolTipText("Edit object in new tab");
514501 rootButton.addActionListener(this);
515502 oe.aConstraints.gridx += 1;
516503 oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
504
+ closeButton.setToolTipText("Close tab");
517505 closeButton.addActionListener(this);
518506 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519507 //clearButton.addActionListener(this);
....@@ -616,17 +604,91 @@
616604 radio.layout = sevenButton;
617605 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618606 }
607
+
608
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
609
+ {
610
+ //constraints.gridx = 0;
611
+ //constraints.gridy = 0;
612
+ panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
+ fastCB.setToolTipText("Fast mode");
614
+ fastCB.addItemListener(this);
615
+ //constraints.gridy += 1;
616
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
+ supportCB.setToolTipText("Enabled rigging");
618
+ supportCB.addItemListener(this);
619
+
620
+ // constraints.gridy += 1;
621
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
622
+ // localCB.addItemListener(this);
623
+
624
+ //constraints.gridy += 1;
625
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
626
+ crowdCB.setToolTipText("Used for crowds");
627
+ crowdCB.addItemListener(this);
628
+
629
+ //constraints.gridy += 1;
630
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
631
+ smoothCB.setToolTipText("Snapping delay");
632
+ smoothCB.addItemListener(this);
633
+
634
+ //constraints.gridy += 1;
635
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
636
+ slowCB.setToolTipText("Smooth interpolation");
637
+ slowCB.addItemListener(this);
638
+ //constraints.gridy += 1;
639
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640
+ boxCB.setToolTipText("Display bounding boxes");
641
+ boxCB.addItemListener(this);
642
+ //constraints.gridy += 1;
643
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645
+ zoomBoxCB.addItemListener(this);
646
+
647
+// constraints.gridy += 1;
648
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
649
+// speakerMocapCB.addItemListener(this);
650
+
651
+ if (false)
652
+ {
653
+ // handled in scripts
654
+ //constraints.gridy += 1;
655
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
656
+ speakerCameraCB.addItemListener(this);
657
+
658
+ //constraints.gridy += 1;
659
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
660
+ speakerFocusCB.addItemListener(this);
661
+
662
+ //constraints.gridy += 1;
663
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
664
+ smoothfocusCB.addItemListener(this);
665
+ }
666
+
667
+//constraints.gridx += 1;
668
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
669
+// debugCB.addItemListener(this);
670
+
671
+ //constraints.gridy += 1;
672
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
673
+ oeilCB.addItemListener(this);
674
+
675
+ //constraints.gridy += 1;
676
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
677
+ lookAtCB.setToolTipText("Look-at target");
678
+ lookAtCB.addItemListener(this);
679
+
680
+ }
619681
620682 void EditObject(Object3D obj)
621683 {
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();
684
+ cRadio radioButton = new cRadio(obj.name);
685
+ radioButton.SetObject(obj);
686
+ radioButton.layout = sevenButton;
687
+ radioButton.SetCamera(cameraView.renderCamera, false);
688
+ radioButton.addActionListener(this);
689
+ radioPanel.add(radioButton);
690
+ buttonGroup.add(radioButton);
691
+ radioButton.doClick();
630692 }
631693 void SetupViews(ObjEditor oe)
632694 {
....@@ -646,6 +708,7 @@
646708 JCheckBox fastCB;
647709 JCheckBox slowCB;
648710 JCheckBox boxCB;
711
+ JCheckBox zoomBoxCB;
649712 JCheckBox trackCB;
650713 JCheckBox smoothfocusCB;
651714 // JCheckBox speakerMocapCB;
....@@ -688,8 +751,7 @@
688751 dropAttributes |= Object3D.TEXTURE;
689752 else
690753 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
754
+ } else if(e.getSource() == liveCB)
693755 {
694756 cameraView.ToggleLive();
695757 }
....@@ -726,6 +788,10 @@
726788 Recompile();
727789 cameraView.repaint();
728790 // refreshContents();
791
+ }
792
+ else if(e.getSource() == zoomBoxCB)
793
+ {
794
+ cameraView.ToggleZoomBoxMode();
729795 }
730796 else if(e.getSource() == smoothfocusCB)
731797 {
....@@ -1002,6 +1068,8 @@
10021068
10031069 void buildCreateMenu(Menu menu)
10041070 {
1071
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1072
+ //heightFieldItem.addActionListener(this);
10051073 gridItem = menu.add(new MenuItem("Grid"));
10061074 gridItem.addActionListener(this);
10071075 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,6 +1082,8 @@
10141082 torusItem.addActionListener(this);
10151083 superItem = menu.add(new MenuItem("Superellipsoid"));
10161084 superItem.addActionListener(this);
1085
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1086
+ kleinItem.addActionListener(this);
10171087 particleItem = menu.add(new MenuItem("Particle system"));
10181088 particleItem.addActionListener(this);
10191089 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1048,15 +1118,6 @@
10481118 doubleItem.addActionListener(this);
10491119 tripleItem = menu.add(new MenuItem("Trident"));
10501120 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);
10601121 }
10611122
10621123 void buildToolsMenu(Menu menu)
....@@ -1068,6 +1129,8 @@
10681129 menu.add("-");
10691130 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701131 parseverticesItem.addActionListener(this);
1132
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1133
+ textureFieldItem.addActionListener(this);
10711134 alignItem = menu.add(new MenuItem("Align"));
10721135 alignItem.addActionListener(this);
10731136 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
....@@ -1094,6 +1157,8 @@
10941157 resetParentItem.addActionListener(this);
10951158 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961159 repairParentItem.addActionListener(this);
1160
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1161
+ repairShadowItem.addActionListener(this);
10971162 menu.add(invariantsItem = new MenuItem("Invariants"));
10981163 invariantsItem.addActionListener(this);
10991164 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1429,9 +1494,9 @@
14291494
14301495 void Overwrite(int mask)
14311496 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1497
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14331498 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1499
+ Object3D content = GrafreeD.clipboard.get(0);
14351500
14361501 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371502 content = ((cGroup)content).get(0);
....@@ -1454,6 +1519,7 @@
14541519 //
14551520 public void actionPerformed(ActionEvent event) // , Object arg)
14561521 {
1522
+ Object source = event.getSource();
14571523 /*
14581524 if (event.getSource() == nameField)
14591525 {
....@@ -1465,11 +1531,11 @@
14651531 }
14661532 else
14671533 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1534
+ if (source == lookAtItem || source == lookFromItem)
14691535 {
14701536 ScreenFit();
14711537 } else
1472
- if (event.getSource() == switchItem)
1538
+ if (source == switchItem)
14731539 {
14741540 cVector v1 = new cVector();
14751541 cVector v2 = new cVector();
....@@ -1478,11 +1544,11 @@
14781544 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791545 objEditor.cameraView.repaint();
14801546 } else
1481
- if (event.getSource() == rectoidItem)
1547
+ if (source == rectoidItem)
14821548 {
14831549 makeSomething(new Box());
14841550 } else
1485
- if (event.getSource() == particleItem)
1551
+ if (source == particleItem)
14861552 {
14871553 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881554 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1569,9 @@
15031569 applyExample(particleGeom, "SMOKE");
15041570 makeSomething(particleGeom);
15051571 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1572
+ if (source == ragdollItem || source == ragdoll2Item)
15071573 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1574
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091575
15101576 ragdoll.toParent = LA.newMatrix();
15111577 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1587,71 @@
15211587 makeSomething(ragdoll);
15221588 //makeSomething(new VehicleDemo());
15231589 } else
1524
- if (event.getSource() == gridItem)
1590
+ /*
1591
+ */
1592
+ if (source == heightFieldItem)
1593
+ {
1594
+ Object3D obj = new Object3D();
1595
+
1596
+ obj.CreateMaterial();
1597
+ obj.bRep = new BoundaryRep();
1598
+
1599
+ obj.bRep.CreateMesh(new iHeightField()
1600
+ {
1601
+ public double f(double x, double y)
1602
+ {
1603
+ // The Mandelbrot set is represented by coloring
1604
+ // each point (x,y) according to the number of
1605
+ // iterations it takes before the while loop in
1606
+ // this method ends. For points that are actually
1607
+ // in the Mandelbrot set, or very close to it, the
1608
+ // count will reach the maximum value, 80. These
1609
+ // points will be colored purple. All other colors
1610
+ // represent points that are definitely NOT in the set.
1611
+ x -= 600;
1612
+ y -= 500;
1613
+ x /= 200;
1614
+ y /= 200;
1615
+ int count = 0;
1616
+ double zx = x;
1617
+ double zy = y;
1618
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1619
+ double new_zx = zx*zx - zy*zy + x;
1620
+ zy = 2*zx*zy + y;
1621
+ zx = new_zx;
1622
+ count++;
1623
+ }
1624
+ return count; // Math.sqrt(count);
1625
+ }
1626
+ }, 1000,1000);
1627
+
1628
+ makeSomething(obj);
1629
+ } else
1630
+ if (source == gridItem)
15251631 {
15261632 makeSomething(new Grid());
15271633 } else
1528
- if (event.getSource() == ellipsoidItem)
1634
+ if (source == ellipsoidItem)
15291635 {
15301636 makeSomething(new Sphere());
15311637 } else
1532
- if (event.getSource() == coneItem)
1638
+ if (source == coneItem)
15331639 {
15341640 makeSomething(new Cone());
15351641 } else
1536
- if (event.getSource() == torusItem)
1642
+ if (source == torusItem)
15371643 {
15381644 makeSomething(new Torus());
15391645 } else
1540
- if (event.getSource() == superItem)
1646
+ if (source == superItem)
15411647 {
15421648 makeSomething(new Superellipsoid());
15431649 } else
1544
- if (event.getSource() == blobItem)
1650
+ if (source == kleinItem)
1651
+ {
1652
+ makeSomething(new Klein());
1653
+ } else
1654
+ if (source == blobItem)
15451655 {
15461656 Blob blob = new Blob();
15471657 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1659,15 @@
15491659 //blob.retile();
15501660 makeSomething(blob);
15511661 } else
1552
- if (event.getSource() == latheItem)
1662
+ if (source == latheItem)
15531663 {
15541664 makeSomething(new Lathe());
15551665 } else
1556
- if (event.getSource() == bezierItem)
1666
+ if (source == bezierItem)
15571667 {
15581668 makeSomething(new BezierSurface());
15591669 } else
1560
- if (event.getSource() == checkerItem)
1670
+ if (source == checkerItem)
15611671 {
15621672 /*
15631673 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1680,9 @@
15701680 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711681 LA.matInvert(obj.toParent, obj.fromParent);
15721682 */
1573
- makeSomething(new CheckerIG());
1683
+ makeSomething(new Checker());
15741684 } else
1575
- if (event.getSource() == meshItem)
1685
+ if (source == meshItem)
15761686 {
15771687 Object3D itemtomake = new Object3D();
15781688 Object3D child;
....@@ -1593,35 +1703,35 @@
15931703 makeSomething(child);
15941704 }
15951705 } else
1596
- if (event.getSource() == springItem)
1706
+ if (source == springItem)
15971707 {
15981708 cSpring s = new cSpring();
15991709 s.setup();
16001710 makeSomething(s);
16011711 } else
1602
- if (event.getSource() == flagItem)
1712
+ if (source == flagItem)
16031713 {
16041714 cSpring s = new cFlag();
16051715 s.setup();
16061716 makeSomething(s);
16071717 } else
1608
- if (event.getSource() == lightItem)
1718
+ if (source == lightItem)
16091719 {
16101720 makeSomething(new Light());
16111721 } else
1612
- if (event.getSource() == csgItem)
1722
+ if (source == csgItem)
16131723 {
16141724 group(new CSG());
16151725 } else
1616
- if (event.getSource() == templateItem)
1726
+ if (source == templateItem)
16171727 {
16181728 group(new cTemplate());
16191729 } else
1620
- if (event.getSource() == attributeItem)
1730
+ if (source == attributeItem)
16211731 {
16221732 makeSomething(new Attribute());
16231733 } else
1624
- if (event.getSource() == pointflowItem)
1734
+ if (source == pointflowItem)
16251735 {
16261736 makeSomething(new PointFlow());
16271737 } else
....@@ -1633,7 +1743,7 @@
16331743 } else
16341744 */
16351745
1636
- if (event.getSource() == superLoopItem)
1746
+ if (source == superLoopItem)
16371747 {
16381748 Composite g = new cGroup();
16391749 for (int i=0; i<15; i++)
....@@ -1655,7 +1765,7 @@
16551765
16561766 group(g);
16571767 } else
1658
- if (event.getSource() == loopItem)
1768
+ if (source == loopItem)
16591769 {
16601770 Composite csg = new GroupLeaf();
16611771 csg.count = 5;
....@@ -1664,7 +1774,7 @@
16641774 csg.addChild(child);
16651775 child.addChild(csg);
16661776 } else
1667
- if (event.getSource() == doubleItem)
1777
+ if (source == doubleItem)
16681778 {
16691779 Composite csg = new GroupLeaf();
16701780 csg.count = 5;
....@@ -1676,7 +1786,7 @@
16761786 csg.addChild(child);
16771787 child.addChild(csg);
16781788 } else
1679
- if (event.getSource() == tripleItem)
1789
+ if (source == tripleItem)
16801790 {
16811791 Composite csg = new GroupLeaf();
16821792 csg.count = 4;
....@@ -1692,70 +1802,70 @@
16921802 child.addChild(csg);
16931803 } else
16941804
1695
- if (event.getSource() == importGFDItem)
1805
+ if (source == importGFDItem)
16961806 {
16971807 ImportGFD();
16981808 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1809
+ if (source == importVRMLX3DItem)
17001810 {
17011811 ImportVRMLX3D();
17021812 } else
1703
- if (event.getSource() == import3DSItem)
1813
+ if (source == import3DSItem)
17041814 {
17051815 objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
17061816 } else
1707
- if (event.getSource() == importOBJItem)
1817
+ if (source == importOBJItem)
17081818 {
17091819 objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
17101820 } else
1711
- if (event.getSource() == computeAOItem)
1821
+ if (source == computeAOItem)
17121822 {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1823
+ Globals.drawMode = CameraPane.OCCLUSION;
1824
+ Globals.theRenderer.repaint();
17151825 } else
1716
- if (event.getSource() == recompileItem)
1826
+ if (source == recompileItem)
17171827 {
17181828 Recompile();
17191829 refreshContents();
17201830 } else
1721
- if (event.getSource() == editScriptItem)
1831
+ if (source == editScriptItem)
17221832 {
17231833 OpenDialog();
17241834 refreshContents();
17251835 } else
1726
- if (event.getSource() == invariantsItem)
1836
+ if (source == invariantsItem)
17271837 {
17281838 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1839
+ GrafreeD.grafreeD.universe.invariants();
17301840 } else
1731
- if (event.getSource() == memoryItem)
1841
+ if (source == memoryItem)
17321842 {
17331843 //System.out.println("Invariants:");
17341844 PrintMemory();
17351845 } else
1736
- if (event.getSource() == pathItem)
1846
+ if (source == pathItem)
17371847 {
17381848 PrintPath();
17391849 } else
1740
- if (event.getSource() == analyzeItem)
1850
+ if (source == analyzeItem)
17411851 {
17421852 AnalyzeObject();
17431853 } else
1744
- if (event.getSource() == dumpItem)
1854
+ if (source == dumpItem)
17451855 {
17461856 DumpObject();
17471857 } else
1748
- if (event.getSource() == screenfitButton)
1858
+ if (source == screenfitButton)
17491859 {
17501860 //Reload(lastConverter, lastFilename, true);
17511861 ScreenFit();
17521862 } else
1753
- if (event.getSource() == screenfitpointButton)
1863
+ if (source == screenfitpointButton)
17541864 {
17551865 //Reload(lastConverter, lastFilename, true);
17561866 ScreenFitPoint();
17571867 } else
1758
- if (event.getSource() == snapobjectButton)
1868
+ if (source == snapobjectButton)
17591869 {
17601870 //Reload(lastConverter, lastFilename, true);
17611871 SnapObject();
....@@ -1766,13 +1876,13 @@
17661876 // Recompile();
17671877 // refreshContents();
17681878 // } else
1769
- if (event.getSource() == gcButton)
1879
+ if (source == gcButton)
17701880 {
17711881 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17721882 System.gc();
17731883 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17741884 } else
1775
- if (event.getSource() == editLeafItem)
1885
+ if (source == editLeafItem)
17761886 {
17771887 Object3D obj;
17781888 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +1896,66 @@
17861896 }
17871897 refreshContents(true);
17881898 } else
1789
- if (event.getSource() == openWindowItem)
1899
+ if (source == openWindowItem)
17901900 {
17911901 EditSelection(true);
17921902 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
1903
+ if (source == cutItem || source == clearButton)
17941904 {
17951905 loadClipboard(true);
17961906 } else
1797
- if (event.getSource() == duplicateItem)
1907
+ if (source == duplicateItem)
17981908 {
1799
- Object3D keep = GraphreeD.clipboard;
1909
+ Object3D keep = GrafreeD.clipboard;
18001910 loadClipboard(false);
18011911 paste(false);
1802
- GraphreeD.clipboard = keep;
1912
+ GrafreeD.clipboard = keep;
18031913 } else
1804
- if (event.getSource() == cloneItem)
1914
+ if (source == cloneItem)
18051915 {
18061916 CloneSelection(false);
18071917 } else
1808
- if (event.getSource() == cloneSupportItem)
1918
+ if (source == cloneSupportItem)
18091919 {
18101920 CloneSelection(true);
18111921 } else
1812
- if (event.getSource() == copyItem)
1922
+ if (source == copyItem)
18131923 {
18141924 loadClipboard(false);
18151925 } else
1816
- if (event.getSource() == pasteItem)
1926
+ if (source == pasteItem)
18171927 {
18181928 paste(false);
18191929 } else
1820
- if (event.getSource() == pasteLinkItem)
1930
+ if (source == pasteLinkItem)
18211931 {
18221932 pasteInto(false);
18231933 } else
1824
- if (event.getSource() == pasteCloneItem)
1934
+ if (source == pasteCloneItem)
18251935 {
18261936 pasteInto(true);
18271937 } else
1828
- if (event.getSource() == pasteExpandItem)
1938
+ if (source == pasteExpandItem)
18291939 {
18301940 paste(true);
18311941 } else
1832
- if (event.getSource() == synchronizeItem)
1942
+ if (source == synchronizeItem)
18331943 {
18341944 Overwrite(Object3D.TRANSFORM);
18351945 } else
1836
- if (event.getSource() == overwriteNameItem)
1946
+ if (source == overwriteNameItem)
18371947 {
18381948 Overwrite(Object3D.NAME);
18391949 } else
1840
- if (event.getSource() == overwriteUVItem)
1950
+ if (source == overwriteUVItem)
18411951 {
18421952 Overwrite(Object3D.UV);
18431953 } else
1844
- if (event.getSource() == overwriteMatItem)
1954
+ if (source == overwriteMatItem)
18451955 {
1956
+ /* july 2015
18461957 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
1958
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18481959 else
18491960 {
18501961 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +1967,16 @@
18561967 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18571968 }
18581969 }
1970
+ */
1971
+
1972
+ Overwrite(dropAttributes);
18591973 }
1860
- if (event.getSource() == overwriteGeoItem)
1974
+ if (source == overwriteGeoItem)
18611975 {
18621976 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1977
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18641978 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
1979
+// Object3D content = GrafreeD.clipboard.get(0);
18661980 //
18671981 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18681982 // content = ((cGroup)content).get(0);
....@@ -1874,7 +1988,7 @@
18741988 // refreshContents();
18751989 // }
18761990 } else
1877
- if (event.getSource() == generateMeshItem)
1991
+ if (source == generateMeshItem)
18781992 {
18791993 //if (group.selection.size() == 1)
18801994 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +1999,7 @@
18851999 ResetModel();
18862000 refreshContents();
18872001 } else
1888
- if (event.getSource() == extractGeometriesItem)
2002
+ if (source == extractGeometriesItem)
18892003 {
18902004 boolean one = false;
18912005
....@@ -1912,7 +2026,7 @@
19122026 ResetModel();
19132027 refreshContents();
19142028 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2029
+ if (source == cloneGeometriesItem)
19162030 {
19172031 boolean one = false;
19182032
....@@ -1938,32 +2052,37 @@
19382052 ResetModel();
19392053 refreshContents();
19402054 } else
1941
- if (event.getSource() == shareGeometriesItem)
2055
+ if (source == shareGeometriesItem)
19422056 {
19432057 boolean one = false;
19442058
19452059 if (group.selection.size() == 1)
19462060 one = true;
19472061
2062
+ Object3D merge = null;
2063
+
19482064 Object3D content = new cGroup();
19492065
19502066 for (int i=0; i<group.selection.size(); i++)
19512067 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2068
+ merge = new Merge(group.selection.get(i));
19532069
19542070 if (one)
1955
- makeSomething(sel, false);
2071
+ makeSomething(merge, false);
19562072 else
1957
- content.addChild(sel);
2073
+ content.addChild(merge);
19582074 }
19592075
19602076 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2077
+ makeSomething(content, true);
2078
+ else
2079
+ {
2080
+ ResetModel();
2081
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2082
+ refreshContents();
2083
+ }
19652084 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2085
+ if (source == mergeGeometriesItem)
19672086 {
19682087 boolean one = false;
19692088
....@@ -1993,11 +2112,11 @@
19932112 ResetModel();
19942113 refreshContents();
19952114 } else
1996
- if (event.getSource() == linkverticesItem)
2115
+ if (source == linkverticesItem)
19972116 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2117
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992118 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2119
+// Object3D content = GrafreeD.clipboard.get(0);
20012120 //
20022121 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032122 // content = ((cGroup)content).get(0);
....@@ -2006,14 +2125,14 @@
20062125 // group.selection.get(0).setMasterThis(content); // should be identity
20072126 // refreshContents();
20082127 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2128
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20102129 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2130
+ Object3D content = GrafreeD.clipboard.get(0);
20122131
20132132 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142133 content = ((cGroup)content).get(0);
20152134
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2135
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172136 for (int i=0; i<group.selection.size(); i++)
20182137 {
20192138 boolean random = CameraPane.RANDOM;
....@@ -2022,11 +2141,11 @@
20222141 // group.selection.get(i).setMasterThis(content); // should be identity
20232142 CameraPane.RANDOM = random;
20242143 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2144
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262145 refreshContents();
20272146 }
20282147 } else
2029
- if (event.getSource() == resetsupportItem)
2148
+ if (source == resetsupportItem)
20302149 {
20312150 for (int i=0; i<group.selection.size(); i++)
20322151 {
....@@ -2038,7 +2157,16 @@
20382157
20392158 refreshContents();
20402159 } else
2041
- if (event.getSource() == resetreferencesItem)
2160
+ if (source == relinkverticesItem)
2161
+ {
2162
+ boolean random = CameraPane.RANDOM;
2163
+ CameraPane.RANDOM = false; // parse all random nodes
2164
+ group.selection.RelinkToSupport();
2165
+ CameraPane.RANDOM = random;
2166
+
2167
+ refreshContents();
2168
+ } else
2169
+ if (source == resetreferencesItem)
20422170 {
20432171 for (int i=0; i<group.selection.size(); i++)
20442172 {
....@@ -2047,11 +2175,11 @@
20472175
20482176 refreshContents();
20492177 } else
2050
- if (event.getSource() == setMasterItem)
2178
+ if (source == setMasterItem)
20512179 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2180
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20532181 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2182
+ Object3D content = GrafreeD.clipboard.get(0);
20552183
20562184 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572185 content = ((cGroup)content).get(0);
....@@ -2060,13 +2188,13 @@
20602188 refreshContents();
20612189 }
20622190 } else
2063
- if (event.getSource() == poseMeshItem)
2191
+ if (source == poseMeshItem)
20642192 {
20652193 if (group.selection.size() == 1)
20662194 {
2067
- if (GraphreeD.clipboard.size() == 1)
2195
+ if (GrafreeD.clipboard.size() == 1)
20682196 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2197
+ Object3D content = GrafreeD.clipboard.get(0);
20702198
20712199 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722200 content = ((cGroup)content).get(0);
....@@ -2079,19 +2207,19 @@
20792207 }
20802208
20812209 } else
2082
- if (event.getSource() == revertMeshItem)
2210
+ if (source == revertMeshItem)
20832211 {
20842212 RevertMeshes();
20852213 } else
2086
- if (event.getSource() == resetMeshItem)
2214
+ if (source == resetMeshItem)
20872215 {
20882216 ResetAll();
20892217 } else
2090
- if (event.getSource() == stepAllItem)
2218
+ if (source == stepAllItem)
20912219 {
20922220 StepAll();
20932221 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2222
+ if (source == clearItem) // || event.getSource() == clearButton)
20952223 {
20962224 //int indices[] = jList.getSelectedIndices();
20972225 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2227,46 @@
20992227
21002228 ClearSelection(false);
21012229 } else
2102
- if (event.getSource() == clearAllItem)
2230
+ if (source == clearAllItem)
21032231 {
21042232 ClearSelection(true);
21052233 } else
2106
- if (event.getSource() == grabItem)
2234
+ if (source == grabItem)
21072235 {
21082236 group(new cGroup(), true);
21092237 } else
2110
- if (event.getSource() == frontItem)
2238
+ if (source == hideItem)
2239
+ {
2240
+ group(new HiddenObject());
2241
+ } else
2242
+ if (source == frontItem)
21112243 {
21122244 front();
21132245 } else
2114
- if (event.getSource() == backItem)
2246
+ if (source == backItem)
21152247 {
21162248 back();
21172249 } else
2118
- if (event.getSource() == cameraItem)
2250
+ if (source == cameraItem)
21192251 {
21202252 makeSomething(new Camera());
21212253 } else
2122
- if (event.getSource() == compositeItem)
2254
+ if (source == compositeItem)
21232255 {
21242256 group(new Composite());
21252257 } else
2126
- if (event.getSource() == randomItem)
2258
+ if (source == randomItem)
21272259 {
21282260 RandomNode random = new RandomNode();
21292261 group(random);
21302262 if (random.size() > 0)
21312263 random.name = random.get(0).name + "Rnd";
21322264 } else
2133
- if (event.getSource() == physicsItem)
2265
+ if (source == physicsItem)
21342266 {
21352267 group(new PhysicsNode());
21362268 } else
2137
- if (event.getSource() == frameselectorItem)
2269
+ if (source == frameselectorItem)
21382270 {
21392271 for (int i=0; i<group.selection.size(); i++)
21402272 {
....@@ -2146,7 +2278,7 @@
21462278 ResetModel();
21472279 refreshContents();
21482280 } else
2149
- if (event.getSource() == switchGeoItem)
2281
+ if (source == switchGeoItem)
21502282 {
21512283 for (int i=0; i<group.selection.size(); i++)
21522284 {
....@@ -2158,7 +2290,7 @@
21582290 ResetModel();
21592291 refreshContents();
21602292 } else
2161
- if (event.getSource() == switchTransfoItem)
2293
+ if (source == switchTransfoItem)
21622294 {
21632295 for (int i=0; i<group.selection.size(); i++)
21642296 {
....@@ -2170,7 +2302,7 @@
21702302 ResetModel();
21712303 refreshContents();
21722304 } else
2173
- if (event.getSource() == morphItem)
2305
+ if (source == morphItem)
21742306 {
21752307 for (int i=0; i<group.selection.size(); i++)
21762308 {
....@@ -2182,7 +2314,7 @@
21822314 ResetModel();
21832315 refreshContents();
21842316 } else
2185
- if (event.getSource() == scriptNodeItem)
2317
+ if (source == scriptNodeItem)
21862318 {
21872319 boolean atleastone = false;
21882320
....@@ -2221,191 +2353,215 @@
22212353 }
22222354 }
22232355 } else
2224
- if (event.getSource() == linkerItem)
2356
+ if (source == linkerItem)
22252357 {
22262358 group(new cLinker());
22272359 } else
2228
- if (event.getSource() == textureItem)
2360
+ if (source == textureItem)
22292361 {
22302362 group(new TextureNode());
22312363 } else
2232
- if (event.getSource() == shadowXItem)
2364
+ if (source == billboardItem)
2365
+ {
2366
+ group(new BillboardNode());
2367
+ } else
2368
+ if (source == shadowXItem)
22332369 {
22342370 CastShadow(0);
22352371 } else
2236
- if (event.getSource() == shadowYItem)
2372
+ if (source == shadowYItem)
22372373 {
22382374 CastShadow(1);
22392375 } else
2240
- if (event.getSource() == shadowZItem)
2376
+ if (source == shadowZItem)
22412377 {
22422378 CastShadow(2);
22432379 } else
2244
- if (event.getSource() == ungroupItem)
2380
+ if (source == ungroupItem)
22452381 {
2246
- ungroup();
2382
+ //ungroup();
2383
+ for (int i=0; i<group.selection.size(); i++)
2384
+ {
2385
+ Ungroup(group.selection.get(i));
2386
+ }
2387
+
2388
+ ClearSelection(false);
2389
+
2390
+ refreshContents();
22472391 } else
2248
- if (event.getSource() == genUVItem)
2392
+ if (source == genUVItem)
22492393 {
22502394 GenUV();
22512395 } else
2252
- if (event.getSource() == genNormalsCADItem)
2396
+ if (source == genNormalsCADItem)
22532397 {
22542398 GenNormals(true);
22552399 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2400
+ if (source == genNormalsMESHItem)
2401
+ {
2402
+ GenNormals(true); // TODO
2403
+ } else
2404
+ if (source == genNormalsORGANItem)
22572405 {
22582406 GenNormals(false);
22592407 } else
2260
- if (event.getSource() == stripifyItem)
2408
+ if (source == genNormalsMINEItem)
2409
+ {
2410
+ GenNormalsMINE();
2411
+ } else
2412
+ if (source == stripifyItem)
22612413 {
22622414 Stripify();
22632415 } else
2264
- if (event.getSource() == unstripifyItem)
2416
+ if (source == unstripifyItem)
22652417 {
22662418 Unstripify();
22672419 } else
2268
- if (event.getSource() == trimItem)
2420
+ if (source == trimItem)
22692421 {
22702422 Trim();
22712423 } else
2272
- if (event.getSource() == untrimItem)
2424
+ if (source == untrimItem)
22732425 {
22742426 Untrim();
22752427 } else
2276
- if (event.getSource() == clearColorsItem)
2428
+ if (source == clearColorsItem)
22772429 {
22782430 ClearColors();
22792431 } else
2280
- if (event.getSource() == clearMaterialsItem)
2432
+ if (source == clearMaterialsItem)
22812433 {
22822434 ClearMaterials();
22832435 } else
2284
- if (event.getSource() == liveleavesItem)
2436
+ if (source == liveleavesItem)
22852437 {
22862438 LiveLeaves(true);
22872439 } else
2288
- if (event.getSource() == unliveleavesItem)
2440
+ if (source == unliveleavesItem)
22892441 {
22902442 LiveLeaves(false);
22912443 } else
2292
- if (event.getSource() == supportleavesItem)
2444
+ if (source == supportleavesItem)
22932445 {
22942446 SupportLeaves(true);
22952447 } else
2296
- if (event.getSource() == unsupportleavesItem)
2448
+ if (source == unsupportleavesItem)
22972449 {
22982450 SupportLeaves(false);
22992451 } else
2300
- if (event.getSource() == hideleavesItem)
2452
+ if (source == hideleavesItem)
23012453 {
23022454 HideLeaves(true);
23032455 } else
2304
- if (event.getSource() == showleavesItem)
2456
+ if (source == showleavesItem)
23052457 {
23062458 HideLeaves(false);
23072459 } else
2308
- if (event.getSource() == markleavesItem)
2460
+ if (source == markleavesItem)
23092461 {
23102462 MarkLeaves(true);
23112463 } else
2312
- if (event.getSource() == unmarkleavesItem)
2464
+ if (source == unmarkleavesItem)
23132465 {
23142466 MarkLeaves(false);
23152467 } else
2316
- if (event.getSource() == flipVItem)
2468
+ if (source == flipVItem)
23172469 {
23182470 FlipV(true);
23192471 } else
2320
- if (event.getSource() == unflipVItem)
2472
+ if (source == unflipVItem)
23212473 {
23222474 FlipV(false);
23232475 } else
2324
- if (event.getSource() == lowTexturesItem)
2476
+ if (source == lowTexturesItem)
23252477 {
23262478 SetTexRes(0);
23272479 } else
2328
- if (event.getSource() == normalTexturesItem)
2480
+ if (source == normalTexturesItem)
23292481 {
23302482 SetTexRes(1);
23312483 } else
2332
- if (event.getSource() == highTexturesItem)
2484
+ if (source == highTexturesItem)
23332485 {
23342486 SetTexRes(2);
23352487 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2488
+ if (source == veryhighTexturesItem)
23372489 {
23382490 SetTexRes(3);
23392491 } else
2340
- if (event.getSource() == maxTexturesItem)
2492
+ if (source == maxTexturesItem)
23412493 {
23422494 SetTexRes(4);
23432495 } else
2344
- if (event.getSource() == panoTexturesItem)
2496
+ if (source == panoTexturesItem)
23452497 {
23462498 SetTexRes(5);
23472499 } else
2348
- if (event.getSource() == reverseNormalsItem)
2500
+ if (source == reverseNormalsItem)
23492501 {
23502502 ReverseNormals();
23512503 } else
2352
- if (event.getSource() == parseverticesItem)
2504
+ if (source == parseverticesItem)
23532505 {
23542506 ParseVertices();
23552507 } else
2356
- if (event.getSource() == alignItem)
2508
+ if (source == textureFieldItem)
2509
+ {
2510
+ TextureVertices();
2511
+ } else
2512
+ if (source == alignItem)
23572513 {
23582514 Align();
23592515 } else
2360
- if (event.getSource() == mirrorItem)
2516
+ if (source == mirrorItem)
23612517 {
23622518 MirrorPoses();
23632519 } else
2364
- if (event.getSource() == reduceMorphItem)
2520
+ if (source == reduceMorphItem)
23652521 {
23662522 MeshReduction(false);
23672523 } else
2368
- if (event.getSource() == reduce34MorphItem)
2524
+ if (source == reduce34MorphItem)
23692525 {
23702526 MeshReduction(true);
23712527 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2528
+ if (source == reverseTrianglesItem)
23732529 {
23742530 ReverseTriangles();
23752531 } else
2376
- if (event.getSource() == reduceMeshItem)
2532
+ if (source == reduceMeshItem)
23772533 {
23782534 ReduceMesh(false);
23792535 } else
2380
- if (event.getSource() == reduce34MeshItem)
2536
+ if (source == reduce34MeshItem)
23812537 {
23822538 ReduceMesh(true);
23832539 } else
2384
- if (event.getSource() == increaseMeshItem)
2540
+ if (source == increaseMeshItem)
23852541 {
23862542 IncreaseMesh();
23872543 } else
2388
- if (event.getSource() == clipMeshItem)
2544
+ if (source == clipMeshItem)
23892545 {
23902546 ClipMesh();
23912547 } else
2392
- if (event.getSource() == smoothMeshItem)
2548
+ if (source == smoothMeshItem)
23932549 {
23942550 SmoothMesh();
23952551 } else
2396
- if (event.getSource() == transformgeometryItem)
2552
+ if (source == transformgeometryItem)
23972553 {
23982554 TransformGeometry();
23992555 } else
2400
- if (event.getSource() == resetTransformItem)
2556
+ if (source == resetTransformItem)
24012557 {
24022558 ResetTransform();
24032559 } else
2404
- if (event.getSource() == resetCentroidItem)
2560
+ if (source == resetCentroidItem)
24052561 {
24062562 ResetCentroid();
24072563 } else
2408
- if (event.getSource() == resetParentItem)
2564
+ if (source == resetParentItem)
24092565 {
24102566 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112567 {
....@@ -2415,7 +2571,7 @@
24152571
24162572 refreshContents();
24172573 } else
2418
- if (event.getSource() == repairParentItem)
2574
+ if (source == repairParentItem)
24192575 {
24202576 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212577 {
....@@ -2429,7 +2585,21 @@
24292585
24302586 refreshContents();
24312587 } else
2432
- if (event.getSource() == sortbysizeItem)
2588
+ if (source == repairShadowItem)
2589
+ {
2590
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2591
+ {
2592
+ Object3D obj = (Object3D)e.nextElement();
2593
+ obj.RepairShadow();
2594
+// for (int i=0; i<obj.size(); i++)
2595
+// {
2596
+// obj.get(i).parent = obj;
2597
+// }
2598
+ }
2599
+
2600
+ refreshContents();
2601
+ } else
2602
+ if (source == sortbysizeItem)
24332603 {
24342604 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352605 {
....@@ -2441,7 +2611,7 @@
24412611 ResetModel();
24422612 refreshContents();
24432613 } else
2444
- if (event.getSource() == sortbynameItem)
2614
+ if (source == sortbynameItem)
24452615 {
24462616 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472617 {
....@@ -2453,7 +2623,7 @@
24532623 ResetModel();
24542624 refreshContents();
24552625 } else
2456
- if (event.getSource() == attachPigmentItem)
2626
+ if (source == attachPigmentItem)
24572627 {
24582628 String texture = GetFile("Attach pigment");
24592629 Object3D obj;
....@@ -2465,7 +2635,7 @@
24652635
24662636 refreshContents();
24672637 } else
2468
- if (event.getSource() == detachPigmentItem)
2638
+ if (source == detachPigmentItem)
24692639 {
24702640 Object3D obj;
24712641 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2646,7 @@
24762646
24772647 refreshContents();
24782648 } else
2479
- if (event.getSource() == attachBumpItem)
2649
+ if (source == attachBumpItem)
24802650 {
24812651 String texture = GetFile("Attach bump");
24822652 Object3D obj;
....@@ -2488,7 +2658,7 @@
24882658
24892659 refreshContents();
24902660 } else
2491
- if (event.getSource() == detachBumpItem)
2661
+ if (source == detachBumpItem)
24922662 {
24932663 Object3D obj;
24942664 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2669,7 @@
24992669
25002670 refreshContents();
25012671 } else
2502
- if (event.getSource() == pigmentBumpItem)
2672
+ if (source == pigmentBumpItem)
25032673 {
25042674 Object3D obj;
25052675 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2680,195 @@
25102680
25112681 refreshContents();
25122682 } else
2513
- if (event.getSource() == flashSelectionButton)
2683
+ if (source == flashSelectionButton)
25142684 {
25152685 CameraPane.flash = true;
25162686 refreshContents();
25172687 } else
2518
- if (event.getSource() == oneButton)
2688
+ if (source == oneButton)
25192689 {
25202690 } else
2521
- if (event.getSource() == twoButton)
2691
+ if (source == twoButton)
25222692 {
25232693 radio.layout = twoButton;
25242694 // bug
25252695 //gridPanel.setDividerLocation(1.0);
25262696 //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();
2697
+// bigThree.remove(scenePanel);
2698
+// bigThree.remove(centralPanel);
2699
+// bigThree.remove(XYZPanel);
2700
+// aWindowConstraints.gridx = 0;
2701
+// aWindowConstraints.gridy = 0;
2702
+// aWindowConstraints.gridwidth = 1;
2703
+// // aConstraints.gridheight = 3;
2704
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2705
+// aWindowConstraints.weightx = 0;
2706
+// aWindowConstraints.weighty = 1;
2707
+// //bigThree.add(jtp, aWindowConstraints);
2708
+// aWindowConstraints.weightx = 1;
2709
+// aWindowConstraints.gridwidth = 3;
2710
+// // aConstraints.gridheight = 3;
2711
+// aWindowConstraints.gridx = 1;
2712
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2713
+// bigThree.add(centralPanel, aWindowConstraints);
2714
+// aWindowConstraints.weightx = 0;
2715
+// aWindowConstraints.gridx = 4;
2716
+// aWindowConstraints.gridwidth = 1;
2717
+// // aConstraints.gridheight = 3;
2718
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2719
+// //bigThree.add(XYZPanel, aWindowConstraints);
2720
+// scenePanel.setVisible(false);
2721
+// centralPanel.setVisible(true);
2722
+// XYZPanel.setVisible(false);
2723
+ bigThree.ClearUI();
2724
+ bigThree.add(centralPanel);
2725
+ bigThree.FlushUI();
25512726 } else
2552
- if (event.getSource() == threeButton)
2727
+ if (source == threeButton)
25532728 {
25542729 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();
2730
+
2731
+// bigThree.remove(scenePanel);
2732
+// bigThree.remove(centralPanel);
2733
+// bigThree.remove(XYZPanel);
2734
+// aWindowConstraints.gridx = 0;
2735
+// aWindowConstraints.gridy = 0;
2736
+// aWindowConstraints.gridwidth = 1;
2737
+// // aConstraints.gridheight = 3;
2738
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2739
+// aWindowConstraints.weightx = 0;
2740
+// aWindowConstraints.weighty = 1;
2741
+// //bigThree.add(jtp, aWindowConstraints);
2742
+// aWindowConstraints.weightx = 1;
2743
+// aWindowConstraints.gridwidth = 3;
2744
+// // aConstraints.gridheight = 3;
2745
+// aWindowConstraints.gridx = 1;
2746
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2747
+// bigThree.add(centralPanel, aWindowConstraints);
2748
+// aWindowConstraints.weightx = 0;
2749
+// aWindowConstraints.gridx = 4;
2750
+// aWindowConstraints.gridwidth = 1;
2751
+// // aConstraints.gridheight = 3;
2752
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2753
+// bigThree.add(XYZPanel, aWindowConstraints);
2754
+// bigThree.validate();
2755
+// scenePanel.setVisible(false);
2756
+// centralPanel.setVisible(true);
2757
+// XYZPanel.setVisible(true);
2758
+ bigThree.ClearUI();
2759
+ bigThree.add(centralPanel);
2760
+ bigThree.add(XYZPanel);
2761
+ bigThree.FlushUI();
25792762 } else
2580
- if (event.getSource() == fourButton)
2763
+ if (source == fourButton)
25812764 {
25822765 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();
2766
+
2767
+// bigThree.remove(scenePanel);
2768
+// bigThree.remove(centralPanel);
2769
+// bigThree.remove(XYZPanel);
2770
+// aWindowConstraints.gridx = 0;
2771
+// aWindowConstraints.gridy = 0;
2772
+// aWindowConstraints.gridwidth = 1;
2773
+// // aWindowConstraints.gridheight = 3;
2774
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2775
+// aWindowConstraints.weightx = 1;
2776
+// aWindowConstraints.weighty = 1;
2777
+// bigThree.add(scenePanel, aWindowConstraints);
2778
+// aWindowConstraints.weightx = 1;
2779
+// aWindowConstraints.gridwidth = 3;
2780
+// // aConstraints.gridheight = 3;
2781
+// aWindowConstraints.gridx = 1;
2782
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2783
+// //bigThree.add(cameraPanel, aWindowConstraints);
2784
+// aWindowConstraints.weightx = 0;
2785
+// aWindowConstraints.gridx = 4;
2786
+// aWindowConstraints.gridwidth = 1;
2787
+// // aWindowConstraints.gridheight = 3;
2788
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2789
+// //bigThree.add(XYZPanel, aWindowConstraints);
2790
+// bigThree.validate();
2791
+// scenePanel.setVisible(true);
2792
+// centralPanel.setVisible(false);
2793
+// XYZPanel.setVisible(false);
2794
+ bigThree.ClearUI();
2795
+ bigThree.add(scenePanel);
2796
+ bigThree.FlushUI();
26072797 } else
2608
- if (event.getSource() == sixButton)
2798
+ if (source == sixButton)
26092799 {
26102800 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();
2801
+
2802
+// bigThree.remove(scenePanel);
2803
+// bigThree.remove(centralPanel);
2804
+// bigThree.remove(XYZPanel);
2805
+// aWindowConstraints.gridx = 0;
2806
+// aWindowConstraints.gridy = 0;
2807
+// aWindowConstraints.gridwidth = 1;
2808
+// // aConstraints.gridheight = 3;
2809
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2810
+// aWindowConstraints.weightx = 0;
2811
+// aWindowConstraints.weighty = 1;
2812
+// bigThree.add(scenePanel, aWindowConstraints);
2813
+// aWindowConstraints.weightx = 1;
2814
+// aWindowConstraints.gridwidth = 3;
2815
+// // aWindowConstraints.gridheight = 3;
2816
+// aWindowConstraints.gridx = 1;
2817
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2818
+// bigThree.add(centralPanel, aWindowConstraints);
2819
+// aWindowConstraints.weightx = 0;
2820
+// aWindowConstraints.gridx = 4;
2821
+// aWindowConstraints.gridwidth = 1;
2822
+// // aWindowConstraints.gridheight = 3;
2823
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2824
+// //bigThree.add(XYZPanel, aConstraints);
2825
+// bigThree.validate();
2826
+// scenePanel.setVisible(true);
2827
+// centralPanel.setVisible(true);
2828
+// XYZPanel.setVisible(false);
2829
+ bigThree.ClearUI();
2830
+ bigThree.add(scenePanel);
2831
+ bigThree.add(centralPanel);
2832
+ bigThree.FlushUI();
26352833 } else
2636
- if (event.getSource() == sevenButton)
2834
+ if (source == sevenButton)
26372835 {
26382836 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();
2837
+
2838
+// bigThree.remove(scenePanel);
2839
+// bigThree.remove(centralPanel);
2840
+// bigThree.remove(XYZPanel);
2841
+// aWindowConstraints.gridx = 0;
2842
+// aWindowConstraints.gridy = 0;
2843
+// aWindowConstraints.gridwidth = 1;
2844
+// // aWindowConstraints.gridheight = 3;
2845
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2846
+// aWindowConstraints.weightx = 0;
2847
+// aWindowConstraints.weighty = 1;
2848
+// bigThree.add(scenePanel, aWindowConstraints);
2849
+// aWindowConstraints.weightx = 1;
2850
+// aWindowConstraints.gridwidth = 3;
2851
+// // aWindowConstraints.gridheight = 3;
2852
+// aWindowConstraints.gridx = 1;
2853
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2854
+// bigThree.add(centralPanel, aWindowConstraints);
2855
+// aWindowConstraints.weightx = 0;
2856
+// aWindowConstraints.gridx = 4;
2857
+// aWindowConstraints.gridwidth = 1;
2858
+// // aConstraints.gridheight = 3;
2859
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2860
+// bigThree.add(XYZPanel, aWindowConstraints);
2861
+// bigThree.validate();
2862
+// scenePanel.setVisible(true);
2863
+// centralPanel.setVisible(true);
2864
+// XYZPanel.setVisible(true);
2865
+ bigThree.ClearUI();
2866
+ bigThree.add(scenePanel);
2867
+ bigThree.add(centralPanel);
2868
+ bigThree.add(XYZPanel);
2869
+ bigThree.FlushUI();
26632870 } else
2664
- if (event.getSource() == rootButton)
2871
+ if (source == rootButton)
26652872 {
26662873 Object3D obj;
26672874 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2673,7 +2880,7 @@
26732880
26742881 refreshContents(true);
26752882 } else
2676
- if (event.getSource() == closeButton)
2883
+ if (source == closeButton)
26772884 {
26782885 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26792886 cRadio ab;
....@@ -2694,11 +2901,11 @@
26942901 }
26952902 refreshContents(true);
26962903 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
2904
+ if (source == editItem || source == editButton)
26982905 {
26992906 EditSelection(false);
27002907 } else
2701
- if (event.getSource() == uneditButton)
2908
+ if (source == uneditButton)
27022909 {
27032910 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27042911 {
....@@ -2710,12 +2917,12 @@
27102917
27112918 child.editWindow = null; // ???????????
27122919 }
2713
- objEditor.ctrlPanel.revalidate();
2920
+ objEditor.ctrlPanel.validate();
27142921 //objEditor.jTree.clearSelection();
27152922 //objEditor.ResetSliders();
27162923 refreshContents(true);
27172924 } else
2718
- if (event.getSource() == clearPanelButton)
2925
+ if (source == clearPanelButton)
27192926 {
27202927 assert(copy == group);
27212928 //copy.ClearUI();
....@@ -2726,7 +2933,7 @@
27262933 listUI.clear();
27272934 refreshContents(true);
27282935 } else
2729
- if (event.getSource() == allParamsButton)
2936
+ if (source == allParamsButton)
27302937 {
27312938 assert(copy == group);
27322939
....@@ -2747,19 +2954,19 @@
27472954
27482955 refreshContents(true);
27492956 } else
2750
- if (event.getSource() == unselectButton)
2957
+ if (source == unselectButton)
27512958 {
27522959 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
2960
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27542961 objEditor.ResetSliders();
27552962 refreshContents(true);
27562963 } else
2757
- if(event.getSource() instanceof cRadio)
2964
+ if(source instanceof cRadio)
27582965 {
27592966 group.parent = keepparent;
27602967 group.attributes = 0;
27612968 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
2969
+ /*cRadio*/ radio = (cRadio)source;
27632970 Object3D obj = radio.GetObject();
27642971 System.out.println("Edit " + obj);
27652972 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +2986,7 @@
27792986 }
27802987
27812988 copy = group;
2782
- //CameraPane.theRenderer.object = group;
2989
+ //Globals.theRenderer.object = group;
27832990 if(!useclient)
27842991 {
27852992 cameraView.renderCamera = radio.camera;
....@@ -2788,7 +2995,8 @@
27882995 cameraView.cameras[cameraView.cameracount] = radio.camera;
27892996 cameraView.targetLookAt.set(radio.camera.lookAt);
27902997 cameraView.object = group;
2791
- cameraView.lighttouched = true;
2998
+ //cameraView.lighttouched = true;
2999
+ Globals.lighttouched = true;
27923000 topView.object = group;
27933001 frontView.object = group;
27943002 sideView.object = group;
....@@ -2824,7 +3032,7 @@
28243032 if (useclient)
28253033 {
28263034 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3035
+ Globals.lighttouched = true;
28283036 //topView.object = client;
28293037 //frontView.object = client;
28303038 //sideView.object = client;
....@@ -2832,7 +3040,7 @@
28323040 else
28333041 {
28343042 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3043
+ Globals.lighttouched = true;
28363044 //topView.object = group;
28373045 //frontView.object = group;
28383046 //sideView.object = group;
....@@ -3065,9 +3273,9 @@
30653273 obj = (Object3D)e.nextElement();
30663274
30673275 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3276
+ GrafreeD.AnalyzeObject(obj);
30693277 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3278
+ GrafreeD.AnalyzeObject(obj.bRep);
30713279
30723280 // System.err.println((size/1024) + " KB is the size of " + obj);
30733281 }
....@@ -3109,6 +3317,13 @@
31093317 void GenNormals(boolean crease)
31103318 {
31113319 group.GenNormalsS(crease);
3320
+
3321
+ refreshContents();
3322
+ }
3323
+
3324
+ void GenNormalsMINE()
3325
+ {
3326
+ group.selection.GenNormalsMINE();
31123327
31133328 refreshContents();
31143329 }
....@@ -3157,104 +3372,250 @@
31573372
31583373 //Object3D buffer;
31593374 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
-
3375
+// BoundaryRep temprep;
3376
+// Object3D nodes;
3377
+// Vector<Vertex> vertices;
3378
+//
3379
+// cGroup buffer;
3380
+//
3381
+// public void Vertex(Object3D node, Vertex v)
3382
+// {
3383
+//// vertices.add(v);
3384
+//// nodes.addElement(node);
3385
+////
3386
+//// if (temprep.GetCache(v) != null)
3387
+//// {
3388
+//// temprep.Remove(v);
3389
+//// } else
3390
+//// {
3391
+//// temprep.Remember(v);
3392
+//// }
3393
+//
3394
+// //Object3D node = nodes.get(index);
3395
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3396
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3397
+//
3398
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3399
+//
3400
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3401
+//
3402
+// cGroup g = new cGroup();
3403
+//
3404
+// if (g.toParent == null)
3405
+// {
3406
+// g.toParent = LA.newMatrix();
3407
+// g.fromParent = LA.newMatrix();
3408
+// }
3409
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3410
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3411
+//
3412
+// g.add(GrafreeD.clipboard);
3413
+//
3414
+// buffer.add(g);
3415
+// }
3416
+//
3417
+// public void Face(Object3D node, Face f)
3418
+// {
3419
+//
3420
+// }
3421
+//
3422
+// void ParseVerticesOld() // ??
3423
+// {
3424
+// //if (group.selection.size() != 1)
3425
+// // return;
3426
+//
3427
+// temprep = new BoundaryRep();
3428
+// nodes = new Object3D();
3429
+// vertices = new Vector<Vertex>();
3430
+//
3431
+// boolean epsequal = GrafreeD.epsequal;
3432
+// GrafreeD.epsequal = true;
3433
+//
3434
+// for (int i=0; i<group.selection.size(); i++)
3435
+// {
3436
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3437
+//
3438
+// group.selection.get(i).Parse(
3439
+//this );
3440
+//
3441
+// int repsize = temprep.VertexCount();
3442
+// int tablesize = temprep.vertextable.size();
3443
+// int nodesize = nodes.size();
3444
+//
3445
+// assert(vertices.size() == nodes.size());
3446
+//
3447
+// temprep.vertextable.elements();
3448
+//
3449
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3450
+//
3451
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3452
+// {
3453
+// cGroup g = new cGroup();
3454
+//
3455
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3456
+//
3457
+// Object3D node = nodes.get(index);
3458
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3459
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3460
+//
3461
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3462
+//
3463
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3464
+//
3465
+// if (g.toParent == null)
3466
+// {
3467
+// g.toParent = LA.newMatrix();
3468
+// g.fromParent = LA.newMatrix();
3469
+// }
3470
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3471
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3472
+//
3473
+// g.add(GrafreeD.clipboard);
3474
+//
3475
+// buffer.add(g);
3476
+// }
3477
+//
3478
+// makeSomething(buffer, i==group.selection.size()-1);
3479
+// }
3480
+//
3481
+// GrafreeD.epsequal = epsequal;
3482
+//
3483
+// //buffer = null;
3484
+// temprep = null;
3485
+// nodes = null;
3486
+//
3487
+// refreshContents();
3488
+// }
3489
+
31843490 void ParseVertices()
31853491 {
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;
3492
+ boolean epsequal = GrafreeD.epsequal;
3493
+ GrafreeD.epsequal = true;
31953494
31963495 for (int i=0; i<group.selection.size(); i++)
31973496 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3497
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993498
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3499
+ group.selection.get(i).Parse(
3500
+
3501
+ new iParse()
3502
+ {
3503
+ public void Vertex(Object3D node, Vertex v)
3504
+ {
3505
+ temp.set(v);
3506
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053507
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();
3508
+ cGroup g = new cGroup();
32113509
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3510
+ if (g.toParent == null)
3511
+ {
3512
+ g.toParent = LA.newMatrix();
3513
+ g.fromParent = LA.newMatrix();
3514
+ }
3515
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3516
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153517
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);
3518
+ g.add(GrafreeD.clipboard);
32203519
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);
3520
+ buffer.add(g);
3521
+ }
32323522
3233
- g.add(GraphreeD.clipboard);
3523
+ public void Face(Object3D node, Face f)
3524
+ {
32343525
3235
- buffer.add(g);
3236
- }
3526
+ }
3527
+ }
3528
+ );
32373529
32383530 makeSomething(buffer, i==group.selection.size()-1);
32393531 }
32403532
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3533
+ GrafreeD.epsequal = epsequal;
32463534
32473535 refreshContents();
32483536 }
3249
-
3537
+
3538
+ void TextureVertices()
3539
+ {
3540
+ for (int i=0; i<group.selection.size(); i++)
3541
+ {
3542
+ group.selection.get(i).Parse(
3543
+ new iParse()
3544
+ {
3545
+ public void Vertex(Object3D node, Vertex v)
3546
+ {
3547
+ cTexture tex = node.GetTextures();
3548
+ String pigment = Object3D.GetPigment(tex);
3549
+ //String bump = Object3D.GetBump(tex);
3550
+
3551
+ com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3552
+
3553
+ double s = v.s;
3554
+
3555
+ if (s == 1)
3556
+ s = 0;
3557
+
3558
+ double t = v.t;
3559
+
3560
+ if (t == 1)
3561
+ t = 0;
3562
+
3563
+ int indexs = (int) (texturedata.getWidth() * s);
3564
+ int indext = (int) (texturedata.getHeight() * t);
3565
+
3566
+ int index = indext * texturedata.getWidth() + indexs;
3567
+
3568
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3569
+
3570
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3571
+
3572
+ float scale = bytebuf.get(index*slide) & 0xFF;
3573
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3574
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3575
+ scale /= 3;
3576
+
3577
+ scale /= 0xFF;
3578
+ // c'est quoi ca? scale /= 4;
3579
+
3580
+ //v.AO = scale;
3581
+
3582
+ v.x += v.norm.x * scale;
3583
+ v.y += v.norm.y * scale;
3584
+ v.z += v.norm.z * scale;
3585
+ }
3586
+
3587
+ public void Face(Object3D node, Face f)
3588
+ {
3589
+ }
3590
+ }
3591
+ );
3592
+ }
3593
+
3594
+ refreshContents();
3595
+ }
3596
+
32503597 void Align()
32513598 {
3599
+ if (group.selection.size() == 0)
3600
+ return;
3601
+
3602
+ cVector bbmin = new cVector();
3603
+ cVector bbmax = new cVector();
3604
+
3605
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3606
+
3607
+ double dx = bbmax.x - bbmin.x;
3608
+ double dy = bbmax.y - bbmin.y;
3609
+ double dz = bbmax.z - bbmin.z;
3610
+
3611
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3612
+
32523613 for (int i=0; i<group.selection.size(); i++)
32533614 {
32543615 Object3D obj = group.selection.get(i);
32553616
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3617
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3618
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583619 }
32593620
32603621 refreshContents();
....@@ -3267,7 +3628,7 @@
32673628 // ref.SaveSupports();
32683629 // Object3D par = ref.parent;
32693630 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3631
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713632 // ref.parent = par;
32723633 // ref.RestoreSupports();
32733634
....@@ -3297,7 +3658,7 @@
32973658 // lowres.SaveSupports();
32983659 // par = lowres.parent;
32993660 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3661
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013662 Object3D newlow = CloneObject(lowres, false);
33023663 newlow.name = sn.switchobject.get(i).name;
33033664 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3680,7 @@
33193680 return;
33203681
33213682 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3683
+ Object3D ref = GrafreeD.clipboard.get(0);
33233684
33243685 Object3D newgroup = new Object3D("Po:" + poses.name);
33253686
....@@ -3488,7 +3849,7 @@
34883849 group.selection.RelinkToSupport(); // july 2014
34893850 System.out.println("DONE.");
34903851 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3852
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34923853 }
34933854
34943855 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +3874,20 @@
35133874
35143875 void ClipMesh()
35153876 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3877
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
35173878 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3879
+ Object3D content = GrafreeD.clipboard.get(0);
35193880
35203881 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213882 content = ((cGroup)content).get(0);
35223883
35233884 // for (int i=0; i<group.selection.size(); i++)
35243885 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3886
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35263887 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
3888
+ group.selection.ClipMesh(GrafreeD.clipboard);
35283889 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
3890
+// group.selection.ClipMesh(GrafreeD.clipboard);
35303891 System.out.println("DONE.");
35313892 refreshContents();
35323893 }
....@@ -3773,16 +4134,16 @@
37734134
37744135 objEditor.SetText(); // jan 2014
37754136
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4137
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
37774138 CameraPane.flash = true;
37784139
37794140 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
37804141 // a camera
37814142 {
37824143 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;
4144
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4145
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4146
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864147 }
37874148
37884149 refreshContents();
....@@ -3864,12 +4225,12 @@
38644225 {
38654226 if (group.selection.isEmpty())
38664227 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4228
+ GrafreeD.clipboardIsTempGroup = false;
38684229 Composite tGroup = null;
38694230 if (group.selection.size() > 0) // 1)
38704231 {
38714232 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4233
+ GrafreeD.clipboardIsTempGroup = true;
38734234 }
38744235
38754236 if (cut)
....@@ -3909,16 +4270,16 @@
39094270 //System.out.println("cut " + child);
39104271 //System.out.println("parent = " + child.parent);
39114272 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4273
+ if (GrafreeD.clipboardIsTempGroup)
39134274 tGroup.add/*Child*/(tmp);
39144275 else
3915
- GraphreeD.clipboard = tmp;
4276
+ GrafreeD.clipboard = tmp;
39164277 }
39174278 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4279
+ if (GrafreeD.clipboardIsTempGroup)
39194280 tGroup.add/*Child*/(child);
39204281 else
3921
- GraphreeD.clipboard = child;
4282
+ GrafreeD.clipboard = child;
39224283 }
39234284
39244285 //ResetModel();
....@@ -3950,21 +4311,21 @@
39504311 //System.out.println("cut " + elem);
39514312 //System.out.println("parent = " + elem.parent);
39524313 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4314
+ if (GrafreeD.clipboardIsTempGroup)
39544315 tGroup.add/*Child*/(tmp);
39554316 else
3956
- GraphreeD.clipboard = tmp;
4317
+ GrafreeD.clipboard = tmp;
39574318 }
39584319 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4320
+ if (GrafreeD.clipboardIsTempGroup)
39604321 tGroup.add/*Child*/(child);
39614322 else
3962
- GraphreeD.clipboard = child;
4323
+ GrafreeD.clipboard = child;
39634324 }
39644325
39654326 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4327
+ if (GrafreeD.clipboardIsTempGroup)
4328
+ GrafreeD.clipboard = tGroup;
39684329 if (cut)
39694330 {
39704331 ResetModel();
....@@ -3974,11 +4335,11 @@
39744335
39754336 void paste(boolean expand)
39764337 {
3977
- // if (GraphreeD.clipboard == null)
4338
+ // if (GrafreeD.clipboard == null)
39784339 // return;
39794340 boolean first = true;
39804341
3981
- if (GraphreeD.clipboardIsTempGroup)
4342
+ if (GrafreeD.clipboardIsTempGroup)
39824343 {
39834344 Composite temp;
39844345
....@@ -3989,7 +4350,7 @@
39894350 temp = (Composite)Applet3D.clipboard.deepCopy();
39904351 */
39914352 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4353
+ for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934354 {
39944355 Object3D child = (Object3D)e.nextElement();
39954356
....@@ -4003,7 +4364,7 @@
40034364 else
40044365 elem = child.deepCopy(); // ?
40054366 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4367
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074368 // elem = elem.get(0);
40084369 makeSomething(elem, true); // ?? first);
40094370 //group.addChild(elem);
....@@ -4023,14 +4384,14 @@
40234384 //Object3D cb = Applet3D.clipboard;
40244385 //temp.addChild(cb);
40254386 //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());
4387
+ assert(GrafreeD.clipboard.parent == null);
4388
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
+ makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
40314392 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4393
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
+ GrafreeD.clipboard.get(0).parent = keepparent;
40344395 }
40354396
40364397 ResetModel();
....@@ -4039,7 +4400,7 @@
40394400
40404401 void pasteInto(boolean copyit)
40414402 {
4042
-// if (GraphreeD.clipboard == null)
4403
+// if (GrafreeD.clipboard == null)
40434404 // return;
40444405
40454406 if (group.selection.size() != 1)
....@@ -4072,9 +4433,9 @@
40724433 {
40734434 boolean first = true;
40744435
4075
- if (GraphreeD.clipboardIsTempGroup)
4436
+ if (GrafreeD.clipboardIsTempGroup)
40764437 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4438
+ Composite temp = (Composite)GrafreeD.clipboard;
40784439 Object3D copy;
40794440 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804441 {
....@@ -4084,7 +4445,7 @@
40844445 }
40854446 } else
40864447 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4448
+ linkSomething(GrafreeD.clipboard); //.get(0));
40884449 }
40894450 }
40904451 }
....@@ -4276,6 +4637,26 @@
42764637 makeSomething(csg);
42774638 }
42784639
4640
+ void Ungroup(Object3D g)
4641
+ {
4642
+ if (g instanceof HiddenObject)
4643
+ {
4644
+ HiddenObject h = (HiddenObject) g;
4645
+
4646
+ for (int i=0; i<h.ActualSize(); i++)
4647
+ {
4648
+ objEditor.makeSomething(h.get(i), false);
4649
+ }
4650
+ }
4651
+ else
4652
+ {
4653
+ for (int i=0; i<g.Size(); i++)
4654
+ {
4655
+ objEditor.makeSomething(g.get(i), false);
4656
+ }
4657
+ }
4658
+ }
4659
+
42794660 void ungroup()
42804661 {
42814662 /*
....@@ -4471,7 +4852,7 @@
44714852
44724853 void ImportGFD()
44734854 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4855
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754856 browser.show();
44764857 String filename = browser.getFile();
44774858 if (filename != null && filename.length() > 0)
....@@ -4509,7 +4890,7 @@
45094890
45104891 void ImportVRMLX3D()
45114892 {
4512
- if (GraphreeD.standAlone)
4893
+ if (GrafreeD.standAlone)
45134894 {
45144895 /**/
45154896 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +4907,7 @@
45264907
45274908 String GetFile(String dialogName)
45284909 {
4529
- if (GraphreeD.standAlone)
4910
+ if (GrafreeD.standAlone)
45304911 {
45314912 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45324913 browser.show();
....@@ -4635,6 +5016,7 @@
46355016 private MenuItem resetsupportItem;
46365017 private MenuItem resetreferencesItem;
46375018 private MenuItem linkverticesItem;
5019
+ private MenuItem relinkverticesItem;
46385020 private MenuItem setMasterItem;
46395021 private MenuItem resetMeshItem;
46405022 private MenuItem stepAllItem;
....@@ -4653,8 +5035,10 @@
46535035 private MenuItem clearItem;
46545036 private MenuItem clearAllItem;
46555037 private MenuItem genUVItem;
5038
+ private MenuItem genNormalsMESHItem;
46565039 private MenuItem genNormalsCADItem;
46575040 private MenuItem genNormalsORGANItem;
5041
+ private MenuItem genNormalsMINEItem;
46585042 private MenuItem stripifyItem;
46595043 private MenuItem unstripifyItem;
46605044 private MenuItem trimItem;
....@@ -4696,6 +5080,7 @@
46965080 private MenuItem resetCentroidItem;
46975081 private MenuItem transformgeometryItem;
46985082 private MenuItem resetTransformItem;
5083
+ private MenuItem hideItem;
46995084 private MenuItem grabItem;
47005085 private MenuItem backItem;
47015086 private MenuItem frontItem;
....@@ -4716,6 +5101,7 @@
47165101
47175102 private MenuItem resetParentItem;
47185103 private MenuItem repairParentItem;
5104
+ private MenuItem repairShadowItem;
47195105 private MenuItem sortbysizeItem;
47205106 private MenuItem sortbynameItem;
47215107
....@@ -4728,12 +5114,15 @@
47285114 private MenuItem particleItem;
47295115 private MenuItem ragdollItem;
47305116 private MenuItem ragdoll2Item;
5117
+ private MenuItem heightFieldItem;
5118
+ private MenuItem textureFieldItem;
47315119 private MenuItem gridItem;
47325120 private MenuItem rectoidItem;
47335121 private MenuItem ellipsoidItem;
47345122 private MenuItem coneItem;
47355123 private MenuItem torusItem;
47365124 private MenuItem superItem;
5125
+ private MenuItem kleinItem;
47375126 private MenuItem blobItem;
47385127 private MenuItem latheItem;
47395128 private MenuItem bezierItem;
....@@ -4746,6 +5135,7 @@
47465135 private MenuItem csgItem;
47475136 private MenuItem templateItem;
47485137 private MenuItem textureItem;
5138
+ private MenuItem billboardItem;
47495139 private MenuItem shadowXItem;
47505140 private MenuItem shadowYItem;
47515141 private MenuItem shadowZItem;