From f1c718cce66e5651a0dae91375db6ebfaded1a92 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sat, 27 Apr 2019 21:33:41 -0400
Subject: [PATCH] Test unfold UV

---
 GroupEditor.java |  272 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 207 insertions(+), 65 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 4fa02b1..b72085f 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -219,6 +219,8 @@
 		resetsupportItem.addActionListener(this);
 		linkverticesItem = menu.add(new MenuItem("Link to Support"));
 		linkverticesItem.addActionListener(this);
+		relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
+		relinkverticesItem.addActionListener(this);
 		setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
 		setMasterItem.addActionListener(this);
                 
@@ -231,6 +233,10 @@
 		frontItem.addActionListener(this);
 		compositeItem = menu.add(new MenuItem("Composite"));
 		compositeItem.addActionListener(this);
+		hideItem = menu.add(new MenuItem("Hide"));
+		hideItem.addActionListener(this);
+		ungroupItem = menu.add(new MenuItem("Ungroup"));
+		ungroupItem.addActionListener(this);
 		menu.add("-");
 		randomItem = menu.add(new MenuItem("Random"));
 		randomItem.addActionListener(this);
@@ -252,6 +258,8 @@
 		oe.menuBar.add(menu = new Menu("Object"));
 		textureItem = menu.add(new MenuItem("Texture"));
 		textureItem.addActionListener(this);
+		billboardItem = menu.add(new MenuItem("Billboard"));
+		billboardItem.addActionListener(this);
 		csgItem = menu.add(new MenuItem("CSG"));
 		csgItem.addActionListener(this);
                 shadowXItem = menu.add(new MenuItem("Shadow X"));
@@ -269,14 +277,12 @@
 		pointflowItem = menu.add(new MenuItem("Point Flow"));
 		pointflowItem.addActionListener(this);
 		menu.add("-");
-		transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
-		transformgeometryItem.addActionListener(this);
 		resetTransformItem = menu.add(new MenuItem("Reset Transform"));
 		resetTransformItem.addActionListener(this);
 		resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
 		resetCentroidItem.addActionListener(this);
-		ungroupItem = menu.add(new MenuItem("Ungroup"));
-		ungroupItem.addActionListener(this);
+		transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
+		transformgeometryItem.addActionListener(this);
                 
 		oe.menuBar.add(menu = new Menu("Geometry"));
 		genUVItem = menu.add(new MenuItem("Generate UV"));
@@ -287,6 +293,8 @@
 		genNormalsCADItem.addActionListener(this);
 		genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
 		genNormalsMESHItem.addActionListener(this);
+		genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
+		genNormalsMINEItem.addActionListener(this);
 		stripifyItem = menu.add(new MenuItem("Stripify"));
 		stripifyItem.addActionListener(this);
 		unstripifyItem = menu.add(new MenuItem("Unstripify"));
@@ -429,11 +437,17 @@
 		oe.aConstraints.gridwidth = 1;
         	oe.aConstraints.gridx = 0;
                 
-                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(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
+                fastCB.setToolTipText("Fast mode");
+                                fastCB.addItemListener(this);
+        	oe.aConstraints.gridx += 1;
                 oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
+                supportCB.setToolTipText("Enabled rigging");
                                 supportCB.addItemListener(this);
 
         //	oe.aConstraints.gridx += 1;
@@ -441,22 +455,27 @@
         //                        localCB.addItemListener(this);
 
         	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
+                oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints);
+                crowdCB.setToolTipText("Used for crowds");
                                 crowdCB.addItemListener(this);
 
         	oe.aConstraints.gridx += 1;
                 oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
+                smoothCB.setToolTipText("Snapping delay");
                                 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.setToolTipText("Smooth interpolation");
                                 slowCB.addItemListener(this);
         	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
+                oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), oe.aConstraints);
+                boxCB.setToolTipText("Display bounding boxes");
                                 boxCB.addItemListener(this);
+        	oe.aConstraints.gridx += 1;
+                oe.toolbarPanel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), oe.aConstraints);
+                zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
+                                zoomBoxCB.addItemListener(this);
 
 //        	oe.aConstraints.gridx += 1;
 //                oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
@@ -483,19 +502,22 @@
 //                debugCB.addItemListener(this);
 
         	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
+                oe.toolbarPanel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), oe.aConstraints);
                                 oeilCB.addItemListener(this);
 
         	oe.aConstraints.gridx += 1;
-                oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
+                oe.toolbarPanel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), oe.aConstraints);
+                lookAtCB.setToolTipText("Look-at target");
                                 lookAtCB.addItemListener(this);
 
         	oe.aConstraints.gridx += 1;
                 oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
