From 25cef97465f0bfa8959663754e9243006324c81c Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 01 May 2019 10:09:53 -0400
Subject: [PATCH] Nimbus L&F

---
 GroupEditor.java |  865 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 474 insertions(+), 391 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index d7a1c3e..60a98fd 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -12,6 +12,7 @@
 import com.jme.math.Vector3f;
 import com.jme.renderer.ColorRGBA;
 
+import grafeme.ui.*;
 //import buoy.widget.BFileChooser;
 
 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
@@ -433,84 +434,26 @@
         oe.radioPanel.add(dummyButton);
         oe.buttonGroup.add(dummyButton);
          */
-                aConstraints.gridy += 1;
-		oe.aConstraints.gridwidth = 1;
-        	oe.aConstraints.gridx = 0;
+                //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
                 
-                oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
+                oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
+                liveCB.setToolTipText("Enabled animation");
                                 liveCB.addItemListener(this);
 
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
-                                supportCB.addItemListener(this);
-
-        //	oe.aConstraints.gridx += 1;
-        //        oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
-        //                        localCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
-                                crowdCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
-                                smoothCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
-                                fastCB.addItemListener(this);
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
-                                slowCB.addItemListener(this);
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
-                                boxCB.addItemListener(this);
-
-//        	oe.aConstraints.gridx += 1;
-//                oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
-//                                speakerMocapCB.addItemListener(this);
-
-            if (false)
-            {
-                // handled in scripts
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
-                                speakerCameraCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
-                                speakerFocusCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
-                                smoothfocusCB.addItemListener(this);
-            }
-
-//oe.aConstraints.gridx += 1;
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
-//                debugCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
-                                oeilCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
-                                lookAtCB.addItemListener(this);
-
-        	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
+                oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
+                trackCB.setToolTipText("Enable tracking");
                                 trackCB.addItemListener(this);
 
-        	oe.aConstraints.gridx += 1;
-		oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                screenfitButton.setToolTipText("Screen fit");
 		screenfitButton.addActionListener(this);
-			oe.aConstraints.gridx += 1;
+
 //		oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
 //		screenfitpointButton.addActionListener(this);
 //			oe.aConstraints.gridx += 1;
-		oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
 		snapobjectButton.addActionListener(this);
+                snapobjectButton.setToolTipText("Snap Object");
 			oe.aConstraints.gridx += 1;
 
                 //aConstraints.gridx = 0;
@@ -518,29 +461,35 @@
 		oe.aConstraints.weighty = 0;
 		oe.aConstraints.gridwidth = 1;
 		
-		oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                flashSelectionButton.setToolTipText("Show selection");
 		flashSelectionButton.addActionListener(this);
-		oe.aConstraints.gridx += 1;
-		oe.aConstraints.weighty = 0;
-		oe.aConstraints.gridwidth = 1;
                 
-                //
-		oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
+                
+		oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                twoButton.setToolTipText("Show center view only");
 		twoButton.addActionListener(this);
-		oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
 		fourButton.addActionListener(this);
-		oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
+                fourButton.setToolTipText("Show left panel only");
+		oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                sixButton.setToolTipText("2-column layout left");
 		sixButton.addActionListener(this);
-		oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
+		oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                threeButton.setToolTipText("2-column layout right");
 		threeButton.addActionListener(this);
-		oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
+		oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                sevenButton.setToolTipText("3-column layout");
 		sevenButton.addActionListener(this);
                 //
 
-		oe.toolbarPanel.add(rootButton = new cButton(" o o o  E  ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                rootButton.setToolTipText("Edit object in new tab");
 		rootButton.addActionListener(this);
 			oe.aConstraints.gridx += 1;
-		oe.toolbarPanel.add(closeButton = new cButton("  X  ")); //, oe.aConstraints);
+		oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                closeButton.setToolTipText("Close tab");
 		closeButton.addActionListener(this);
 		//oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
 		//clearButton.addActionListener(this);
@@ -643,17 +592,91 @@
         radio.layout = sevenButton;
         oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
 	}
+        
+        void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
+        {
+        	//constraints.gridx = 0;
+        	//constraints.gridy = 0;
+                panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
+                fastCB.setToolTipText("Fast mode");
+                                fastCB.addItemListener(this);
+        	//constraints.gridy += 1;
+                panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
+                supportCB.setToolTipText("Enabled rigging");
+                                supportCB.addItemListener(this);
+
+        //	constraints.gridy += 1;
+        //        panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
+        //                        localCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
+                crowdCB.setToolTipText("Used for crowds");
+                                crowdCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
+                smoothCB.setToolTipText("Snapping delay");
+                                smoothCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
+                slowCB.setToolTipText("Smooth interpolation");
+                                slowCB.addItemListener(this);
+        	//constraints.gridy += 1;
+                panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
+                boxCB.setToolTipText("Display bounding boxes");
+                                boxCB.addItemListener(this);
+        	//constraints.gridy += 1;
+                panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
+                zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
+                                zoomBoxCB.addItemListener(this);
+
+//        	constraints.gridy += 1;
+//                panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
+//                                speakerMocapCB.addItemListener(this);
+
+            if (false)
+            {
+                // handled in scripts
+        	//constraints.gridy += 1;
+                panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
+                                speakerCameraCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
+                                speakerFocusCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
+                                smoothfocusCB.addItemListener(this);
+            }
+
+//constraints.gridx += 1;
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
+//                debugCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
+                                oeilCB.addItemListener(this);
+
+        	//constraints.gridy += 1;
+                panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
+                lookAtCB.setToolTipText("Look-at target");
+                                lookAtCB.addItemListener(this);
+
+        }
 	
         void EditObject(Object3D obj)
         {
-            cRadio dummyButton = new cRadio(obj.name);
-            dummyButton.SetObject(obj);
-            dummyButton.layout = sevenButton;
-            dummyButton.SetCamera(cameraView.renderCamera, false);
-            dummyButton.addActionListener(this);
-            radioPanel.add(dummyButton);
-            buttonGroup.add(dummyButton);
-            dummyButton.doClick();
+            cRadio radioButton = new cRadio(obj.name);
+            radioButton.SetObject(obj);
+            radioButton.layout = sevenButton;
+            radioButton.SetCamera(cameraView.renderCamera, false);
+            radioButton.addActionListener(this);
+            radioPanel.add(radioButton);
+            buttonGroup.add(radioButton);
+            radioButton.doClick();
         }
         void SetupViews(ObjEditor oe)
         {
@@ -673,6 +696,7 @@
         JCheckBox fastCB;
         JCheckBox slowCB;
         JCheckBox boxCB;
+        JCheckBox zoomBoxCB;
         JCheckBox trackCB;
         JCheckBox smoothfocusCB;
 //        JCheckBox speakerMocapCB;
@@ -715,8 +739,7 @@
                     dropAttributes |= Object3D.TEXTURE;
                 else
                     dropAttributes &= ~Object3D.TEXTURE;
-            }
-            else if(e.getSource() == liveCB)
+            } else if(e.getSource() == liveCB)
             {
                 cameraView.ToggleLive();
             }
