From dfa3a6fc84dc6a4ffc1040f24e85a93e5058dde5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Apr 2011 09:22:06 +0000 Subject: [PATCH] fix [#26774] Grease Pencil error? own error with recent change to grease pencil. --- source/blender/editors/gpencil/gpencil_buttons.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 8df89a29f28..67b732ffa5e 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -88,6 +88,14 @@ static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl) WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work! } +static void gp_ui_actlayer_cb (bContext *C, void *gpd, void *gpl) +{ + /* make sure the layer we want to remove is the active one */ + gpencil_layer_setactive(gpd, gpl); + + WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work! +} + /* ------- Drawing Code ------- */ /* draw the controls for a given layer */ @@ -122,9 +130,11 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con subrow= uiLayoutRow(row, 0); /* active */ + block= uiLayoutGetBlock(subrow); icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; - uiItemR(subrow, &ptr, "active", 0, "", icon); - + but= uiDefIconBut(block, BUT, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Set active layer"); + uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl); + /* locked */ icon= (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED; uiItemR(subrow, &ptr, "lock", 0, "", icon);