Fix #135611: Grease Pencil: Correct poll function for layer_group_color_tag

Operator `GREASE_PENCIL_OT_layer_group_color_tag` did not check the
existence of active layer group before executing. Now corrected with a
`poll()` callback.

Pull Request: https://projects.blender.org/blender/blender/pulls/135612
This commit is contained in:
YimingWu
2025-03-07 11:21:01 +01:00
committed by Falk David
parent 4179960ede
commit ec33541b99
3 changed files with 8 additions and 1 deletions

View File

@@ -1059,7 +1059,7 @@ static void GREASE_PENCIL_OT_layer_group_color_tag(wmOperatorType *ot)
ot->description = "Change layer group icon";
ot->exec = grease_pencil_layer_group_color_tag_exec;
ot->poll = grease_pencil_context_poll;
ot->poll = active_grease_pencil_layer_group_poll;
ot->flag = OPTYPE_UNDO;

View File

@@ -70,6 +70,12 @@ bool active_grease_pencil_layer_poll(bContext *C)
return grease_pencil && grease_pencil->has_active_layer();
}
bool active_grease_pencil_layer_group_poll(bContext *C)
{
const GreasePencil *grease_pencil = blender::ed::greasepencil::from_context(*C);
return grease_pencil && grease_pencil->has_active_group();
}
bool editable_grease_pencil_point_selection_poll(bContext *C)
{
if (!editable_grease_pencil_poll(C)) {

View File

@@ -318,6 +318,7 @@ bool active_grease_pencil_poll(bContext *C);
bool active_grease_pencil_material_poll(bContext *C);
bool editable_grease_pencil_poll(bContext *C);
bool active_grease_pencil_layer_poll(bContext *C);
bool active_grease_pencil_layer_group_poll(bContext *C);
bool editable_grease_pencil_point_selection_poll(bContext *C);
bool grease_pencil_selection_poll(bContext *C);
bool grease_pencil_painting_poll(bContext *C);