From 116ced422b87cfd5870401ba777f6185a4d474c6 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sun, 12 Aug 2012 19:26:16 +0000 Subject: [PATCH] SDK : - Select tool does not keep its own instance of the selected spatial, it nows use the ToolController.selectedSpatial, for better selection synchronisation between sceneExplorer and sceneViewer git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9649 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/gde/scenecomposer/tools/SelectTool.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java index f9752dfb3..68df25a99 100644 --- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java +++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java @@ -43,8 +43,6 @@ import org.openide.util.Lookup; */ public class SelectTool extends SceneEditTool { - protected Spatial selected; - private enum State { translate, rotate, scale @@ -89,6 +87,7 @@ public class SelectTool extends SceneEditTool { public void keyPressed(KeyInputEvent kie) { checkModificatorKeys(kie); // alt,shift,ctrl + Spatial selected = toolController.getSelectedSpatial(); if (selected == null) { return; // only do anything if a spatial is selected @@ -146,6 +145,7 @@ public class SelectTool extends SceneEditTool { } private void clearState(boolean resetSelected) { + Spatial selected = toolController.getSelectedSpatial(); if (resetSelected && selected != null) { // reset the transforms if (startRot != null) { @@ -267,6 +267,7 @@ public class SelectTool extends SceneEditTool { } private boolean checkStateKey(KeyInputEvent kie) { + Spatial selected = toolController.getSelectedSpatial(); if (kie.getKeyCode() == KeyInput.KEY_G) { currentState = State.translate; MoveManager moveManager = Lookup.getDefault().lookup(MoveManager.class); @@ -390,6 +391,7 @@ public class SelectTool extends SceneEditTool { @Override public void actionPrimary(Vector2f screenCoord, boolean pressed, final JmeNode rootNode, DataObject dataObject) { if (!pressed) { + Spatial selected = toolController.getSelectedSpatial(); // left mouse released if (!wasDraggingL) { // left mouse pressed @@ -430,6 +432,7 @@ public class SelectTool extends SceneEditTool { @Override public void actionSecondary(final Vector2f screenCoord, boolean pressed, final JmeNode rootNode, DataObject dataObject) { if (pressed) { + Spatial selected = toolController.getSelectedSpatial(); // mouse down if (moving != null) { @@ -560,6 +563,7 @@ public class SelectTool extends SceneEditTool { } private void doMouseScale(Vector3f axis, Vector2f screenCoord, JmeNode rootNode, JmeSpatial selectedSpatial) { + Spatial selected = toolController.getSelectedSpatial(); // scale based on the original mouse position and original model-to-screen position // and compare that to the distance from the new mouse position and the original distance if (startMouseCoord == null) { @@ -593,6 +597,7 @@ public class SelectTool extends SceneEditTool { } private void doMouseRotate(Vector3f axis, Vector2f screenCoord, JmeNode rootNode, JmeSpatial selectedSpatial) { + Spatial selected = toolController.getSelectedSpatial(); if (startMouseCoord == null) { startMouseCoord = screenCoord.clone(); } @@ -628,6 +633,7 @@ public class SelectTool extends SceneEditTool { } private void duplicateSelected() { + Spatial selected = toolController.getSelectedSpatial(); if (selected == null) { return; } @@ -659,6 +665,7 @@ public class SelectTool extends SceneEditTool { } private void deleteSelected() { + Spatial selected = toolController.getSelectedSpatial(); if (selected == null) { return; }