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-07-18 19:42:47 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-07-18 19:42:47 +0300
commit039f3646b5a2a3a76fd43df1a2cf68bc0242f1c7 (patch)
tree2bd17e05ca7830f0da27bad1e13ecee4657b8c03 /io_scene_fbx/import_fbx.py
parent8e62ba483ef5e56667f1601b9f7c08a58a5ba986 (diff)
FBX Export: WIP attempt to have 'skip_export' objects.
This would allo us e.g. to not export armature object as a root for bone chains, or to have a real 'only deform' export option, in each case by ignoring some nodes and 'reparenting' their children to first exported parent. Idea is simple, but as always when touching to FBX transform (and even worse, FBX bones binding), it turns into nightmare (a bit like the 'apply transform' issue). So stuffing this here for now, in case someone (or myself) feels like wasting another day or two on this mess - with no guarantee of success...
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 e667693d..252e532d 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1664,7 +1664,7 @@ class FbxImportHelperNode:
child.armature = armature
child.find_armature_bones(armature)
- def find_armatures(self):
+ def find_armatures(self, settings):
needs_armature = False
for child in self.children:
if child.is_bone:
@@ -1681,6 +1681,11 @@ class FbxImportHelperNode:
armature.fbx_name = "Armature"
armature.is_armature = True
+ # if our fake armature is a non-parented object, we need to set a transform
+ # that will result in NOP once applied all corrections...
+ if self.is_root:
+ armature.matrix = settings.global_matrix_inv
+
for child in self.children:
if child.is_bone:
child.parent = armature
@@ -1692,7 +1697,7 @@ class FbxImportHelperNode:
for child in self.children:
if child.is_armature or child.is_bone:
continue
- child.find_armatures()
+ child.find_armatures(settings)
def find_bone_children(self):
has_bone_children = False
@@ -2525,7 +2530,7 @@ def load(operator, context, filepath="",
assert(fbx_props[0] is not None)
transform_data = blen_read_object_transform_preprocess(fbx_props, fbx_obj, Matrix(), use_prepost_rot)
- is_bone = fbx_obj.props[2] in {b'LimbNode'} # Note: 'Root' "bones" are handled as (armature) objects.
+ is_bone = fbx_obj.props[2] == b'LimbNode' # Note: 'Root' "bones" are handled as (armature) objects.
fbx_helper_nodes[a_uuid] = FbxImportHelperNode(fbx_obj, bl_data, transform_data, is_bone)
# add parent-child relations and add blender data to the node
@@ -2552,7 +2557,7 @@ def load(operator, context, filepath="",
child.parent = parent
# find armatures (either an empty below a bone or a new node inserted at the bone
- root_helper.find_armatures()
+ root_helper.find_armatures(settings)
# mark nodes that have bone children
root_helper.find_bone_children()