Commit: 7df0a19d63df41d6ec1d58126f5109478ed00b00
Author: Joshua Leung
Date:   Mon Feb 9 12:34:17 2015 +1300
Branches: master
https://developer.blender.org/rB7df0a19d63df41d6ec1d58126f5109478ed00b00

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

===================================================================

M       source/blender/editors/space_outliner/outliner_draw.c
M       source/blender/editors/space_outliner/space_outliner.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_draw.c 
b/source/blender/editors/space_outliner/outliner_draw.c
index 97d6a88..77e0e46 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 df5a1c8..30de9c1 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;
        }
        
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to