Minor fixes to armature loading.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10528 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 12 years ago
parent a725516f00
commit e282db0f7f
  1. 6
      engine/src/blender/com/jme3/scene/plugins/blender/animations/BoneContext.java
  2. 5
      engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java

@ -89,7 +89,7 @@ public class BoneContext {
boneName = boneStructure.getFieldValue("name").toString(); boneName = boneStructure.getFieldValue("name").toString();
length = ((Number) boneStructure.getFieldValue("length")).floatValue(); length = ((Number) boneStructure.getFieldValue("length")).floatValue();
ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class); ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
armatureMatrix = objectHelper.getMatrix(boneStructure, "arm_mat", true); armatureMatrix = objectHelper.getMatrix(boneStructure, "arm_mat", blenderContext.getBlenderKey().isFixUpAxis());
this.computeRestMatrix(objectToArmatureMatrix); this.computeRestMatrix(objectToArmatureMatrix);
List<Structure> childbase = ((Structure) boneStructure.getFieldValue("childbase")).evaluateListBase(blenderContext); List<Structure> childbase = ((Structure) boneStructure.getFieldValue("childbase")).evaluateListBase(blenderContext);
@ -117,10 +117,6 @@ public class BoneContext {
inverseTotalTransformation = restMatrix.invert(); inverseTotalTransformation = restMatrix.invert();
restMatrix = inverseParentMatrix.mult(restMatrix); restMatrix = inverseParentMatrix.mult(restMatrix);
for (BoneContext child : this.children) {
child.computeRestMatrix(objectToArmatureMatrix);
}
} }
/** /**

@ -100,8 +100,9 @@ import com.jme3.util.BufferUtils;
ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class); ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
if(objectHelper.isLineage(armatureObject, objectStructure, blenderContext)) { if(objectHelper.isLineage(armatureObject, objectStructure, blenderContext)) {
Matrix4f armatureObjectMatrix = objectHelper.getMatrix(armatureObject, "obmat", blenderContext.getBlenderKey().isFixUpAxis()); boolean fixUpAxis = blenderContext.getBlenderKey().isFixUpAxis();
Matrix4f inverseMeshObjectMatrix = objectHelper.getMatrix(objectStructure, "obmat", true).invertLocal(); Matrix4f armatureObjectMatrix = objectHelper.getMatrix(armatureObject, "obmat", fixUpAxis);
Matrix4f inverseMeshObjectMatrix = objectHelper.getMatrix(objectStructure, "imat", fixUpAxis);
objectToArmatureTransformation = armatureObjectMatrix.multLocal(inverseMeshObjectMatrix); objectToArmatureTransformation = armatureObjectMatrix.multLocal(inverseMeshObjectMatrix);
Matrix3f rot = objectToArmatureTransformation.toRotationMatrix(); Matrix3f rot = objectToArmatureTransformation.toRotationMatrix();
objectToArmatureTransformation = new Matrix4f(); objectToArmatureTransformation = new Matrix4f();

Loading…
Cancel
Save