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
This commit is contained in:
@@ -127,7 +127,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|||||||
Structure parentStructure = pParent.fetchData(blenderContext.getInputStream()).get(0);
|
Structure parentStructure = pParent.fetchData(blenderContext.getInputStream()).get(0);
|
||||||
parent = this.toObject(parentStructure, blenderContext);
|
parent = this.toObject(parentStructure, blenderContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform t = this.getTransformation(objectStructure, blenderContext);
|
Transform t = this.getTransformation(objectStructure, blenderContext);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -158,13 +158,6 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
node.setLocalTransform(t);
|
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
|
//setting the parent
|
||||||
if(parent instanceof Node) {
|
if(parent instanceof Node) {
|
||||||
((Node)parent).attachChild(node);
|
((Node)parent).attachChild(node);
|
||||||
@@ -216,7 +209,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|||||||
Node armature = new Node(name);
|
Node armature = new Node(name);
|
||||||
armature.setLocalTransform(t);
|
armature.setLocalTransform(t);
|
||||||
armature.setUserData(ArmatureHelper.ARMETURE_NODE_MARKER, Boolean.TRUE);
|
armature.setUserData(ArmatureHelper.ARMETURE_NODE_MARKER, Boolean.TRUE);
|
||||||
//TODO: modifiers for armature ????
|
|
||||||
if(parent instanceof Node) {
|
if(parent instanceof Node) {
|
||||||
((Node)parent).attachChild(armature);
|
((Node)parent).attachChild(armature);
|
||||||
}
|
}
|
||||||
@@ -234,6 +227,14 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|||||||
|
|
||||||
blenderContext.addLoadedFeatures(objectStructure.getOldMemoryAddress(), name, objectStructure, result);
|
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
|
//loading constraints connected with this object
|
||||||
ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
|
ConstraintHelper constraintHelper = blenderContext.getHelper(ConstraintHelper.class);
|
||||||
constraintHelper.loadConstraints(objectStructure, blenderContext);
|
constraintHelper.loadConstraints(objectStructure, blenderContext);
|
||||||
|
|||||||
Reference in New Issue
Block a user