GPv3: Crash when drawing in locked or hidden layer #116779

Merged
Falk David merged 1 commits from PratikPB2123/blender:gpv3-editable-layer into main 2024-01-08 11:19:04 +01:00
1 changed files with 6 additions and 0 deletions

View File

@ -142,6 +142,12 @@ static int grease_pencil_stroke_invoke(bContext *C, wmOperator *op, const wmEven
const int current_frame = scene->r.cfra;
bke::greasepencil::Layer &active_layer = *grease_pencil.get_active_layer();
if (!active_layer.is_editable()) {
BKE_report(op->reports, RPT_ERROR, "Active layer is locked or hidden");
return OPERATOR_CANCELLED;
}
/* If there is no drawing at the current frame and auto-key is off, then */
if (!active_layer.has_drawing_at(current_frame) && !blender::animrig::is_autokey_on(scene)) {
BKE_report(op->reports, RPT_ERROR, "No Grease Pencil frame to draw on");