+                trackCB.setToolTipText("Enable tracking");
                                 trackCB.addItemListener(this);
 
         	oe.aConstraints.gridx += 1;
 		oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
+                screenfitButton.setToolTipText("Screen fit");
 		screenfitButton.addActionListener(this);
 			oe.aConstraints.gridx += 1;
 //		oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
@@ -503,6 +525,7 @@
 //			oe.aConstraints.gridx += 1;
 		oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
 		snapobjectButton.addActionListener(this);
+                snapobjectButton.setToolTipText("Snap Object");
 			oe.aConstraints.gridx += 1;
 
                 //aConstraints.gridx = 0;
@@ -511,28 +534,39 @@
 		oe.aConstraints.gridwidth = 1;
 		
 		oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
+                flashSelectionButton.setToolTipText("Show selection");
 		flashSelectionButton.addActionListener(this);
+                
+		oe.toolbarPanel.add(new cButton("     ", false));
+                
 		oe.aConstraints.gridx += 1;
 		oe.aConstraints.weighty = 0;
 		oe.aConstraints.gridwidth = 1;
                 
                 //
 		oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
+                twoButton.setToolTipText("Show center view only");
 		twoButton.addActionListener(this);
 		oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
 		fourButton.addActionListener(this);
+                fourButton.setToolTipText("Show left panel only");
 		oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
+                sixButton.setToolTipText("2-column layout left");
 		sixButton.addActionListener(this);
 		oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
+                threeButton.setToolTipText("2-column layout right");
 		threeButton.addActionListener(this);
 		oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, 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 ")); //, 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);
+                closeButton.setToolTipText("Close tab");
 		closeButton.addActionListener(this);
 		//oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
 		//clearButton.addActionListener(this);
@@ -638,14 +672,14 @@
 	
         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)
         {
@@ -665,6 +699,7 @@
         JCheckBox fastCB;
         JCheckBox slowCB;
         JCheckBox boxCB;
+        JCheckBox zoomBoxCB;
         JCheckBox trackCB;
         JCheckBox smoothfocusCB;
 //        JCheckBox speakerMocapCB;
@@ -707,8 +742,7 @@
                     dropAttributes |= Object3D.TEXTURE;
                 else
                     dropAttributes &= ~Object3D.TEXTURE;
-            }
-            else if(e.getSource() == liveCB)
+            } else if(e.getSource() == liveCB)
             {
                 cameraView.ToggleLive();
             }
@@ -745,6 +779,10 @@
                 Recompile();
         cameraView.repaint();
 //                refreshContents();
