FBX IO: Fix pose bone custom props not being exported.

We want to export editbone props in the 'edit data' NodeAttribute FBX nodes,
and the posebone props in the 'object data' Model FBX nodes...

Reported in T69554.
This commit is contained in:
Bastien Montagne 2019-10-08 16:20:23 +02:00
parent a17cabe4c9
commit cb4e5b248c
Notes: blender-bot 2023-02-14 19:08:48 +01:00
Referenced by issue #69554, FBX import does not read custom bone properties
3 changed files with 10 additions and 2 deletions

View File

@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
"version": (4, 18, 1),
"version": (4, 19, 0),
"blender": (2, 81, 6),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",

View File

@ -1686,7 +1686,9 @@ def fbx_data_object_elements(root, ob_obj, scene_data):
# Custom properties.
if scene_data.settings.use_custom_props:
fbx_data_element_custom_properties(props, ob_obj.bdata)
# Here we want customprops from the 'pose' bone, not the 'edit' bone...
bdata = ob_obj.bdata_pose_bone if ob_obj.is_bone else ob_obj.bdata
fbx_data_element_custom_properties(props, bdata)
# Those settings would obviously need to be edited in a complete version of the exporter, may depends on
# object type, etc.

View File

@ -1007,6 +1007,12 @@ class ObjectWrapper(metaclass=MetaObjectWrapper):
return ObjectWrapper(self.bdata.parent, self._ref) or ObjectWrapper(self._ref)
parent = property(get_parent)
def get_bdata_pose_bone(self):
if self._tag == 'BO':
return self._ref.pose.bones[self.bdata.name]
return None
bdata_pose_bone = property(get_bdata_pose_bone)
def get_matrix_local(self):
if self._tag == 'OB':
return self.bdata.matrix_local.copy()