diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-12-12 13:02:03 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-12-12 13:02:03 +0300 |
commit | 6454d95e19d4d99c680448f3bf124a8f7fb0842e (patch) | |
tree | f41984d4d91322019fc2a4b361a5291f0b511a0e /io_scene_fbx/import_fbx.py | |
parent | 1164b7f9570d17d5b91d486e0e6451f46a721daf (diff) |
Fix T42683: do not crash on importing trashy FBX files.
Looks like FBX allows corruption in its 'database', like UIDs
only existing in Connection table, and just ignores it. When in Rome...
Diffstat (limited to 'io_scene_fbx/import_fbx.py')
-rw-r--r-- | io_scene_fbx/import_fbx.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index d821672d..d25684c9 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -2134,8 +2134,8 @@ def load(operator, context, filepath="", return [(c_found[0], c_found[1], c_type) for (c_uuid, c_type) in dct.get(fbx_uuid, ()) # 0 is used for the root node, which isnt in fbx_table_nodes - for c_found in (() if c_uuid is 0 else (fbx_table_nodes[c_uuid],)) - if (fbx_id is None) or (c_found[0].id == fbx_id)] + for c_found in (() if c_uuid is 0 else (fbx_table_nodes.get(c_uuid, (None, None)),)) + if (fbx_id is None) or (c_found[0] and c_found[0].id == fbx_id)] def connection_filter_forward(fbx_uuid, fbx_id): return connection_filter_ex(fbx_uuid, fbx_id, fbx_connection_map) @@ -2454,7 +2454,7 @@ def load(operator, context, filepath="", if fbx_obj.id != b'Geometry': continue - mesh = fbx_table_nodes[fbx_uuid][1] + mesh = fbx_table_nodes.get(fbx_uuid, (None, None))[1] # can happen in rare cases if mesh is None: @@ -2537,7 +2537,7 @@ def load(operator, context, filepath="", if fbx_obj.id != b'Material': continue - material = fbx_table_nodes[fbx_uuid][1] + material = fbx_table_nodes.get(fbx_uuid, (None, None))[1] for (fbx_lnk, image, fbx_lnk_type) in connection_filter_reverse(fbx_uuid, b'Texture'): @@ -2655,7 +2655,7 @@ def load(operator, context, filepath="", fbx_obj, blen_data = fbx_item if fbx_obj.id != b'Material': continue - material = fbx_table_nodes[fbx_uuid][1] + material = fbx_table_nodes.get(fbx_uuid, (None, None))[1] image, tex_map = material_images.get(material, {}).get(b'DiffuseColor', (None, None)) # do we have alpha? if image and image.depth == 32: |