From f924d3e00db476c06f55f3d5aaef307e17575340 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 13 May 2019 07:29:08 -0400
Subject: [PATCH] Transform children

---
 GroupEditor.java |  261 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 161 insertions(+), 100 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 56e3aff..a7eda89 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -98,14 +98,14 @@
 
     void CloneClipboard(boolean supports)
     {
-        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));
+        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(GrafreeD.clipboard, false));
-        GrafreeD.clipboard.get(0).parent = keepparent;
+            makeSomething(CloneObject(Grafreed.clipboard, false));
+        Grafreed.clipboard.get(0).parent = keepparent;
     }
     
     static Object3D CloneObject(Object3D obj, boolean supports)
@@ -119,7 +119,7 @@
         //               obj.support = null;
         if (!supports)
             obj.SaveSupports();
-        Object3D clone = (Object3D)GrafreeD.clone(obj);
+        Object3D clone = (Object3D)Grafreed.clone(obj);
         obj.parent = parent;
         //               obj.support = support;
         //               clone.support = support; // aout 2013
@@ -171,6 +171,14 @@
 		//editItem.addActionListener(this);
 		duplicateItem = menu.add(new MenuItem("Duplicate"));
 		duplicateItem.addActionListener(this);
+		cloneItem = menu.add(new MenuItem("Clone"));
+		cloneItem.addActionListener(this);
+        if (Globals.ADVANCED)
+        {
+		cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
+		cloneSupportItem.addActionListener(this);
+        }
+		menu.add("-");
 		cutItem = menu.add(new MenuItem("Cut"));
 		cutItem.addActionListener(this);
 		copyItem = menu.add(new MenuItem("Copy"));
@@ -178,10 +186,7 @@
 		pasteItem = menu.add(new MenuItem("Paste"));
 		pasteItem.addActionListener(this);
 		menu.add("-");
-		cloneItem = menu.add(new MenuItem("Clone"));
-		cloneItem.addActionListener(this);
-		cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
-		cloneSupportItem.addActionListener(this);
+                
 		menu.add("-");
 		pasteIntoItem = menu.add(new MenuItem("Paste into"));
 		pasteIntoItem.addActionListener(this);
