From fda119866d8055529bf22683779911242cb6b37e Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 18 Feb 2015 13:01:29 +1300 Subject: GPencil: RMB menu tools in Outliner works for GP Layers now It would be even better if these used their own dedicated menu which could include the protect values too, but this one at least works now --- .../editors/space_outliner/outliner_tools.c | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source') diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index d6c3a851801..64e00589712 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -33,6 +33,7 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" +#include "DNA_gpencil_types.h" #include "DNA_group_types.h" #include "DNA_lamp_types.h" #include "DNA_linestyle_types.h" @@ -585,6 +586,20 @@ static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem, void (void)tselem; } +static void gp_layer_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg)) +{ + bGPDlayer *gpl = (bGPDlayer *)te->directdata; + + if (event == OL_DOP_SELECT) + gpl->flag |= GP_LAYER_SELECT; + else if (event == OL_DOP_DESELECT) + gpl->flag &= ~GP_LAYER_SELECT; + else if (event == OL_DOP_HIDE) + gpl->flag |= GP_LAYER_HIDE; + else if (event == OL_DOP_UNHIDE) + gpl->flag &= ~GP_LAYER_HIDE; +} + static void data_select_linked_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *C_v) { if (event == OL_DOP_SELECT_LINKED) { @@ -1453,6 +1468,7 @@ void OUTLINER_OT_modifier_operation(wmOperatorType *ot) /* ******************** */ +// XXX: select linked is for RNA structs only static EnumPropertyItem prop_data_op_types[] = { {OL_DOP_SELECT, "SELECT", 0, "Select", ""}, {OL_DOP_DESELECT, "DESELECT", 0, "Deselect", ""}, @@ -1507,6 +1523,14 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op) } break; + case TSE_GP_LAYER: + { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, gp_layer_cb, NULL); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL); + ED_undo_push(C, "Grease Pencil Layer operation"); + } + break; + case TSE_RNA_STRUCT: if (event == OL_DOP_SELECT_LINKED) { outliner_do_data_operation(soops, datalevel, event, &soops->tree, data_select_linked_cb, C); -- cgit v1.2.3