From 491c164bd36a0ded4086bbc5ed82494903d0be06 Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Thu, 23 Jun 2011 14:09:15 +0000 Subject: [PATCH] Using BoneAnimation cloning rather that internal method. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7698 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../blender/helpers/v249/ModifierHelper.java | 38 +------------------ 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java index 0793e2327..823b34207 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java @@ -56,7 +56,6 @@ import com.jme3.effect.shapes.EmitterMeshVertexShape; import com.jme3.effect.shapes.EmitterShape; import com.jme3.material.Material; import com.jme3.math.Matrix4f; -import com.jme3.math.Quaternion; import com.jme3.math.Vector3f; import com.jme3.scene.Geometry; import com.jme3.scene.Mesh; @@ -342,7 +341,7 @@ public class ModifierHelper extends AbstractBlenderHelper { Constraint[] constraints = constraintHelper.getConstraints(modifierArmatureObject); HashMap anims = new HashMap(); for (int i = 0; i < animList.size(); ++i) { - BoneAnimation boneAnimation = this.cloneBoneAnimation(animList.get(i)); + BoneAnimation boneAnimation = animList.get(i).clone(); // baking constraints into animations if (constraints != null && constraints.length > 0) { @@ -642,41 +641,6 @@ public class ModifierHelper extends AbstractBlenderHelper { return node; } - /** - * This class clones the bone animation data. - * @param source - * the source that is to be cloned - * @return the copy of the given bone animation - */ - protected BoneAnimation cloneBoneAnimation(BoneAnimation source) { - BoneAnimation result = new BoneAnimation(source.getName(), source.getLength()); - - // copying tracks and applying constraints - BoneTrack[] sourceTracks = source.getTracks(); - BoneTrack[] boneTracks = new BoneTrack[sourceTracks.length]; - for (int i = 0; i < sourceTracks.length; ++i) { - int tablesLength = sourceTracks[i].getTimes().length; - - Vector3f[] sourceTranslations = sourceTracks[i].getTranslations(); - Quaternion[] sourceRotations = sourceTracks[i].getRotations(); - Vector3f[] sourceScales = sourceTracks[i].getScales(); - - Vector3f[] translations = new Vector3f[tablesLength]; - Quaternion[] rotations = new Quaternion[tablesLength]; - Vector3f[] scales = new Vector3f[tablesLength]; - for (int j = 0; j < tablesLength; ++j) { - translations[j] = sourceTranslations[j].clone(); - rotations[j] = sourceRotations[j].clone(); - scales[j] = sourceScales != null ? sourceScales[j].clone() : new Vector3f(1.0f, 1.0f, 1.0f); - } - // times do not change, no need to clone them - boneTracks[i] = new BoneTrack(sourceTracks[i].getTargetBoneIndex(), sourceTracks[i].getTimes(), - translations, rotations, scales); - } - result.setTracks(boneTracks); - return result; - } - /** * This method merges two skeletons into one. I assume that each skeleton's 0-indexed bone is objectAnimationBone so * only one such bone should be placed in the result