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
This commit is contained in:
Philipp Oeser 2020-06-25 16:58:15 +02:00
parent af03b63e25
commit 5e564f9304
Notes: blender-bot 2023-02-14 18:56:42 +01:00
Referenced by issue #78083, FBX TypeError: object of type `NoneType` has no len ()"
Referenced by issue #76160, FBX import error
2 changed files with 5 additions and 1 deletions

View File

@ -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",

View File

@ -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),