Skip to content

Commit

Permalink
Merge pull request #94102 from Calinou/obj-import-fix-no-surfaces-error
Browse files Browse the repository at this point in the history
Fix error message being printed when importing an OBJ with no surfaces
  • Loading branch information
akien-mga committed Jul 8, 2024
2 parents c10fde6 + bbf6830 commit 6d2fe76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions editor/import/3d/resource_importer_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 6d2fe76

Please sign in to comment.