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
This commit is contained in:
Janne Nylander
2025-08-31 18:05:52 +02:00
committed by casey-bianco-davis
parent abfb359b6a
commit 63c869b8b7

View File

@@ -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<int> material_indexes =
attributes.lookup_or_add_for_write_span<int>(
"material_index",