From c3ab5b3748ae3d1f3481880311c7e1c107ffd223 Mon Sep 17 00:00:00 2001 From: Nehon Date: Wed, 18 Feb 2015 00:27:13 +0100 Subject: [PATCH] SceneToolController AppState is now always after the CameraController in the AppState list in the SceneApplication --- .../core/scene/controller/AbstractCameraController.java | 9 ++++++++- .../gde/core/scene/controller/SceneToolController.java | 9 ++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java index 4fbeef3a1..02fdfb106 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java @@ -97,7 +97,14 @@ public abstract class AbstractCameraController extends AbstractAppState implemen } public void enable() { - SceneApplication.getApplication().getStateManager().attach(this); + SceneToolController c = SceneApplication.getApplication().getStateManager().getState(SceneToolController.class); + if(c != null){ + SceneApplication.getApplication().getStateManager().detach(c); + SceneApplication.getApplication().getStateManager().attach(this); + SceneApplication.getApplication().getStateManager().attach(c); + }else{ + SceneApplication.getApplication().getStateManager().attach(this); + } final AbstractCameraController cc = SceneApplication.getApplication().getActiveCameraController(); SceneApplication.getApplication().setActiveCameraController(this); diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/SceneToolController.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/SceneToolController.java index 8dc190f77..23c6817a9 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/SceneToolController.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/controller/SceneToolController.java @@ -53,7 +53,7 @@ public class SceneToolController implements AppState { public SceneToolController(AssetManager manager) { this.toolsNode = new Node("ToolsNode"); - initTools(); + initTools(); SceneApplication.getApplication().getStateManager().attach(this); } @@ -416,17 +416,16 @@ public class SceneToolController implements AppState { // throw new UnsupportedOperationException("Not supported yet."); } - public void update(float f) { + public void update(float f) { if (selected == null || selectionShape == null) { return; } selectionShape.setLocalTranslation(selected.getWorldTranslation()); selectionShape.setLocalRotation(selected.getWorldRotation()); - //selectionShape.setLocalScale(selected.getWorldScale()); - + selectionShape.setLocalScale(selected.getWorldScale()); + } - public void render(RenderManager rm) { // throw new UnsupportedOperationException("Not supported yet."); }