Issue 540: NullPointerException when loading blender model

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9998 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 12 years ago
parent 6573b87bf0
commit 5e2c814086
  1. 4
      engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java
  2. 1
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java
  3. 6
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java

@ -236,7 +236,9 @@ public class ArmatureHelper extends AbstractBlenderHelper {
if (!p.isNull()) { if (!p.isNull()) {
Structure ipoStructure = p.fetchData(blenderContext.getInputStream()).get(0); Structure ipoStructure = p.fetchData(blenderContext.getInputStream()).get(0);
Ipo ipo = ipoHelper.fromIpoStructure(ipoStructure, blenderContext); 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));
}
} }
} }
} }

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

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

Loading…
Cancel
Save