@@ -753,6 +776,10 @@
                 Recompile();
         cameraView.repaint();
 //                refreshContents();
+            }
+            else if(e.getSource() == zoomBoxCB)
+            {
+                cameraView.ToggleZoomBoxMode();
             }
             else if(e.getSource() == smoothfocusCB)
             {
@@ -1118,6 +1145,8 @@
 		resetParentItem.addActionListener(this);
 		repairParentItem = menu.add(new MenuItem("Repair Parent"));
 		repairParentItem.addActionListener(this);
+		repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
+		repairShadowItem.addActionListener(this);
 		menu.add(invariantsItem = new MenuItem("Invariants"));
 		invariantsItem.addActionListener(this);
 		menu.add(recompileItem = new MenuItem("Recompile"));
@@ -1478,6 +1507,7 @@
 //
         public void actionPerformed(ActionEvent event) // , Object arg)
 	{
+                Object source = event.getSource();
             /*
 		if (event.getSource() == nameField)
 		{
@@ -1489,11 +1519,11 @@
 		}
                 else
              */
-		if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
+		if (source == lookAtItem || source == lookFromItem)
 		{
                     ScreenFit();
                 } else
-		if (event.getSource() == switchItem)
+		if (source == switchItem)
 		{
 			cVector v1 = new cVector();
 			cVector v2 = new cVector();
@@ -1502,11 +1532,11 @@
 			objEditor.cameraView.renderCamera.setAim(v2, v1);
 			objEditor.cameraView.repaint();
 		} else
-		if (event.getSource() == rectoidItem)
+		if (source == rectoidItem)
 		{
 			makeSomething(new Box());
 		} else
-		if (event.getSource() == particleItem)
+		if (source == particleItem)
 		{
         ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
         ParticleController particleController = new ParticleController(particleGeom);
@@ -1527,9 +1557,9 @@
         applyExample(particleGeom, "SMOKE");
 			makeSomething(particleGeom);
 		} else
-		if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
+		if (source == ragdollItem || source == ragdoll2Item)
 		{
-                    GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
+                    GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
                     
                     ragdoll.toParent = LA.newMatrix();
                     ragdoll.fromParent = LA.newMatrix();
@@ -1547,7 +1577,7 @@
 		} else
                     /*
                      */
-		if (event.getSource() == heightFieldItem)
+		if (source == heightFieldItem)
 		{
                     Object3D obj = new Object3D();
                     
@@ -1585,31 +1615,31 @@
                     
                     makeSomething(obj);
 		} else
-		if (event.getSource() == gridItem)
+		if (source == gridItem)
 		{
 			makeSomething(new Grid());
 		} else
-		if (event.getSource() == ellipsoidItem)
+		if (source == ellipsoidItem)
 		{
 			makeSomething(new Sphere());
 		} else
-		if (event.getSource() == coneItem)
+		if (source == coneItem)
 		{
 			makeSomething(new Cone());
 		} else
-		if (event.getSource() == torusItem)
+		if (source == torusItem)
 		{
 			makeSomething(new Torus());
 		} else
-		if (event.getSource() == superItem)
+		if (source == superItem)
 		{
 			makeSomething(new Superellipsoid());
 		} else
-		if (event.getSource() == kleinItem)
+		if (source == kleinItem)
 		{
 			makeSomething(new Klein());
 		} else
-		if (event.getSource() == blobItem)
+		if (source == blobItem)
 		{
 			Blob blob = new Blob();
 			BlobComponent comp = new BlobComponent();
@@ -1617,15 +1647,15 @@
 			//blob.retile();
 			makeSomething(blob);
 		} else
-		if (event.getSource() == latheItem)
+		if (source == latheItem)
 		{
 			makeSomething(new Lathe());
 		} else
-		if (event.getSource() == bezierItem)
+		if (source == bezierItem)
 		{
 			makeSomething(new BezierSurface());
 		} else
-		if (event.getSource() == checkerItem)
+		if (source == checkerItem)
 		{
                     /*
 			Object3D obj = new BezierSurface(5,8);
@@ -1640,7 +1670,7 @@
                      */
 			makeSomething(new Checker());
 		} else
-		if (event.getSource() == meshItem)
+		if (source == meshItem)
 		{
                     Object3D itemtomake = new Object3D();
                     Object3D child;
@@ -1661,35 +1691,35 @@
                         makeSomething(child);
                     }
 		} else
-		if (event.getSource() == springItem)
+		if (source == springItem)
 		{
 			cSpring s = new cSpring();
                         s.setup();
 			makeSomething(s);
 		} else
-		if (event.getSource() == flagItem)
+		if (source == flagItem)
 		{
 			cSpring s = new cFlag();
                         s.setup();
 			makeSomething(s);
 		} else
-		if (event.getSource() == lightItem)
+		if (source == lightItem)
 		{
 			makeSomething(new Light());
 		} else
-		if (event.getSource() == csgItem)
+		if (source == csgItem)
 		{
 			group(new CSG());
 		} else
-		if (event.getSource() == templateItem)
+		if (source == templateItem)
 		{
 			group(new cTemplate());
 		} else
-		if (event.getSource() == attributeItem)
+		if (source == attributeItem)
 		{
 			makeSomething(new Attribute());
 		} else
-		if (event.getSource() == pointflowItem)
+		if (source == pointflowItem)
 		{
 			makeSomething(new PointFlow());
 		} else
@@ -1701,7 +1731,7 @@
 		} else
                      */
                     
