From 63c869b8b73c3d6199c9a90617c00a3802fd7c4e Mon Sep 17 00:00:00 2001 From: Janne Nylander Date: Sun, 31 Aug 2025 18:05:52 +0200 Subject: [PATCH] Fix #145471: Pen tool could not assign first material slot to stroke The material slot index check in `add_single_point_and_curve` in `grease_pencil_pen.cc` would check if the selected material slot index was not 0. I think the idea was to check if there isn't any active material slot selected, in which case `const int material_index = this->vc.obact->actcol - 1;` would return -1. This PR just changes the check value from 0 to -1. Pull Request: https://projects.blender.org/blender/blender/pulls/145473 --- .../blender/editors/grease_pencil/intern/grease_pencil_pen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_pen.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_pen.cc index 16efcc2f53d..41f4ab723e9 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_pen.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_pen.cc @@ -665,7 +665,7 @@ struct PenToolOperation { curves.update_curve_types(); const int material_index = this->vc.obact->actcol - 1; - if (material_index != 0) { + if (material_index != -1) { bke::SpanAttributeWriter material_indexes = attributes.lookup_or_add_for_write_span( "material_index",