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. 2
      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. 2
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java

@ -236,10 +236,12 @@ 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);
if(ipo != null) {
tracks.add((BoneTrack) ipo.calculateTrack(boneIndex, 0, ipo.getLastFrame(), fps, false)); tracks.add((BoneTrack) ipo.calculateTrack(boneIndex, 0, ipo.getLastFrame(), fps, false));
} }
} }
} }
}
return tracks.toArray(new BoneTrack[tracks.size()]); return tracks.toArray(new BoneTrack[tracks.size()]);
} }

@ -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,9 +149,11 @@ 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);
if(ipo != null) {
result = new ObjectAnimationModifier(ipo, objectStructure.getName(), objectStructure.getOldMemoryAddress(), blenderContext); result = new ObjectAnimationModifier(ipo, objectStructure.getName(), objectStructure.getOldMemoryAddress(), blenderContext);
blenderContext.addModifier(objectStructure.getOldMemoryAddress(), result); blenderContext.addModifier(objectStructure.getOldMemoryAddress(), result);
} }
}
return result; return result;
} }

Loading…
Cancel
Save