[Bf-extensions-cvs] [770d08b7] blender-v2.83-release: FBX Import: skip invalid custom enum properties
Philipp Oeser
noreply at git.blender.org
Tue Jan 18 11:06:34 CET 2022
Commit: 770d08b71f6bca3f7b3ab36b65469b571f859d60
Author: Philipp Oeser
Date: Tue Aug 31 09:43:04 2021 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBA770d08b71f6bca3f7b3ab36b65469b571f859d60
FBX Import: skip invalid custom enum properties
This was (correctly) asserting before, now handle this more gracefully
and just skip (and warn about this) a custom property that has an
invalid value set.
Seems there are a couple of exporters out there that do this wrong, I
think this tradeoff can be made though.
Fixes T91062, T81657, T83501, T86595
Maniphest Tasks: T91062, T86595, T83501, T81657
Differential Revision: https://developer.blender.org/D12354
===================================================================
M io_scene_fbx/__init__.py
M io_scene_fbx/import_fbx.py
===================================================================
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 40ca5fc4..48d02c73 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, 20, 3),
+ "version": (4, 20, 4),
"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/import_fbx.py b/io_scene_fbx/import_fbx.py
index 1c3447ef..1b1b8f59 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -363,8 +363,10 @@ def blen_read_custom_properties(fbx_obj, blen_obj, settings):
val = fbx_prop.props[4]
if settings.use_custom_props_enum_as_string and fbx_prop.props[5]:
enum_items = fbx_prop.props[5].decode('utf-8', 'replace').split('~')
- assert(val >= 0 and val < len(enum_items))
- blen_obj[prop_name] = enum_items[val]
+ if val >= 0 and val < len(enum_items):
+ blen_obj[prop_name] = enum_items[val]
+ else:
+ print ("WARNING: User property '%s' has wrong enum value, skipped" % prop_name)
else:
blen_obj[prop_name] = val
else:
More information about the Bf-extensions-cvs
mailing list