Bugfix: NPE was thrown when object animation was loaded. To fix that modifiers are now loaded after the whole object is loaded to the blenderContext.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10142 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 12 years ago
parent 6520fc5b10
commit 01873e6f80
  1. 17
      engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java

@ -158,13 +158,6 @@ public class ObjectHelper extends AbstractBlenderHelper {
}
node.setLocalTransform(t);
//reading and applying all modifiers
ModifierHelper modifierHelper = blenderContext.getHelper(ModifierHelper.class);
Collection<Modifier> modifiers = modifierHelper.readModifiers(objectStructure, blenderContext);
for(Modifier modifier : modifiers) {
modifier.apply(node, blenderContext);
}
//setting the parent
if(parent instanceof Node) {
((Node)parent).attachChild(node);
@ -216,7 +209,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
Node armature = new Node(name);
armature.setLocalTransform(t);
armature.setUserData(ArmatureHelper.ARMETURE_NODE_MARKER, Boolean.TRUE);
//TODO: modifiers for armature ????
if(parent instanceof Node) {
((Node)parent).attachChild(armature);
}
@ -234,6 +227,14 @@ public class ObjectHelper extends AbstractBlenderHelper {
blenderContext.addLoadedFeatures(objectStructure.getOldMemoryAddress(), name, objectStructure, result);
//applying modifiers
LOGGER.log(Level.FINE, "Reading and applying object's modifiers.");
ModifierHelper modifierHelper = blenderContext.getHelper(ModifierHelper.class);
Collection<Modifier> modifiers = modifierHelper.readModifiers(objectStructure, blenderContext);
for(Modifier modifier : modifiers) {
modifier.apply(result, blenderContext);
}
//loading constraints connected with this object
ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
constraintHelper.loadConstraints(objectStructure, blenderContext);

Loading…
Cancel
Save