From b4f31129b8b9a99075ea69bac2bd32b3c530fb38 Mon Sep 17 00:00:00 2001 From: Baptiste Nicolet Date: Fri, 15 Mar 2024 10:44:44 +0100 Subject: [PATCH] Geometry: Check that mesh is not empty or null before trying to write it, when it doesn't have any assigned material --- mitsuba-blender/io/exporter/geometry.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mitsuba-blender/io/exporter/geometry.py b/mitsuba-blender/io/exporter/geometry.py index 27daef0..b022b75 100644 --- a/mitsuba-blender/io/exporter/geometry.py +++ b/mitsuba-blender/io/exporter/geometry.py @@ -127,11 +127,9 @@ def export_object(deg_instance, export_ctx, is_particle): if mat_count == 0: # No assigned material - converted_parts.append(( - name_clean, - -1, - convert_mesh(export_ctx, b_mesh, transform, name_clean, 0) - )) + mts_mesh = convert_mesh(export_ctx, b_mesh, transform, name_clean, 0) + if mts_mesh is not None and mts_mesh.face_count() > 0: + converted_parts.append((name_clean, -1, mts_mesh)) else: refs_per_mat = {} for mat_nr in range(mat_count):