[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35993] trunk/blender/source/blender/ editors/gpencil/gpencil_buttons.c: fix [#26774] Grease Pencil error?

Campbell Barton ideasman42 at gmail.com
Mon Apr 4 11:22:06 CEST 2011


Revision: 35993
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35993
Author:   campbellbarton
Date:     2011-04-04 09:22:06 +0000 (Mon, 04 Apr 2011)
Log Message:
-----------
fix [#26774] Grease Pencil error?
own error with recent change to grease pencil.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c	2011-04-04 08:47:31 UTC (rev 35992)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c	2011-04-04 09:22:06 UTC (rev 35993)
@@ -88,6 +88,14 @@
 	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 @@
 	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);




More information about the Bf-blender-cvs mailing list