Fixing a bug that caused NPE to be thrown when no actions where applied to armature.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8360 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 14 years ago
parent 7a0713cd59
commit 952081b192
  1. 2
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java

@ -118,6 +118,7 @@ import com.jme3.util.BufferUtils;
//read animations //read animations
ArrayList<Animation> animations = new ArrayList<Animation>(); ArrayList<Animation> animations = new ArrayList<Animation>();
List<FileBlockHeader> actionHeaders = blenderContext.getFileBlocks(Integer.valueOf(FileBlockHeader.BLOCK_AC00)); List<FileBlockHeader> actionHeaders = blenderContext.getFileBlocks(Integer.valueOf(FileBlockHeader.BLOCK_AC00));
if(actionHeaders != null) {//it may happen that the model has armature with no actions
for (FileBlockHeader header : actionHeaders) { for (FileBlockHeader header : actionHeaders) {
Structure actionStructure = header.getStructure(blenderContext); Structure actionStructure = header.getStructure(blenderContext);
String actionName = actionStructure.getName(); String actionName = actionStructure.getName();
@ -136,6 +137,7 @@ import com.jme3.util.BufferUtils;
boneAnimation.setTracks(tracks); boneAnimation.setTracks(tracks);
animations.add(boneAnimation); animations.add(boneAnimation);
} }
}
animData = new AnimData(new Skeleton(bones), animations); animData = new AnimData(new Skeleton(bones), animations);
} }
} }

Loading…
Cancel
Save