-		if (event.getSource() == superLoopItem)
+		if (source == superLoopItem)
 		{
                         Composite g = new cGroup();
                         for (int i=0; i<15; i++)
@@ -1723,7 +1753,7 @@
                             
 			group(g);
 		} else
-		if (event.getSource() == loopItem)
+		if (source == loopItem)
 		{
                         Composite csg = new GroupLeaf();
                         csg.count = 5;
@@ -1732,7 +1762,7 @@
                         csg.addChild(child);
                         child.addChild(csg);
 		} else
-		if (event.getSource() == doubleItem)
+		if (source == doubleItem)
 		{
                         Composite csg = new GroupLeaf();
                         csg.count = 5;
@@ -1744,7 +1774,7 @@
                         csg.addChild(child);
                         child.addChild(csg);
 		} else
-		if (event.getSource() == tripleItem)
+		if (source == tripleItem)
 		{
                         Composite csg = new GroupLeaf();
                         csg.count = 4;
@@ -1760,70 +1790,70 @@
                         child.addChild(csg);
 		} else
                     
-		if (event.getSource() == importGFDItem)
+		if (source == importGFDItem)
 		{
 			ImportGFD();
 		} else
-		if (event.getSource() == importVRMLX3DItem)
+		if (source == importVRMLX3DItem)
 		{
 			ImportVRMLX3D();
 		} else
-		if (event.getSource() == import3DSItem)
+		if (source == import3DSItem)
 		{
 			objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
 		} else
-		if (event.getSource() == importOBJItem)
+		if (source == importOBJItem)
 		{
 			objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
 		} else
-		if (event.getSource() == computeAOItem)
+		if (source == computeAOItem)
 		{
-                    CameraPane.drawMode = CameraPane.OCCLUSION;
-                    CameraPane.theRenderer.repaint();
+                    Globals.drawMode = CameraPane.OCCLUSION;
+                    Globals.theRenderer.repaint();
 		} else
-		if (event.getSource() == recompileItem)
+		if (source == recompileItem)
 		{
                     Recompile();
                     refreshContents();
 		} else
-		if (event.getSource() == editScriptItem)
+		if (source == editScriptItem)
 		{
                     OpenDialog();
                     refreshContents();
 		} else
-		if (event.getSource() == invariantsItem)
+		if (source == invariantsItem)
 		{
                     System.out.println("Invariants:");
-                    GrafreeD.theApplet3D.universe.invariants();
+                    GrafreeD.grafreeD.universe.invariants();
 		} else
-		if (event.getSource() == memoryItem)
+		if (source == memoryItem)
 		{
                     //System.out.println("Invariants:");
                     PrintMemory();
 		} else
-		if (event.getSource() == pathItem)
+		if (source == pathItem)
 		{
                     PrintPath();
 		} else
-		if (event.getSource() == analyzeItem)
+		if (source == analyzeItem)
 		{
                     AnalyzeObject();
 		} else
-		if (event.getSource() == dumpItem)
+		if (source == dumpItem)
 		{
                     DumpObject();
 		} else
-		if (event.getSource() == screenfitButton)
+		if (source == screenfitButton)
 		{
 			//Reload(lastConverter, lastFilename, true);
                     ScreenFit();
 		} else
-		if (event.getSource() == screenfitpointButton)
+		if (source == screenfitpointButton)
 		{
 			//Reload(lastConverter, lastFilename, true);
                     ScreenFitPoint();
 		} else
-		if (event.getSource() == snapobjectButton)
+		if (source == snapobjectButton)
 		{
 			//Reload(lastConverter, lastFilename, true);
                     SnapObject();
@@ -1834,13 +1864,13 @@
 //                    Recompile();
 //                    refreshContents();
 //		} else
-		if (event.getSource() == gcButton)
+		if (source == gcButton)
 		{
                     System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
                     System.gc();
                     System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
 		} else
-		if (event.getSource() == editLeafItem)
+		if (source == editLeafItem)
 		{
                     Object3D obj;
                     for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -1854,62 +1884,62 @@
                     }
                     refreshContents(true);
 		} else
-		if (event.getSource() == openWindowItem)
+		if (source == openWindowItem)
 		{
 			EditSelection(true);
 		} else
-		if (event.getSource() == cutItem || event.getSource() == clearButton)
+		if (source == cutItem || source == clearButton)
 		{
 			loadClipboard(true);
 		} else
-		if (event.getSource() == duplicateItem)
+		if (source == duplicateItem)
 		{
                     Object3D keep = GrafreeD.clipboard;
 			loadClipboard(false);
 			paste(false);
                     GrafreeD.clipboard = keep;
 		} else
-		if (event.getSource() == cloneItem)
+		if (source == cloneItem)
 		{
                     CloneSelection(false);
 		} else
-		if (event.getSource() == cloneSupportItem)
+		if (source == cloneSupportItem)
 		{
                     CloneSelection(true);
 		} else
-		if (event.getSource() == copyItem)
+		if (source == copyItem)
 		{
 			loadClipboard(false);
 		} else
-		if (event.getSource() == pasteItem)
+		if (source == pasteItem)
 		{
 			paste(false);
 		} else
-		if (event.getSource() == pasteLinkItem)
+		if (source == pasteLinkItem)
 		{
 			pasteInto(false);
 		} else
-		if (event.getSource() == pasteCloneItem)
+		if (source == pasteCloneItem)
 		{
 			pasteInto(true);
 		} else
-		if (event.getSource() == pasteExpandItem)
+		if (source == pasteExpandItem)
 		{
 			paste(true);
 		} else
-		if (event.getSource() == synchronizeItem)
+		if (source == synchronizeItem)
 		{
                     Overwrite(Object3D.TRANSFORM);
                 } else
-		if (event.getSource() == overwriteNameItem)
+		if (source == overwriteNameItem)
 		{
                     Overwrite(Object3D.NAME);
                 } else
-		if (event.getSource() == overwriteUVItem)
+		if (source == overwriteUVItem)
 		{
                     Overwrite(Object3D.UV);
                 } else
