From 752599891a7f924e2fa8a1c483b1a11f6627169a Mon Sep 17 00:00:00 2001 From: "Kae..pl" Date: Thu, 23 Jan 2014 16:07:06 +0000 Subject: [PATCH] Bugfix: fixed an issue with badly loaded bone animations when bones did not have fully defined translation/rotation/scale. Bugfix: fixed an issue with blender 2.49 animation loading when ipo had no curves defined (NPE was then thrown). git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11001 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../plugins/blender/animations/AnimationHelper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/animations/AnimationHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/animations/AnimationHelper.java index 19c51b422..bb73db037 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/AnimationHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/AnimationHelper.java @@ -274,8 +274,10 @@ public class AnimationHelper extends AbstractBlenderHelper { if (!p.isNull()) { Structure ipoStructure = p.fetchData().get(0); Ipo ipo = this.fromIpoStructure(ipoStructure, blenderContext); - lastFrame = Math.max(lastFrame, ipo.getLastFrame()); - blenderAction.featuresTracks.put(animatedFeatureName, ipo); + if(ipo != null) {//this can happen when ipo with no curves appear in blender file + lastFrame = Math.max(lastFrame, ipo.getLastFrame()); + blenderAction.featuresTracks.put(animatedFeatureName, ipo); + } } } blenderAction.stopFrame = lastFrame; @@ -364,9 +366,8 @@ public class AnimationHelper extends AbstractBlenderHelper { public BoneTrack[] toTracks(Skeleton skeleton) { List tracks = new ArrayList(featuresTracks.size()); for (Entry entry : featuresTracks.entrySet()) { - Bone bone = skeleton.getBone(entry.getKey()); int boneIndex = skeleton.getBoneIndex(entry.getKey()); - tracks.add((BoneTrack) entry.getValue().calculateTrack(boneIndex, bone.getLocalPosition(), bone.getLocalRotation(), bone.getLocalScale(), 1, stopFrame, fps, false)); + tracks.add((BoneTrack) entry.getValue().calculateTrack(boneIndex, Vector3f.ZERO, Quaternion.IDENTITY, Vector3f.UNIT_XYZ, 1, stopFrame, fps, false)); } return tracks.toArray(new BoneTrack[tracks.size()]); }