Selaa lähdekoodia

SDK : Various import fix and code formatting

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9602 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
rem..om 13 vuotta sitten
vanhempi
commit
138616f355

+ 7 - 10
jme3-core/src/com/jme3/gde/core/scene/controller/SceneToolController.java

@@ -21,7 +21,6 @@ import com.jme3.effect.ParticleEmitter;
 import com.jme3.gde.core.scene.SceneApplication;
 import com.jme3.material.Material;
 import com.jme3.math.ColorRGBA;
-import com.jme3.math.Transform;
 import com.jme3.math.Vector3f;
 import com.jme3.renderer.RenderManager;
 import com.jme3.scene.Geometry;
@@ -31,8 +30,6 @@ import com.jme3.scene.Spatial;
 import com.jme3.scene.debug.Arrow;
 import com.jme3.scene.debug.Grid;
 import com.jme3.scene.debug.WireBox;
-import com.jme3.scene.shape.Box;
-import com.jme3.util.TempVars;
 import java.util.concurrent.Callable;
 
 /**
@@ -145,19 +142,19 @@ public class SceneToolController implements AppState {
     public void rebuildSelectionBox() {
         if (SceneApplication.getApplication().isAwt()) {
             SceneApplication.getApplication().enqueue(new Callable<Object>() {
+
                 public Object call() throws Exception {
                     doUpdateSelection(selected);
                     return null;
                 }
             });
-        }
-        else {
+        } else {
             if (selected != null) {
                 attachSelectionShape(selected);
             }
         }
     }
-    
+
     public void setCursorLocation(final Vector3f location) {
         SceneApplication.getApplication().enqueue(new Callable<Object>() {
 
@@ -248,17 +245,17 @@ public class SceneToolController implements AppState {
             wireBox.fromBoundingBox(bbox);
             final Geometry selectionGeometry = new Geometry("selection_geometry_sceneviewer", wireBox);
             selectionGeometry.setMaterial(blueMat);
-            selectionGeometry.setLocalTranslation( bbox.getCenter().subtract(geom.getWorldTranslation()) );
+            selectionGeometry.setLocalTranslation(bbox.getCenter().subtract(geom.getWorldTranslation()));
             //Vector3f scale = new Vector3f(1,1,1);
             //scale.x = 1/geom.getWorldScale().x;
             //scale.y = 1/geom.getWorldScale().y;
             //scale.z = 1/geom.getWorldScale().z;
             selectionShape = new Node("SelectionParent");
-            ((Node)selectionShape).attachChild(selectionGeometry);
+            ((Node) selectionShape).attachChild(selectionGeometry);
             //selectionShape.setLocalTransform(geom.getWorldTransform());
             //selectionShape.setLocalTranslation(geom.getWorldTranslation());
             //selectionGeometry.setLocalScale(scale);
-            
+
             SceneApplication.getApplication().enqueue(new Callable<Object>() {
 
                 public Object call() throws Exception {
@@ -415,7 +412,7 @@ public class SceneToolController implements AppState {
         if (selected == null || selectionShape == null) {
             return;
         }
-        
+
         selectionShape.setLocalTranslation(selected.getWorldTranslation());
         selectionShape.setLocalRotation(selected.getWorldRotation());
         //selectionShape.setLocalScale(selected.getWorldScale());

+ 29 - 92
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBone.java

@@ -32,9 +32,7 @@
 package com.jme3.gde.core.sceneexplorer.nodes;
 
 import com.jme3.animation.Bone;
-import com.jme3.animation.SkeletonControl;
 import com.jme3.gde.core.scene.SceneApplication;
-import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent;
 import java.awt.Image;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.event.ActionEvent;
@@ -60,16 +58,15 @@ public class JmeBone extends AbstractSceneExplorerNode {
     private Bone bone;
     private JmeSkeletonControl jmeSkeletonControl;
     protected final DataFlavor BONE_FLAVOR = new DataFlavor(ClipboardSpatial.class, "Bone");
-   
+
     public JmeBone() {
-       
     }
 
-    public JmeBone(JmeSkeletonControl jmeSkeletonControl,Bone bone, JmeBoneChildren children) {       
+    public JmeBone(JmeSkeletonControl jmeSkeletonControl, Bone bone, JmeBoneChildren children) {
         super(children);
-        this.jmeChildren = children;     
+        this.jmeChildren = children;
         this.jmeSkeletonControl = jmeSkeletonControl;
-        getLookupContents().add(bone);        
+        getLookupContents().add(bone);
         getLookupContents().add(this);
         super.setName(bone.getName());
         this.bone = bone;
@@ -100,94 +97,34 @@ public class JmeBone extends AbstractSceneExplorerNode {
         return sheet;
 
     }
-//
-//    @Override
-//    public PasteType getDropType(final Transferable t, int action, int index) {
-//        Object data = null;
-//        try {
-//            data = t.getTransferData(BONE_FLAVOR);
-//        } catch (Exception ex) {
-////            Exceptions.printStackTrace(ex);
-//        }
-//        if (data == null) {
-//            return null;
-//        }
-//        if (data instanceof ClipboardSpatial) {
-//            final Spatial spat = ((ClipboardSpatial) data).createSpatial();
-//            return new PasteType() {
-//
-//                @Override
-//                public Transferable paste() throws IOException {
-//                    try {
-//                        fireSave(true);
-//                        SceneApplication.getApplication().enqueue(new Callable<Void>() {
-//
-//                            public Void call() throws Exception {
-//                                skeletonControl.getAttachmentsNode(bone.getName()).attachChild(spat);
-//                                return null;
-//                            }
-//                        }).get();
-//                        refresh(false);
-//                        return t;
-//                    } catch (InterruptedException ex) {
-//                        Exceptions.printStackTrace(ex);
-//                    } catch (ExecutionException ex) {
-//                        Exceptions.printStackTrace(ex);
-//                    }
-//                    return null;
-//                }
-//            };
-//        }
-//        return null;
-//    }
-//
-//    @Override
-//    protected void createPasteTypes(Transferable t, List<PasteType> s) {
-//        super.createPasteTypes(t, s);
-//        PasteType paste = getDropType(t, DnDConstants.ACTION_COPY_OR_MOVE, -1);
-//        if (null != paste) {
-//            s.add(paste);
-//        }
-//    }
 
     @Override
     public Action[] getActions(boolean context) {
-//        return super.getActions(context);
-        
-         return new Action[]{
-                 Actions.alwaysEnabled(new AttachementNodeActionListener(), "Get attachement Node", "", false),
-            };
-//        if (((JmeBoneChildren) jmeChildren).readOnly) {
-//            return new Action[]{
-//                 Actions.alwaysEnabled(new AttachementNodeActionListener(), "Get attachement Node", "", false),
-//            };
-//        } else {
-//             return new Action[]{
-//                 Actions.alwaysEnabled(new AttachementNodeActionListener(), "Get attachement Node", "", false),
-//            };
-//        }
+
+        return new Action[]{
+                    Actions.alwaysEnabled(new AttachementNodeActionListener(), "Get attachement Node", "", false),};
     }
-    
-    private class AttachementNodeActionListener implements ActionListener{
-          public void actionPerformed(ActionEvent e) {
-                     fireSave(true);
-                    try {
-                        SceneApplication.getApplication().enqueue(new Callable<Void>() {
-
-                            public Void call() throws Exception {
-                                jmeSkeletonControl.getSkeletonControl().getAttachmentsNode(bone.getName());
-                                return null;
-                            }
-                          
-                        }).get();
-                        ((AbstractSceneExplorerNode)jmeSkeletonControl.getParentNode()).refresh(false);
-                    } catch (InterruptedException ex) {
-                        Exceptions.printStackTrace(ex);
-                    } catch (ExecutionException ex) {
-                        Exceptions.printStackTrace(ex);
+
+    private class AttachementNodeActionListener implements ActionListener {
+
+        public void actionPerformed(ActionEvent e) {
+            fireSave(true);
+            try {
+                SceneApplication.getApplication().enqueue(new Callable<Void>() {
+
+                    public Void call() throws Exception {
+                        jmeSkeletonControl.getSkeletonControl().getAttachmentsNode(bone.getName());
+                        return null;
                     }
-                        
-                }
+                }).get();
+                ((AbstractSceneExplorerNode) jmeSkeletonControl.getParentNode()).refresh(false);
+            } catch (InterruptedException ex) {
+                Exceptions.printStackTrace(ex);
+            } catch (ExecutionException ex) {
+                Exceptions.printStackTrace(ex);
+            }
+
+        }
     }
 
     public Class getExplorerObjectClass() {
@@ -199,9 +136,9 @@ public class JmeBone extends AbstractSceneExplorerNode {
     }
 
     public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
-        JmeBoneChildren children = new JmeBoneChildren(jmeSkeletonControl,(Bone) key);
+        JmeBoneChildren children = new JmeBoneChildren(jmeSkeletonControl, (Bone) key);
         children.setReadOnly(cookie);
         children.setDataObject(key2);
-        return new org.openide.nodes.Node[]{new JmeBone(jmeSkeletonControl,(Bone) key, children).setReadOnly(cookie)};
+        return new org.openide.nodes.Node[]{new JmeBone(jmeSkeletonControl, (Bone) key, children).setReadOnly(cookie)};
     }
 }

+ 3 - 30
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBoneChildren.java

@@ -32,27 +32,17 @@
 package com.jme3.gde.core.sceneexplorer.nodes;
 
 import com.jme3.animation.Bone;
-import com.jme3.animation.SkeletonControl;
 import com.jme3.gde.core.scene.SceneApplication;
-import com.jme3.light.AmbientLight;
-import com.jme3.light.DirectionalLight;
-import com.jme3.light.PointLight;
-import com.jme3.light.SpotLight;
-import com.jme3.scene.Spatial;
-import com.jme3.scene.control.Control;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import org.openide.loaders.DataObject;
 import org.openide.nodes.Children;
 import org.openide.nodes.Node;
 import org.openide.util.Exceptions;
-import org.openide.util.Lookup;
 
 /**
  *
@@ -95,29 +85,12 @@ public class JmeBoneChildren extends Children.Keys<Object> {
 
                 public List<Object> call() throws Exception {
                     List<Object> keys = new LinkedList<Object>();
-                    if (rootBone != null) {                       
+                    if (rootBone != null) {
                         keys.addAll(rootBone.getChildren());
                     } else {
                         keys.addAll(Arrays.asList(jmeSkeletonControl.getSkeletonControl().getSkeleton().getRoots()));
                     }
-//                    if (spatial instanceof Geometry) {
-//                        Geometry geom = (Geometry) spatial;
-//                        Mesh mesh = geom.getMesh();
-//                        if (mesh != null) {
-//                            keys.add(new MeshGeometryPair(mesh, geom));
-//                        }
-//                    }
-//                    LightList lights = spatial.getLocalLightList();
-//                    for (int i = 0; i < lights.size(); i++) {
-//                        Light light = lights.get(i);
-//                        if (light != null) {
-//                            keys.add(new LightSpatialPair(light, spatial));
-//                        }
-//                    }
-//                    for (int i = 0; i < spatial.getNumControls(); i++) {
-//                        Control control = spatial.getControl(i);
-//                        keys.add(control);
-//                    }
+
                     return keys;
                 }
             }).get();
@@ -144,7 +117,7 @@ public class JmeBoneChildren extends Children.Keys<Object> {
         if (key instanceof Bone) {
             JmeBoneChildren children = new JmeBoneChildren(jmeSkeletonControl, (Bone) key);
             children.setReadOnly(readOnly);
-            children.setDataObject(dataObject);            
+            children.setDataObject(dataObject);
             return new Node[]{new JmeBone(jmeSkeletonControl, (Bone) key, children).setReadOnly(readOnly)};
         }
         return new Node[]{Node.EMPTY};

+ 2 - 8
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSkeletonControl.java

@@ -31,10 +31,8 @@
  */
 package com.jme3.gde.core.sceneexplorer.nodes;
 
