Fix #145228: Wrong material when copying grease pencil strokes

When copying grease pencil strokes, `BKE_object_material_get()` was used
to retrieve the material ID, but the index starts at 1 instead of 0,
this caused the pasted material to be wrong. Now the index is properly
incremented to 1 when copying.

Pull Request: https://projects.blender.org/blender/blender/pulls/145398
This commit is contained in:
YimingWu
2025-08-29 16:39:05 +02:00
committed by YimingWu
parent a82d09bee4
commit 2529b79486

View File

@@ -2587,7 +2587,7 @@ static wmOperatorStatus grease_pencil_copy_strokes_exec(bContext *C, wmOperator
if (!is_material_index_used(material_index)) {
continue;
}
const Material *material = BKE_object_material_get(object, material_index);
const Material *material = BKE_object_material_get(object, material_index + 1);
clipboard.materials.append({material ? material->id.session_uid : 0, material_index});
}