From bb52601e4e80dd70b25e2210b01c0650d16687f4 Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Sun, 16 Oct 2011 23:28:48 +0000 Subject: [PATCH] * Gutted out SpatialAnimation * Fix crash in TestObjectAnimation** git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8420 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../modifiers/ObjectAnimationModifier.java | 5 +- .../com/jme3/animation/SpatialAnimation.java | 86 +------------------ 2 files changed, 6 insertions(+), 85 deletions(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ObjectAnimationModifier.java b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ObjectAnimationModifier.java index 3d0737019..a0f655e9a 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ObjectAnimationModifier.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ObjectAnimationModifier.java @@ -9,6 +9,7 @@ import java.util.logging.Logger; import com.jme3.animation.AnimControl; import com.jme3.animation.Animation; import com.jme3.animation.BoneTrack; +import com.jme3.animation.SpatialTrack; import com.jme3.animation.Track; import com.jme3.scene.Node; import com.jme3.scene.plugins.blender.BlenderContext; @@ -83,10 +84,10 @@ import com.jme3.scene.plugins.ogre.AnimData; int fps = blenderContext.getBlenderKey().getFps(); // calculating track for the only bone in this skeleton - BoneTrack track = (BoneTrack) ipo.calculateTrack(-1, 0, ipo.getLastFrame(), fps); + SpatialTrack track = (SpatialTrack) ipo.calculateTrack(-1, 0, ipo.getLastFrame(), fps); Animation animation = new Animation(objectAnimationName, ipo.getLastFrame() / fps); - animation.setTracks(new BoneTrack[] { track }); + animation.setTracks(new SpatialTrack[] { track }); ArrayList animations = new ArrayList(1); animations.add(animation); diff --git a/engine/src/core/com/jme3/animation/SpatialAnimation.java b/engine/src/core/com/jme3/animation/SpatialAnimation.java index c9601df63..54f50583a 100644 --- a/engine/src/core/com/jme3/animation/SpatialAnimation.java +++ b/engine/src/core/com/jme3/animation/SpatialAnimation.java @@ -1,91 +1,11 @@ package com.jme3.animation; -import java.io.IOException; - -import com.jme3.export.InputCapsule; -import com.jme3.export.JmeExporter; -import com.jme3.export.JmeImporter; -import com.jme3.export.OutputCapsule; -import com.jme3.scene.Spatial; - /** - * This class animates the whole spatials. All spatial's children are also - * affected by their parent's movement. - * - * @author Marcin Roguski (Kaelthas) * @deprecated use Animation instead with tracks of selected type (ie. BoneTrack, SpatialTrack, MeshTrack) */ @Deprecated public class SpatialAnimation extends Animation { - /** The name of the animation. */ - private String name; - /** The length of the animation. */ - private float length; - /** The track of the animation. */ - private SpatialTrack[] tracks; - - /** - * Constructor. Stores the name and length of the animation. - * @param name the name of the animation - * @param length the length of the animation - */ - public SpatialAnimation(String name, float length) { - this.name = name; - this.length = length; - } - - @Override - public void setTime(float time, float blendAmount, AnimControl control, - AnimChannel channel) { - Spatial spatial = control.getSpatial(); - if (spatial != null) { - tracks[0].setTime(time, spatial, 0); - } - } - - /** - * This method sets the animation track. - * @param track the animation track - */ - public void setTrack(SpatialTrack track) { - this.tracks[0] = track; - } - - /** - * @return the animation track - */ - public SpatialTrack[] getTracks() { - return tracks; - } - - @Override - public String getName() { - return name; - } - - @Override - public float getLength() { - return length; - } - - @Override - public String toString() { - return "SpatialAnim[name=" + name + ", length=" + length + "]"; - } - - @Override - public void write(JmeExporter ex) throws IOException { - OutputCapsule oc = ex.getCapsule(this); - oc.write(name, "name", null); - oc.write(length, "length", 0); - oc.write(tracks, "tracks", null); - } - - @Override - public void read(JmeImporter im) throws IOException { - InputCapsule in = im.getCapsule(this); - name = in.readString("name", null); - length = in.readFloat("length", 0); - tracks = (SpatialTrack[]) in.readSavableArray("track", null); - } + public SpatialAnimation(String name, float length) { + super(name, length); + } }