[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24873] trunk/blender/source/blender: Fix for [#20008] In the Graph Editor, clicking on the eye doesn' t update the GUI

Matt Ebb matt at mke3.net
Wed Nov 25 09:28:58 CET 2009


Revision: 24873
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24873
Author:   broken
Date:     2009-11-25 09:28:57 +0100 (Wed, 25 Nov 2009)

Log Message:
-----------
Fix for [#20008] In the Graph Editor, clicking on the eye doesn't update the GUI

As part of this, fixed a typo in rna flags which was causing some strange behaviour with icons earlier. Reverted the workaround for this, too.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/fmodifier_ui.c
    trunk/blender/source/blender/editors/interface/interface.c
    trunk/blender/source/blender/editors/interface/interface_utils.c
    trunk/blender/source/blender/makesrna/RNA_types.h
    trunk/blender/source/blender/makesrna/intern/rna_fcurve.c

Modified: trunk/blender/source/blender/editors/animation/fmodifier_ui.c
===================================================================
--- trunk/blender/source/blender/editors/animation/fmodifier_ui.c	2009-11-24 23:24:56 UTC (rev 24872)
+++ trunk/blender/source/blender/editors/animation/fmodifier_ui.c	2009-11-25 08:28:57 UTC (rev 24873)
@@ -111,16 +111,6 @@
 		fmi->verify_data(fcm);
 }
 
-/* callback to set the active modifier */
-static void activate_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
-{
-	ListBase *modifiers = (ListBase *)fmods_v;
-	FModifier *fcm= (FModifier *)fcm_v;
-	
-	/* call API function to set the active modifier for active modifier-stack */
-	set_active_fmodifier(modifiers, fcm);
-}
-
 /* callback to remove the given modifier  */
 static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v)
 {
@@ -636,7 +626,11 @@
 	uiBlock *block;
 	uiBut *but;
 	short width= 314;
+	PointerRNA ptr;
 	
+	/* init the RNA-pointer */
+	RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+	
 	/* draw header */
 	{
 		/* get layout-row + UI-block for this */
@@ -645,32 +639,34 @@
 		row= uiLayoutRow(box, 0);
 		block= uiLayoutGetBlock(row); // err...
 		
-		uiBlockSetEmboss(block, UI_EMBOSSN);
-		
 		/* left-align -------------------------------------------- */
 		subrow= uiLayoutRow(row, 0);
 		uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
 		
+		uiBlockSetEmboss(block, UI_EMBOSSN);
+		
 		/* expand */
-		uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_EXPANDED, B_REDR, ICON_TRIA_RIGHT,	0, -1, UI_UNIT_X, UI_UNIT_Y, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is expanded.");
+		uiItemR(subrow, "", 0, &ptr, "expanded", UI_ITEM_R_ICON_ONLY);
 		
 		/* checkbox for 'active' status (for now) */
-		but= uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_ACTIVE, B_REDR, ICON_RADIOBUT_OFF,	0, -1, UI_UNIT_X, UI_UNIT_Y, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is active one.");
-		uiButSetFunc(but, activate_fmodifier_cb, modifiers, fcm);
+		uiItemR(subrow, "", 0, &ptr, "active", UI_ITEM_R_ICON_ONLY);
 		
 		/* name */
 		if (fmi)
-			uiDefBut(block, LABEL, 1, fmi->name,	0, 0, 150, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
+			uiItemL(subrow, fmi->name, 0);
 		else
-			uiDefBut(block, LABEL, 1, "<Unknown Modifier>",	0, 0, 150, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "F-Curve Modifier Type. Click to make modifier active one.");
+			uiItemL(subrow, "<Unknown Modifier>", 0);
 		
 		/* right-align ------------------------------------------- */
 		subrow= uiLayoutRow(row, 0);
 		uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
 		
+		
 		/* 'mute' button */
-		uiDefIconButBitS(block, ICONTOG, FMODIFIER_FLAG_MUTED, B_REDR, ICON_MUTE_IPO_OFF,	0, 0, UI_UNIT_X, UI_UNIT_Y, &fcm->flag, 0.0, 0.0, 0, 0, "Modifier is temporarily muted (not evaluated).");
+		uiItemR(subrow, "", 0, &ptr, "muted", UI_ITEM_R_ICON_ONLY);
 		
+		uiBlockSetEmboss(block, UI_EMBOSSN);
+		
 		/* delete button */
 		but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete F-Curve Modifier.");
 		uiButSetFunc(but, delete_fmodifier_cb, modifiers, fcm);

Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c	2009-11-24 23:24:56 UTC (rev 24872)
+++ trunk/blender/source/blender/editors/interface/interface.c	2009-11-25 08:28:57 UTC (rev 24873)
@@ -2235,6 +2235,7 @@
 	but->bit= type & BIT;
 	but->bitnr= type & 31;
 	but->icon = 0;
+	but->iconadd=0;
 
 	but->retval= retval;
 	if( strlen(str)>=UI_MAX_NAME_STR-1 ) {

Modified: trunk/blender/source/blender/editors/interface/interface_utils.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_utils.c	2009-11-24 23:24:56 UTC (rev 24872)
+++ trunk/blender/source/blender/editors/interface/interface_utils.c	2009-11-25 08:28:57 UTC (rev 24873)
@@ -69,11 +69,10 @@
 			else
 				value= RNA_property_boolean_get(ptr, prop);
 			
-			// XXX: when to do TOG, and when to do ICONTOG? for now, let's just do TOG, since ICONTOG causes too much trouble everywhere else
 			if(icon && name && strcmp(name, "") == 0)
-				but= uiDefIconButR(block, TOG, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+				but= uiDefIconButR(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
 			else if(icon)
-				but= uiDefIconTextButR(block, TOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
+				but= uiDefIconTextButR(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
 			else
 				but= uiDefButR(block, OPTION, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
 			break;

Modified: trunk/blender/source/blender/makesrna/RNA_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_types.h	2009-11-24 23:24:56 UTC (rev 24872)
+++ trunk/blender/source/blender/makesrna/RNA_types.h	2009-11-25 08:28:57 UTC (rev 24873)
@@ -140,7 +140,7 @@
 	PROP_ANIMATEABLE = 1<<1,
 
 	/* icon */
-	PROP_ICONS_CONSECUTIVE = 1<12,
+	PROP_ICONS_CONSECUTIVE = 1<<12,
 
 	/* hidden in  the user interface */
 	PROP_HIDDEN = 1<<19,

Modified: trunk/blender/source/blender/makesrna/intern/rna_fcurve.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2009-11-24 23:24:56 UTC (rev 24872)
+++ trunk/blender/source/blender/makesrna/intern/rna_fcurve.c	2009-11-25 08:28:57 UTC (rev 24873)
@@ -252,6 +252,30 @@
 	return remove_fmodifier_index(&fcu->modifiers, index);
 }
 
+static void rna_Fmodifier_active_set(PointerRNA *ptr, int value)
+{
+	FModifier *fm= (FModifier*)ptr->data;
+
+	/* don't toggle, always switch on */
+	fm->flag |= FMODIFIER_FLAG_ACTIVE;
+}
+
+static void rna_Fmodifier_active_update(bContext *C, PointerRNA *ptr)
+{
+	FModifier *fm, *fmo= (FModifier*)ptr->data;
+
+	/* clear active state of other FModifiers in this list */
+	for (fm=fmo->prev; fm; fm=fm->prev)
+	{
+		fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
+	}
+	for (fm=fmo->next; fm; fm=fm->next)
+	{
+		fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
+	}
+	
+}
+
 #else
 
 static void rna_def_fmodifier_generator(BlenderRNA *brna)
@@ -629,12 +653,13 @@
 	prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_EXPANDED);
 	RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI.");
+	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 	
 	prop= RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
 	RNA_def_property_ui_text(prop, "Muted", "F-Curve Modifier will not be evaluated.");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
+	RNA_def_property_ui_icon(prop, ICON_MUTE_IPO_OFF, 1);
 	
 		// XXX this is really an internal flag, but it may be useful for some tools to be able to access this...
 	prop= RNA_def_property(srna, "disabled", PROP_BOOLEAN, PROP_NONE);
@@ -647,7 +672,9 @@
 	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_ACTIVE);
 	RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited ");
-	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
+	RNA_def_property_boolean_funcs(prop, NULL, "rna_Fmodifier_active_set");
+	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, "rna_Fmodifier_active_update");
+	RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1);
 }	
 
 /* *********************** */
@@ -809,7 +836,6 @@
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active fcurve modifier", "Active fcurve modifier.");
 
-
 	/* Constraint collection */
 	func= RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);





More information about the Bf-blender-cvs mailing list