Fix: Grease Pencil: Crash running operators that require a 3D viewport

Correct the poll functions for reproject & texture gradient.

Pull Request: https://projects.blender.org/blender/blender/pulls/135618
This commit is contained in:
Campbell Barton
2025-03-07 18:13:20 +01:00
committed by Falk David
parent a568890515
commit 967fb3ae4c
3 changed files with 8 additions and 2 deletions
@@ -3416,7 +3416,7 @@ static void GREASE_PENCIL_OT_reproject(wmOperatorType *ot)
/* callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = grease_pencil_reproject_exec;
ot->poll = editable_grease_pencil_poll;
ot->poll = editable_grease_pencil_with_region_view3d_poll;
ot->ui = grease_pencil_reproject_ui;
/* flags */
@@ -3880,7 +3880,7 @@ static void GREASE_PENCIL_OT_texture_gradient(wmOperatorType *ot)
ot->invoke = grease_pencil_texture_gradient_invoke;
ot->modal = grease_pencil_texture_gradient_modal;
ot->exec = grease_pencil_texture_gradient_exec;
ot->poll = editable_grease_pencil_poll;
ot->poll = editable_grease_pencil_with_region_view3d_poll;
ot->cancel = WM_gesture_straightline_cancel;
/* Flags. */
@@ -64,6 +64,11 @@ bool editable_grease_pencil_poll(bContext *C)
return true;
}
bool editable_grease_pencil_with_region_view3d_poll(bContext *C)
{
return ED_operator_region_view3d_active(C) && editable_grease_pencil_poll(C);
}
bool active_grease_pencil_layer_poll(bContext *C)
{
const GreasePencil *grease_pencil = blender::ed::greasepencil::from_context(*C);
@@ -317,6 +317,7 @@ bool grease_pencil_context_poll(bContext *C);
bool active_grease_pencil_poll(bContext *C);
bool active_grease_pencil_material_poll(bContext *C);
bool editable_grease_pencil_poll(bContext *C);
bool editable_grease_pencil_with_region_view3d_poll(bContext *C);
bool active_grease_pencil_layer_poll(bContext *C);
bool editable_grease_pencil_point_selection_poll(bContext *C);
bool grease_pencil_selection_poll(bContext *C);