[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22859] branches/blender2.5/blender/source /blender/editors/gpencil/gpencil_buttons.c: Grease Pencil UI - Small fixes for the toggles ( icons working correctly now)

Joshua Leung aligorith at gmail.com
Sat Aug 29 13:48:38 CEST 2009


Revision: 22859
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22859
Author:   aligorith
Date:     2009-08-29 13:48:38 +0200 (Sat, 29 Aug 2009)

Log Message:
-----------
Grease Pencil UI - Small fixes for the toggles (icons working correctly now)

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_buttons.c

Modified: branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_buttons.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_buttons.c	2009-08-29 10:34:31 UTC (rev 22858)
+++ branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_buttons.c	2009-08-29 11:48:38 UTC (rev 22859)
@@ -76,7 +76,6 @@
 /* ------- Callbacks ----------- */
 /* These are just 'dummy wrappers' around gpencil api calls */
 
-
 /* make layer active one after being clicked on */
 void gp_ui_activelayer_cb (bContext *C, void *gpd, void *gpl)
 {
@@ -106,6 +105,7 @@
 	uiBlock *block;
 	uiBut *but;
 	PointerRNA ptr;
+	int icon;
 	
 	/* make pointer to layer data */
 	RNA_pointer_create((ID *)gpd, &RNA_GPencilLayer, gpl, &ptr);
@@ -128,10 +128,12 @@
 	uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
 	
 	/* active */
-	uiItemR(subrow, "", ICON_RADIOBUT_OFF, &ptr, "active", UI_ITEM_R_TOGGLE); // XXX we need to set it to toggle to get icon
+	icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
+	uiItemR(subrow, "", icon, &ptr, "active", 0);
 	
 	/* locked */
-	uiItemR(subrow, "", ICON_UNLOCKED, &ptr, "locked", UI_ITEM_R_TOGGLE); // XXX we need to set it to toggle to get icon
+	icon= (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED;
+	uiItemR(subrow, "", icon, &ptr, "locked", 0);
 	
 	/* when layer is locked or hidden, only draw header */
 	if (gpl->flag & (GP_LAYER_LOCKED|GP_LAYER_HIDE)) {
@@ -139,7 +141,8 @@
 		
 		/* visibility button (only if hidden but not locked!) */
 		if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED))
-			uiItemR(subrow, "", ICON_RESTRICT_VIEW_OFF, &ptr, "hide", UI_ITEM_R_TOGGLE); // XXX we need to set it to toggle to get icon
+			uiItemR(subrow, "", ICON_RESTRICT_VIEW_ON, &ptr, "hide", 0); 
+			
 		
 		/* name */
 		if (gpl->flag & GP_LAYER_HIDE)
@@ -163,7 +166,7 @@
 	else {
 		/* draw rest of header -------------------------------- */
 		/* visibility button */
-		uiItemR(subrow, "", ICON_RESTRICT_VIEW_OFF, &ptr, "hide", UI_ITEM_R_TOGGLE); // XXX we need to set it to toggle to get icon
+		uiItemR(subrow, "", ICON_RESTRICT_VIEW_OFF, &ptr, "hide", 0); 
 		
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		
@@ -227,10 +230,9 @@
 	uiLayout *col;
 	
 	/* draw gpd settings first ------------------------------------- */
-	col= uiLayoutColumn(layout, 1);
+	col= uiLayoutColumn(layout, 0);
 		/* current Grease Pencil block */
 		// TODO: show some info about who owns this?
-			// XXX: this template doesn't show up!
 		uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_new", "GPENCIL_OT_data_unlink");
 		
 		/* add new layer button */





More information about the Bf-blender-cvs mailing list