Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-08-31 10:43:04 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-11-23 11:34:17 +0300
commit2fe7db71710f0f1c53f590b1d75654121e32523b (patch)
tree383d14dc4ee561d91e81caba2f3d6540fa5b1be6
parentce25c08d472f9f7d295b1735b1b6c321a4fc2a13 (diff)
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
-rw-r--r--io_scene_fbx/__init__.py2
-rw-r--r--io_scene_fbx/import_fbx.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 71ae6ec3..01bc5421 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, 22, 0),
+ "version": (4, 23, 0),
"blender": (2, 90, 0),
"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 ec16b6d1..ba11757a 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -369,8 +369,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: