Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/fbx_utils.py8
-rw-r--r--io_scene_fbx/import_fbx.py3
2 files changed, 10 insertions, 1 deletions
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index 22ff4be0..4d5cbe8e 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -998,9 +998,15 @@ class ObjectWrapper(metaclass=MetaObjectWrapper):
# In fact, this is wrong - since we do not store that matrix in FBX at all, we shall not use it here...
#~ matrix = self.bdata.matrix_parent_inverse * matrix
if parent._tag == 'BO':
+ # In bone parent case, local matrix is in ***armature*** space!!!!!!!!!!!!
+ # So we need to bring it back into parent bone space.
+ matrix = parent._ref.pose.bones[parent.name].matrix.inverted_safe() * matrix
+
# In bone parent case, we get transformation in **bone tip** space (sigh).
# Have to bring it back into bone root, which is FBX expected value.
- matrix = Matrix.Translation((0, (parent.bdata.tail - parent.bdata.head).length, 0)) * matrix
+ # Actually, since we parent back to bone space above, we do not need that
+ # correction here it seems...
+ #~ matrix = Matrix.Translation((0, (parent.bdata.tail - parent.bdata.head).length, 0)) * matrix
# Our matrix is in local space, time to bring it in its final desired space.
if parent:
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 1db465f9..d70bc90f 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1637,6 +1637,8 @@ class FbxImportHelperNode:
return obj
def build_skeleton_children(self, fbx_tmpl, settings, scene):
+ from mathutils import Matrix
+
if self.is_bone:
for child in self.children:
if child.ignore:
@@ -1646,6 +1648,7 @@ class FbxImportHelperNode:
child_obj.parent = self.bl_obj # get the armature the bone belongs to
child_obj.parent_bone = self.bl_bone
child_obj.parent_type = 'BONE'
+ child_obj.matrix_parent_inverse = Matrix()
# Blender attaches to the end of a bone, while FBX attaches to the start. bone_child_matrix corrects for that.
if child.pre_matrix: