Issue 540: NullPointerException when loading blender model

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9998 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
Kae..pl 2012-11-16 12:47:54 +00:00
parent 6573b87bf0
commit 5e2c814086
3 changed files with 7 additions and 4 deletions

View File

@ -236,7 +236,9 @@ public class ArmatureHelper extends AbstractBlenderHelper {
if (!p.isNull()) {
Structure ipoStructure = p.fetchData(blenderContext.getInputStream()).get(0);
Ipo ipo = ipoHelper.fromIpoStructure(ipoStructure, blenderContext);
tracks.add((BoneTrack) ipo.calculateTrack(boneIndex, 0, ipo.getLastFrame(), fps, false));
if(ipo != null) {
tracks.add((BoneTrack) ipo.calculateTrack(boneIndex, 0, ipo.getLastFrame(), fps, false));
}
}
}
}

View File

@ -325,7 +325,6 @@ import com.jme3.util.BufferUtils;
if (boneIndex != null) {
float weight = ((Number) deformWeight.getFieldValue("weight")).floatValue();
if (weight == 0.0f) {
weight = 1;
boneIndex = Integer.valueOf(0);
}
// we apply the weight to all referenced vertices

View File

@ -149,8 +149,10 @@ public class ModifierHelper extends AbstractBlenderHelper {
IpoHelper ipoHelper = blenderContext.getHelper(IpoHelper.class);
Structure ipoStructure = pIpo.fetchData(blenderContext.getInputStream()).get(0);
Ipo ipo = ipoHelper.fromIpoStructure(ipoStructure, blenderContext);
result = new ObjectAnimationModifier(ipo, objectStructure.getName(), objectStructure.getOldMemoryAddress(), blenderContext);
blenderContext.addModifier(objectStructure.getOldMemoryAddress(), result);
if(ipo != null) {
result = new ObjectAnimationModifier(ipo, objectStructure.getName(), objectStructure.getOldMemoryAddress(), blenderContext);
blenderContext.addModifier(objectStructure.getOldMemoryAddress(), result);
}
}
return result;
}