Normand Briere
2019-04-29 c0c300a9dbd4c0fc127e003e9481d3f9246bbe7a
GroupEditor.java
....@@ -14,7 +14,7 @@
1414
1515 //import buoy.widget.BFileChooser;
1616
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
17
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
1818 ObjectUI,
1919 Runnable,
2020 ActionListener,
....@@ -83,7 +83,7 @@
8383
8484 void CloneSelection(boolean supports)
8585 {
86
- // Object3D keep = GraphreeD.clipboard;
86
+ // Object3D keep = GrafreeD.clipboard;
8787 //Object3D obj;
8888 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
8989 {
....@@ -97,14 +97,14 @@
9797
9898 void CloneClipboard(boolean supports)
9999 {
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));
100
+ assert(GrafreeD.clipboard.parent == null);
101
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
+ makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
105105 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
106
+ makeSomething(CloneObject(GrafreeD.clipboard, false));
107
+ GrafreeD.clipboard.get(0).parent = keepparent;
108108 }
109109
110110 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +118,7 @@
118118 // obj.support = null;
119119 if (!supports)
120120 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
121
+ Object3D clone = (Object3D)GrafreeD.clone(obj);
122122 obj.parent = parent;
123123 // obj.support = support;
124124 // clone.support = support; // aout 2013
....@@ -188,8 +188,9 @@
188188 clearItem.addActionListener(this);
189189 clearAllItem = menu.add(new MenuItem("Clear All"));
190190 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
191
+
192
+ oe.menuBar.add(menu = new Menu("Setting"));
193
+ resetMeshItem = menu.add(new MenuItem("Reset All"));
193194 resetMeshItem.addActionListener(this);
194195 stepAllItem = menu.add(new MenuItem("Step All"));
195196 stepAllItem.addActionListener(this);
....@@ -218,18 +219,24 @@
218219 resetsupportItem.addActionListener(this);
219220 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220221 linkverticesItem.addActionListener(this);
222
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223
+ relinkverticesItem.addActionListener(this);
221224 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222225 setMasterItem.addActionListener(this);
223226
224
- oe.menuBar.add(menu = new Menu("Object"));
227
+ oe.menuBar.add(menu = new Menu("Group"));
225228 grabItem = menu.add(new MenuItem("Grab"));
226229 grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
229230 backItem = menu.add(new MenuItem("Back"));
230231 backItem.addActionListener(this);
232
+ frontItem = menu.add(new MenuItem("Front"));
233
+ frontItem.addActionListener(this);
231234 compositeItem = menu.add(new MenuItem("Composite"));
232235 compositeItem.addActionListener(this);
236
+ hideItem = menu.add(new MenuItem("Hide"));
237
+ hideItem.addActionListener(this);
238
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
239
+ ungroupItem.addActionListener(this);
233240 menu.add("-");
234241 randomItem = menu.add(new MenuItem("Random"));
235242 randomItem.addActionListener(this);
....@@ -247,9 +254,12 @@
247254 scriptNodeItem.addActionListener(this);
248255 cameraItem = menu.add(new MenuItem("Camera"));
249256 cameraItem.addActionListener(this);
250
- menu.add("-");
257
+
258
+ oe.menuBar.add(menu = new Menu("Object"));
251259 textureItem = menu.add(new MenuItem("Texture"));
252260 textureItem.addActionListener(this);
261
+ billboardItem = menu.add(new MenuItem("Billboard"));
262
+ billboardItem.addActionListener(this);
253263 csgItem = menu.add(new MenuItem("CSG"));
254264 csgItem.addActionListener(this);
255265 shadowXItem = menu.add(new MenuItem("Shadow X"));
....@@ -267,14 +277,12 @@
267277 pointflowItem = menu.add(new MenuItem("Point Flow"));
268278 pointflowItem.addActionListener(this);
269279 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272280 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273281 resetTransformItem.addActionListener(this);
274282 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275283 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
284
+ transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
+ transformgeometryItem.addActionListener(this);
278286
279287 oe.menuBar.add(menu = new Menu("Geometry"));
280288 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +291,10 @@
283291 genNormalsORGANItem.addActionListener(this);
284292 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285293 genNormalsCADItem.addActionListener(this);
294
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295
+ genNormalsMESHItem.addActionListener(this);
296
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
297
+ genNormalsMINEItem.addActionListener(this);
286298 stripifyItem = menu.add(new MenuItem("Stripify"));
287299 stripifyItem.addActionListener(this);
288300 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +304,6 @@
292304 untrimItem = menu.add(new MenuItem("Untrim"));
293305 untrimItem.addActionListener(this);
294306 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297307 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298308 clearColorsItem.addActionListener(this);
299309 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -310,6 +320,10 @@
310320 smoothMeshItem.addActionListener(this);
311321 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312322 clipMeshItem.addActionListener(this);
323
+
324
+ oe.menuBar.add(menu = new Menu("Attributes"));
325
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326
+ clearMaterialsItem.addActionListener(this);
313327 menu.add("-");
314328 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315329 liveleavesItem.addActionListener(this);
....@@ -332,27 +346,18 @@
332346 flipVItem.addActionListener(this);
333347 unflipVItem = menu.add(new MenuItem("Unflip V"));
334348 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
349
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336350 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
351
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338352 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
353
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340354 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
355
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342356 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
357
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344358 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
359
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346360 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);
356361
357362 oe.menuBar.add(menu = new Menu("Selection"));
358363 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -370,9 +375,31 @@
370375 sortbysizeItem.addActionListener(this);
371376 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372377 sortbynameItem.addActionListener(this);
378
+ menu.add("-");
379
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380
+ extractGeometriesItem.addActionListener(this);
381
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382
+ cloneGeometriesItem.addActionListener(this);
383
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
+ shareGeometriesItem.addActionListener(this);
385
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
+ mergeGeometriesItem.addActionListener(this);
387
+
373388 oe.menuBar.add(menu = new Menu("Insert"));
374389 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
390
+
391
+
392
+ oe.menuBar.add(menu = new Menu("Include"));
393
+ importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
+ importGFDItem.addActionListener(this);
395
+ importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
+ importVRMLX3DItem.addActionListener(this);
397
+ importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
+ importOBJItem.addActionListener(this);
399
+ import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
+ import3DSItem.addActionListener(this);
401
+
402
+ oe.menuBar.add(menu = new Menu("Tools"));
376403 buildToolsMenu(menu);
377404 }
378405
....@@ -407,76 +434,24 @@
407434 oe.buttonGroup.add(dummyButton);
408435 */
409436 aConstraints.gridy += 1;
437
+
438
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439
+
410440 oe.aConstraints.gridwidth = 1;
411441 oe.aConstraints.gridx = 0;
412442
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
443
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
444
+ liveCB.setToolTipText("Enabled animation");
414445 liveCB.addItemListener(this);
415446
416447 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);
448
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
449
+ trackCB.setToolTipText("Enable tracking");
476450 trackCB.addItemListener(this);
477451
478452 oe.aConstraints.gridx += 1;
479453 oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
454
+ screenfitButton.setToolTipText("Screen fit");
480455 screenfitButton.addActionListener(this);
481456 oe.aConstraints.gridx += 1;
482457 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
....@@ -484,6 +459,7 @@
484459 // oe.aConstraints.gridx += 1;
485460 oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486461 snapobjectButton.addActionListener(this);
462
+ snapobjectButton.setToolTipText("Snap Object");
487463 oe.aConstraints.gridx += 1;
488464
489465 //aConstraints.gridx = 0;
....@@ -492,28 +468,39 @@
492468 oe.aConstraints.gridwidth = 1;
493469
494470 oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
471
+ flashSelectionButton.setToolTipText("Show selection");
495472 flashSelectionButton.addActionListener(this);
473
+
474
+ oe.toolbarPanel.add(new cButton(" ", false));
475
+
496476 oe.aConstraints.gridx += 1;
497477 oe.aConstraints.weighty = 0;
498478 oe.aConstraints.gridwidth = 1;
499479
500480 //
501481 oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
482
+ twoButton.setToolTipText("Show center view only");
502483 twoButton.addActionListener(this);
503484 oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
504485 fourButton.addActionListener(this);
486
+ fourButton.setToolTipText("Show left panel only");
505487 oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
488
+ sixButton.setToolTipText("2-column layout left");
506489 sixButton.addActionListener(this);
507490 oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
491
+ threeButton.setToolTipText("2-column layout right");
508492 threeButton.addActionListener(this);
509493 oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
494
+ sevenButton.setToolTipText("3-column layout");
510495 sevenButton.addActionListener(this);
511496 //
512497
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
498
+ oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
499
+ rootButton.setToolTipText("Edit object in new tab");
514500 rootButton.addActionListener(this);
515501 oe.aConstraints.gridx += 1;
516502 oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
503
+ closeButton.setToolTipText("Close tab");
517504 closeButton.addActionListener(this);
518505 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
519506 //clearButton.addActionListener(this);
....@@ -616,17 +603,91 @@
616603 radio.layout = sevenButton;
617604 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
618605 }
606
+
607
+ void AddOptions(JPanel panel, GridBagConstraints constraints)
608
+ {
609
+ constraints.gridx = 0;
610
+ constraints.gridy = 0;
611
+ panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), constraints);
612
+ fastCB.setToolTipText("Fast mode");
613
+ fastCB.addItemListener(this);
614
+ constraints.gridy += 1;
615
+ panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), constraints);
616
+ supportCB.setToolTipText("Enabled rigging");
617
+ supportCB.addItemListener(this);
618
+
619
+ // constraints.gridy += 1;
620
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
621
+ // localCB.addItemListener(this);
622
+
623
+ constraints.gridy += 1;
624
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), constraints);
625
+ crowdCB.setToolTipText("Used for crowds");
626
+ crowdCB.addItemListener(this);
627
+
628
+ constraints.gridy += 1;
629
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), constraints);
630
+ smoothCB.setToolTipText("Snapping delay");
631
+ smoothCB.addItemListener(this);
632
+
633
+ constraints.gridy += 1;
634
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), constraints);
635
+ slowCB.setToolTipText("Smooth interpolation");
636
+ slowCB.addItemListener(this);
637
+ constraints.gridy += 1;
638
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), constraints);
639
+ boxCB.setToolTipText("Display bounding boxes");
640
+ boxCB.addItemListener(this);
641
+ constraints.gridy += 1;
642
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), constraints);
643
+ zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
644
+ zoomBoxCB.addItemListener(this);
645
+
646
+// constraints.gridy += 1;
647
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
648
+// speakerMocapCB.addItemListener(this);
649
+
650
+ if (false)
651
+ {
652
+ // handled in scripts
653
+ constraints.gridy += 1;
654
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), constraints);
655
+ speakerCameraCB.addItemListener(this);
656
+
657
+ constraints.gridy += 1;
658
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), constraints);
659
+ speakerFocusCB.addItemListener(this);
660
+
661
+ constraints.gridy += 1;
662
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), constraints);
663
+ smoothfocusCB.addItemListener(this);
664
+ }
665
+
666
+//constraints.gridx += 1;
667
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
668
+// debugCB.addItemListener(this);
669
+
670
+ constraints.gridy += 1;
671
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), constraints);
672
+ oeilCB.addItemListener(this);
673
+
674
+ constraints.gridy += 1;
675
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), constraints);
676
+ lookAtCB.setToolTipText("Look-at target");
677
+ lookAtCB.addItemListener(this);
678
+
679
+ }
619680
620681 void EditObject(Object3D obj)
621682 {
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();
683
+ cRadio radioButton = new cRadio(obj.name);
684
+ radioButton.SetObject(obj);
685
+ radioButton.layout = sevenButton;
686
+ radioButton.SetCamera(cameraView.renderCamera, false);
687
+ radioButton.addActionListener(this);
688
+ radioPanel.add(radioButton);
689
+ buttonGroup.add(radioButton);
690
+ radioButton.doClick();
630691 }
631692 void SetupViews(ObjEditor oe)
632693 {
....@@ -646,6 +707,7 @@
646707 JCheckBox fastCB;
647708 JCheckBox slowCB;
648709 JCheckBox boxCB;
710
+ JCheckBox zoomBoxCB;
649711 JCheckBox trackCB;
650712 JCheckBox smoothfocusCB;
651713 // JCheckBox speakerMocapCB;
....@@ -688,8 +750,7 @@
688750 dropAttributes |= Object3D.TEXTURE;
689751 else
690752 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
753
+ } else if(e.getSource() == liveCB)
693754 {
694755 cameraView.ToggleLive();
695756 }
....@@ -726,6 +787,10 @@
726787 Recompile();
727788 cameraView.repaint();
728789 // refreshContents();
790
+ }
791
+ else if(e.getSource() == zoomBoxCB)
792
+ {
793
+ cameraView.ToggleZoomBoxMode();
729794 }
730795 else if(e.getSource() == smoothfocusCB)
731796 {
....@@ -1002,6 +1067,8 @@
10021067
10031068 void buildCreateMenu(Menu menu)
10041069 {
1070
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1071
+ //heightFieldItem.addActionListener(this);
10051072 gridItem = menu.add(new MenuItem("Grid"));
10061073 gridItem.addActionListener(this);
10071074 rectoidItem = menu.add(new MenuItem("Box"));
....@@ -1014,6 +1081,8 @@
10141081 torusItem.addActionListener(this);
10151082 superItem = menu.add(new MenuItem("Superellipsoid"));
10161083 superItem.addActionListener(this);
1084
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1085
+ kleinItem.addActionListener(this);
10171086 particleItem = menu.add(new MenuItem("Particle system"));
10181087 particleItem.addActionListener(this);
10191088 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1048,15 +1117,6 @@
10481117 doubleItem.addActionListener(this);
10491118 tripleItem = menu.add(new MenuItem("Trident"));
10501119 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);
10601120 }
10611121
10621122 void buildToolsMenu(Menu menu)
....@@ -1068,6 +1128,8 @@
10681128 menu.add("-");
10691129 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701130 parseverticesItem.addActionListener(this);
1131
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1132
+ textureFieldItem.addActionListener(this);
10711133 alignItem = menu.add(new MenuItem("Align"));
10721134 alignItem.addActionListener(this);
10731135 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
....@@ -1094,6 +1156,8 @@
10941156 resetParentItem.addActionListener(this);
10951157 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961158 repairParentItem.addActionListener(this);
1159
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1160
+ repairShadowItem.addActionListener(this);
10971161 menu.add(invariantsItem = new MenuItem("Invariants"));
10981162 invariantsItem.addActionListener(this);
10991163 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1429,9 +1493,9 @@
14291493
14301494 void Overwrite(int mask)
14311495 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1496
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
14331497 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
1498
+ Object3D content = GrafreeD.clipboard.get(0);
14351499
14361500 if (content instanceof cGroup && ((cGroup)content).transientlink )
14371501 content = ((cGroup)content).get(0);
....@@ -1454,6 +1518,7 @@
14541518 //
14551519 public void actionPerformed(ActionEvent event) // , Object arg)
14561520 {
1521
+ Object source = event.getSource();
14571522 /*
14581523 if (event.getSource() == nameField)
14591524 {
....@@ -1465,11 +1530,11 @@
14651530 }
14661531 else
14671532 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1533
+ if (source == lookAtItem || source == lookFromItem)
14691534 {
14701535 ScreenFit();
14711536 } else
1472
- if (event.getSource() == switchItem)
1537
+ if (source == switchItem)
14731538 {
14741539 cVector v1 = new cVector();
14751540 cVector v2 = new cVector();
....@@ -1478,11 +1543,11 @@
14781543 objEditor.cameraView.renderCamera.setAim(v2, v1);
14791544 objEditor.cameraView.repaint();
14801545 } else
1481
- if (event.getSource() == rectoidItem)
1546
+ if (source == rectoidItem)
14821547 {
14831548 makeSomething(new Box());
14841549 } else
1485
- if (event.getSource() == particleItem)
1550
+ if (source == particleItem)
14861551 {
14871552 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14881553 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +1568,9 @@
15031568 applyExample(particleGeom, "SMOKE");
15041569 makeSomething(particleGeom);
15051570 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1571
+ if (source == ragdollItem || source == ragdoll2Item)
15071572 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1573
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15091574
15101575 ragdoll.toParent = LA.newMatrix();
15111576 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +1586,71 @@
15211586 makeSomething(ragdoll);
15221587 //makeSomething(new VehicleDemo());
15231588 } else
1524
- if (event.getSource() == gridItem)
1589
+ /*
1590
+ */
1591
+ if (source == heightFieldItem)
1592
+ {
1593
+ Object3D obj = new Object3D();
1594
+
1595
+ obj.CreateMaterial();
1596
+ obj.bRep = new BoundaryRep();
1597
+
1598
+ obj.bRep.CreateMesh(new iHeightField()
1599
+ {
1600
+ public double f(double x, double y)
1601
+ {
1602
+ // The Mandelbrot set is represented by coloring
1603
+ // each point (x,y) according to the number of
1604
+ // iterations it takes before the while loop in
1605
+ // this method ends. For points that are actually
1606
+ // in the Mandelbrot set, or very close to it, the
1607
+ // count will reach the maximum value, 80. These
1608
+ // points will be colored purple. All other colors
1609
+ // represent points that are definitely NOT in the set.
1610
+ x -= 600;
1611
+ y -= 500;
1612
+ x /= 200;
1613
+ y /= 200;
1614
+ int count = 0;
1615
+ double zx = x;
1616
+ double zy = y;
1617
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
1618
+ double new_zx = zx*zx - zy*zy + x;
1619
+ zy = 2*zx*zy + y;
1620
+ zx = new_zx;
1621
+ count++;
1622
+ }
1623
+ return count; // Math.sqrt(count);
1624
+ }
1625
+ }, 1000,1000);
1626
+
1627
+ makeSomething(obj);
1628
+ } else
1629
+ if (source == gridItem)
15251630 {
15261631 makeSomething(new Grid());
15271632 } else
1528
- if (event.getSource() == ellipsoidItem)
1633
+ if (source == ellipsoidItem)
15291634 {
15301635 makeSomething(new Sphere());
15311636 } else
1532
- if (event.getSource() == coneItem)
1637
+ if (source == coneItem)
15331638 {
15341639 makeSomething(new Cone());
15351640 } else
1536
- if (event.getSource() == torusItem)
1641
+ if (source == torusItem)
15371642 {
15381643 makeSomething(new Torus());
15391644 } else
1540
- if (event.getSource() == superItem)
1645
+ if (source == superItem)
15411646 {
15421647 makeSomething(new Superellipsoid());
15431648 } else
1544
- if (event.getSource() == blobItem)
1649
+ if (source == kleinItem)
1650
+ {
1651
+ makeSomething(new Klein());
1652
+ } else
1653
+ if (source == blobItem)
15451654 {
15461655 Blob blob = new Blob();
15471656 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +1658,15 @@
15491658 //blob.retile();
15501659 makeSomething(blob);
15511660 } else
1552
- if (event.getSource() == latheItem)
1661
+ if (source == latheItem)
15531662 {
15541663 makeSomething(new Lathe());
15551664 } else
1556
- if (event.getSource() == bezierItem)
1665
+ if (source == bezierItem)
15571666 {
15581667 makeSomething(new BezierSurface());
15591668 } else
1560
- if (event.getSource() == checkerItem)
1669
+ if (source == checkerItem)
15611670 {
15621671 /*
15631672 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +1679,9 @@
15701679 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15711680 LA.matInvert(obj.toParent, obj.fromParent);
15721681 */
1573
- makeSomething(new CheckerIG());
1682
+ makeSomething(new Checker());
15741683 } else
1575
- if (event.getSource() == meshItem)
1684
+ if (source == meshItem)
15761685 {
15771686 Object3D itemtomake = new Object3D();
15781687 Object3D child;
....@@ -1593,35 +1702,35 @@
15931702 makeSomething(child);
15941703 }
15951704 } else
1596
- if (event.getSource() == springItem)
1705
+ if (source == springItem)
15971706 {
15981707 cSpring s = new cSpring();
15991708 s.setup();
16001709 makeSomething(s);
16011710 } else
1602
- if (event.getSource() == flagItem)
1711
+ if (source == flagItem)
16031712 {
16041713 cSpring s = new cFlag();
16051714 s.setup();
16061715 makeSomething(s);
16071716 } else
1608
- if (event.getSource() == lightItem)
1717
+ if (source == lightItem)
16091718 {
16101719 makeSomething(new Light());
16111720 } else
1612
- if (event.getSource() == csgItem)
1721
+ if (source == csgItem)
16131722 {
16141723 group(new CSG());
16151724 } else
1616
- if (event.getSource() == templateItem)
1725
+ if (source == templateItem)
16171726 {
16181727 group(new cTemplate());
16191728 } else
1620
- if (event.getSource() == attributeItem)
1729
+ if (source == attributeItem)
16211730 {
16221731 makeSomething(new Attribute());
16231732 } else
1624
- if (event.getSource() == pointflowItem)
1733
+ if (source == pointflowItem)
16251734 {
16261735 makeSomething(new PointFlow());
16271736 } else
....@@ -1633,7 +1742,7 @@
16331742 } else
16341743 */
16351744
1636
- if (event.getSource() == superLoopItem)
1745
+ if (source == superLoopItem)
16371746 {
16381747 Composite g = new cGroup();
16391748 for (int i=0; i<15; i++)
....@@ -1655,7 +1764,7 @@
16551764
16561765 group(g);
16571766 } else
1658
- if (event.getSource() == loopItem)
1767
+ if (source == loopItem)
16591768 {
16601769 Composite csg = new GroupLeaf();
16611770 csg.count = 5;
....@@ -1664,7 +1773,7 @@
16641773 csg.addChild(child);
16651774 child.addChild(csg);
16661775 } else
1667
- if (event.getSource() == doubleItem)
1776
+ if (source == doubleItem)
16681777 {
16691778 Composite csg = new GroupLeaf();
16701779 csg.count = 5;
....@@ -1676,7 +1785,7 @@
16761785 csg.addChild(child);
16771786 child.addChild(csg);
16781787 } else
1679
- if (event.getSource() == tripleItem)
1788
+ if (source == tripleItem)
16801789 {
16811790 Composite csg = new GroupLeaf();
16821791 csg.count = 4;
....@@ -1692,70 +1801,70 @@
16921801 child.addChild(csg);
16931802 } else
16941803
1695
- if (event.getSource() == importGFDItem)
1804
+ if (source == importGFDItem)
16961805 {
16971806 ImportGFD();
16981807 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1808
+ if (source == importVRMLX3DItem)
17001809 {
17011810 ImportVRMLX3D();
17021811 } else
1703
- if (event.getSource() == import3DSItem)
1812
+ if (source == import3DSItem)
17041813 {
17051814 objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
17061815 } else
1707
- if (event.getSource() == importOBJItem)
1816
+ if (source == importOBJItem)
17081817 {
17091818 objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
17101819 } else
1711
- if (event.getSource() == computeAOItem)
1820
+ if (source == computeAOItem)
17121821 {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1822
+ Globals.drawMode = CameraPane.OCCLUSION;
1823
+ Globals.theRenderer.repaint();
17151824 } else
1716
- if (event.getSource() == recompileItem)
1825
+ if (source == recompileItem)
17171826 {
17181827 Recompile();
17191828 refreshContents();
17201829 } else
1721
- if (event.getSource() == editScriptItem)
1830
+ if (source == editScriptItem)
17221831 {
17231832 OpenDialog();
17241833 refreshContents();
17251834 } else
1726
- if (event.getSource() == invariantsItem)
1835
+ if (source == invariantsItem)
17271836 {
17281837 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
1838
+ GrafreeD.grafreeD.universe.invariants();
17301839 } else
1731
- if (event.getSource() == memoryItem)
1840
+ if (source == memoryItem)
17321841 {
17331842 //System.out.println("Invariants:");
17341843 PrintMemory();
17351844 } else
1736
- if (event.getSource() == pathItem)
1845
+ if (source == pathItem)
17371846 {
17381847 PrintPath();
17391848 } else
1740
- if (event.getSource() == analyzeItem)
1849
+ if (source == analyzeItem)
17411850 {
17421851 AnalyzeObject();
17431852 } else
1744
- if (event.getSource() == dumpItem)
1853
+ if (source == dumpItem)
17451854 {
17461855 DumpObject();
17471856 } else
1748
- if (event.getSource() == screenfitButton)
1857
+ if (source == screenfitButton)
17491858 {
17501859 //Reload(lastConverter, lastFilename, true);
17511860 ScreenFit();
17521861 } else
1753
- if (event.getSource() == screenfitpointButton)
1862
+ if (source == screenfitpointButton)
17541863 {
17551864 //Reload(lastConverter, lastFilename, true);
17561865 ScreenFitPoint();
17571866 } else
1758
- if (event.getSource() == snapobjectButton)
1867
+ if (source == snapobjectButton)
17591868 {
17601869 //Reload(lastConverter, lastFilename, true);
17611870 SnapObject();
....@@ -1766,13 +1875,13 @@
17661875 // Recompile();
17671876 // refreshContents();
17681877 // } else
1769
- if (event.getSource() == gcButton)
1878
+ if (source == gcButton)
17701879 {
17711880 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17721881 System.gc();
17731882 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17741883 } else
1775
- if (event.getSource() == editLeafItem)
1884
+ if (source == editLeafItem)
17761885 {
17771886 Object3D obj;
17781887 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +1895,66 @@
17861895 }
17871896 refreshContents(true);
17881897 } else
1789
- if (event.getSource() == openWindowItem)
1898
+ if (source == openWindowItem)
17901899 {
17911900 EditSelection(true);
17921901 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
1902
+ if (source == cutItem || source == clearButton)
17941903 {
17951904 loadClipboard(true);
17961905 } else
1797
- if (event.getSource() == duplicateItem)
1906
+ if (source == duplicateItem)
17981907 {
1799
- Object3D keep = GraphreeD.clipboard;
1908
+ Object3D keep = GrafreeD.clipboard;
18001909 loadClipboard(false);
18011910 paste(false);
1802
- GraphreeD.clipboard = keep;
1911
+ GrafreeD.clipboard = keep;
18031912 } else
1804
- if (event.getSource() == cloneItem)
1913
+ if (source == cloneItem)
18051914 {
18061915 CloneSelection(false);
18071916 } else
1808
- if (event.getSource() == cloneSupportItem)
1917
+ if (source == cloneSupportItem)
18091918 {
18101919 CloneSelection(true);
18111920 } else
1812
- if (event.getSource() == copyItem)
1921
+ if (source == copyItem)
18131922 {
18141923 loadClipboard(false);
18151924 } else
1816
- if (event.getSource() == pasteItem)
1925
+ if (source == pasteItem)
18171926 {
18181927 paste(false);
18191928 } else
1820
- if (event.getSource() == pasteLinkItem)
1929
+ if (source == pasteLinkItem)
18211930 {
18221931 pasteInto(false);
18231932 } else
1824
- if (event.getSource() == pasteCloneItem)
1933
+ if (source == pasteCloneItem)
18251934 {
18261935 pasteInto(true);
18271936 } else
1828
- if (event.getSource() == pasteExpandItem)
1937
+ if (source == pasteExpandItem)
18291938 {
18301939 paste(true);
18311940 } else
1832
- if (event.getSource() == synchronizeItem)
1941
+ if (source == synchronizeItem)
18331942 {
18341943 Overwrite(Object3D.TRANSFORM);
18351944 } else
1836
- if (event.getSource() == overwriteNameItem)
1945
+ if (source == overwriteNameItem)
18371946 {
18381947 Overwrite(Object3D.NAME);
18391948 } else
1840
- if (event.getSource() == overwriteUVItem)
1949
+ if (source == overwriteUVItem)
18411950 {
18421951 Overwrite(Object3D.UV);
18431952 } else
1844
- if (event.getSource() == overwriteMatItem)
1953
+ if (source == overwriteMatItem)
18451954 {
1955
+ /* july 2015
18461956 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
1957
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18481958 else
18491959 {
18501960 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +1966,16 @@
18561966 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18571967 }
18581968 }
1969
+ */
1970
+
1971
+ Overwrite(dropAttributes);
18591972 }
1860
- if (event.getSource() == overwriteGeoItem)
1973
+ if (source == overwriteGeoItem)
18611974 {
18621975 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
1976
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18641977 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
1978
+// Object3D content = GrafreeD.clipboard.get(0);
18661979 //
18671980 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18681981 // content = ((cGroup)content).get(0);
....@@ -1874,7 +1987,7 @@
18741987 // refreshContents();
18751988 // }
18761989 } else
1877
- if (event.getSource() == generateMeshItem)
1990
+ if (source == generateMeshItem)
18781991 {
18791992 //if (group.selection.size() == 1)
18801993 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +1998,7 @@
18851998 ResetModel();
18861999 refreshContents();
18872000 } else
1888
- if (event.getSource() == extractGeometriesItem)
2001
+ if (source == extractGeometriesItem)
18892002 {
18902003 boolean one = false;
18912004
....@@ -1912,7 +2025,7 @@
19122025 ResetModel();
19132026 refreshContents();
19142027 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2028
+ if (source == cloneGeometriesItem)
19162029 {
19172030 boolean one = false;
19182031
....@@ -1938,32 +2051,37 @@
19382051 ResetModel();
19392052 refreshContents();
19402053 } else
1941
- if (event.getSource() == shareGeometriesItem)
2054
+ if (source == shareGeometriesItem)
19422055 {
19432056 boolean one = false;
19442057
19452058 if (group.selection.size() == 1)
19462059 one = true;
19472060
2061
+ Object3D merge = null;
2062
+
19482063 Object3D content = new cGroup();
19492064
19502065 for (int i=0; i<group.selection.size(); i++)
19512066 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2067
+ merge = new Merge(group.selection.get(i));
19532068
19542069 if (one)
1955
- makeSomething(sel, false);
2070
+ makeSomething(merge, false);
19562071 else
1957
- content.addChild(sel);
2072
+ content.addChild(merge);
19582073 }
19592074
19602075 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2076
+ makeSomething(content, true);
2077
+ else
2078
+ {
2079
+ ResetModel();
2080
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2081
+ refreshContents();
2082
+ }
19652083 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2084
+ if (source == mergeGeometriesItem)
19672085 {
19682086 boolean one = false;
19692087
....@@ -1993,11 +2111,11 @@
19932111 ResetModel();
19942112 refreshContents();
19952113 } else
1996
- if (event.getSource() == linkverticesItem)
2114
+ if (source == linkverticesItem)
19972115 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2116
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19992117 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
2118
+// Object3D content = GrafreeD.clipboard.get(0);
20012119 //
20022120 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20032121 // content = ((cGroup)content).get(0);
....@@ -2006,14 +2124,14 @@
20062124 // group.selection.get(0).setMasterThis(content); // should be identity
20072125 // refreshContents();
20082126 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2127
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
20102128 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
2129
+ Object3D content = GrafreeD.clipboard.get(0);
20122130
20132131 if (content instanceof cGroup && ((cGroup)content).transientlink )
20142132 content = ((cGroup)content).get(0);
20152133
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2134
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20172135 for (int i=0; i<group.selection.size(); i++)
20182136 {
20192137 boolean random = CameraPane.RANDOM;
....@@ -2022,11 +2140,11 @@
20222140 // group.selection.get(i).setMasterThis(content); // should be identity
20232141 CameraPane.RANDOM = random;
20242142 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2143
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20262144 refreshContents();
20272145 }
20282146 } else
2029
- if (event.getSource() == resetsupportItem)
2147
+ if (source == resetsupportItem)
20302148 {
20312149 for (int i=0; i<group.selection.size(); i++)
20322150 {
....@@ -2038,7 +2156,16 @@
20382156
20392157 refreshContents();
20402158 } else
2041
- if (event.getSource() == resetreferencesItem)
2159
+ if (source == relinkverticesItem)
2160
+ {
2161
+ boolean random = CameraPane.RANDOM;
2162
+ CameraPane.RANDOM = false; // parse all random nodes
2163
+ group.selection.RelinkToSupport();
2164
+ CameraPane.RANDOM = random;
2165
+
2166
+ refreshContents();
2167
+ } else
2168
+ if (source == resetreferencesItem)
20422169 {
20432170 for (int i=0; i<group.selection.size(); i++)
20442171 {
....@@ -2047,11 +2174,11 @@
20472174
20482175 refreshContents();
20492176 } else
2050
- if (event.getSource() == setMasterItem)
2177
+ if (source == setMasterItem)
20512178 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2179
+ if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20532180 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
2181
+ Object3D content = GrafreeD.clipboard.get(0);
20552182
20562183 if (content instanceof cGroup && ((cGroup)content).transientlink )
20572184 content = ((cGroup)content).get(0);
....@@ -2060,13 +2187,13 @@
20602187 refreshContents();
20612188 }
20622189 } else
2063
- if (event.getSource() == poseMeshItem)
2190
+ if (source == poseMeshItem)
20642191 {
20652192 if (group.selection.size() == 1)
20662193 {
2067
- if (GraphreeD.clipboard.size() == 1)
2194
+ if (GrafreeD.clipboard.size() == 1)
20682195 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
2196
+ Object3D content = GrafreeD.clipboard.get(0);
20702197
20712198 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722199 content = ((cGroup)content).get(0);
....@@ -2079,19 +2206,19 @@
20792206 }
20802207
20812208 } else
2082
- if (event.getSource() == revertMeshItem)
2209
+ if (source == revertMeshItem)
20832210 {
20842211 RevertMeshes();
20852212 } else
2086
- if (event.getSource() == resetMeshItem)
2213
+ if (source == resetMeshItem)
20872214 {
20882215 ResetAll();
20892216 } else
2090
- if (event.getSource() == stepAllItem)
2217
+ if (source == stepAllItem)
20912218 {
20922219 StepAll();
20932220 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2221
+ if (source == clearItem) // || event.getSource() == clearButton)
20952222 {
20962223 //int indices[] = jList.getSelectedIndices();
20972224 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +2226,46 @@
20992226
21002227 ClearSelection(false);
21012228 } else
2102
- if (event.getSource() == clearAllItem)
2229
+ if (source == clearAllItem)
21032230 {
21042231 ClearSelection(true);
21052232 } else
2106
- if (event.getSource() == grabItem)
2233
+ if (source == grabItem)
21072234 {
21082235 group(new cGroup(), true);
21092236 } else
2110
- if (event.getSource() == frontItem)
2237
+ if (source == hideItem)
2238
+ {
2239
+ group(new HiddenObject());
2240
+ } else
2241
+ if (source == frontItem)
21112242 {
21122243 front();
21132244 } else
2114
- if (event.getSource() == backItem)
2245
+ if (source == backItem)
21152246 {
21162247 back();
21172248 } else
2118
- if (event.getSource() == cameraItem)
2249
+ if (source == cameraItem)
21192250 {
21202251 makeSomething(new Camera());
21212252 } else
2122
- if (event.getSource() == compositeItem)
2253
+ if (source == compositeItem)
21232254 {
21242255 group(new Composite());
21252256 } else
2126
- if (event.getSource() == randomItem)
2257
+ if (source == randomItem)
21272258 {
21282259 RandomNode random = new RandomNode();
21292260 group(random);
21302261 if (random.size() > 0)
21312262 random.name = random.get(0).name + "Rnd";
21322263 } else
2133
- if (event.getSource() == physicsItem)
2264
+ if (source == physicsItem)
21342265 {
21352266 group(new PhysicsNode());
21362267 } else
2137
- if (event.getSource() == frameselectorItem)
2268
+ if (source == frameselectorItem)
21382269 {
21392270 for (int i=0; i<group.selection.size(); i++)
21402271 {
....@@ -2146,7 +2277,7 @@
21462277 ResetModel();
21472278 refreshContents();
21482279 } else
2149
- if (event.getSource() == switchGeoItem)
2280
+ if (source == switchGeoItem)
21502281 {
21512282 for (int i=0; i<group.selection.size(); i++)
21522283 {
....@@ -2158,7 +2289,7 @@
21582289 ResetModel();
21592290 refreshContents();
21602291 } else
2161
- if (event.getSource() == switchTransfoItem)
2292
+ if (source == switchTransfoItem)
21622293 {
21632294 for (int i=0; i<group.selection.size(); i++)
21642295 {
....@@ -2170,7 +2301,7 @@
21702301 ResetModel();
21712302 refreshContents();
21722303 } else
2173
- if (event.getSource() == morphItem)
2304
+ if (source == morphItem)
21742305 {
21752306 for (int i=0; i<group.selection.size(); i++)
21762307 {
....@@ -2182,7 +2313,7 @@
21822313 ResetModel();
21832314 refreshContents();
21842315 } else
2185
- if (event.getSource() == scriptNodeItem)
2316
+ if (source == scriptNodeItem)
21862317 {
21872318 boolean atleastone = false;
21882319
....@@ -2221,191 +2352,215 @@
22212352 }
22222353 }
22232354 } else
2224
- if (event.getSource() == linkerItem)
2355
+ if (source == linkerItem)
22252356 {
22262357 group(new cLinker());
22272358 } else
2228
- if (event.getSource() == textureItem)
2359
+ if (source == textureItem)
22292360 {
22302361 group(new TextureNode());
22312362 } else
2232
- if (event.getSource() == shadowXItem)
2363
+ if (source == billboardItem)
2364
+ {
2365
+ group(new BillboardNode());
2366
+ } else
2367
+ if (source == shadowXItem)
22332368 {
22342369 CastShadow(0);
22352370 } else
2236
- if (event.getSource() == shadowYItem)
2371
+ if (source == shadowYItem)
22372372 {
22382373 CastShadow(1);
22392374 } else
2240
- if (event.getSource() == shadowZItem)
2375
+ if (source == shadowZItem)
22412376 {
22422377 CastShadow(2);
22432378 } else
2244
- if (event.getSource() == ungroupItem)
2379
+ if (source == ungroupItem)
22452380 {
2246
- ungroup();
2381
+ //ungroup();
2382
+ for (int i=0; i<group.selection.size(); i++)
2383
+ {
2384
+ Ungroup(group.selection.get(i));
2385
+ }
2386
+
2387
+ ClearSelection(false);
2388
+
2389
+ refreshContents();
22472390 } else
2248
- if (event.getSource() == genUVItem)
2391
+ if (source == genUVItem)
22492392 {
22502393 GenUV();
22512394 } else
2252
- if (event.getSource() == genNormalsCADItem)
2395
+ if (source == genNormalsCADItem)
22532396 {
22542397 GenNormals(true);
22552398 } else
2256
- if (event.getSource() == genNormalsORGANItem)
2399
+ if (source == genNormalsMESHItem)
2400
+ {
2401
+ GenNormals(true); // TODO
2402
+ } else
2403
+ if (source == genNormalsORGANItem)
22572404 {
22582405 GenNormals(false);
22592406 } else
2260
- if (event.getSource() == stripifyItem)
2407
+ if (source == genNormalsMINEItem)
2408
+ {
2409
+ GenNormalsMINE();
2410
+ } else
2411
+ if (source == stripifyItem)
22612412 {
22622413 Stripify();
22632414 } else
2264
- if (event.getSource() == unstripifyItem)
2415
+ if (source == unstripifyItem)
22652416 {
22662417 Unstripify();
22672418 } else
2268
- if (event.getSource() == trimItem)
2419
+ if (source == trimItem)
22692420 {
22702421 Trim();
22712422 } else
2272
- if (event.getSource() == untrimItem)
2423
+ if (source == untrimItem)
22732424 {
22742425 Untrim();
22752426 } else
2276
- if (event.getSource() == clearColorsItem)
2427
+ if (source == clearColorsItem)
22772428 {
22782429 ClearColors();
22792430 } else
2280
- if (event.getSource() == clearMaterialsItem)
2431
+ if (source == clearMaterialsItem)
22812432 {
22822433 ClearMaterials();
22832434 } else
2284
- if (event.getSource() == liveleavesItem)
2435
+ if (source == liveleavesItem)
22852436 {
22862437 LiveLeaves(true);
22872438 } else
2288
- if (event.getSource() == unliveleavesItem)
2439
+ if (source == unliveleavesItem)
22892440 {
22902441 LiveLeaves(false);
22912442 } else
2292
- if (event.getSource() == supportleavesItem)
2443
+ if (source == supportleavesItem)
22932444 {
22942445 SupportLeaves(true);
22952446 } else
2296
- if (event.getSource() == unsupportleavesItem)
2447
+ if (source == unsupportleavesItem)
22972448 {
22982449 SupportLeaves(false);
22992450 } else
2300
- if (event.getSource() == hideleavesItem)
2451
+ if (source == hideleavesItem)
23012452 {
23022453 HideLeaves(true);
23032454 } else
2304
- if (event.getSource() == showleavesItem)
2455
+ if (source == showleavesItem)
23052456 {
23062457 HideLeaves(false);
23072458 } else
2308
- if (event.getSource() == markleavesItem)
2459
+ if (source == markleavesItem)
23092460 {
23102461 MarkLeaves(true);
23112462 } else
2312
- if (event.getSource() == unmarkleavesItem)
2463
+ if (source == unmarkleavesItem)
23132464 {
23142465 MarkLeaves(false);
23152466 } else
2316
- if (event.getSource() == flipVItem)
2467
+ if (source == flipVItem)
23172468 {
23182469 FlipV(true);
23192470 } else
2320
- if (event.getSource() == unflipVItem)
2471
+ if (source == unflipVItem)
23212472 {
23222473 FlipV(false);
23232474 } else
2324
- if (event.getSource() == lowTexturesItem)
2475
+ if (source == lowTexturesItem)
23252476 {
23262477 SetTexRes(0);
23272478 } else
2328
- if (event.getSource() == normalTexturesItem)
2479
+ if (source == normalTexturesItem)
23292480 {
23302481 SetTexRes(1);
23312482 } else
2332
- if (event.getSource() == highTexturesItem)
2483
+ if (source == highTexturesItem)
23332484 {
23342485 SetTexRes(2);
23352486 } else
2336
- if (event.getSource() == veryhighTexturesItem)
2487
+ if (source == veryhighTexturesItem)
23372488 {
23382489 SetTexRes(3);
23392490 } else
2340
- if (event.getSource() == maxTexturesItem)
2491
+ if (source == maxTexturesItem)
23412492 {
23422493 SetTexRes(4);
23432494 } else
2344
- if (event.getSource() == panoTexturesItem)
2495
+ if (source == panoTexturesItem)
23452496 {
23462497 SetTexRes(5);
23472498 } else
2348
- if (event.getSource() == reverseNormalsItem)
2499
+ if (source == reverseNormalsItem)
23492500 {
23502501 ReverseNormals();
23512502 } else
2352
- if (event.getSource() == parseverticesItem)
2503
+ if (source == parseverticesItem)
23532504 {
23542505 ParseVertices();
23552506 } else
2356
- if (event.getSource() == alignItem)
2507
+ if (source == textureFieldItem)
2508
+ {
2509
+ TextureVertices();
2510
+ } else
2511
+ if (source == alignItem)
23572512 {
23582513 Align();
23592514 } else
2360
- if (event.getSource() == mirrorItem)
2515
+ if (source == mirrorItem)
23612516 {
23622517 MirrorPoses();
23632518 } else
2364
- if (event.getSource() == reduceMorphItem)
2519
+ if (source == reduceMorphItem)
23652520 {
23662521 MeshReduction(false);
23672522 } else
2368
- if (event.getSource() == reduce34MorphItem)
2523
+ if (source == reduce34MorphItem)
23692524 {
23702525 MeshReduction(true);
23712526 } else
2372
- if (event.getSource() == reverseTrianglesItem)
2527
+ if (source == reverseTrianglesItem)
23732528 {
23742529 ReverseTriangles();
23752530 } else
2376
- if (event.getSource() == reduceMeshItem)
2531
+ if (source == reduceMeshItem)
23772532 {
23782533 ReduceMesh(false);
23792534 } else
2380
- if (event.getSource() == reduce34MeshItem)
2535
+ if (source == reduce34MeshItem)
23812536 {
23822537 ReduceMesh(true);
23832538 } else
2384
- if (event.getSource() == increaseMeshItem)
2539
+ if (source == increaseMeshItem)
23852540 {
23862541 IncreaseMesh();
23872542 } else
2388
- if (event.getSource() == clipMeshItem)
2543
+ if (source == clipMeshItem)
23892544 {
23902545 ClipMesh();
23912546 } else
2392
- if (event.getSource() == smoothMeshItem)
2547
+ if (source == smoothMeshItem)
23932548 {
23942549 SmoothMesh();
23952550 } else
2396
- if (event.getSource() == transformgeometryItem)
2551
+ if (source == transformgeometryItem)
23972552 {
23982553 TransformGeometry();
23992554 } else
2400
- if (event.getSource() == resetTransformItem)
2555
+ if (source == resetTransformItem)
24012556 {
24022557 ResetTransform();
24032558 } else
2404
- if (event.getSource() == resetCentroidItem)
2559
+ if (source == resetCentroidItem)
24052560 {
24062561 ResetCentroid();
24072562 } else
2408
- if (event.getSource() == resetParentItem)
2563
+ if (source == resetParentItem)
24092564 {
24102565 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24112566 {
....@@ -2415,7 +2570,7 @@
24152570
24162571 refreshContents();
24172572 } else
2418
- if (event.getSource() == repairParentItem)
2573
+ if (source == repairParentItem)
24192574 {
24202575 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24212576 {
....@@ -2429,7 +2584,21 @@
24292584
24302585 refreshContents();
24312586 } else
2432
- if (event.getSource() == sortbysizeItem)
2587
+ if (source == repairShadowItem)
2588
+ {
2589
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
2590
+ {
2591
+ Object3D obj = (Object3D)e.nextElement();
2592
+ obj.RepairShadow();
2593
+// for (int i=0; i<obj.size(); i++)
2594
+// {
2595
+// obj.get(i).parent = obj;
2596
+// }
2597
+ }
2598
+
2599
+ refreshContents();
2600
+ } else
2601
+ if (source == sortbysizeItem)
24332602 {
24342603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24352604 {
....@@ -2441,7 +2610,7 @@
24412610 ResetModel();
24422611 refreshContents();
24432612 } else
2444
- if (event.getSource() == sortbynameItem)
2613
+ if (source == sortbynameItem)
24452614 {
24462615 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24472616 {
....@@ -2453,7 +2622,7 @@
24532622 ResetModel();
24542623 refreshContents();
24552624 } else
2456
- if (event.getSource() == attachPigmentItem)
2625
+ if (source == attachPigmentItem)
24572626 {
24582627 String texture = GetFile("Attach pigment");
24592628 Object3D obj;
....@@ -2465,7 +2634,7 @@
24652634
24662635 refreshContents();
24672636 } else
2468
- if (event.getSource() == detachPigmentItem)
2637
+ if (source == detachPigmentItem)
24692638 {
24702639 Object3D obj;
24712640 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +2645,7 @@
24762645
24772646 refreshContents();
24782647 } else
2479
- if (event.getSource() == attachBumpItem)
2648
+ if (source == attachBumpItem)
24802649 {
24812650 String texture = GetFile("Attach bump");
24822651 Object3D obj;
....@@ -2488,7 +2657,7 @@
24882657
24892658 refreshContents();
24902659 } else
2491
- if (event.getSource() == detachBumpItem)
2660
+ if (source == detachBumpItem)
24922661 {
24932662 Object3D obj;
24942663 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2499,7 +2668,7 @@
24992668
25002669 refreshContents();
25012670 } else
2502
- if (event.getSource() == pigmentBumpItem)
2671
+ if (source == pigmentBumpItem)
25032672 {
25042673 Object3D obj;
25052674 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +2679,195 @@
25102679
25112680 refreshContents();
25122681 } else
2513
- if (event.getSource() == flashSelectionButton)
2682
+ if (source == flashSelectionButton)
25142683 {
25152684 CameraPane.flash = true;
25162685 refreshContents();
25172686 } else
2518
- if (event.getSource() == oneButton)
2687
+ if (source == oneButton)
25192688 {
25202689 } else
2521
- if (event.getSource() == twoButton)
2690
+ if (source == twoButton)
25222691 {
25232692 radio.layout = twoButton;
25242693 // bug
25252694 //gridPanel.setDividerLocation(1.0);
25262695 //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();
2696
+// bigThree.remove(scenePanel);
2697
+// bigThree.remove(centralPanel);
2698
+// bigThree.remove(XYZPanel);
2699
+// aWindowConstraints.gridx = 0;
2700
+// aWindowConstraints.gridy = 0;
2701
+// aWindowConstraints.gridwidth = 1;
2702
+// // aConstraints.gridheight = 3;
2703
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2704
+// aWindowConstraints.weightx = 0;
2705
+// aWindowConstraints.weighty = 1;
2706
+// //bigThree.add(jtp, aWindowConstraints);
2707
+// aWindowConstraints.weightx = 1;
2708
+// aWindowConstraints.gridwidth = 3;
2709
+// // aConstraints.gridheight = 3;
2710
+// aWindowConstraints.gridx = 1;
2711
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2712
+// bigThree.add(centralPanel, aWindowConstraints);
2713
+// aWindowConstraints.weightx = 0;
2714
+// aWindowConstraints.gridx = 4;
2715
+// aWindowConstraints.gridwidth = 1;
2716
+// // aConstraints.gridheight = 3;
2717
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2718
+// //bigThree.add(XYZPanel, aWindowConstraints);
2719
+// scenePanel.setVisible(false);
2720
+// centralPanel.setVisible(true);
2721
+// XYZPanel.setVisible(false);
2722
+ bigThree.ClearUI();
2723
+ bigThree.add(centralPanel);
2724
+ bigThree.FlushUI();
25512725 } else
2552
- if (event.getSource() == threeButton)
2726
+ if (source == threeButton)
25532727 {
25542728 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();
2729
+
2730
+// bigThree.remove(scenePanel);
2731
+// bigThree.remove(centralPanel);
2732
+// bigThree.remove(XYZPanel);
2733
+// aWindowConstraints.gridx = 0;
2734
+// aWindowConstraints.gridy = 0;
2735
+// aWindowConstraints.gridwidth = 1;
2736
+// // aConstraints.gridheight = 3;
2737
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2738
+// aWindowConstraints.weightx = 0;
2739
+// aWindowConstraints.weighty = 1;
2740
+// //bigThree.add(jtp, aWindowConstraints);
2741
+// aWindowConstraints.weightx = 1;
2742
+// aWindowConstraints.gridwidth = 3;
2743
+// // aConstraints.gridheight = 3;
2744
+// aWindowConstraints.gridx = 1;
2745
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2746
+// bigThree.add(centralPanel, aWindowConstraints);
2747
+// aWindowConstraints.weightx = 0;
2748
+// aWindowConstraints.gridx = 4;
2749
+// aWindowConstraints.gridwidth = 1;
2750
+// // aConstraints.gridheight = 3;
2751
+// aConstraints.fill = GridBagConstraints.VERTICAL;
2752
+// bigThree.add(XYZPanel, aWindowConstraints);
2753
+// bigThree.validate();
2754
+// scenePanel.setVisible(false);
2755
+// centralPanel.setVisible(true);
2756
+// XYZPanel.setVisible(true);
2757
+ bigThree.ClearUI();
2758
+ bigThree.add(centralPanel);
2759
+ bigThree.add(XYZPanel);
2760
+ bigThree.FlushUI();
25792761 } else
2580
- if (event.getSource() == fourButton)
2762
+ if (source == fourButton)
25812763 {
25822764 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();
2765
+
2766
+// bigThree.remove(scenePanel);
2767
+// bigThree.remove(centralPanel);
2768
+// bigThree.remove(XYZPanel);
2769
+// aWindowConstraints.gridx = 0;
2770
+// aWindowConstraints.gridy = 0;
2771
+// aWindowConstraints.gridwidth = 1;
2772
+// // aWindowConstraints.gridheight = 3;
2773
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2774
+// aWindowConstraints.weightx = 1;
2775
+// aWindowConstraints.weighty = 1;
2776
+// bigThree.add(scenePanel, aWindowConstraints);
2777
+// aWindowConstraints.weightx = 1;
2778
+// aWindowConstraints.gridwidth = 3;
2779
+// // aConstraints.gridheight = 3;
2780
+// aWindowConstraints.gridx = 1;
2781
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2782
+// //bigThree.add(cameraPanel, aWindowConstraints);
2783
+// aWindowConstraints.weightx = 0;
2784
+// aWindowConstraints.gridx = 4;
2785
+// aWindowConstraints.gridwidth = 1;
2786
+// // aWindowConstraints.gridheight = 3;
2787
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2788
+// //bigThree.add(XYZPanel, aWindowConstraints);
2789
+// bigThree.validate();
2790
+// scenePanel.setVisible(true);
2791
+// centralPanel.setVisible(false);
2792
+// XYZPanel.setVisible(false);
2793
+ bigThree.ClearUI();
2794
+ bigThree.add(scenePanel);
2795
+ bigThree.FlushUI();
26072796 } else
2608
- if (event.getSource() == sixButton)
2797
+ if (source == sixButton)
26092798 {
26102799 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();
2800
+
2801
+// bigThree.remove(scenePanel);
2802
+// bigThree.remove(centralPanel);
2803
+// bigThree.remove(XYZPanel);
2804
+// aWindowConstraints.gridx = 0;
2805
+// aWindowConstraints.gridy = 0;
2806
+// aWindowConstraints.gridwidth = 1;
2807
+// // aConstraints.gridheight = 3;
2808
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2809
+// aWindowConstraints.weightx = 0;
2810
+// aWindowConstraints.weighty = 1;
2811
+// bigThree.add(scenePanel, aWindowConstraints);
2812
+// aWindowConstraints.weightx = 1;
2813
+// aWindowConstraints.gridwidth = 3;
2814
+// // aWindowConstraints.gridheight = 3;
2815
+// aWindowConstraints.gridx = 1;
2816
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2817
+// bigThree.add(centralPanel, aWindowConstraints);
2818
+// aWindowConstraints.weightx = 0;
2819
+// aWindowConstraints.gridx = 4;
2820
+// aWindowConstraints.gridwidth = 1;
2821
+// // aWindowConstraints.gridheight = 3;
2822
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2823
+// //bigThree.add(XYZPanel, aConstraints);
2824
+// bigThree.validate();
2825
+// scenePanel.setVisible(true);
2826
+// centralPanel.setVisible(true);
2827
+// XYZPanel.setVisible(false);
2828
+ bigThree.ClearUI();
2829
+ bigThree.add(scenePanel);
2830
+ bigThree.add(centralPanel);
2831
+ bigThree.FlushUI();
26352832 } else
2636
- if (event.getSource() == sevenButton)
2833
+ if (source == sevenButton)
26372834 {
26382835 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();
2836
+
2837
+// bigThree.remove(scenePanel);
2838
+// bigThree.remove(centralPanel);
2839
+// bigThree.remove(XYZPanel);
2840
+// aWindowConstraints.gridx = 0;
2841
+// aWindowConstraints.gridy = 0;
2842
+// aWindowConstraints.gridwidth = 1;
2843
+// // aWindowConstraints.gridheight = 3;
2844
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2845
+// aWindowConstraints.weightx = 0;
2846
+// aWindowConstraints.weighty = 1;
2847
+// bigThree.add(scenePanel, aWindowConstraints);
2848
+// aWindowConstraints.weightx = 1;
2849
+// aWindowConstraints.gridwidth = 3;
2850
+// // aWindowConstraints.gridheight = 3;
2851
+// aWindowConstraints.gridx = 1;
2852
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
2853
+// bigThree.add(centralPanel, aWindowConstraints);
2854
+// aWindowConstraints.weightx = 0;
2855
+// aWindowConstraints.gridx = 4;
2856
+// aWindowConstraints.gridwidth = 1;
2857
+// // aConstraints.gridheight = 3;
2858
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2859
+// bigThree.add(XYZPanel, aWindowConstraints);
2860
+// bigThree.validate();
2861
+// scenePanel.setVisible(true);
2862
+// centralPanel.setVisible(true);
2863
+// XYZPanel.setVisible(true);
2864
+ bigThree.ClearUI();
2865
+ bigThree.add(scenePanel);
2866
+ bigThree.add(centralPanel);
2867
+ bigThree.add(XYZPanel);
2868
+ bigThree.FlushUI();
26632869 } else
2664
- if (event.getSource() == rootButton)
2870
+ if (source == rootButton)
26652871 {
26662872 Object3D obj;
26672873 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2673,7 +2879,7 @@
26732879
26742880 refreshContents(true);
26752881 } else
2676
- if (event.getSource() == closeButton)
2882
+ if (source == closeButton)
26772883 {
26782884 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26792885 cRadio ab;
....@@ -2694,11 +2900,11 @@
26942900 }
26952901 refreshContents(true);
26962902 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
2903
+ if (source == editItem || source == editButton)
26982904 {
26992905 EditSelection(false);
27002906 } else
2701
- if (event.getSource() == uneditButton)
2907
+ if (source == uneditButton)
27022908 {
27032909 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27042910 {
....@@ -2715,7 +2921,7 @@
27152921 //objEditor.ResetSliders();
27162922 refreshContents(true);
27172923 } else
2718
- if (event.getSource() == clearPanelButton)
2924
+ if (source == clearPanelButton)
27192925 {
27202926 assert(copy == group);
27212927 //copy.ClearUI();
....@@ -2726,7 +2932,7 @@
27262932 listUI.clear();
27272933 refreshContents(true);
27282934 } else
2729
- if (event.getSource() == allParamsButton)
2935
+ if (source == allParamsButton)
27302936 {
27312937 assert(copy == group);
27322938
....@@ -2747,19 +2953,19 @@
27472953
27482954 refreshContents(true);
27492955 } else
2750
- if (event.getSource() == unselectButton)
2956
+ if (source == unselectButton)
27512957 {
27522958 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
2959
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27542960 objEditor.ResetSliders();
27552961 refreshContents(true);
27562962 } else
2757
- if(event.getSource() instanceof cRadio)
2963
+ if(source instanceof cRadio)
27582964 {
27592965 group.parent = keepparent;
27602966 group.attributes = 0;
27612967 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
2968
+ /*cRadio*/ radio = (cRadio)source;
27632969 Object3D obj = radio.GetObject();
27642970 System.out.println("Edit " + obj);
27652971 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +2985,7 @@
27792985 }
27802986
27812987 copy = group;
2782
- //CameraPane.theRenderer.object = group;
2988
+ //Globals.theRenderer.object = group;
27832989 if(!useclient)
27842990 {
27852991 cameraView.renderCamera = radio.camera;
....@@ -2788,7 +2994,8 @@
27882994 cameraView.cameras[cameraView.cameracount] = radio.camera;
27892995 cameraView.targetLookAt.set(radio.camera.lookAt);
27902996 cameraView.object = group;
2791
- cameraView.lighttouched = true;
2997
+ //cameraView.lighttouched = true;
2998
+ Globals.lighttouched = true;
27922999 topView.object = group;
27933000 frontView.object = group;
27943001 sideView.object = group;
....@@ -2824,7 +3031,7 @@
28243031 if (useclient)
28253032 {
28263033 cameraView.object = client;
2827
- cameraView.lighttouched = true;
3034
+ Globals.lighttouched = true;
28283035 //topView.object = client;
28293036 //frontView.object = client;
28303037 //sideView.object = client;
....@@ -2832,7 +3039,7 @@
28323039 else
28333040 {
28343041 cameraView.object = group;
2835
- cameraView.lighttouched = true;
3042
+ Globals.lighttouched = true;
28363043 //topView.object = group;
28373044 //frontView.object = group;
28383045 //sideView.object = group;
....@@ -3065,9 +3272,9 @@
30653272 obj = (Object3D)e.nextElement();
30663273
30673274 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
3275
+ GrafreeD.AnalyzeObject(obj);
30693276 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
3277
+ GrafreeD.AnalyzeObject(obj.bRep);
30713278
30723279 // System.err.println((size/1024) + " KB is the size of " + obj);
30733280 }
....@@ -3109,6 +3316,13 @@
31093316 void GenNormals(boolean crease)
31103317 {
31113318 group.GenNormalsS(crease);
3319
+
3320
+ refreshContents();
3321
+ }
3322
+
3323
+ void GenNormalsMINE()
3324
+ {
3325
+ group.selection.GenNormalsMINE();
31123326
31133327 refreshContents();
31143328 }
....@@ -3157,104 +3371,250 @@
31573371
31583372 //Object3D buffer;
31593373 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
-
3374
+// BoundaryRep temprep;
3375
+// Object3D nodes;
3376
+// Vector<Vertex> vertices;
3377
+//
3378
+// cGroup buffer;
3379
+//
3380
+// public void Vertex(Object3D node, Vertex v)
3381
+// {
3382
+//// vertices.add(v);
3383
+//// nodes.addElement(node);
3384
+////
3385
+//// if (temprep.GetCache(v) != null)
3386
+//// {
3387
+//// temprep.Remove(v);
3388
+//// } else
3389
+//// {
3390
+//// temprep.Remember(v);
3391
+//// }
3392
+//
3393
+// //Object3D node = nodes.get(index);
3394
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
3395
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3396
+//
3397
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3398
+//
3399
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3400
+//
3401
+// cGroup g = new cGroup();
3402
+//
3403
+// if (g.toParent == null)
3404
+// {
3405
+// g.toParent = LA.newMatrix();
3406
+// g.fromParent = LA.newMatrix();
3407
+// }
3408
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3409
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3410
+//
3411
+// g.add(GrafreeD.clipboard);
3412
+//
3413
+// buffer.add(g);
3414
+// }
3415
+//
3416
+// public void Face(Object3D node, Face f)
3417
+// {
3418
+//
3419
+// }
3420
+//
3421
+// void ParseVerticesOld() // ??
3422
+// {
3423
+// //if (group.selection.size() != 1)
3424
+// // return;
3425
+//
3426
+// temprep = new BoundaryRep();
3427
+// nodes = new Object3D();
3428
+// vertices = new Vector<Vertex>();
3429
+//
3430
+// boolean epsequal = GrafreeD.epsequal;
3431
+// GrafreeD.epsequal = true;
3432
+//
3433
+// for (int i=0; i<group.selection.size(); i++)
3434
+// {
3435
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3436
+//
3437
+// group.selection.get(i).Parse(
3438
+//this );
3439
+//
3440
+// int repsize = temprep.VertexCount();
3441
+// int tablesize = temprep.vertextable.size();
3442
+// int nodesize = nodes.size();
3443
+//
3444
+// assert(vertices.size() == nodes.size());
3445
+//
3446
+// temprep.vertextable.elements();
3447
+//
3448
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
3449
+//
3450
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3451
+// {
3452
+// cGroup g = new cGroup();
3453
+//
3454
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3455
+//
3456
+// Object3D node = nodes.get(index);
3457
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
3458
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
3459
+//
3460
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
3461
+//
3462
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3463
+//
3464
+// if (g.toParent == null)
3465
+// {
3466
+// g.toParent = LA.newMatrix();
3467
+// g.fromParent = LA.newMatrix();
3468
+// }
3469
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3470
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
3471
+//
3472
+// g.add(GrafreeD.clipboard);
3473
+//
3474
+// buffer.add(g);
3475
+// }
3476
+//
3477
+// makeSomething(buffer, i==group.selection.size()-1);
3478
+// }
3479
+//
3480
+// GrafreeD.epsequal = epsequal;
3481
+//
3482
+// //buffer = null;
3483
+// temprep = null;
3484
+// nodes = null;
3485
+//
3486
+// refreshContents();
3487
+// }
3488
+
31843489 void ParseVertices()
31853490 {
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;
3491
+ boolean epsequal = GrafreeD.epsequal;
3492
+ GrafreeD.epsequal = true;
31953493
31963494 for (int i=0; i<group.selection.size(); i++)
31973495 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
3496
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31993497
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
3498
+ group.selection.get(i).Parse(
3499
+
3500
+ new iParse()
3501
+ {
3502
+ public void Vertex(Object3D node, Vertex v)
3503
+ {
3504
+ temp.set(v);
3505
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32053506
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();
3507
+ cGroup g = new cGroup();
32113508
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
3509
+ if (g.toParent == null)
3510
+ {
3511
+ g.toParent = LA.newMatrix();
3512
+ g.fromParent = LA.newMatrix();
3513
+ }
3514
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3515
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32153516
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);
3517
+ g.add(GrafreeD.clipboard);
32203518
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);
3519
+ buffer.add(g);
3520
+ }
32323521
3233
- g.add(GraphreeD.clipboard);
3522
+ public void Face(Object3D node, Face f)
3523
+ {
32343524
3235
- buffer.add(g);
3236
- }
3525
+ }
3526
+ }
3527
+ );
32373528
32383529 makeSomething(buffer, i==group.selection.size()-1);
32393530 }
32403531
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
3532
+ GrafreeD.epsequal = epsequal;
32463533
32473534 refreshContents();
32483535 }
3249
-
3536
+
3537
+ void TextureVertices()
3538
+ {
3539
+ for (int i=0; i<group.selection.size(); i++)
3540
+ {
3541
+ group.selection.get(i).Parse(
3542
+ new iParse()
3543
+ {
3544
+ public void Vertex(Object3D node, Vertex v)
3545
+ {
3546
+ cTexture tex = node.GetTextures();
3547
+ String pigment = Object3D.GetPigment(tex);
3548
+ //String bump = Object3D.GetBump(tex);
3549
+
3550
+ com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3551
+
3552
+ double s = v.s;
3553
+
3554
+ if (s == 1)
3555
+ s = 0;
3556
+
3557
+ double t = v.t;
3558
+
3559
+ if (t == 1)
3560
+ t = 0;
3561
+
3562
+ int indexs = (int) (texturedata.getWidth() * s);
3563
+ int indext = (int) (texturedata.getHeight() * t);
3564
+
3565
+ int index = indext * texturedata.getWidth() + indexs;
3566
+
3567
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
3568
+
3569
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
3570
+
3571
+ float scale = bytebuf.get(index*slide) & 0xFF;
3572
+ scale += bytebuf.get(index*slide+1) & 0xFF;
3573
+ scale += bytebuf.get(index*slide+2) & 0xFF;
3574
+ scale /= 3;
3575
+
3576
+ scale /= 0xFF;
3577
+ // c'est quoi ca? scale /= 4;
3578
+
3579
+ //v.AO = scale;
3580
+
3581
+ v.x += v.norm.x * scale;
3582
+ v.y += v.norm.y * scale;
3583
+ v.z += v.norm.z * scale;
3584
+ }
3585
+
3586
+ public void Face(Object3D node, Face f)
3587
+ {
3588
+ }
3589
+ }
3590
+ );
3591
+ }
3592
+
3593
+ refreshContents();
3594
+ }
3595
+
32503596 void Align()
32513597 {
3598
+ if (group.selection.size() == 0)
3599
+ return;
3600
+
3601
+ cVector bbmin = new cVector();
3602
+ cVector bbmax = new cVector();
3603
+
3604
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
3605
+
3606
+ double dx = bbmax.x - bbmin.x;
3607
+ double dy = bbmax.y - bbmin.y;
3608
+ double dz = bbmax.z - bbmin.z;
3609
+
3610
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
3611
+
32523612 for (int i=0; i<group.selection.size(); i++)
32533613 {
32543614 Object3D obj = group.selection.get(i);
32553615
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
3616
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
3617
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32583618 }
32593619
32603620 refreshContents();
....@@ -3267,7 +3627,7 @@
32673627 // ref.SaveSupports();
32683628 // Object3D par = ref.parent;
32693629 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
3630
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32713631 // ref.parent = par;
32723632 // ref.RestoreSupports();
32733633
....@@ -3297,7 +3657,7 @@
32973657 // lowres.SaveSupports();
32983658 // par = lowres.parent;
32993659 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
3660
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33013661 Object3D newlow = CloneObject(lowres, false);
33023662 newlow.name = sn.switchobject.get(i).name;
33033663 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +3679,7 @@
33193679 return;
33203680
33213681 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
3682
+ Object3D ref = GrafreeD.clipboard.get(0);
33233683
33243684 Object3D newgroup = new Object3D("Po:" + poses.name);
33253685
....@@ -3488,7 +3848,7 @@
34883848 group.selection.RelinkToSupport(); // july 2014
34893849 System.out.println("DONE.");
34903850 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3851
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34923852 }
34933853
34943854 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +3873,20 @@
35133873
35143874 void ClipMesh()
35153875 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3876
+ if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
35173877 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
3878
+ Object3D content = GrafreeD.clipboard.get(0);
35193879
35203880 if (content instanceof cGroup && ((cGroup)content).transientlink )
35213881 content = ((cGroup)content).get(0);
35223882
35233883 // for (int i=0; i<group.selection.size(); i++)
35243884 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
3885
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35263886 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
3887
+ group.selection.ClipMesh(GrafreeD.clipboard);
35283888 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
3889
+// group.selection.ClipMesh(GrafreeD.clipboard);
35303890 System.out.println("DONE.");
35313891 refreshContents();
35323892 }
....@@ -3773,16 +4133,16 @@
37734133
37744134 objEditor.SetText(); // jan 2014
37754135
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4136
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
37774137 CameraPane.flash = true;
37784138
37794139 if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
37804140 // a camera
37814141 {
37824142 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;
4143
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4144
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4145
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37864146 }
37874147
37884148 refreshContents();
....@@ -3864,12 +4224,12 @@
38644224 {
38654225 if (group.selection.isEmpty())
38664226 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
4227
+ GrafreeD.clipboardIsTempGroup = false;
38684228 Composite tGroup = null;
38694229 if (group.selection.size() > 0) // 1)
38704230 {
38714231 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
4232
+ GrafreeD.clipboardIsTempGroup = true;
38734233 }
38744234
38754235 if (cut)
....@@ -3909,16 +4269,16 @@
39094269 //System.out.println("cut " + child);
39104270 //System.out.println("parent = " + child.parent);
39114271 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
4272
+ if (GrafreeD.clipboardIsTempGroup)
39134273 tGroup.add/*Child*/(tmp);
39144274 else
3915
- GraphreeD.clipboard = tmp;
4275
+ GrafreeD.clipboard = tmp;
39164276 }
39174277 else
3918
- if (GraphreeD.clipboardIsTempGroup)
4278
+ if (GrafreeD.clipboardIsTempGroup)
39194279 tGroup.add/*Child*/(child);
39204280 else
3921
- GraphreeD.clipboard = child;
4281
+ GrafreeD.clipboard = child;
39224282 }
39234283
39244284 //ResetModel();
....@@ -3950,21 +4310,21 @@
39504310 //System.out.println("cut " + elem);
39514311 //System.out.println("parent = " + elem.parent);
39524312 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
4313
+ if (GrafreeD.clipboardIsTempGroup)
39544314 tGroup.add/*Child*/(tmp);
39554315 else
3956
- GraphreeD.clipboard = tmp;
4316
+ GrafreeD.clipboard = tmp;
39574317 }
39584318 else
3959
- if (GraphreeD.clipboardIsTempGroup)
4319
+ if (GrafreeD.clipboardIsTempGroup)
39604320 tGroup.add/*Child*/(child);
39614321 else
3962
- GraphreeD.clipboard = child;
4322
+ GrafreeD.clipboard = child;
39634323 }
39644324
39654325 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
4326
+ if (GrafreeD.clipboardIsTempGroup)
4327
+ GrafreeD.clipboard = tGroup;
39684328 if (cut)
39694329 {
39704330 ResetModel();
....@@ -3974,11 +4334,11 @@
39744334
39754335 void paste(boolean expand)
39764336 {
3977
- // if (GraphreeD.clipboard == null)
4337
+ // if (GrafreeD.clipboard == null)
39784338 // return;
39794339 boolean first = true;
39804340
3981
- if (GraphreeD.clipboardIsTempGroup)
4341
+ if (GrafreeD.clipboardIsTempGroup)
39824342 {
39834343 Composite temp;
39844344
....@@ -3989,7 +4349,7 @@
39894349 temp = (Composite)Applet3D.clipboard.deepCopy();
39904350 */
39914351 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4352
+ for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39934353 {
39944354 Object3D child = (Object3D)e.nextElement();
39954355
....@@ -4003,7 +4363,7 @@
40034363 else
40044364 elem = child.deepCopy(); // ?
40054365 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
4366
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40074367 // elem = elem.get(0);
40084368 makeSomething(elem, true); // ?? first);
40094369 //group.addChild(elem);
....@@ -4023,14 +4383,14 @@
40234383 //Object3D cb = Applet3D.clipboard;
40244384 //temp.addChild(cb);
40254385 //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());
4386
+ assert(GrafreeD.clipboard.parent == null);
4387
+ Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4388
+ GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4389
+ if (LA.isIdentity(GrafreeD.clipboard.toParent))
4390
+ makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
40314391 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
4392
+ makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4393
+ GrafreeD.clipboard.get(0).parent = keepparent;
40344394 }
40354395
40364396 ResetModel();
....@@ -4039,7 +4399,7 @@
40394399
40404400 void pasteInto(boolean copyit)
40414401 {
4042
-// if (GraphreeD.clipboard == null)
4402
+// if (GrafreeD.clipboard == null)
40434403 // return;
40444404
40454405 if (group.selection.size() != 1)
....@@ -4072,9 +4432,9 @@
40724432 {
40734433 boolean first = true;
40744434
4075
- if (GraphreeD.clipboardIsTempGroup)
4435
+ if (GrafreeD.clipboardIsTempGroup)
40764436 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
4437
+ Composite temp = (Composite)GrafreeD.clipboard;
40784438 Object3D copy;
40794439 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40804440 {
....@@ -4084,7 +4444,7 @@
40844444 }
40854445 } else
40864446 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
4447
+ linkSomething(GrafreeD.clipboard); //.get(0));
40884448 }
40894449 }
40904450 }
....@@ -4276,6 +4636,26 @@
42764636 makeSomething(csg);
42774637 }
42784638
4639
+ void Ungroup(Object3D g)
4640
+ {
4641
+ if (g instanceof HiddenObject)
4642
+ {
4643
+ HiddenObject h = (HiddenObject) g;
4644
+
4645
+ for (int i=0; i<h.ActualSize(); i++)
4646
+ {
4647
+ objEditor.makeSomething(h.get(i), false);
4648
+ }
4649
+ }
4650
+ else
4651
+ {
4652
+ for (int i=0; i<g.Size(); i++)
4653
+ {
4654
+ objEditor.makeSomething(g.get(i), false);
4655
+ }
4656
+ }
4657
+ }
4658
+
42794659 void ungroup()
42804660 {
42814661 /*
....@@ -4471,7 +4851,7 @@
44714851
44724852 void ImportGFD()
44734853 {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4854
+ FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
44754855 browser.show();
44764856 String filename = browser.getFile();
44774857 if (filename != null && filename.length() > 0)
....@@ -4509,7 +4889,7 @@
45094889
45104890 void ImportVRMLX3D()
45114891 {
4512
- if (GraphreeD.standAlone)
4892
+ if (GrafreeD.standAlone)
45134893 {
45144894 /**/
45154895 FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
....@@ -4526,7 +4906,7 @@
45264906
45274907 String GetFile(String dialogName)
45284908 {
4529
- if (GraphreeD.standAlone)
4909
+ if (GrafreeD.standAlone)
45304910 {
45314911 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45324912 browser.show();
....@@ -4635,6 +5015,7 @@
46355015 private MenuItem resetsupportItem;
46365016 private MenuItem resetreferencesItem;
46375017 private MenuItem linkverticesItem;
5018
+ private MenuItem relinkverticesItem;
46385019 private MenuItem setMasterItem;
46395020 private MenuItem resetMeshItem;
46405021 private MenuItem stepAllItem;
....@@ -4653,8 +5034,10 @@
46535034 private MenuItem clearItem;
46545035 private MenuItem clearAllItem;
46555036 private MenuItem genUVItem;
5037
+ private MenuItem genNormalsMESHItem;
46565038 private MenuItem genNormalsCADItem;
46575039 private MenuItem genNormalsORGANItem;
5040
+ private MenuItem genNormalsMINEItem;
46585041 private MenuItem stripifyItem;
46595042 private MenuItem unstripifyItem;
46605043 private MenuItem trimItem;
....@@ -4696,6 +5079,7 @@
46965079 private MenuItem resetCentroidItem;
46975080 private MenuItem transformgeometryItem;
46985081 private MenuItem resetTransformItem;
5082
+ private MenuItem hideItem;
46995083 private MenuItem grabItem;
47005084 private MenuItem backItem;
47015085 private MenuItem frontItem;
....@@ -4716,6 +5100,7 @@
47165100
47175101 private MenuItem resetParentItem;
47185102 private MenuItem repairParentItem;
5103
+ private MenuItem repairShadowItem;
47195104 private MenuItem sortbysizeItem;
47205105 private MenuItem sortbynameItem;
47215106
....@@ -4728,12 +5113,15 @@
47285113 private MenuItem particleItem;
47295114 private MenuItem ragdollItem;
47305115 private MenuItem ragdoll2Item;
5116
+ private MenuItem heightFieldItem;
5117
+ private MenuItem textureFieldItem;
47315118 private MenuItem gridItem;
47325119 private MenuItem rectoidItem;
47335120 private MenuItem ellipsoidItem;
47345121 private MenuItem coneItem;
47355122 private MenuItem torusItem;
47365123 private MenuItem superItem;
5124
+ private MenuItem kleinItem;
47375125 private MenuItem blobItem;
47385126 private MenuItem latheItem;
47395127 private MenuItem bezierItem;
....@@ -4746,6 +5134,7 @@
47465134 private MenuItem csgItem;
47475135 private MenuItem templateItem;
47485136 private MenuItem textureItem;
5137
+ private MenuItem billboardItem;
47495138 private MenuItem shadowXItem;
47505139 private MenuItem shadowYItem;
47515140 private MenuItem shadowZItem;