-		if (event.getSource() == overwriteMatItem)
+		if (source == overwriteMatItem)
 		{
                     /* july 2015
                     if ((dropAttributes & Object3D.TEXTURE) == 0)
@@ -1929,7 +1959,7 @@
                     
                     Overwrite(dropAttributes);
                 }
-		if (event.getSource() == overwriteGeoItem)
+		if (source == overwriteGeoItem)
 		{
                     Overwrite(Object3D.GEOMETRY);
 //                    if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
@@ -1946,7 +1976,7 @@
 //		refreshContents();
 //                    }
 		} else
-		if (event.getSource() == generateMeshItem)
+		if (source == generateMeshItem)
 		{
                     //if (group.selection.size() == 1)
 //                    for (int i=0; i<group.selection.size(); i++)
@@ -1957,7 +1987,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == extractGeometriesItem)
+		if (source == extractGeometriesItem)
 		{
                     boolean one = false;
                     
@@ -1984,7 +2014,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == cloneGeometriesItem)
+		if (source == cloneGeometriesItem)
 		{
                     boolean one = false;
                     
@@ -2010,7 +2040,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == shareGeometriesItem)
+		if (source == shareGeometriesItem)
 		{
                     boolean one = false;
                     
@@ -2040,7 +2070,7 @@
                         refreshContents();
                     }
 		} else
-		if (event.getSource() == mergeGeometriesItem)
+		if (source == mergeGeometriesItem)
 		{
                     boolean one = false;
                     
@@ -2070,7 +2100,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == linkverticesItem)
+		if (source == linkverticesItem)
 		{
 //                    if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
 //                    {
@@ -2090,7 +2120,7 @@
                         if (content instanceof cGroup && ((cGroup)content).transientlink )
                             content = ((cGroup)content).get(0);
 
-            CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
+            Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
                         for (int i=0; i<group.selection.size(); i++)
                         {
                             boolean random = CameraPane.RANDOM;
@@ -2099,11 +2129,11 @@
                       //      group.selection.get(i).setMasterThis(content); // should be identity
                             CameraPane.RANDOM = random;
                         }
-            CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
+            Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
 		refreshContents();
                     }
 		} else
-		if (event.getSource() == resetsupportItem)
+		if (source == resetsupportItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
                     {
@@ -2115,7 +2145,7 @@
 
                     refreshContents();
 		} else
-		if (event.getSource() == relinkverticesItem)
+		if (source == relinkverticesItem)
 		{
                     boolean random = CameraPane.RANDOM;
                     CameraPane.RANDOM = false; // parse all random nodes
@@ -2124,7 +2154,7 @@
 
                     refreshContents();
 		} else
-		if (event.getSource() == resetreferencesItem)
+		if (source == resetreferencesItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
                     {
@@ -2133,7 +2163,7 @@
 
                     refreshContents();
 		} else
-		if (event.getSource() == setMasterItem)
+		if (source == setMasterItem)
 		{
                     if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
                     {
@@ -2146,7 +2176,7 @@
 		refreshContents();
                     }
 		} else
-		if (event.getSource() == poseMeshItem)
+		if (source == poseMeshItem)
 		{
                     if (group.selection.size() == 1)
                     {
@@ -2165,19 +2195,19 @@
                     }
                         
 		} else
-		if (event.getSource() == revertMeshItem)
+		if (source == revertMeshItem)
 		{
 			RevertMeshes();
 		} else
-		if (event.getSource() == resetMeshItem)
+		if (source == resetMeshItem)
 		{
 			ResetAll();
 		} else
-		if (event.getSource() == stepAllItem)
+		if (source == stepAllItem)
 		{
 			StepAll();
 		} else
-		if (event.getSource() == clearItem) // || event.getSource() == clearButton)
+		if (source == clearItem) // || event.getSource() == clearButton)
 		{
 			//int indices[] = jList.getSelectedIndices();
 			//for (int i = indices.length - 1; i >= 0; i--)
@@ -2185,46 +2215,46 @@
 
 			ClearSelection(false);
 		} else
-		if (event.getSource() == clearAllItem)
+		if (source == clearAllItem)
 		{
 			ClearSelection(true);
 		} else
-		if (event.getSource() == grabItem)
+		if (source == grabItem)
 		{
 			group(new cGroup(), true);
 		} else
-		if (event.getSource() == hideItem)
+		if (source == hideItem)
 		{
 			group(new HiddenObject());
 		} else
-		if (event.getSource() == frontItem)
+		if (source == frontItem)
 		{
                     front();
 		} else
-		if (event.getSource() == backItem)
+		if (source == backItem)
 		{
                     back();
 		} else
-		if (event.getSource() == cameraItem)
+		if (source == cameraItem)
 		{
 			makeSomething(new Camera());
 		} else
-		if (event.getSource() == compositeItem)
+		if (source == compositeItem)
 		{
 			group(new Composite());
 		} else
-		if (event.getSource() == randomItem)
+		if (source == randomItem)
 		{
                         RandomNode random = new RandomNode();
 			group(random);
                         if (random.size() > 0)
                             random.name = random.get(0).name + "Rnd";
 		} else
-		if (event.getSource() == physicsItem)
+		if (source == physicsItem)
                 {
                     group(new PhysicsNode());
 		} else
-		if (event.getSource() == frameselectorItem)
+		if (source == frameselectorItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
                     {
@@ -2236,7 +2266,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == switchGeoItem)
+		if (source == switchGeoItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
                     {
@@ -2248,7 +2278,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == switchTransfoItem)
+		if (source == switchTransfoItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
                     {
@@ -2260,7 +2290,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == morphItem)
+		if (source == morphItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
                     {
@@ -2272,7 +2302,7 @@
                     ResetModel();
                     refreshContents();
 		} else
-		if (event.getSource() == scriptNodeItem)
+		if (source == scriptNodeItem)
 		{
                     boolean atleastone = false;
                     
@@ -2311,31 +2341,31 @@
                         }
                     }
 		} else
-		if (event.getSource() == linkerItem)
+		if (source == linkerItem)
 		{
 			group(new cLinker());
 		} else
-		if (event.getSource() == textureItem)
+		if (source == textureItem)
 		{
 			group(new TextureNode());
 		} else
-		if (event.getSource() == billboardItem)
+		if (source == billboardItem)
 		{
 			group(new BillboardNode());
 		} else
-		if (event.getSource() == shadowXItem)
+		if (source == shadowXItem)
 		{
 			CastShadow(0);
 		} else
-		if (event.getSource() == shadowYItem)
+		if (source == shadowYItem)
 		{
 			CastShadow(1);
 		} else
-		if (event.getSource() == shadowZItem)
+		if (source == shadowZItem)
 		{
 			CastShadow(2);
 		} else
-		if (event.getSource() == ungroupItem)
+		if (source == ungroupItem)
 		{
 			//ungroup();
                     for (int i=0; i<group.selection.size(); i++)
@@ -2347,179 +2377,179 @@
                     
                     refreshContents();
 		} else
-		if (event.getSource() == genUVItem)
+		if (source == genUVItem)
                 {
 			GenUV();
 		} else
-		if (event.getSource() == genNormalsCADItem)
+		if (source == genNormalsCADItem)
                 {
 			GenNormals(true);
 		} else
-		if (event.getSource() == genNormalsMESHItem)
+		if (source == genNormalsMESHItem)
                 {
 			GenNormals(true); // TODO
 		} else
-		if (event.getSource() == genNormalsORGANItem)
+		if (source == genNormalsORGANItem)
                 {
 			GenNormals(false);
 		} else
-		if (event.getSource() == genNormalsMINEItem)
+		if (source == genNormalsMINEItem)
                 {
 			GenNormalsMINE();
 		} else
-		if (event.getSource() == stripifyItem)
+		if (source == stripifyItem)
                 {
 			Stripify();
 		} else
-		if (event.getSource() == unstripifyItem)
+		if (source == unstripifyItem)
                 {
 			Unstripify();
 		} else
-		if (event.getSource() == trimItem)
+		if (source == trimItem)
                 {
 			Trim();
 		} else
-		if (event.getSource() == untrimItem)
+		if (source == untrimItem)
                 {
 			Untrim();
 		} else
-		if (event.getSource() == clearColorsItem)
+		if (source == clearColorsItem)
                 {
 			ClearColors();
 		} else
-		if (event.getSource() == clearMaterialsItem)
+		if (source == clearMaterialsItem)
                 {
 			ClearMaterials();
 		} else
-		if (event.getSource() == liveleavesItem)
+		if (source == liveleavesItem)
                 {
 			LiveLeaves(true);
 		} else
-		if (event.getSource() == unliveleavesItem)
+		if (source == unliveleavesItem)
                 {
 			LiveLeaves(false);
 		} else
-		if (event.getSource() == supportleavesItem)
+		if (source == supportleavesItem)
                 {
 			SupportLeaves(true);
 		} else
-		if (event.getSource() == unsupportleavesItem)
+		if (source == unsupportleavesItem)
                 {
 			SupportLeaves(false);
 		} else
-		if (event.getSource() == hideleavesItem)
+		if (source == hideleavesItem)
                 {
 			HideLeaves(true);
 		} else
-		if (event.getSource() == showleavesItem)
+		if (source == showleavesItem)
                 {
 			HideLeaves(false);
 		} else
-		if (event.getSource() == markleavesItem)
+		if (source == markleavesItem)
                 {
 			MarkLeaves(true);
 		} else
-		if (event.getSource() == unmarkleavesItem)
+		if (source == unmarkleavesItem)
                 {
 			MarkLeaves(false);
 		} else
-		if (event.getSource() == flipVItem)
+		if (source == flipVItem)
                 {
 			FlipV(true);
 		} else
-		if (event.getSource() == unflipVItem)
+		if (source == unflipVItem)
                 {
 			FlipV(false);
 		} else
-		if (event.getSource() == lowTexturesItem)
+		if (source == lowTexturesItem)
                 {
 			SetTexRes(0);
 		} else
-		if (event.getSource() == normalTexturesItem)
+		if (source == normalTexturesItem)
                 {
 			SetTexRes(1);
 		} else
-		if (event.getSource() == highTexturesItem)
+		if (source == highTexturesItem)
                 {
 			SetTexRes(2);
 		} else
-		if (event.getSource() == veryhighTexturesItem)
+		if (source == veryhighTexturesItem)
                 {
 			SetTexRes(3);
 		} else
-		if (event.getSource() == maxTexturesItem)
+		if (source == maxTexturesItem)
                 {
 			SetTexRes(4);
 		} else
-		if (event.getSource() == panoTexturesItem)
+		if (source == panoTexturesItem)
                 {
 			SetTexRes(5);
 		} else
-		if (event.getSource() == reverseNormalsItem)
+		if (source == reverseNormalsItem)
                 {
 			ReverseNormals();
 		} else
-		if (event.getSource() == parseverticesItem)
+		if (source == parseverticesItem)
                 {
 			ParseVertices();
 		} else
-		if (event.getSource() == textureFieldItem)
+		if (source == textureFieldItem)
                 {
 			TextureVertices();
 		} else
-		if (event.getSource() == alignItem)
+		if (source == alignItem)
                 {
 			Align();
 		} else
-		if (event.getSource() == mirrorItem)
+		if (source == mirrorItem)
                 {
 			MirrorPoses();
 		} else
-		if (event.getSource() == reduceMorphItem)
+		if (source == reduceMorphItem)
                 {
 			MeshReduction(false);
 		} else
-		if (event.getSource() == reduce34MorphItem)
+		if (source == reduce34MorphItem)
                 {
 			MeshReduction(true);
 		} else
-		if (event.getSource() == reverseTrianglesItem)
+		if (source == reverseTrianglesItem)
                 {
 			ReverseTriangles();
 		} else
-		if (event.getSource() == reduceMeshItem)
+		if (source == reduceMeshItem)
                 {
 			ReduceMesh(false);
 		} else
-		if (event.getSource() == reduce34MeshItem)
+		if (source == reduce34MeshItem)
                 {
 			ReduceMesh(true);
 		} else
-		if (event.getSource() == increaseMeshItem)
+		if (source == increaseMeshItem)
                 {
 			IncreaseMesh();
 		} else
-		if (event.getSource() == clipMeshItem)
+		if (source == clipMeshItem)
                 {
 			ClipMesh();
 		} else
-		if (event.getSource() == smoothMeshItem)
+		if (source == smoothMeshItem)
                 {
 			SmoothMesh();
 		} else
-		if (event.getSource() == transformgeometryItem)
+		if (source == transformgeometryItem)
 		{
                         TransformGeometry();
 		} else
-		if (event.getSource() == resetTransformItem)
+		if (source == resetTransformItem)
 		{
                         ResetTransform();
 		} else
-		if (event.getSource() == resetCentroidItem)
+		if (source == resetCentroidItem)
 		{
                         ResetCentroid();
 		} else
-		if (event.getSource() == resetParentItem)
+		if (source == resetParentItem)
 		{
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
 			{
@@ -2529,7 +2559,7 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == repairParentItem)
+		if (source == repairParentItem)
 		{
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
 			{
@@ -2543,7 +2573,21 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == sortbysizeItem)
+		if (source == repairShadowItem)
+		{
+			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
+			{
+				Object3D obj = (Object3D)e.nextElement();
+                                obj.RepairShadow();
+//                                for (int i=0; i<obj.size(); i++)
+//                                {
+//                                    obj.get(i).parent = obj;
+//                                }
+			}
+			
+			refreshContents();
+		} else
+		if (source == sortbysizeItem)
 		{
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
 			{
@@ -2555,7 +2599,7 @@
                         ResetModel();
 			refreshContents();
 		} else
-		if (event.getSource() == sortbynameItem)
+		if (source == sortbynameItem)
 		{
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
 			{
@@ -2567,7 +2611,7 @@
         		ResetModel();
 			refreshContents();
 		} else
-		if (event.getSource() == attachPigmentItem)
+		if (source == attachPigmentItem)
 		{
                     String texture = GetFile("Attach pigment");
 			Object3D obj;
@@ -2579,7 +2623,7 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == detachPigmentItem)
+		if (source == detachPigmentItem)
 		{
 			Object3D obj;
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -2590,7 +2634,7 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == attachBumpItem)
+		if (source == attachBumpItem)
 		{
                     String texture = GetFile("Attach bump");
 			Object3D obj;
@@ -2602,7 +2646,7 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == detachBumpItem)
+		if (source == detachBumpItem)
 		{
 			Object3D obj;
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -2613,7 +2657,7 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == pigmentBumpItem)
+		if (source == pigmentBumpItem)
 		{
 			Object3D obj;
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -2624,158 +2668,195 @@
 			
 			refreshContents();
 		} else
-		if (event.getSource() == flashSelectionButton)
+		if (source == flashSelectionButton)
 		{
 			CameraPane.flash = true;
 			refreshContents();
 		} else
-		if (event.getSource() == oneButton)
+		if (source == oneButton)
 		{
                 } else
-		if (event.getSource() == twoButton)
+		if (source == twoButton)
 		{
                     radio.layout = twoButton;
                     // bug
                     //gridPanel.setDividerLocation(1.0);
                     //bigPanel.setDividerLocation(0.0);
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
-                    bigThree.remove(XYZPanel);
-                    aWindowConstraints.gridx = 0;
-                    aWindowConstraints.gridy = 0;
-                    aWindowConstraints.gridwidth = 1;
-            //        aConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.weighty = 1;
-                    //bigThree.add(jtp, aWindowConstraints);
-                    aWindowConstraints.weightx = 1;
-                    aWindowConstraints.gridwidth = 3;
-            //        aConstraints.gridheight = 3;
-                    aWindowConstraints.gridx = 1;
-                    aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.gridx = 4;
-                    aWindowConstraints.gridwidth = 1;
-            //        aConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    //bigThree.add(XYZPanel, aWindowConstraints);
-                    bigThree.revalidate();
+//                    bigThree.remove(scenePanel);
+//                    bigThree.remove(centralPanel);
+//                    bigThree.remove(XYZPanel);
+//                    aWindowConstraints.gridx = 0;
+//                    aWindowConstraints.gridy = 0;
+//                    aWindowConstraints.gridwidth = 1;
+//            //        aConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.weighty = 1;
+//                    //bigThree.add(jtp, aWindowConstraints);
+//                    aWindowConstraints.weightx = 1;
+//                    aWindowConstraints.gridwidth = 3;
+//            //        aConstraints.gridheight = 3;
+//                    aWindowConstraints.gridx = 1;
+//                    aWindowConstraints.fill = GridBagConstraints.BOTH;
+//                    bigThree.add(centralPanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.gridx = 4;
+//                    aWindowConstraints.gridwidth = 1;
+//            //        aConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    //bigThree.add(XYZPanel, aWindowConstraints);
+//                    scenePanel.setVisible(false);
+//                    centralPanel.setVisible(true);
+//                    XYZPanel.setVisible(false);
+                    bigThree.ClearUI();
+                    bigThree.add(centralPanel);
+                    bigThree.FlushUI();
                 } else
-		if (event.getSource() == threeButton)
+		if (source == threeButton)
 		{
                     radio.layout = threeButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
-                    bigThree.remove(XYZPanel);
-                    aWindowConstraints.gridx = 0;
-                    aWindowConstraints.gridy = 0;
-                    aWindowConstraints.gridwidth = 1;
-            //        aConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.weighty = 1;
-                    //bigThree.add(jtp, aWindowConstraints);
-                    aWindowConstraints.weightx = 1;
-                    aWindowConstraints.gridwidth = 3;
-            //        aConstraints.gridheight = 3;
-                    aWindowConstraints.gridx = 1;
-                    aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.gridx = 4;
-                    aWindowConstraints.gridwidth = 1;
-            //        aConstraints.gridheight = 3;
-                    aConstraints.fill = GridBagConstraints.VERTICAL;
-                    bigThree.add(XYZPanel, aWindowConstraints);
-                    bigThree.revalidate();
+                    
+//                    bigThree.remove(scenePanel);
+//                    bigThree.remove(centralPanel);
+//                    bigThree.remove(XYZPanel);
+//                    aWindowConstraints.gridx = 0;
+//                    aWindowConstraints.gridy = 0;
+//                    aWindowConstraints.gridwidth = 1;
+//            //        aConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.weighty = 1;
+//                    //bigThree.add(jtp, aWindowConstraints);
+//                    aWindowConstraints.weightx = 1;
+//                    aWindowConstraints.gridwidth = 3;
+//            //        aConstraints.gridheight = 3;
+//                    aWindowConstraints.gridx = 1;
+//                    aWindowConstraints.fill = GridBagConstraints.BOTH;
+//                    bigThree.add(centralPanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.gridx = 4;
+//                    aWindowConstraints.gridwidth = 1;
+//            //        aConstraints.gridheight = 3;
+//                    aConstraints.fill = GridBagConstraints.VERTICAL;
+//                    bigThree.add(XYZPanel, aWindowConstraints);
+//                    bigThree.validate();
+//                    scenePanel.setVisible(false);
+//                    centralPanel.setVisible(true);
+//                    XYZPanel.setVisible(true);
+                    bigThree.ClearUI();
+                    bigThree.add(centralPanel);
+                    bigThree.add(XYZPanel);
+                    bigThree.FlushUI();
                 } else
-		if (event.getSource() == fourButton)
+		if (source == fourButton)
 		{
                     radio.layout = fourButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
-                    bigThree.remove(XYZPanel);
-                    aWindowConstraints.gridx = 0;
-                    aWindowConstraints.gridy = 0;
-                    aWindowConstraints.gridwidth = 1;
-              //      aWindowConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    aWindowConstraints.weightx = 1;
-                    aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
-                    aWindowConstraints.weightx = 1;
-                    aWindowConstraints.gridwidth = 3;
-              //      aConstraints.gridheight = 3;
-                    aWindowConstraints.gridx = 1;
-                    aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    //bigThree.add(cameraPanel, aWindowConstraints);
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.gridx = 4;
-                    aWindowConstraints.gridwidth = 1;
-              //      aWindowConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    //bigThree.add(XYZPanel, aWindowConstraints);
-                    bigThree.revalidate();
+                    
+//                    bigThree.remove(scenePanel);
+//                    bigThree.remove(centralPanel);
+//                    bigThree.remove(XYZPanel);
+//                    aWindowConstraints.gridx = 0;
+//                    aWindowConstraints.gridy = 0;
+//                    aWindowConstraints.gridwidth = 1;
+//              //      aWindowConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.BOTH;
+//                    aWindowConstraints.weightx = 1;
+//                    aWindowConstraints.weighty = 1;
+//                    bigThree.add(scenePanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 1;
+//                    aWindowConstraints.gridwidth = 3;
+//              //      aConstraints.gridheight = 3;
+//                    aWindowConstraints.gridx = 1;
+//                    aWindowConstraints.fill = GridBagConstraints.BOTH;
+//                    //bigThree.add(cameraPanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.gridx = 4;
+//                    aWindowConstraints.gridwidth = 1;
+//              //      aWindowConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    //bigThree.add(XYZPanel, aWindowConstraints);
+//                    bigThree.validate();
+//                    scenePanel.setVisible(true);
+//                    centralPanel.setVisible(false);
+//                    XYZPanel.setVisible(false);
+                    bigThree.ClearUI();
+                    bigThree.add(scenePanel);
+                    bigThree.FlushUI();
                 } else
-		if (event.getSource() == sixButton)
+		if (source == sixButton)
 		{
                     radio.layout = sixButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
-                    bigThree.remove(XYZPanel);
-                    aWindowConstraints.gridx = 0;
-                    aWindowConstraints.gridy = 0;
-                    aWindowConstraints.gridwidth = 1;
-              //      aConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
-                    aWindowConstraints.weightx = 1;
-                    aWindowConstraints.gridwidth = 3;
-              //      aWindowConstraints.gridheight = 3;
-                    aWindowConstraints.gridx = 1;
-                    aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.gridx = 4;
-                    aWindowConstraints.gridwidth = 1;
-              //      aWindowConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    //bigThree.add(XYZPanel, aConstraints);
-                    bigThree.revalidate();
+                    
+//                    bigThree.remove(scenePanel);
+//                    bigThree.remove(centralPanel);
+//                    bigThree.remove(XYZPanel);
+//                    aWindowConstraints.gridx = 0;
+//                    aWindowConstraints.gridy = 0;
+//                    aWindowConstraints.gridwidth = 1;
+//              //      aConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.weighty = 1;
+//                    bigThree.add(scenePanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 1;
+//                    aWindowConstraints.gridwidth = 3;
+//              //      aWindowConstraints.gridheight = 3;
+//                    aWindowConstraints.gridx = 1;
+//                    aWindowConstraints.fill = GridBagConstraints.BOTH;
+//                    bigThree.add(centralPanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.gridx = 4;
+//                    aWindowConstraints.gridwidth = 1;
+//              //      aWindowConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    //bigThree.add(XYZPanel, aConstraints);
+//                    bigThree.validate();
+//                    scenePanel.setVisible(true);
+//                    centralPanel.setVisible(true);
+//                    XYZPanel.setVisible(false);
+                    bigThree.ClearUI();
+                    bigThree.add(scenePanel);
+                    bigThree.add(centralPanel);
+                    bigThree.FlushUI();
                 } else
-		if (event.getSource() == sevenButton)
+		if (source == sevenButton)
 		{
                     radio.layout = sevenButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
-                    bigThree.remove(XYZPanel);
-                    aWindowConstraints.gridx = 0;
-                    aWindowConstraints.gridy = 0;
-                    aWindowConstraints.gridwidth = 1;
-               //     aWindowConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
-                    aWindowConstraints.weightx = 1;
-                    aWindowConstraints.gridwidth = 3;
-               //     aWindowConstraints.gridheight = 3;
-                    aWindowConstraints.gridx = 1;
-                    aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
-                    aWindowConstraints.weightx = 0;
-                    aWindowConstraints.gridx = 4;
-                    aWindowConstraints.gridwidth = 1;
-               //     aConstraints.gridheight = 3;
-                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
-                    bigThree.add(XYZPanel, aWindowConstraints);
-                    bigThree.revalidate();
+                    
+//                    bigThree.remove(scenePanel);
+//                    bigThree.remove(centralPanel);
+//                    bigThree.remove(XYZPanel);
+//                    aWindowConstraints.gridx = 0;
+//                    aWindowConstraints.gridy = 0;
+//                    aWindowConstraints.gridwidth = 1;
+//               //     aWindowConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.weighty = 1;
+//                    bigThree.add(scenePanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 1;
+//                    aWindowConstraints.gridwidth = 3;
+//               //     aWindowConstraints.gridheight = 3;
+//                    aWindowConstraints.gridx = 1;
+//                    aWindowConstraints.fill = GridBagConstraints.BOTH;
+//                    bigThree.add(centralPanel, aWindowConstraints);
+//                    aWindowConstraints.weightx = 0;
+//                    aWindowConstraints.gridx = 4;
+//                    aWindowConstraints.gridwidth = 1;
+//               //     aConstraints.gridheight = 3;
+//                    aWindowConstraints.fill = GridBagConstraints.VERTICAL;
+//                    bigThree.add(XYZPanel, aWindowConstraints);
+//                    bigThree.validate();
+//                    scenePanel.setVisible(true);
+//                    centralPanel.setVisible(true);
+//                    XYZPanel.setVisible(true);
+                    bigThree.ClearUI();
+                    bigThree.add(scenePanel);
+                    bigThree.add(centralPanel);
+                    bigThree.add(XYZPanel);
+                    bigThree.FlushUI();
                 } else
-		if (event.getSource() == rootButton)
+		if (source == rootButton)
 		{
                     Object3D obj;
                     for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -2787,7 +2868,7 @@
 
                     refreshContents(true);
 		} else
-		if (event.getSource() == closeButton)
+		if (source == closeButton)
 		{
 //System.out.println("CLOSE: " + buttonGroup.getSelection());
                     cRadio ab;
@@ -2808,11 +2889,11 @@
                     }
                     refreshContents(true);
 		} else
-		if (event.getSource() == editItem || event.getSource() == editButton)
+		if (source == editItem || source == editButton)
 		{
 			EditSelection(false);
 		} else
-		if (event.getSource() == uneditButton)
+		if (source == uneditButton)
 		{
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
 			{
@@ -2824,12 +2905,12 @@
                                 
                                 child.editWindow = null; // ???????????
 			}
-			objEditor.ctrlPanel.revalidate();
+			objEditor.ctrlPanel.validate();
 			//objEditor.jTree.clearSelection();
 			//objEditor.ResetSliders();
                     refreshContents(true);
 		} else
-		if (event.getSource() == clearPanelButton)
+		if (source == clearPanelButton)
 		{
                     assert(copy == group);
                     //copy.ClearUI();
@@ -2840,7 +2921,7 @@
                     listUI.clear();
                     refreshContents(true);
 		} else
-		if (event.getSource() == allParamsButton)
+		if (source == allParamsButton)
 		{
                     assert(copy == group);
                     
@@ -2861,19 +2942,19 @@
                         
                     refreshContents(true);
 		} else
-		if (event.getSource() == unselectButton)
+		if (source == unselectButton)
 		{
 			objEditor.jTree.clearSelection();
              // ?? oct 2012           GrafreeD.clipboard.clear();
 			objEditor.ResetSliders();
                     refreshContents(true);
 		} else
-                if(event.getSource() instanceof cRadio)
+                if(source instanceof cRadio)
 		{
                     group.parent = keepparent;
                         group.attributes = 0;
                     //group.editWindow = null;
-                    /*cRadio*/ radio = (cRadio)event.getSource();
+                    /*cRadio*/ radio = (cRadio)source;
                     Object3D obj = radio.GetObject();
                     System.out.println("Edit " + obj);
                     if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
@@ -2893,7 +2974,7 @@
                     }
                     
                     copy = group;
