From 89aa2b160f1927bc39e1668a33dc74311c44085d Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Thu, 10 Nov 2011 00:52:12 +0000 Subject: [PATCH] SDK: - add physics undo/redo to MoveTool git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8625 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../jme3/gde/scenecomposer/tools/MoveTool.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveTool.java b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveTool.java index bf09845f7..956fd2140 100644 --- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveTool.java +++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/MoveTool.java @@ -169,14 +169,29 @@ public class MoveTool extends SceneEditTool { @Override public void sceneUndo() { spatial.setLocalTranslation(before); + RigidBodyControl control = toolController.getSelectedSpatial().getControl(RigidBodyControl.class); + if (control != null) { + control.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation()); + } + CharacterControl character = toolController.getSelectedSpatial().getControl(CharacterControl.class); + if (character != null) { + character.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation()); + } toolController.selectedSpatialTransformed(); } @Override public void sceneRedo() { spatial.setLocalTranslation(after); + RigidBodyControl control = toolController.getSelectedSpatial().getControl(RigidBodyControl.class); + if (control != null) { + control.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation()); + } + CharacterControl character = toolController.getSelectedSpatial().getControl(CharacterControl.class); + if (character != null) { + character.setPhysicsLocation(toolController.getSelectedSpatial().getWorldTranslation()); + } toolController.selectedSpatialTransformed(); } - } }