diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-07-08 23:14:52 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2024-07-08 23:14:52 +0200 |
commit | bbf68306c50fe0f0e6e69be9aff48f3f7853ac4e (patch) | |
tree | 4c28688e8b86f676ba8f28814fee8194f0663695 /editor | |
parent | ec02d406ca0b9c822addff49cf58e9a72cf74eb0 (diff) | |
download | redot-engine-bbf68306c50fe0f0e6e69be9aff48f3f7853ac4e.tar.gz |
Fix error message being printed when importing an OBJ with no surfaces
An OBJ with no surfaces is valid, and typically happens when
you import an OBJ mesh with no associated MTL file.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/3d/resource_importer_obj.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/import/3d/resource_importer_obj.cpp b/editor/import/3d/resource_importer_obj.cpp index 6d68e93c75..a0c05598a2 100644 --- a/editor/import/3d/resource_importer_obj.cpp +++ b/editor/import/3d/resource_importer_obj.cpp @@ -425,9 +425,13 @@ static Error _parse_obj(const String &p_path, List<Ref<ImporterMesh>> &r_meshes, } if (!current_material.is_empty()) { - mesh->set_surface_name(mesh->get_surface_count() - 1, current_material.get_basename()); + if (mesh->get_surface_count() >= 1) { + mesh->set_surface_name(mesh->get_surface_count() - 1, current_material.get_basename()); + } } else if (!current_group.is_empty()) { - mesh->set_surface_name(mesh->get_surface_count() - 1, current_group); + if (mesh->get_surface_count() >= 1) { + mesh->set_surface_name(mesh->get_surface_count() - 1, current_group); + } } Array array = surf_tool->commit_to_arrays(); |