GPv3: Fix: Avoid the creation of new objects for empty material slots when separating by material

This PR fix the creation of new objects for empty material slots

Pull Request: https://projects.blender.org/blender/blender/pulls/119062
This commit is contained in:
Matias Mendiola
2024-03-05 12:17:03 +01:00
committed by Falk David
parent 15ccec1edb
commit d5517e8d93

View File

@@ -2035,6 +2035,10 @@ static bool grease_pencil_separate_material(bContext &C,
/* Create a new object for each material. */
for (const int mat_i : IndexRange(object_src.totcol).drop_front(1)) {
if (!BKE_object_material_slot_used(&object_src, mat_i + 1)) {
continue;
}
Object *object_dst = duplicate_grease_pencil_object(
&bmain, &scene, &view_layer, &base_prev, grease_pencil_src);