From fc0ac44e30a56c87c7cf39fe66f6b3178732f1b6 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 01 Oct 2017 20:17:17 -0400
Subject: [PATCH] Klein + billboard + rigging "seuil"

---
 GroupEditor.java |  291 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 198 insertions(+), 93 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 200e78d..d7a1c3e 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -83,7 +83,7 @@
 
     void CloneSelection(boolean supports)
     {
-        //   Object3D keep = GraphreeD.clipboard;
+        //   Object3D keep = GrafreeD.clipboard;
            //Object3D obj;
            for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
            {
@@ -97,14 +97,14 @@
 
     void CloneClipboard(boolean supports)
     {
-        assert(GraphreeD.clipboard.parent == null);
-        Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
-        GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
-        if (LA.isIdentity(GraphreeD.clipboard.toParent))
-            makeSomething(CloneObject(GraphreeD.clipboard.get(0), false));
+        assert(GrafreeD.clipboard.parent == null);
+        Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
+        GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
+        if (LA.isIdentity(GrafreeD.clipboard.toParent))
+            makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
         else
-            makeSomething(CloneObject(GraphreeD.clipboard, false));
-        GraphreeD.clipboard.get(0).parent = keepparent;
+            makeSomething(CloneObject(GrafreeD.clipboard, false));
+        GrafreeD.clipboard.get(0).parent = keepparent;
     }
     
     static Object3D CloneObject(Object3D obj, boolean supports)
@@ -118,7 +118,7 @@
         //               obj.support = null;
         if (!supports)
             obj.SaveSupports();
-        Object3D clone = (Object3D)GraphreeD.clone(obj);
+        Object3D clone = (Object3D)GrafreeD.clone(obj);
         obj.parent = parent;
         //               obj.support = support;
         //               clone.support = support; // aout 2013
@@ -219,18 +219,24 @@
 		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);
                 
 		oe.menuBar.add(menu = new Menu("Group"));
 		grabItem = menu.add(new MenuItem("Grab"));
 		grabItem.addActionListener(this);
-		frontItem = menu.add(new MenuItem("Front"));
-		frontItem.addActionListener(this);
 		backItem = menu.add(new MenuItem("Back"));
 		backItem.addActionListener(this);
+		frontItem = menu.add(new MenuItem("Front"));
+		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"));
@@ -285,6 +291,10 @@
 		genNormalsORGANItem.addActionListener(this);
 		genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
 		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"));
@@ -380,7 +390,7 @@
                 
                
                 oe.menuBar.add(menu = new Menu("Include"));
-		importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
+		importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
 		importGFDItem.addActionListener(this);
 		importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
 		importVRMLX3DItem.addActionListener(this);
@@ -1033,6 +1043,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"));
@@ -1441,9 +1453,9 @@
     
     void Overwrite(int mask)
     {
-        if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
+        if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
         {
-            Object3D content = GraphreeD.clipboard.get(0);
+            Object3D content = GrafreeD.clipboard.get(0);
 
             if (content instanceof cGroup && ((cGroup)content).transientlink )
                 content = ((cGroup)content).get(0);
@@ -1592,6 +1604,10 @@
 		if (event.getSource() == superItem)
 		{
 			makeSomething(new Superellipsoid());
+		} else
+		if (event.getSource() == kleinItem)
+		{
+			makeSomething(new Klein());
 		} else
 		if (event.getSource() == blobItem)
 		{
@@ -1778,7 +1794,7 @@
 		if (event.getSource() == invariantsItem)
 		{
                     System.out.println("Invariants:");
-                    GraphreeD.theApplet3D.universe.invariants();
+                    GrafreeD.theApplet3D.universe.invariants();
 		} else
 		if (event.getSource() == memoryItem)
 		{
@@ -1848,10 +1864,10 @@
 		} else
 		if (event.getSource() == duplicateItem)
 		{
-                    Object3D keep = GraphreeD.clipboard;
+                    Object3D keep = GrafreeD.clipboard;
 			loadClipboard(false);
 			paste(false);
-                    GraphreeD.clipboard = keep;
+                    GrafreeD.clipboard = keep;
 		} else
 		if (event.getSource() == cloneItem)
 		{
@@ -1895,8 +1911,9 @@
                 } else
 		if (event.getSource() == overwriteMatItem)
 		{
+                    /* july 2015
                     if ((dropAttributes & Object3D.TEXTURE) == 0)
-                        Overwrite(Object3D.MATERIAL);
+                        Overwrite(Object3D.MATERIAL | Object3D.COLOR);
                     else
                     {
                         if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
@@ -1908,13 +1925,16 @@
                             Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
                         }
                     }
+                    */
+                    
+                    Overwrite(dropAttributes);
                 }
 		if (event.getSource() == overwriteGeoItem)
 		{
                     Overwrite(Object3D.GEOMETRY);
-//                    if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
+//                    if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
 //                    {
-//                        Object3D content = GraphreeD.clipboard.get(0);
+//                        Object3D content = GrafreeD.clipboard.get(0);
 //                        
 //                        if (content instanceof cGroup && ((cGroup)content).transientlink )
 //                            content = ((cGroup)content).get(0);
@@ -1997,23 +2017,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)
 		{
@@ -2047,9 +2072,9 @@
 		} else
 		if (event.getSource() == linkverticesItem)
 		{
-//                    if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
+//                    if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
 //                    {
-//                        Object3D content = GraphreeD.clipboard.get(0);
+//                        Object3D content = GrafreeD.clipboard.get(0);
 //                        
 //                        if (content instanceof cGroup && ((cGroup)content).transientlink )
 //                            content = ((cGroup)content).get(0);
@@ -2058,9 +2083,9 @@
 //                        group.selection.get(0).setMasterThis(content); // should be identity
 //		refreshContents();
 //                    }
-                    if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
+                    if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
                     {
-                        Object3D content = GraphreeD.clipboard.get(0);
+                        Object3D content = GrafreeD.clipboard.get(0);
                         
                         if (content instanceof cGroup && ((cGroup)content).transientlink )
                             content = ((cGroup)content).get(0);
@@ -2090,6 +2115,15 @@
 
                     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
 		if (event.getSource() == resetreferencesItem)
 		{
                     for (int i=0; i<group.selection.size(); i++)
@@ -2101,9 +2135,9 @@
 		} else
 		if (event.getSource() == setMasterItem)
 		{
-                    if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
+                    if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
                     {
-                        Object3D content = GraphreeD.clipboard.get(0);
+                        Object3D content = GrafreeD.clipboard.get(0);
                         
                         if (content instanceof cGroup && ((cGroup)content).transientlink )
                             content = ((cGroup)content).get(0);
@@ -2116,9 +2150,9 @@
 		{
                     if (group.selection.size() == 1)
                     {
-                        if (GraphreeD.clipboard.size() == 1)
+                        if (GrafreeD.clipboard.size() == 1)
                         {
-                            Object3D content = GraphreeD.clipboard.get(0);
+                            Object3D content = GrafreeD.clipboard.get(0);
 
                             if (content instanceof cGroup && ((cGroup)content).transientlink )
                                 content = ((cGroup)content).get(0);
@@ -2158,6 +2192,10 @@
 		if (event.getSource() == grabItem)
 		{
 			group(new cGroup(), true);
+		} else
+		if (event.getSource() == hideItem)
+		{
+			group(new HiddenObject());
 		} else
 		if (event.getSource() == frontItem)
 		{
@@ -2281,6 +2319,10 @@
 		{
 			group(new TextureNode());
 		} else
+		if (event.getSource() == billboardItem)
+		{
+			group(new BillboardNode());
+		} else
 		if (event.getSource() == shadowXItem)
 		{
 			CastShadow(0);
@@ -2295,7 +2337,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)
                 {
@@ -2305,9 +2355,17 @@
                 {
 			GenNormals(true);
 		} else
+		if (event.getSource() == genNormalsMESHItem)
+                {
+			GenNormals(true); // TODO
+		} else
 		if (event.getSource() == genNormalsORGANItem)
                 {
 			GenNormals(false);
+		} else
+		if (event.getSource() == genNormalsMINEItem)
+                {
+			GenNormalsMINE();
 		} else
 		if (event.getSource() == stripifyItem)
                 {
@@ -2806,7 +2864,7 @@
 		if (event.getSource() == unselectButton)
 		{
 			objEditor.jTree.clearSelection();
-             // ?? oct 2012           GraphreeD.clipboard.clear();
+             // ?? oct 2012           GrafreeD.clipboard.clear();
 			objEditor.ResetSliders();
                     refreshContents(true);
 		} else
@@ -3121,9 +3179,9 @@
                     obj = (Object3D)e.nextElement();
                     
                     System.out.println("Object is: " + obj);
-                    GraphreeD.AnalyzeObject(obj);
+                    GrafreeD.AnalyzeObject(obj);
                     System.out.println("Boundary rep: " + obj.bRep);
-                    GraphreeD.AnalyzeObject(obj.bRep);
+                    GrafreeD.AnalyzeObject(obj.bRep);
                     
 //                    System.err.println((size/1024) + " KB is the size of " + obj);
                 }
@@ -3165,6 +3223,13 @@
 	void GenNormals(boolean crease)
 	{
 		group.GenNormalsS(crease);
+		
+		refreshContents();
+	}
+	
+	void GenNormalsMINE()
+	{
+		group.selection.GenNormalsMINE();
 		
 		refreshContents();
 	}
@@ -3250,7 +3315,7 @@
 //                    LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
 //                    LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
 //
-//                    g.add(GraphreeD.clipboard);
+//                    g.add(GrafreeD.clipboard);
 //
 //                    buffer.add(g);
 //        }
@@ -3269,8 +3334,8 @@
 //            nodes = new Object3D();
 //            vertices = new Vector<Vertex>();
 //            
-//            boolean epsequal = GraphreeD.epsequal;
-//            GraphreeD.epsequal = true;
+//            boolean epsequal = GrafreeD.epsequal;
+//            GrafreeD.epsequal = true;
 //            
 //            for (int i=0; i<group.selection.size(); i++)
 //            {
@@ -3311,7 +3376,7 @@
 //                    LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
 //                    LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
 //
-//                    g.add(GraphreeD.clipboard);
+//                    g.add(GrafreeD.clipboard);
 //
 //                    buffer.add(g);
 //                }
@@ -3319,7 +3384,7 @@
 //                makeSomething(buffer, i==group.selection.size()-1);
 //            }
 //            
-//            GraphreeD.epsequal = epsequal;
+//            GrafreeD.epsequal = epsequal;
 //            
 //            //buffer = null;
 //            temprep = null;
@@ -3330,8 +3395,8 @@
 	
 	void ParseVertices()
 	{
-            boolean epsequal = GraphreeD.epsequal;
-            GraphreeD.epsequal = true;
+            boolean epsequal = GrafreeD.epsequal;
+            GrafreeD.epsequal = true;
             
             for (int i=0; i<group.selection.size(); i++)
             {
@@ -3356,7 +3421,7 @@
                                 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
                                 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
 
-                                g.add(GraphreeD.clipboard);
+                                g.add(GrafreeD.clipboard);
 
                                 buffer.add(g);
                             }
@@ -3371,7 +3436,7 @@
                 makeSomething(buffer, i==group.selection.size()-1);
             }
             
-            GraphreeD.epsequal = epsequal;
+            GrafreeD.epsequal = epsequal;
             
             refreshContents();
 	}
@@ -3416,7 +3481,7 @@
                             scale /= 3;
                             
                             scale /= 0xFF;
-                            scale /= 4;
+                            // c'est quoi ca? scale /= 4;
                             
                             //v.AO = scale;
                             
@@ -3437,12 +3502,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();
@@ -3455,7 +3534,7 @@
 //            ref.SaveSupports();
 //            Object3D par = ref.parent;
 //            ref.parent = null;
-//            Object3D lowres = (Object3D) GraphreeD.clone(ref);
+//            Object3D lowres = (Object3D) GrafreeD.clone(ref);
 //            ref.parent = par;
 //            ref.RestoreSupports();
             
@@ -3485,7 +3564,7 @@
 //                lowres.SaveSupports();
 //                par = lowres.parent;
 //                lowres.parent = null;
-//                Object3D newlow = (Object3D) GraphreeD.clone(lowres);
+//                Object3D newlow = (Object3D) GrafreeD.clone(lowres);
                 Object3D newlow = CloneObject(lowres, false);
                 newlow.name = sn.switchobject.get(i).name;
             System.out.println("    pose#" + i + " = " + newlow);
@@ -3507,7 +3586,7 @@
                 return;
             
             Object3D poses = group.selection.get(0);
-            Object3D ref = GraphreeD.clipboard.get(0);
+            Object3D ref = GrafreeD.clipboard.get(0);
             
             Object3D newgroup = new Object3D("Po:" + poses.name);
             
@@ -3701,20 +3780,20 @@
 	
 	void ClipMesh()
 	{
-            if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
+            if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
             {
-                Object3D content = GraphreeD.clipboard.get(0);
+                Object3D content = GrafreeD.clipboard.get(0);
 
                 if (content instanceof cGroup && ((cGroup)content).transientlink )
                     content = ((cGroup)content).get(0);
 
 //                for (int i=0; i<group.selection.size(); i++)
 //                {
-//                    group.selection.get(i).ClipMesh(GraphreeD.clipboard);
+//                    group.selection.get(i).ClipMesh(GrafreeD.clipboard);
 //                }
-                  group.selection.ClipMesh(GraphreeD.clipboard);
+                  group.selection.ClipMesh(GrafreeD.clipboard);
             }
-//		group.selection.ClipMesh(GraphreeD.clipboard);
+//		group.selection.ClipMesh(GrafreeD.clipboard);
             System.out.println("DONE.");
             refreshContents();
 	}
@@ -4052,12 +4131,12 @@
 	{
 		if (group.selection.isEmpty())
 			return;
-		GraphreeD.clipboardIsTempGroup = false;
+		GrafreeD.clipboardIsTempGroup = false;
 		Composite tGroup = null;
 		if (group.selection.size() > 0) // 1)
 		{
 			tGroup = new cGroup();
-			GraphreeD.clipboardIsTempGroup = true;
+			GrafreeD.clipboardIsTempGroup = true;
 		}
                 
 		if (cut)
@@ -4097,16 +4176,16 @@
 		//System.out.println("cut " + child);
 		//System.out.println("parent = " + child.parent);
                 //                   tmp.addChild(child);
-                                    if (GraphreeD.clipboardIsTempGroup)
+                                    if (GrafreeD.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(tmp);
                                     else
-                                            GraphreeD.clipboard = tmp;
+                                            GrafreeD.clipboard = tmp;
                                 }
                                 else
-                                    if (GraphreeD.clipboardIsTempGroup)
+                                    if (GrafreeD.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(child);
                                     else
-                                            GraphreeD.clipboard = child;
+                                            GrafreeD.clipboard = child;
 			}
 			
 			//ResetModel();
@@ -4138,21 +4217,21 @@
 		//System.out.println("cut " + elem);
 		//System.out.println("parent = " + elem.parent);
                 //                    tmp.addChild(elem);
-                                    if (GraphreeD.clipboardIsTempGroup)
+                                    if (GrafreeD.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(tmp);
                                     else
-                                            GraphreeD.clipboard = tmp;
+                                            GrafreeD.clipboard = tmp;
                                 }
                                 else
-                                    if (GraphreeD.clipboardIsTempGroup)
+                                    if (GrafreeD.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(child);
                                     else
-                                            GraphreeD.clipboard = child;
+                                            GrafreeD.clipboard = child;
 			}
 			
 		}
-		if (GraphreeD.clipboardIsTempGroup)
-			GraphreeD.clipboard = tGroup;
+		if (GrafreeD.clipboardIsTempGroup)
+			GrafreeD.clipboard = tGroup;
 		if (cut)
                 {
                     ResetModel();
@@ -4162,11 +4241,11 @@
 	
 	void paste(boolean expand)
 	{
-	//	if (GraphreeD.clipboard == null)
+	//	if (GrafreeD.clipboard == null)
 	//		return;
 		boolean first = true;
 		
-		if (GraphreeD.clipboardIsTempGroup)
+		if (GrafreeD.clipboardIsTempGroup)
 		{
 			Composite temp;
 			
@@ -4177,7 +4256,7 @@
 				temp = (Composite)Applet3D.clipboard.deepCopy();
                          */
 			Object3D elem;
-			for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
+			for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
 			{
 				Object3D child = (Object3D)e.nextElement();
                                 
@@ -4191,7 +4270,7 @@
                         else
 				elem = child.deepCopy(); // ?
                         child.parent = keepparent;
-			//if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
+			//if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
                         //    elem = elem.get(0);
 				makeSomething(elem, true); // ?? first);
 				//group.addChild(elem);
@@ -4211,14 +4290,14 @@
 			//Object3D cb = Applet3D.clipboard;
 			//temp.addChild(cb);
 			//makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
-                    assert(GraphreeD.clipboard.parent == null);
-                        Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
-                        GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
-                        if (LA.isIdentity(GraphreeD.clipboard.toParent))
-                            makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
+                    assert(GrafreeD.clipboard.parent == null);
+                        Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
+                        GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
+                        if (LA.isIdentity(GrafreeD.clipboard.toParent))
+                            makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
                         else
-                            makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
-                        GraphreeD.clipboard.get(0).parent = keepparent;
+                            makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
+                        GrafreeD.clipboard.get(0).parent = keepparent;
 		}
 		
 		ResetModel();
@@ -4227,7 +4306,7 @@
 	
 	void pasteInto(boolean copyit)
 	{
-//		if (GraphreeD.clipboard == null)
+//		if (GrafreeD.clipboard == null)
 //			return;
 
 		if (group.selection.size() != 1)
@@ -4260,9 +4339,9 @@
 		{
 			boolean first = true;
 			
-			if (GraphreeD.clipboardIsTempGroup)
+			if (GrafreeD.clipboardIsTempGroup)
 			{
-				Composite temp = (Composite)GraphreeD.clipboard;
+				Composite temp = (Composite)GrafreeD.clipboard;
 				Object3D copy;
 				for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
 				{
@@ -4272,7 +4351,7 @@
 				}
 			} else
 			{
-				linkSomething(GraphreeD.clipboard); //.get(0));
+				linkSomething(GrafreeD.clipboard); //.get(0));
 			}
 		}
             }
@@ -4464,6 +4543,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()
 	{
             /*
@@ -4659,7 +4758,7 @@
 
         void ImportGFD()
         {
-            FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
+            FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
             browser.show();
             String filename = browser.getFile();
             if (filename != null && filename.length() > 0)
@@ -4697,7 +4796,7 @@
 
 	void ImportVRMLX3D()
 	{
-		if (GraphreeD.standAlone)
+		if (GrafreeD.standAlone)
 		{
                     /**/
 			FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
@@ -4714,7 +4813,7 @@
 				
 	String GetFile(String dialogName)
 	{
-		if (GraphreeD.standAlone)
+		if (GrafreeD.standAlone)
 		{
 			FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
 			browser.show();
@@ -4823,6 +4922,7 @@
 	private MenuItem resetsupportItem;
 	private MenuItem resetreferencesItem;
 	private MenuItem linkverticesItem;
+	private MenuItem relinkverticesItem;
 	private MenuItem setMasterItem;
 	private MenuItem resetMeshItem;
 	private MenuItem stepAllItem;
@@ -4841,8 +4941,10 @@
 	private MenuItem clearItem;
 	private MenuItem clearAllItem;
 	private MenuItem genUVItem;
+	private MenuItem genNormalsMESHItem;
 	private MenuItem genNormalsCADItem;
 	private MenuItem genNormalsORGANItem;
+	private MenuItem genNormalsMINEItem;
 	private MenuItem stripifyItem;
 	private MenuItem unstripifyItem;
 	private MenuItem trimItem;
@@ -4884,6 +4986,7 @@
 	private MenuItem resetCentroidItem;
 	private MenuItem transformgeometryItem;
 	private MenuItem resetTransformItem;
+	private MenuItem hideItem;
 	private MenuItem grabItem;
 	private MenuItem backItem;
 	private MenuItem frontItem;
@@ -4924,6 +5027,7 @@
 	private MenuItem coneItem;
 	private MenuItem torusItem;
 	private MenuItem superItem;
+	private MenuItem kleinItem;
 	private MenuItem blobItem;
 	private MenuItem latheItem;
 	private MenuItem bezierItem;
@@ -4936,6 +5040,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