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>2016-02-12 11:26:00 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-02-12 11:26:00 +0300
commitcf871d6a3027bad3b39b66abf71a5d08f7650db5 (patch)
treec9d5cf1ff0d1efb780bc6891acc05b1dc5d62aaf /io_scene_fbx
parent6266b4139503bb614576f15ea4e90870ac5e597d (diff)
FBX exporter: add option to choose which type of FBX node to use as armature.
By default, Blender uses a 'Null' one (rouglhly equivalent to our Empty), but now user can also choose a 'Root' or even plain "LimbNode". This seems to be necessary to hack around some Unity bug (see T47325). WARNING: the 'LimbNode' option *does not* import back correctly in Blender. Use it in pure export-only cases.
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/__init__.py14
-rw-r--r--io_scene_fbx/export_fbx_bin.py12
-rw-r--r--io_scene_fbx/fbx_utils.py3
3 files changed, 24 insertions, 5 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 9ccc5b7f..65fe695f 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (3, 7, 0),
+ "version": (3, 7, 1),
"blender": (2, 76, 0),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
@@ -375,6 +375,17 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
description="Only write deforming bones (and non-deforming ones when they have deforming children)",
default=False,
)
+ armature_nodetype = EnumProperty(
+ name="Armature FBXNode Type",
+ items=(('NULL', "Null", "'Null' FBX node, similar to Blender's Empty (default)"),
+ ('ROOT', "Root", "'Root' FBX node, supposed to be the root of chains of bones..."),
+ ('LIMBNODE', "LimbNode", "'LimbNode' FBX node, a regular joint between two bones..."),
+ ),
+ description="FBX type of node (object) used to represent Blender's armatures "
+ "(use Null one unless you experience issues with other app, other choices may no import back "
+ "perfectly in Blender...)",
+ default='NULL',
+ )
# Anim - 7.4
bake_anim = BoolProperty(
name="Baked Animation",
@@ -517,6 +528,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper, IOFBXOrientationHelper):
layout.prop(self, "add_leaf_bones")
layout.prop(self, "primary_bone_axis")
layout.prop(self, "secondary_bone_axis")
+ layout.prop(self, "armature_nodetype")
elif self.ui_tab == 'ANIMATION':
layout.prop(self, "bake_anim")
col = layout.column()
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index d3aeee76..fc34ea31 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1557,8 +1557,12 @@ def fbx_data_object_elements(root, ob_obj, scene_data):
if ob_obj.is_bone:
obj_type = b"LimbNode"
elif (ob_obj.type == 'ARMATURE'):
- #~ obj_type = b"Root"
- obj_type = b"Null"
+ if scene_data.settings.armature_nodetype == 'ROOT':
+ obj_type = b"Root"
+ elif scene_data.settings.armature_nodetype == 'LIMBNODE':
+ obj_type = b"LimbNode"
+ else: # Default, preferred option...
+ obj_type = b"Null"
elif (ob_obj.type in BLENDER_OBJECT_TYPES_MESHLIKE):
obj_type = b"Mesh"
elif (ob_obj.type == 'LAMP'):
@@ -2867,6 +2871,7 @@ def save_single(operator, scene, filepath="",
embed_textures=False,
use_custom_props=False,
bake_space_transform=False,
+ armature_nodetype='NULL',
**kwargs
):
@@ -2919,7 +2924,8 @@ def save_single(operator, scene, filepath="",
bake_space_transform, global_matrix_inv, global_matrix_inv_transposed,
context_objects, object_types, use_mesh_modifiers,
mesh_smooth_type, use_mesh_edges, use_tspace,
- use_armature_deform_only, add_leaf_bones, bone_correction_matrix, bone_correction_matrix_inv,
+ armature_nodetype, use_armature_deform_only,
+ add_leaf_bones, bone_correction_matrix, bone_correction_matrix_inv,
bake_anim, bake_anim_use_all_bones, bake_anim_use_nla_strips, bake_anim_use_all_actions,
bake_anim_step, bake_anim_simplify_factor, bake_anim_force_startend_keying,
False, media_settings, use_custom_props,
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index f0501792..ee91a1db 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -1192,7 +1192,8 @@ FBXExportSettings = namedtuple("FBXExportSettings", (
"bake_space_transform", "global_matrix_inv", "global_matrix_inv_transposed",
"context_objects", "object_types", "use_mesh_modifiers",
"mesh_smooth_type", "use_mesh_edges", "use_tspace",
- "use_armature_deform_only", "add_leaf_bones", "bone_correction_matrix", "bone_correction_matrix_inv",
+ "armature_nodetype", "use_armature_deform_only", "add_leaf_bones",
+ "bone_correction_matrix", "bone_correction_matrix_inv",
"bake_anim", "bake_anim_use_all_bones", "bake_anim_use_nla_strips", "bake_anim_use_all_actions",
"bake_anim_step", "bake_anim_simplify_factor", "bake_anim_force_startend_keying",
"use_metadata", "media_settings", "use_custom_props",