[Bf-blender-cvs] [cbf936a] master: Gooseberry animation feature: Add toggle that disables modifiers on fcurves.

Antony Riakiotakis noreply at git.blender.org
Wed Jul 29 14:56:58 CEST 2015


Commit: cbf936a332728212c3805555c4761853d2d41981
Author: Antony Riakiotakis
Date:   Wed Apr 15 15:58:25 2015 +0200
Branches: master
https://developer.blender.org/rBcbf936a332728212c3805555c4761853d2d41981

Gooseberry animation feature: Add toggle that disables modifiers on fcurves.

Feature is found as per channel option in graph editor.

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

M	source/blender/blenkernel/intern/fmodifier.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/include/ED_anim_api.h
M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesdna/DNA_anim_types.h

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

diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 396a260..6e78d08 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1398,7 +1398,10 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
 	/* sanity checks */
 	if (ELEM(NULL, modifiers, modifiers->last))
 		return evaltime;
-		
+
+	if (fcu->flag & FCURVE_MOD_OFF)
+		return evaltime;
+
 	/* Starting from the end of the stack, calculate the time effects of various stacked modifiers 
 	 * on the time the F-Curve should be evaluated at. 
 	 *
@@ -1455,6 +1458,9 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie
 	/* sanity checks */
 	if (ELEM(NULL, modifiers, modifiers->first))
 		return;
+
+	if (fcu->flag & FCURVE_MOD_OFF)
+		return;
 	
 	/* evaluate modifiers */
 	for (fcm = modifiers->first; fcm; fcm = fcm->next) {
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 61dc638..db222f9 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -867,7 +867,11 @@ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings settin
 			
 		case ACHANNEL_SETTING_MUTE: /* muted */
 			return AGRP_MUTED;
-			
+
+		case ACHANNEL_SETTING_MOD_OFF: /* muted */
+			*neg = 1;
+			return AGRP_MODIFIERS_OFF;
+
 		case ACHANNEL_SETTING_PROTECT: /* protected */
 			return AGRP_PROTECTED;
 			
@@ -985,6 +989,10 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settin
 		case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
 			return FCURVE_VISIBLE;
 			
+		case ACHANNEL_SETTING_MOD_OFF:
+			*neg = 1;
+			return FCURVE_MOD_OFF;
+
 		default: /* unsupported */
 			return 0;
 	}
@@ -3979,6 +3987,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
 {
 	short ptrsize, butType;
 	bool negflag;
+	bool usetoggle = true;
 	int flag, icon;
 	void *ptr;
 	const char *tooltip;
@@ -4000,7 +4009,13 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
 			else
 				tooltip = TIP_("Channels are visible in Graph Editor for editing");
 			break;
-			
+
+		case ACHANNEL_SETTING_MOD_OFF:  /* modifiers disabled */
+			icon = ICON_MODIFIER;
+			usetoggle = false;
+			tooltip = TIP_("F-Curve modifiers are disabled");
+			break;
+
 		case ACHANNEL_SETTING_EXPAND: /* expanded triangle */
 			//icon = ((enabled) ? ICON_TRIA_DOWN : ICON_TRIA_RIGHT);
 			icon = ICON_TRIA_RIGHT;
@@ -4061,11 +4076,18 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
 	}
 	
 	/* type of button */
-	if (negflag)
-		butType = UI_BTYPE_ICON_TOGGLE_N;
-	else
-		butType = UI_BTYPE_ICON_TOGGLE;
-	
+	if (usetoggle) {
+		if (negflag)
+			butType = UI_BTYPE_ICON_TOGGLE_N;
+		else
+			butType = UI_BTYPE_ICON_TOGGLE;
+	}
+	else {
+		if (negflag)
+			butType = UI_BTYPE_TOGGLE_N;
+		else
+			butType = UI_BTYPE_TOGGLE;
+	}
 	/* draw button for setting */
 	if (ptr && flag) {
 		switch (ptrsize) {
@@ -4093,6 +4115,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAni
 				case ACHANNEL_SETTING_PROTECT: /* General - protection flags */
 				case ACHANNEL_SETTING_MUTE: /* General - muting flags */
 				case ACHANNEL_SETTING_PINNED: /* NLA Actions - 'map/nomap' */
+				case ACHANNEL_SETTING_MOD_OFF:
 					UI_but_funcN_set(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting));
 					break;
 					
@@ -4264,7 +4287,13 @@ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListEle
 				offset += ICON_WIDTH;
 				draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MUTE);
 			}
-			
+
+			/* modifiers disable */
+			if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
+				offset += ICON_WIDTH;
+				draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MOD_OFF);
+			}
+
 			/* ----------- */
 			
 			/* pinned... */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 0f70bf3..dfa667d 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -412,7 +412,8 @@ typedef enum eAnimChannel_Settings {
 	ACHANNEL_SETTING_EXPAND   = 3,
 	ACHANNEL_SETTING_VISIBLE  = 4,  /* only for Graph Editor */
 	ACHANNEL_SETTING_SOLO     = 5,  /* only for NLA Tracks */
-	ACHANNEL_SETTING_PINNED   = 6   /* only for NLA Actions */
+	ACHANNEL_SETTING_PINNED   = 6,  /* only for NLA Actions */
+	ACHANNEL_SETTING_MOD_OFF  = 7
 } eAnimChannel_Settings;
 
 
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 5953291..ee49f2c 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -883,6 +883,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
 	FModifier *fcm;
 	uiLayout *col, *row;
 	uiBlock *block;
+	bool active;
 	
 	if (!graph_panel_context(C, &ale, &fcu))
 		return;
@@ -907,9 +908,11 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
 		uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste");
 	}
 	
+	active = !(fcu->flag & FCURVE_MOD_OFF);
 	/* draw each modifier */
 	for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
 		col = uiLayoutColumn(pa->layout, true);
+		uiLayoutSetActive(col, active);
 		
 		ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
 	}
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 761e76e..b8688e5 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -471,6 +471,9 @@ typedef enum eActionGroup_Flag {
 	AGRP_NOTVISIBLE = (1 << 5),
 	/* for UI (Graph Editor), sub-channels are shown */
 	AGRP_EXPANDED_G = (1 << 6),
+
+	/* sub channel modifiers off */
+	AGRP_MODIFIERS_OFF = (1 << 7),
 	
 	AGRP_TEMP       = (1 << 30),
 	AGRP_MOVED      = (1 << 31)
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 68f80cb..590179e 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -479,7 +479,7 @@ typedef enum eFCurve_Flags {
 		/* fcurve uses 'auto-handles', which stay horizontal... */
 		// DEPRECATED
 	FCURVE_AUTO_HANDLES	= (1<<5),
-	
+	FCURVE_MOD_OFF		= (1<<6),
 		/* skip evaluation, as RNA-path cannot be resolved (similar to muting, but cannot be set by user) */
 	FCURVE_DISABLED			= (1<<10),
 		/* curve can only have whole-number values (integer types) */




More information about the Bf-blender-cvs mailing list