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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-06-23 13:59:21 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-06-23 13:59:21 +0300
commitd2aa512ae8b1b326f41616a4109e7dadb36bd9d5 (patch)
tree23d8d856a662f365f630c1ba1c3d44bce7486de4 /io_scene_fbx/import_fbx.py
parente7f523325bdac580e28b6b4eca5e5badfbbd114e (diff)
Fix T45157: FBX Import could do with better bone alignment in pure-joints armature case.
Note that, since I do not have any skinned zero-aligned bones FBX file at hands, I do not know whether this option breaks skinning or not (hard to predict, we are playing with at least four different matrices/transforms here)... Time will say.
Diffstat (limited to 'io_scene_fbx/import_fbx.py')
-rw-r--r--io_scene_fbx/import_fbx.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 7a2808db..2eaf2f95 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1762,7 +1762,7 @@ class FbxImportHelperNode:
for child in self.children:
child.collect_armature_meshes()
- def build_skeleton(self, arm, parent_matrix, parent_bone_size=1):
+ def build_skeleton(self, arm, parent_matrix, parent_bone_size=1, force_connect_children=False):
# ----
# Now, create the (edit)bone.
bone = arm.bl_data.edit_bones.new(name=self.fbx_name)
@@ -1802,11 +1802,15 @@ class FbxImportHelperNode:
if child.ignore:
continue
if child.is_bone:
- child_bone = child.build_skeleton(arm, bone_matrix, bone_size)
+ child_bone = child.build_skeleton(arm, bone_matrix, bone_size,
+ force_connect_children=force_connect_children)
# Connection to parent.
child_bone.parent = bone
if similar_values_iter(bone.tail, child_bone.head):
child_bone.use_connect = True
+ elif force_connect_children:
+ bone.tail = child_bone.head
+ child_bone.use_connect = True
return bone
@@ -1977,7 +1981,7 @@ class FbxImportHelperNode:
if child.ignore:
continue
if child.is_bone:
- child_obj = child.build_skeleton(self, Matrix())
+ child.build_skeleton(self, Matrix(), force_connect_children=settings.force_connect_children)
bpy.ops.object.mode_set(mode='OBJECT')
@@ -2075,6 +2079,7 @@ def load(operator, context, filepath="",
use_custom_props=True,
use_custom_props_enum_as_string=True,
ignore_leaf_bones=False,
+ force_connect_children=False,
automatic_bone_orientation=False,
primary_bone_axis='Y',
secondary_bone_axis='X',
@@ -2199,7 +2204,7 @@ def load(operator, context, filepath="",
use_alpha_decals, decal_offset,
use_custom_props, use_custom_props_enum_as_string,
cycles_material_wrap_map, image_cache,
- ignore_leaf_bones, automatic_bone_orientation, bone_correction_matrix,
+ ignore_leaf_bones, force_connect_children, automatic_bone_orientation, bone_correction_matrix,
use_prepost_rot,
)