[Bf-extensions-cvs] [cb4e5b24] master: FBX IO: Fix pose bone custom props not being exported.

Bastien Montagne noreply at git.blender.org
Tue Oct 8 16:22:53 CEST 2019


Commit: cb4e5b248c8a1c438b1228380bbf41b9ddf6fd90
Author: Bastien Montagne
Date:   Tue Oct 8 16:20:23 2019 +0200
Branches: master
https://developer.blender.org/rBAcb4e5b248c8a1c438b1228380bbf41b9ddf6fd90

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.

===================================================================

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/fbx_utils.py

===================================================================

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 382553ba..9257056c 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": (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",
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index b852adaa..d1ba96bb 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -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.
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index a496075d..f71e89a8 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -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()



More information about the Bf-extensions-cvs mailing list