@@ -272,6 +277,7 @@
                 
         if (Globals.ADVANCED)
         {
+		menu.add("-");
 		physicsItem = menu.add(new MenuItem("Physics"));
 		physicsItem.addActionListener(this);
 		frameselectorItem = menu.add(new MenuItem("Frame Selector"));
@@ -297,6 +303,7 @@
 		shadowZItem.addActionListener(this);
         if (Globals.ADVANCED)
         {
+		menu.add("-");
 		linkerItem = menu.add(new MenuItem("Linker"));
 		linkerItem.addActionListener(this);
 		attributeItem = menu.add(new MenuItem("Attribute"));
@@ -305,14 +312,18 @@
 		templateItem.addActionListener(this);
 		pointflowItem = menu.add(new MenuItem("Point Flow"));
 		pointflowItem.addActionListener(this);
-		menu.add("-");
         }
+		menu.add("-");
 		resetTransformItem = menu.add(new MenuItem("Reset Transform"));
 		resetTransformItem.addActionListener(this);
 		resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
 		resetCentroidItem.addActionListener(this);
-		transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
-		transformgeometryItem.addActionListener(this);
+		resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
+		resetCentroidXZItem.addActionListener(this);
+		transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
+		transformGeometryItem.addActionListener(this);
+		transformChildrenItem = menu.add(new MenuItem("Transform Children"));
+		transformChildrenItem.addActionListener(this);
                 
 		oe.menuBar.add(menu = new Menu("Geometry"));
 		genUVItem = menu.add(new MenuItem("Generate UV"));
@@ -415,31 +426,35 @@
 		sortbysizeItem.addActionListener(this);
 		sortbynameItem = menu.add(new MenuItem("Sort by name"));
 		sortbynameItem.addActionListener(this);
+		menu.add("-");
+		shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
+		shareGeometriesItem.addActionListener(this);
+		mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
+		mergeGeometriesItem.addActionListener(this);
         if (Globals.ADVANCED)
         {
-		menu.add("-");
+            // Pretty much the same as duplicate and clone.
 		extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
 		extractGeometriesItem.addActionListener(this);
 		cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
 		cloneGeometriesItem.addActionListener(this);
-		shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
-		shareGeometriesItem.addActionListener(this);
-		mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
-		mergeGeometriesItem.addActionListener(this);
         }
                 
 		oe.menuBar.add(menu = new Menu("Insert"));
 		buildCreateMenu(menu);
                 
                 oe.menuBar.add(menu = new Menu("Include"));
-		importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
-		importGFDItem.addActionListener(this);
-		importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
-		importVRMLX3DItem.addActionListener(this);
-		importOBJItem = menu.add(new MenuItem("OBJ Object..."));
+		importOBJItem = menu.add(new MenuItem("OBJ file..."));
 		importOBJItem.addActionListener(this);
-		import3DSItem = menu.add(new MenuItem("3DS Object..."));
+		menu.add("-");
+		import3DSItem = menu.add(new MenuItem("3DS file..."));
 		import3DSItem.addActionListener(this);
+		menu.add("-");
+		importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
+		importVRMLX3DItem.addActionListener(this);
+		menu.add("-");
+		importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
+		importGFDItem.addActionListener(this);
 
                 oe.menuBar.add(menu = new Menu("Tools"));
 		buildToolsMenu(menu);
@@ -481,7 +496,7 @@
                 liveCB.setToolTipText("Enabled animation");
                                 liveCB.addItemListener(this);
 
-		oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 oneStepButton.setToolTipText("Animate one step forward");
 		oneStepButton.addActionListener(this);
                 
@@ -493,7 +508,7 @@
                 trackCB.setToolTipText("Enable tracking");
                                 trackCB.addItemListener(this);
 
-		oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 screenfitButton.setToolTipText("Screen fit");
 		screenfitButton.addActionListener(this);
 
@@ -502,39 +517,39 @@
 
                 if (Globals.ADVANCED)
                 {
-                        oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+                        oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                         snapobjectButton.addActionListener(this);
                         snapobjectButton.setToolTipText("Snap Object");
                 }
 
-		oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 flashSelectionButton.setToolTipText("Show selection");
 		flashSelectionButton.addActionListener(this);
                 
 		oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
                 
-		oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		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("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
 		fourButton.addActionListener(this);
                 fourButton.setToolTipText("Show left panel only");
-		oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		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("|+|+", !GrafreeD.NIMBUSLAF)); //, 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("+|+|+", !GrafreeD.NIMBUSLAF)); //, 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", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 rootButton.setToolTipText("Edit selection in new tab");
 		rootButton.addActionListener(this);
 
-                oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, 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);
@@ -542,11 +557,11 @@
                         
                 cGridBag commandsPanel = new cGridBag();
                 
-		commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 editButton.setToolTipText("Edit selection");
 		editButton.addActionListener(this);
 
-		commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 uneditButton.setToolTipText("Unedit selection");
 		uneditButton.addActionListener(this);
 
@@ -554,11 +569,11 @@
                 allParamsButton.setToolTipText("Edit all params");
 		allParamsButton.addActionListener(this);
 
-		commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 clearPanelButton.setToolTipText("Clear edit panel");
 		clearPanelButton.addActionListener(this);
 
-		commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+		commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 unselectButton.setToolTipText("Unselect");
 		unselectButton.addActionListener(this);
 
@@ -641,7 +656,7 @@
                 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
                                 zoomBoxCB.addItemListener(this);
 
