From b7dce2b3654df801a3904bc270dfcb641fcdb66e Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 02 Nov 2015 19:20:40 -0500
Subject: [PATCH] Rename GrafreeD

---
 GroupEditor.java |  162 +++++++++++++++++++++++++++--------------------------
 1 files changed, 83 insertions(+), 79 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 200e78d..e40eb06 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
@@ -225,10 +225,10 @@
 		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);
 		menu.add("-");
@@ -380,7 +380,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);
@@ -1441,9 +1441,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);
@@ -1778,7 +1778,7 @@
 		if (event.getSource() == invariantsItem)
 		{
                     System.out.println("Invariants:");
-                    GraphreeD.theApplet3D.universe.invariants();
+                    GrafreeD.theApplet3D.universe.invariants();
 		} else
 		if (event.getSource() == memoryItem)
 		{
@@ -1848,10 +1848,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 +1895,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 +1909,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);
@@ -2047,9 +2051,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 +2062,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);
@@ -2101,9 +2105,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 +2120,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);
@@ -2806,7 +2810,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 +3125,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);
                 }
@@ -3250,7 +3254,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 +3273,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 +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);
 //                }
@@ -3319,7 +3323,7 @@
 //                makeSomething(buffer, i==group.selection.size()-1);
 //            }
 //            
-//            GraphreeD.epsequal = epsequal;
+//            GrafreeD.epsequal = epsequal;
 //            
 //            //buffer = null;
 //            temprep = null;
@@ -3330,8 +3334,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 +3360,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 +3375,7 @@
                 makeSomething(buffer, i==group.selection.size()-1);
             }
             
-            GraphreeD.epsequal = epsequal;
+            GrafreeD.epsequal = epsequal;
             
             refreshContents();
 	}
@@ -3416,7 +3420,7 @@
                             scale /= 3;
                             
                             scale /= 0xFF;
-                            scale /= 4;
+                            // c'est quoi ca? scale /= 4;
                             
                             //v.AO = scale;
                             
@@ -3455,7 +3459,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 +3489,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 +3511,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 +3705,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 +4056,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 +4101,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 +4142,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 +4166,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 +4181,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 +4195,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 +4215,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 +4231,7 @@
 	
 	void pasteInto(boolean copyit)
 	{
-//		if (GraphreeD.clipboard == null)
+//		if (GrafreeD.clipboard == null)
 //			return;
 
 		if (group.selection.size() != 1)
@@ -4260,9 +4264,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 +4276,7 @@
 				}
 			} else
 			{
-				linkSomething(GraphreeD.clipboard); //.get(0));
+				linkSomething(GrafreeD.clipboard); //.get(0));
 			}
 		}
             }
@@ -4659,7 +4663,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 +4701,7 @@
 
 	void ImportVRMLX3D()
 	{
-		if (GraphreeD.standAlone)
+		if (GrafreeD.standAlone)
 		{
                     /**/
 			FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
@@ -4714,7 +4718,7 @@
 				
 	String GetFile(String dialogName)
 	{
-		if (GraphreeD.standAlone)
+		if (GrafreeD.standAlone)
 		{
 			FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
 			browser.show();

--
Gitblit v1.6.2