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
This commit is contained in:
parent
ce25c08d47
commit
2fe7db7171
Notes:
blender-bot
2023-02-14 18:46:49 +01:00
Referenced by issue blender/blender#88449: Blender LTS: Maintenance Task 2.93 Referenced by issue blender/blender#88449, Blender LTS: Maintenance Task 2.93 Referenced by issue blender/blender#91062, Failure to import this FBX (but Unity handles it well) Referenced by issue #86595, i can't import fbx because of python:Traceback Referenced by issue #83501, Import Error FBX from 3ds Max Referenced by issue #81657, FBX Import error (enum with -1 value -- e.g. as done by the babylonjs exporter from 3dsmax)
|
@ -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",
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue