Jelajahi Sumber

SDK:
- remove some queueing to make tool selection update faster

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9352 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 13 tahun lalu
induk
melakukan
d2f0261e46

+ 2 - 8
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneComposerToolController.java

@@ -104,7 +104,7 @@ public class SceneComposerToolController extends SceneToolController {
             onTopToolsNode.updateGeometricState();
         }
         if (editTool != null) {
-            editTool.updateToolsTransformation();
+            editTool.doUpdateToolsTransformation();
         }
 
     }
@@ -154,13 +154,7 @@ public class SceneComposerToolController extends SceneToolController {
 
     public void selectedSpatialTransformed() {
         if (editTool != null) {
-            SceneApplication.getApplication().enqueue(new Callable<Object>() {
-
-                public Object call() throws Exception {
-                    editTool.updateToolsTransformation();
-                    return null;
-                }
-            });
+            editTool.updateToolsTransformation();
         }
     }
 

+ 14 - 8
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneEditTool.java

@@ -123,25 +123,31 @@ public abstract class SceneEditTool {
     /**
      * Called when the selected spatial has been modified
      * outside of the tool.
+     * TODO: why? just move the tool where the object is each frame?
      */
     public void updateToolsTransformation() {
 
         SceneApplication.getApplication().enqueue(new Callable<Object>() {
 
             public Object call() throws Exception {
-                if (toolController.getSelectedSpatial() != null) {
-                    axisMarker.setLocalTranslation(toolController.getSelectedSpatial().getWorldTranslation());
-                    axisMarker.setLocalRotation(toolController.getSelectedSpatial().getWorldRotation());
-                    setAxisMarkerScale(toolController.getSelectedSpatial());
-                } else {
-                    axisMarker.setLocalTranslation(Vector3f.ZERO);
-                    axisMarker.setLocalRotation(Quaternion.IDENTITY);
-                }
+                doUpdateToolsTransformation();
                 return null;
             }
+
         });
     }
 
+    public void doUpdateToolsTransformation() {
+        if (toolController.getSelectedSpatial() != null) {
+            axisMarker.setLocalTranslation(toolController.getSelectedSpatial().getWorldTranslation());
+            axisMarker.setLocalRotation(toolController.getSelectedSpatial().getWorldRotation());
+            setAxisMarkerScale(toolController.getSelectedSpatial());
+        } else {
+            axisMarker.setLocalTranslation(Vector3f.ZERO);
+            axisMarker.setLocalRotation(Quaternion.IDENTITY);
+        }
+    }
+    
     /**
      * Adjust the scale of the marker so it is relative to the size of the
      * selected spatial. It will have a minimum scale of 2.

+ 1 - 1
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveTool.java

@@ -145,7 +145,7 @@ public class MoveTool extends SceneEditTool {
         if (character != null) {
             character.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation());
         }
-        updateToolsTransformation();
+        doUpdateToolsTransformation();
         
         wasDragging = true;
     }

+ 1 - 1
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/ScaleTool.java

@@ -99,7 +99,7 @@ public class ScaleTool extends SceneEditTool {
             Vector3f scale = toolController.getSelectedSpatial().getLocalScale().add(diff, diff, diff);
             lastScale = scale;
             toolController.getSelectedSpatial().setLocalScale(scale);
-            updateToolsTransformation();
+            doUpdateToolsTransformation();
         }
         
         wasDragging = true;

+ 1 - 1
jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java

@@ -44,7 +44,7 @@ public class SelectTool extends SceneEditTool {
             });
 
             if (result != null) {
-                updateToolsTransformation();
+                doUpdateToolsTransformation();
             }
         }