From 1ace200526d09cc3eeed0ff349e4a8366f8bd4de Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Sat, 23 Apr 2011 01:28:32 +0000 Subject: [PATCH] * Actually fixed the setSpatial(null) bug now .. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7289 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/animation/AnimControl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/src/core/com/jme3/animation/AnimControl.java b/engine/src/core/com/jme3/animation/AnimControl.java index 669208755..f1ba48e81 100644 --- a/engine/src/core/com/jme3/animation/AnimControl.java +++ b/engine/src/core/com/jme3/animation/AnimControl.java @@ -270,14 +270,15 @@ public final class AnimControl extends AbstractControl implements Savable, Clone @Override public void setSpatial(Spatial spatial) { + if (spatial == null && skeletonControl != null){ + this.spatial.removeControl(skeletonControl); + } + super.setSpatial(spatial); //Backward compatibility. - if (skeletonControl != null) { + if (spatial != null && skeletonControl != null) { spatial.addControl(skeletonControl); - // once the skeleton control is added to the spatial, - // the AnimControl returns to "non-compatible" mode. - skeletonControl = null; } }