Fix #104773: FBX import fails when custom property name matches an expected non-custom property

The importer expects some named properties to have specific types
because they are usually FBX-defined properties, but the importer was
also accepting user-defined properties with the same name, which could
have any type, causing an error to be raised when checking the
property's type.

This patch changes the importer to ignore custom properties when finding
specific properties by name.

The import of custom properties is unchanged by this patch.

Pull Request: https://projects.blender.org/blender/blender-addons/pulls/104821
This commit is contained in:
Thomas Barlow
2023-07-27 03:27:08 +01:00
committed by Gitea
parent 288a5429d0
commit 9254557d0b

View File

@ -169,6 +169,7 @@ def elem_prop_first(elem, default=None):
# ----
# Support for
# Properties70: { ... P:
# Custom properties ("user properties" in FBX) are ignored here and get handled separately (see #104773).
def elem_props_find_first(elem, elem_prop_id):
if elem is None:
# When properties are not found... Should never happen, but happens - as usual.
@ -185,7 +186,8 @@ def elem_props_find_first(elem, elem_prop_id):
for subelem in elem.elems:
assert(subelem.id == b'P')
if subelem.props[0] == elem_prop_id:
# 'U' flag indicates that the property has been defined by the user.
if subelem.props[0] == elem_prop_id and b'U' not in subelem.props[3]:
return subelem
return None