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/branches/gradle-restructure@11001 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
Kae..pl 11 years ago
parent 4c8369f17e
commit bbe6fc5567
  1. 5
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/animations/AnimationHelper.java

@ -274,10 +274,12 @@ public class AnimationHelper extends AbstractBlenderHelper {
if (!p.isNull()) {
Structure ipoStructure = p.fetchData().get(0);
Ipo ipo = this.fromIpoStructure(ipoStructure, blenderContext);
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;
return blenderAction;
}
@ -364,9 +366,8 @@ public class AnimationHelper extends AbstractBlenderHelper {
public BoneTrack[] toTracks(Skeleton skeleton) {
List<BoneTrack> tracks = new ArrayList<BoneTrack>(featuresTracks.size());
for (Entry<String, Ipo> 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()]);
}

Loading…
Cancel
Save