diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-06-25 17:58:15 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-06-26 15:08:58 +0300 |
commit | 5e564f9304a03380fc97bfad24121289fceb65dc (patch) | |
tree | b83388fbf67ec0ad3fdfcf44400c6391ebd3fe8e | |
parent | af03b63e256a3f656537e56b876cd6ade9b3ff16 (diff) |
Fix T78083: FBX import: handle missing LayerElementNormal data more
gracefully
If the 'Include Custom Normals' import option is used, and the FBX looks
like it has LayerElementNormal (but lacks the actual data), dont throw
an error, just print a warning and continue.
(this has a downside, since such stuff can easily go unnoticed then, but
this seems to be done elsewhere as well...)
Maniphest Tasks: T78083
Differential Revision: https://developer.blender.org/D8122
-rw-r--r-- | io_scene_fbx/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_fbx/import_fbx.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index b412d35f..e5fa3284 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, 21, 2), + "version": (4, 21, 3), "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 6664be4e..3e0b2bfd 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -1203,6 +1203,10 @@ def blen_read_geom_layer_normal(fbx_obj, mesh, xform=None): fbx_layer_data = elem_prop_first(elem_find_first(fbx_layer, layer_id)) fbx_layer_index = elem_prop_first(elem_find_first(fbx_layer, b'NormalsIndex')) + if fbx_layer_data is None: + print("warning %r %r missing data" % (layer_id, fbx_layer_name)) + return False + # try loops, then vertices. tries = ((mesh.loops, "Loops", False, blen_read_geom_array_mapped_polyloop), (mesh.polygons, "Polygons", True, blen_read_geom_array_mapped_polygon), |