From e65e9cc7ccedc91733de3768a77ac569e6998bf8 Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Thu, 27 Jul 2023 03:27:08 +0100 Subject: [PATCH] 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. --- io_scene_fbx/import_fbx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index a3571a408..6c3f08e82 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -168,6 +168,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. @@ -184,7 +185,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 -- 2.30.2