-        if (Globals.ADVANCED)
+        if (true) // Globals.ADVANCED)
         {
                 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
                 supportCB.setToolTipText("Enable rigging");
@@ -930,7 +945,9 @@
 //                        objEditor.DropFile((java.io.File[]) object, true);
 //                        return;
 //                    }
-                    if (string.charAt(0) == '/')
+                    
+                    // File path for Mac and Windows
+                    if (string.charAt(0) == '/' || string.charAt(1) == ':')
                     {
                         // file(s)
                         String[] names = string.split("\n");
@@ -957,7 +974,7 @@
                     
                     flashIt = false;
                     CameraPane pane = (CameraPane) target;
-                    pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
+                    pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
                     pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
                     
                     if (group.selection.size() == 1)
@@ -1164,13 +1181,13 @@
 		parseverticesItem.addActionListener(this);
 		textureFieldItem = menu.add(new MenuItem("Texture Field"));
 		textureFieldItem.addActionListener(this);
-		alignItem = menu.add(new MenuItem("Align Object"));
+		alignItem = menu.add(new MenuItem("Align Objects"));
 		alignItem.addActionListener(this);
 		reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
 		reduceMorphItem.addActionListener(this);
 		reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
 		reduce34MorphItem.addActionListener(this);
-                
+		menu.add("-");
 		menu.add(computeAOItem = new MenuItem("Compute AO"));
 		computeAOItem.addActionListener(this);
                 
@@ -1530,9 +1547,9 @@
     
     void Overwrite(int mask)
     {
-        if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
+        if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
         {
-            Object3D content = GrafreeD.clipboard.get(0);
+            Object3D content = Grafreed.clipboard.get(0);
 
             if (content instanceof cGroup && ((cGroup)content).transientlink )
                 content = ((cGroup)content).get(0);
@@ -1852,7 +1869,15 @@
 		} else
 		if (source == importOBJItem)
 		{
-			objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
+			//objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
+                            FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
+                            browser.setVisible(true);
+                            String filename = browser.getFile();
+                            if (filename != null && filename.length() > 0)
+                            {
+                                String fullname = browser.getDirectory() + filename;
+                                makeSomething(ReadOBJ(fullname), true);
+                            }
 		} else
 		if (source == computeAOItem)
 		{
@@ -1872,7 +1897,7 @@
 		if (source == invariantsItem)
 		{
                     System.out.println("Invariants:");
-                    GrafreeD.grafreeD.universe.invariants();
+                    Grafreed.grafreeD.universe.invariants();
 		} else
 		if (source == memoryItem)
 		{
@@ -1947,10 +1972,10 @@
 		} else
 		if (source == duplicateItem)
 		{
-                    Object3D keep = GrafreeD.clipboard;
+                    Object3D keep = Grafreed.clipboard;
 			loadClipboard(false);
 			paste(false);
-                    GrafreeD.clipboard = keep;
+                    Grafreed.clipboard = keep;
 		} else
 		if (source == cloneItem)
 		{
@@ -2170,9 +2195,9 @@
 //                        group.selection.get(0).setMasterThis(content); // should be identity
 //		refreshContents();
 //                    }
-                    if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
+                    if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
                     {
-                        Object3D content = GrafreeD.clipboard.get(0);
+                        Object3D content = Grafreed.clipboard.get(0);
                         
                         if (content instanceof cGroup && ((cGroup)content).transientlink )
                             content = ((cGroup)content).get(0);
@@ -2222,9 +2247,9 @@
 		} else
 		if (source == setMasterItem)
 		{
-                    if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
+                    if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
                     {
-                        Object3D content = GrafreeD.clipboard.get(0);
+                        Object3D content = Grafreed.clipboard.get(0);
                         
                         if (content instanceof cGroup && ((cGroup)content).transientlink )
                             content = ((cGroup)content).get(0);
@@ -2237,9 +2262,9 @@
 		{
                     if (group.selection.size() == 1)
                     {
-                        if (GrafreeD.clipboard.size() == 1)
+                        if (Grafreed.clipboard.size() == 1)
                         {
-                            Object3D content = GrafreeD.clipboard.get(0);
+                            Object3D content = Grafreed.clipboard.get(0);
 
                             if (content instanceof cGroup && ((cGroup)content).transientlink )
                                 content = ((cGroup)content).get(0);
@@ -2594,9 +2619,13 @@
                 {
 			SmoothMesh();
 		} else
-		if (source == transformgeometryItem)
+		if (source == transformGeometryItem)
 		{
                         TransformGeometry();
+		} else
+		if (source == transformChildrenItem)
+		{
+                        TransformChildren();
 		} else
 		if (source == resetTransformItem)
 		{
@@ -2604,7 +2633,11 @@
 		} else
 		if (source == resetCentroidItem)
 		{
-                        ResetCentroid();
+                        ResetCentroid(true);
+		} else
+		if (source == resetCentroidXZItem)
+		{
+                        ResetCentroid(false);
 		} else
 		if (source == resetParentItem)
 		{
@@ -3120,6 +3153,28 @@
             refreshContents();
         }
         
+        void TransformChildren()
+        {
+            Object3D obj;
+            for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
+            {
+                    obj = (Object3D)e.nextElement();
+                    obj.KeepTextureMatrices();
+                    obj.TransformChildren();
+                    obj.RestoreTextureMatrices();
+                                        
+//                    if (obj.parent == null)
+//                    {
+//                        System.out.println("NULL PARENT!");
+//                        new Exception().printStackTrace();
+//                    }
+//                    else
+//                        TouchTransform(obj);
+//                        //obj.parent.Touch();
+            }
+
+            refreshContents();
+        }
         
         void ResetTransform()
         {
@@ -3232,7 +3287,7 @@
             refreshContents();
         }
         
-        void ResetCentroid()
+        void ResetCentroid(boolean full)
         {
             Object3D obj;
             for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -3247,12 +3302,16 @@
                     LA.matIdentity(Object3D.mat);
                     obj.getBounds(minima, maxima, false);
                     Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
-                    Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
+                    if (full)
+                        Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
                     Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
                     obj.TransformMesh(Object3D.mat);
+                    
                     Object3D.mat[3][0] = (minima.x + maxima.x)/2;
-                    Object3D.mat[3][1] = (minima.y + maxima.y)/2;
+                    if (full)
+                        Object3D.mat[3][1] = (minima.y + maxima.y)/2;
                     Object3D.mat[3][2] = (minima.z + maxima.z)/2;
+                    
                     LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
                     //Object3D.mat[3][0] = -Object3D.mat[3][0];
                     //Object3D.mat[3][1] = -Object3D.mat[3][1];
@@ -3318,9 +3377,9 @@
                     obj = (Object3D)e.nextElement();
                     
                     System.out.println("Object is: " + obj);
-                    GrafreeD.AnalyzeObject(obj);
+                    Grafreed.AnalyzeObject(obj);
                     System.out.println("Boundary rep: " + obj.bRep);
-                    GrafreeD.AnalyzeObject(obj.bRep);
+                    Grafreed.AnalyzeObject(obj.bRep);
                     
 //                    System.err.println((size/1024) + " KB is the size of " + obj);
                 }
@@ -3534,8 +3593,8 @@
 	
 	void ParseVertices()
 	{
-            boolean epsequal = GrafreeD.epsequal;
-            GrafreeD.epsequal = true;
+            boolean epsequal = Grafreed.epsequal;
+            Grafreed.epsequal = true;
             
             for (int i=0; i<group.selection.size(); i++)
             {
@@ -3560,7 +3619,7 @@
                                 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
                                 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
 
-                                g.add(GrafreeD.clipboard);
+                                g.add(Grafreed.clipboard);
 
                                 buffer.add(g);
                             }
@@ -3575,7 +3634,7 @@
                 makeSomething(buffer, i==group.selection.size()-1);
             }
             
-            GrafreeD.epsequal = epsequal;
+            Grafreed.epsequal = epsequal;
             
             refreshContents();
 	}
@@ -3725,7 +3784,7 @@
                 return;
             
             Object3D poses = group.selection.get(0);
-            Object3D ref = GrafreeD.clipboard.get(0);
+            Object3D ref = Grafreed.clipboard.get(0);
             
             Object3D newgroup = new Object3D("Po:" + poses.name);
             
@@ -3919,9 +3978,9 @@
 	
 	void ClipMesh()
 	{
-            if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
+            if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
             {
-                Object3D content = GrafreeD.clipboard.get(0);
+                Object3D content = Grafreed.clipboard.get(0);
 
                 if (content instanceof cGroup && ((cGroup)content).transientlink )
                     content = ((cGroup)content).get(0);
@@ -3930,7 +3989,7 @@
 //                {
 //                    group.selection.get(i).ClipMesh(GrafreeD.clipboard);
 //                }
-                  group.selection.ClipMesh(GrafreeD.clipboard);
+                  group.selection.ClipMesh(Grafreed.clipboard);
             }
 //		group.selection.ClipMesh(GrafreeD.clipboard);
             System.out.println("DONE.");
@@ -4270,12 +4329,12 @@
 	{
 		if (group.selection.isEmpty())
 			return;
-		GrafreeD.clipboardIsTempGroup = false;
+		Grafreed.clipboardIsTempGroup = false;
 		Composite tGroup = null;
 		if (group.selection.size() > 0) // 1)
 		{
 			tGroup = new cGroup();
-			GrafreeD.clipboardIsTempGroup = true;
+			Grafreed.clipboardIsTempGroup = true;
 		}
                 
 		if (cut)
@@ -4315,16 +4374,16 @@
 		//System.out.println("cut " + child);
 		//System.out.println("parent = " + child.parent);
                 //                   tmp.addChild(child);
-                                    if (GrafreeD.clipboardIsTempGroup)
+                                    if (Grafreed.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(tmp);
                                     else
-                                            GrafreeD.clipboard = tmp;
+                                            Grafreed.clipboard = tmp;
                                 }
                                 else
-                                    if (GrafreeD.clipboardIsTempGroup)
+                                    if (Grafreed.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(child);
                                     else
-                                            GrafreeD.clipboard = child;
+                                            Grafreed.clipboard = child;
 			}
 			
 			//ResetModel();
@@ -4356,21 +4415,21 @@
 		//System.out.println("cut " + elem);
 		//System.out.println("parent = " + elem.parent);
                 //                    tmp.addChild(elem);
-                                    if (GrafreeD.clipboardIsTempGroup)
+                                    if (Grafreed.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(tmp);
                                     else
-                                            GrafreeD.clipboard = tmp;
+                                            Grafreed.clipboard = tmp;
                                 }
                                 else
-                                    if (GrafreeD.clipboardIsTempGroup)
+                                    if (Grafreed.clipboardIsTempGroup)
                                             tGroup.add/*Child*/(child);
                                     else
-                                            GrafreeD.clipboard = child;
+                                            Grafreed.clipboard = child;
 			}
 			
 		}
-		if (GrafreeD.clipboardIsTempGroup)
-			GrafreeD.clipboard = tGroup;
+		if (Grafreed.clipboardIsTempGroup)
+			Grafreed.clipboard = tGroup;
 		if (cut)
                 {
                     ResetModel();
@@ -4384,7 +4443,7 @@
 	//		return;
 		boolean first = true;
 		
-		if (GrafreeD.clipboardIsTempGroup)
+		if (Grafreed.clipboardIsTempGroup)
 		{
 			Composite temp;
 			
@@ -4395,7 +4454,7 @@
 				temp = (Composite)Applet3D.clipboard.deepCopy();
                          */
 			Object3D elem;
-			for (Enumeration e = /*temp.children*/GrafreeD.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();
                                 
@@ -4429,14 +4488,14 @@
 			//Object3D cb = Applet3D.clipboard;
 			//temp.addChild(cb);
 			//makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
-                    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());
+                    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?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
-                        GrafreeD.clipboard.get(0).parent = keepparent;
+                            makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
+                        Grafreed.clipboard.get(0).parent = keepparent;
 		}
 		
 		ResetModel();
@@ -4485,9 +4544,9 @@
 		{
 			boolean first = true;
 			
-			if (GrafreeD.clipboardIsTempGroup)
+			if (Grafreed.clipboardIsTempGroup)
 			{
-				Composite temp = (Composite)GrafreeD.clipboard;
+				Composite temp = (Composite)Grafreed.clipboard;
 				Object3D copy;
 				for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
 				{
@@ -4497,7 +4556,7 @@
 				}
 			} else
 			{
-				linkSomething(GrafreeD.clipboard); //.get(0));
+				linkSomething(Grafreed.clipboard); //.get(0));
 			}
 		}
             }
@@ -4942,7 +5001,7 @@
 
 	void ImportVRMLX3D()
 	{
-		if (GrafreeD.standAlone)
+		if (Grafreed.standAlone)
 		{
                     /**/
 			FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
@@ -4959,7 +5018,7 @@
 				
 	String GetFile(String dialogName)
 	{
-		if (GrafreeD.standAlone)
+		if (Grafreed.standAlone)
 		{
 			FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
 			browser.show();
@@ -5133,8 +5192,10 @@
 	private MenuItem panoTexturesItem;
         
 	private MenuItem resetCentroidItem;
-	private MenuItem transformgeometryItem;
+	private MenuItem resetCentroidXZItem;
 	private MenuItem resetTransformItem;
+	private MenuItem transformGeometryItem;
+	private MenuItem transformChildrenItem;
 	private MenuItem hideItem;
 	private MenuItem grabItem;
 	private MenuItem backItem;

--
Gitblit v1.6.2