GPv3: Include hide/reveal operators in layer menu

Similar to gpv2 layer panel, add these operators in gpv3 layer popup
menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/118199
This commit is contained in:
Pratik Borhade
2024-02-13 13:48:36 +01:00
committed by Falk David
parent 749768db5b
commit 2b02d6c1e2
2 changed files with 6 additions and 0 deletions

View File

@@ -51,6 +51,10 @@ class GREASE_PENCIL_MT_grease_pencil_add_layer_extra(Menu):
layout.operator("grease_pencil.layer_group_add", text="Add Group")
layout.separator()
layout.operator("grease_pencil.layer_reveal", icon='RESTRICT_VIEW_OFF', text="Show All")
layout.operator("grease_pencil.layer_hide", icon='RESTRICT_VIEW_ON', text="Hide Others").unselected = True
class DATA_PT_grease_pencil_layers(DataButtonsPanel, Panel):
bl_label = "Layers"

View File

@@ -307,6 +307,7 @@ static int grease_pencil_layer_hide_exec(bContext *C, wmOperator *op)
/* notifiers */
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, &grease_pencil);
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, nullptr);
return OPERATOR_FINISHED;
}
@@ -349,6 +350,7 @@ static int grease_pencil_layer_reveal_exec(bContext *C, wmOperator * /*op*/)
/* notifiers */
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, &grease_pencil);
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, nullptr);
return OPERATOR_FINISHED;
}