diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-02-09 02:34:17 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-02-09 02:47:59 +0300 |
commit | 7df0a19d63df41d6ec1d58126f5109478ed00b00 (patch) | |
tree | c591203cacec53839555ba2ea929ba85ddfcfeed /source/blender | |
parent | 6b107daf23c5b8b6b7b9aebfa7384e103928a8d3 (diff) |
GPencil: Viewport visbility and editability toggles for layers in Outliner
* Viewport visibility and locking are currently exposed
* Later on, visibility in renders can also be included
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/space_outliner.c | 7 |
2 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 97d6a883fa3..77e0e46f3e2 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -347,6 +347,11 @@ static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin), WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); } +static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2)) +{ + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL); +} + static int group_restrict_flag(Group *gr, int flag) { GroupObject *gob; @@ -754,6 +759,29 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar UI_block_emboss_set(block, UI_EMBOSS); } + else if (tselem->type == TSE_GP_LAYER) { + bGPDlayer *gpl = (bGPDlayer *)te->directdata; + + UI_block_emboss_set(block, UI_EMBOSS_NONE); + + bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_RESTRICT_VIEW_OFF, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, + UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0, + TIP_("Restrict/Allow visibility in the 3D View")); + UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + + bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_LOCKED, 0, ICON_UNLOCKED, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, + UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0, + TIP_("Restrict/Allow editing of strokes and keyframes in this layer")); + UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl); + UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); + + /* TODO: visibility in renders */ + + UI_block_emboss_set(block, UI_EMBOSS); + } } if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index df5a1c8d8c6..30de9c16500 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -387,6 +387,13 @@ static void outliner_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa) break; } break; + case NC_GPENCIL: + switch (wmn->data) { + case ND_DATA: + ED_region_tag_redraw(ar); + break; + } + break; } } |