Fix T102836: FBX export including tangents of empty meshes fails.
Not ideal that tangent space calc errors on empty mesh when other similar processes (like lnors computation) perform as usual... But for now just fix FBX code for this specific behavior.
This commit is contained in:
parent
b1543b9a6b
commit
0b0052bd53
Notes:
blender-bot
2023-02-14 18:11:42 +01:00
Referenced by issue #102836, FBX export including tangents of empty meshes fails with python traceback
|
@ -3,7 +3,7 @@
|
|||
bl_info = {
|
||||
"name": "FBX format",
|
||||
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
|
||||
"version": (4, 37, 1),
|
||||
"version": (4, 37, 2),
|
||||
"blender": (3, 4, 0),
|
||||
"location": "File > Import-Export",
|
||||
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
|
||||
|
|
|
@ -1072,11 +1072,14 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
|
|||
"cannot compute/export tangent space for it") % me.name)
|
||||
else:
|
||||
del t_lt
|
||||
t_ln = array.array(data_types.ARRAY_FLOAT64, (0.0,)) * len(me.loops) * 3
|
||||
num_loops = len(me.loops)
|
||||
t_ln = array.array(data_types.ARRAY_FLOAT64, (0.0,)) * num_loops * 3
|
||||
# t_lnw = array.array(data_types.ARRAY_FLOAT64, (0.0,)) * len(me.loops)
|
||||
uv_names = [uvlayer.name for uvlayer in me.uv_layers]
|
||||
for name in uv_names:
|
||||
me.calc_tangents(uvmap=name)
|
||||
# Annoying, `me.calc_tangent` errors in case there is no geometry...
|
||||
if num_loops > 0:
|
||||
for name in uv_names:
|
||||
me.calc_tangents(uvmap=name)
|
||||
for idx, uvlayer in enumerate(me.uv_layers):
|
||||
name = uvlayer.name
|
||||
# Loop bitangents (aka binormals).
|
||||
|
|
Loading…
Reference in New Issue