-import com.jme3.animation.AnimControl;
 import com.jme3.animation.SkeletonControl;
 import com.jme3.gde.core.scene.SceneApplication;
-import com.jme3.gde.core.properties.AnimationProperty;
 import com.jme3.scene.Spatial;
 import java.awt.Image;
 import java.io.IOException;
@@ -43,7 +41,6 @@ import java.util.concurrent.ExecutionException;
 import javax.swing.Action;
 import org.openide.actions.DeleteAction;
 import org.openide.loaders.DataObject;
-import org.openide.nodes.Children;
 import org.openide.nodes.Node;
 import org.openide.nodes.Sheet;
 import org.openide.util.Exceptions;
@@ -62,11 +59,10 @@ public class JmeSkeletonControl extends AbstractSceneExplorerNode {
             ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/skeletonControl.gif");
 
     public JmeSkeletonControl() {
-     
     }
 
     public JmeSkeletonControl(SkeletonControl skeletonControl, JmeBoneChildren children) {
-        super(children);       
+        super(children);
         this.skeletonControl = skeletonControl;
         lookupContents.add(this);
         lookupContents.add(skeletonControl);
@@ -149,13 +145,11 @@ public class JmeSkeletonControl extends AbstractSceneExplorerNode {
     public SkeletonControl getSkeletonControl() {
         return skeletonControl;
     }
-    
-    
 
     @Override
     public Node[] createNodes(Object key, DataObject key2, boolean cookie) {
         JmeBoneChildren children = new JmeBoneChildren(null, null);
-        JmeSkeletonControl jsc = new JmeSkeletonControl((SkeletonControl) key, children);        
+        JmeSkeletonControl jsc = new JmeSkeletonControl((SkeletonControl) key, children);
         return new Node[]{jsc};
     }
 }