-                    //CameraPane.theRenderer.object = group;
+                    //Globals.theRenderer.object = group;
                     if(!useclient)
                     {
                         cameraView.renderCamera = radio.camera;
@@ -2902,7 +2983,8 @@
                         cameraView.cameras[cameraView.cameracount] = radio.camera;
                         cameraView.targetLookAt.set(radio.camera.lookAt);
                         cameraView.object = group;
-                        cameraView.lighttouched = true;
+                        //cameraView.lighttouched = true;
+                        Globals.lighttouched = true;
                         topView.object = group;
                         frontView.object = group;
                         sideView.object = group;
@@ -2938,7 +3020,7 @@
             if (useclient)
             {
                 cameraView.object = client;
-                cameraView.lighttouched = true;
+                Globals.lighttouched = true;
                 //topView.object = client;
                 //frontView.object = client;
                 //sideView.object = client;
@@ -2946,7 +3028,7 @@
             else
             {
                 cameraView.object = group;
-                cameraView.lighttouched = true;
+                Globals.lighttouched = true;
                 //topView.object = group;
                 //frontView.object = group;
                 //sideView.object = group;
@@ -3454,7 +3536,7 @@
                             String pigment = Object3D.GetPigment(tex);
                             //String bump = Object3D.GetBump(tex);
                             
-                            com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
+                            com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
                             
                             double s = v.s;
                             
@@ -3755,7 +3837,7 @@
             group.selection.RelinkToSupport(); // july 2014
             System.out.println("DONE.");
             refreshContents();
-        CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
+        Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
         }
         
 	void ReduceMesh(boolean reduction34)
@@ -4040,16 +4122,16 @@
 			
                         objEditor.SetText(); // jan 2014
                         
-			if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
+			if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
 				CameraPane.flash = true;
                         
 			if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
                             // a camera
                         {
                             CameraPane.camerachangeframe = 0; // don't refuse it
-                            CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
-                         //   CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
-                         //   CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
+                            Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
+                         //   Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
+                         //   Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
                         }
                             
 			refreshContents();
@@ -5007,6 +5089,7 @@
         
 	private MenuItem resetParentItem;
 	private MenuItem repairParentItem;
+	private MenuItem repairShadowItem;
 	private MenuItem sortbysizeItem;
 	private MenuItem sortbynameItem;
         

--
Gitblit v1.6.2