+            }
+            else if(e.getSource() == zoomBoxCB)
+            {
+                cameraView.ToggleZoomBoxMode();
             }
             else if(e.getSource() == smoothfocusCB)
             {
@@ -1035,6 +1073,8 @@
 		torusItem.addActionListener(this);
 		superItem = menu.add(new MenuItem("Superellipsoid"));
 		superItem.addActionListener(this);
+		kleinItem = menu.add(new MenuItem("Klein Bottle"));
+		kleinItem.addActionListener(this);
 		particleItem = menu.add(new MenuItem("Particle system"));
 		particleItem.addActionListener(this);
 		ragdollItem = menu.add(new MenuItem("Rag Walk"));
@@ -1108,6 +1148,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"));
@@ -1595,6 +1637,10 @@
 		{
 			makeSomething(new Superellipsoid());
 		} else
+		if (event.getSource() == kleinItem)
+		{
+			makeSomething(new Klein());
+		} else
 		if (event.getSource() == blobItem)
 		{
 			Blob blob = new Blob();
@@ -1764,8 +1810,8 @@
 		} else
 		if (event.getSource() == computeAOItem)
 		{
-                    CameraPane.drawMode = CameraPane.OCCLUSION;
-                    CameraPane.theRenderer.repaint();
+                    Globals.drawMode = CameraPane.OCCLUSION;
+                    Globals.theRenderer.repaint();
 		} else
 		if (event.getSource() == recompileItem)
 		{
@@ -1780,7 +1826,7 @@
 		if (event.getSource() == invariantsItem)
 		{
                     System.out.println("Invariants:");
-                    GrafreeD.theApplet3D.universe.invariants();
+                    GrafreeD.grafreeD.universe.invariants();
 		} else
 		if (event.getSource() == memoryItem)
 		{
@@ -2003,23 +2049,28 @@
                     if (group.selection.size() == 1)
                         one = true;
 
+                    Object3D merge = null;
+                    
                     Object3D content = new cGroup();
                     
                     for (int i=0; i<group.selection.size(); i++)
                     {
-                        Object3D sel = new Merge(group.selection.get(i));
+                        merge = new Merge(group.selection.get(i));
                         
                         if (one)
-                            makeSomething(sel, false);
+                            makeSomething(merge, false);
                         else
-                            content.addChild(sel);
+                            content.addChild(merge);
                     }
                     
                     if (!one)
-                        makeSomething(content, false);
-                    
-                    ResetModel();
-                    refreshContents();
+                        makeSomething(content, true);
+                    else
+                    {
+                        ResetModel();
+                        Select(merge.GetTreePath(), true, false); // unselect... false);
+                        refreshContents();
+                    }
 		} else
 		if (event.getSource() == mergeGeometriesItem)
 		{
@@ -2071,7 +2122,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;
@@ -2080,7 +2131,7 @@
                       //      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
@@ -2093,6 +2144,15 @@
                         group.selection.get(i).linkVerticesThis(null);
                         CameraPane.RANDOM = random;
                     }
+
+                    refreshContents();
+		} else
+		if (event.getSource() == relinkverticesItem)
+		{
+                    boolean random = CameraPane.RANDOM;
+                    CameraPane.RANDOM = false; // parse all random nodes
+                    group.selection.RelinkToSupport();
+                    CameraPane.RANDOM = random;
 
                     refreshContents();
 		} else
@@ -2164,6 +2224,10 @@
 		if (event.getSource() == grabItem)
 		{
 			group(new cGroup(), true);
+		} else
+		if (event.getSource() == hideItem)
+		{
+			group(new HiddenObject());
 		} else
 		if (event.getSource() == frontItem)
 		{
@@ -2287,6 +2351,10 @@
 		{
 			group(new TextureNode());
 		} else
+		if (event.getSource() == billboardItem)
+		{
+			group(new BillboardNode());
+		} else
 		if (event.getSource() == shadowXItem)
 		{
 			CastShadow(0);
@@ -2301,7 +2369,15 @@
 		} else
 		if (event.getSource() == ungroupItem)
 		{
-			ungroup();
+			//ungroup();
+                    for (int i=0; i<group.selection.size(); i++)
+                    {
+                        Ungroup(group.selection.get(i));
+                    }
+
+                    ClearSelection(false);
+                    
+                    refreshContents();
 		} else
 		if (event.getSource() == genUVItem)
                 {
@@ -2318,6 +2394,10 @@
 		if (event.getSource() == genNormalsORGANItem)
                 {
 			GenNormals(false);
+		} else
+		if (event.getSource() == genNormalsMINEItem)
+                {
+			GenNormalsMINE();
 		} else
 		if (event.getSource() == stripifyItem)
                 {
@@ -2495,6 +2575,20 @@
 			
 			refreshContents();
 		} else
+		if (event.getSource() == 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 (event.getSource() == sortbysizeItem)
 		{
 			for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -2590,8 +2684,8 @@
                     // bug
                     //gridPanel.setDividerLocation(1.0);
                     //bigPanel.setDividerLocation(0.0);
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(scenePanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2606,7 +2700,7 @@
             //        aConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2618,8 +2712,8 @@
 		if (event.getSource() == threeButton)
 		{
                     radio.layout = threeButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(scenePanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2634,7 +2728,7 @@
             //        aConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2646,8 +2740,8 @@
 		if (event.getSource() == fourButton)
 		{
                     radio.layout = fourButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(scenePanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2656,7 +2750,7 @@
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
+                    bigThree.add(scenePanel, aWindowConstraints);
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.gridwidth = 3;
               //      aConstraints.gridheight = 3;
@@ -2674,8 +2768,8 @@
 		if (event.getSource() == sixButton)
 		{
                     radio.layout = sixButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(scenePanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2684,13 +2778,13 @@
                     aWindowConstraints.fill = GridBagConstraints.VERTICAL;
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
+                    bigThree.add(scenePanel, aWindowConstraints);
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.gridwidth = 3;
               //      aWindowConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2702,8 +2796,8 @@
 		if (event.getSource() == sevenButton)
 		{
                     radio.layout = sevenButton;
-                    bigThree.remove(jtp);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(scenePanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2712,13 +2806,13 @@
                     aWindowConstraints.fill = GridBagConstraints.VERTICAL;
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
+                    bigThree.add(scenePanel, aWindowConstraints);
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.gridwidth = 3;
                //     aWindowConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2845,7 +2939,7 @@
                     }
                     
                     copy = group;
-                    //CameraPane.theRenderer.object = group;
+                    //Globals.theRenderer.object = group;
                     if(!useclient)
                     {
                         cameraView.renderCamera = radio.camera;
@@ -2854,7 +2948,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;
@@ -2890,7 +2985,7 @@
             if (useclient)
             {
                 cameraView.object = client;
-                cameraView.lighttouched = true;
+                Globals.lighttouched = true;
                 //topView.object = client;
                 //frontView.object = client;
                 //sideView.object = client;
@@ -2898,7 +2993,7 @@
             else
             {
                 cameraView.object = group;
-                cameraView.lighttouched = true;
+                Globals.lighttouched = true;
                 //topView.object = group;
                 //frontView.object = group;
                 //sideView.object = group;
@@ -3179,6 +3274,13 @@
 		refreshContents();
 	}
 	
+	void GenNormalsMINE()
+	{
+		group.selection.GenNormalsMINE();
+		
+		refreshContents();
+	}
+	
 	void Stripify()
 	{
 		group.StripifyS();
@@ -3399,7 +3501,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;
                             
@@ -3447,12 +3549,26 @@
         
 	void Align()
 	{
+            if (group.selection.size() == 0)
+                return;
+            
+            cVector bbmin = new cVector();
+            cVector bbmax = new cVector();
+            
+            group.selection.get(0).getBounds(bbmin, bbmax, true);
+            
+            double dx = bbmax.x - bbmin.x;
+            double dy = bbmax.y - bbmin.y;
+            double dz = bbmax.z - bbmin.z;
+            
+            double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
+            
             for (int i=0; i<group.selection.size(); i++)
             {
 		Object3D obj = group.selection.get(i);
                 
-                LA.matTranslate(obj.toParent, i/2f, 0, 0);
-                LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
+                LA.matTranslate(obj.toParent, i * scale, 0, 0);
+                LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
             }
             
             refreshContents();
@@ -3686,7 +3802,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)
@@ -3971,16 +4087,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();
@@ -4474,6 +4590,26 @@
 		makeSomething(csg);
 	}
 	
+        void Ungroup(Object3D g)
+        {
+            if (g instanceof HiddenObject)
+            {
+                HiddenObject h = (HiddenObject) g;
+                
+                for (int i=0; i<h.ActualSize(); i++)
+                {
+                    objEditor.makeSomething(h.get(i), false);
+                }
+            }
+            else
+            {
+                for (int i=0; i<g.Size(); i++)
+                {
+                    objEditor.makeSomething(g.get(i), false);
+                }
+            }
+        }
+        
 	void ungroup()
 	{
             /*
@@ -4833,6 +4969,7 @@
 	private MenuItem resetsupportItem;
 	private MenuItem resetreferencesItem;
 	private MenuItem linkverticesItem;
+	private MenuItem relinkverticesItem;
 	private MenuItem setMasterItem;
 	private MenuItem resetMeshItem;
 	private MenuItem stepAllItem;
@@ -4854,6 +4991,7 @@
 	private MenuItem genNormalsMESHItem;
 	private MenuItem genNormalsCADItem;
 	private MenuItem genNormalsORGANItem;
+	private MenuItem genNormalsMINEItem;
 	private MenuItem stripifyItem;
 	private MenuItem unstripifyItem;
 	private MenuItem trimItem;
@@ -4895,6 +5033,7 @@
 	private MenuItem resetCentroidItem;
 	private MenuItem transformgeometryItem;
 	private MenuItem resetTransformItem;
+	private MenuItem hideItem;
 	private MenuItem grabItem;
 	private MenuItem backItem;
 	private MenuItem frontItem;
@@ -4915,6 +5054,7 @@
         
 	private MenuItem resetParentItem;
 	private MenuItem repairParentItem;
+	private MenuItem repairShadowItem;
 	private MenuItem sortbysizeItem;
 	private MenuItem sortbynameItem;
         
@@ -4935,6 +5075,7 @@
 	private MenuItem coneItem;
 	private MenuItem torusItem;
 	private MenuItem superItem;
+	private MenuItem kleinItem;
 	private MenuItem blobItem;
 	private MenuItem latheItem;
 	private MenuItem bezierItem;
@@ -4947,6 +5088,7 @@
 	private MenuItem csgItem;
 	private MenuItem templateItem;
 	private MenuItem textureItem;
+	private MenuItem billboardItem;
 	private MenuItem shadowXItem;
 	private MenuItem shadowYItem;
 	private MenuItem shadowZItem;

--
Gitblit v1.6.2