FBX IO: Add support for armature data custom properties #104888
@ -552,14 +552,21 @@ def fbx_data_element_custom_properties(props, bid):
|
||||
|
||||
def fbx_data_empty_elements(root, empty, scene_data):
|
||||
"""
|
||||
Write the Empty data block (you can control its FBX datatype with the 'fbx_type' string custom property).
|
||||
Write the Empty data block (you can control its FBX datatype with the 'fbx_type' string custom property) or Armature
|
||||
NodeAttribute.
|
||||
"""
|
||||
empty_key = scene_data.data_empties[empty]
|
||||
|
||||
null = elem_data_single_int64(root, b"NodeAttribute", get_fbx_uuid_from_key(empty_key))
|
||||
null.add_string(fbx_name_class(empty.name.encode(), b"NodeAttribute"))
|
||||
val = empty.bdata.get('fbx_type', None)
|
||||
null.add_string(val.encode() if val and isinstance(val, str) else b"Null")
|
||||
bdata = empty.bdata
|
||||
is_armature = bdata.type == 'ARMATURE'
|
||||
if is_armature:
|
||||
fbx_type = b"Null"
|
||||
else:
|
||||
val = bdata.get('fbx_type', None)
|
||||
fbx_type = val.encode() if val and isinstance(val, str) else b"Null"
|
||||
null.add_string(fbx_type)
|
||||
|
||||
elem_data_single_string(null, b"TypeFlags", b"Null")
|
||||
|
||||
@ -567,7 +574,10 @@ def fbx_data_empty_elements(root, empty, scene_data):
|
||||
props = elem_properties(null)
|
||||
elem_props_template_finalize(tmpl, props)
|
||||
|
||||
# No custom properties, already saved with object (Model).
|
||||
# Empty/Armature Object custom properties have already been saved with the Model.
|
||||
# Only Armature data custom properties need to be saved here with the NodeAttribute.
|
||||
if is_armature:
|
||||
fbx_data_element_custom_properties(props, bdata.data)
|
||||
|
||||
|
||||
def fbx_data_light_elements(root, lamp, scene_data):
|
||||
|
@ -2826,8 +2826,13 @@ class FbxImportHelperNode:
|
||||
elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
|
||||
|
||||
if settings.use_custom_props:
|
||||
# Read Armature Object custom props from the Node
|
||||
blen_read_custom_properties(self.fbx_elem, arm, settings)
|
||||
|
||||
if self.fbx_data_elem:
|
||||
# Read Armature Data custom props from the NodeAttribute
|
||||
blen_read_custom_properties(self.fbx_data_elem, arm_data, settings)
|
||||
|
||||
# instance in scene
|
||||
view_layer.active_layer_collection.collection.objects.link(arm)
|
||||
arm.select_set(True)
|
||||
|
Loading…
Reference in New Issue
Block a user