Commit: 62eec5ab8e92e462336272d7f451e263481193f3
Author: Antony Riakiotakis
Date:   Wed Apr 15 15:58:25 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB62eec5ab8e92e462336272d7f451e263481193f3

Add toggle that disables modifiers on fcurves. Gooseberry request, not
sure how useful it would be on master + it misses an icon, so commiting
here first.

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

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/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 ebd05d8..f27430c 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -865,7 +865,10 @@ 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 */
+                       return AGRP_MODIFIERS_OFF;
+
                case ACHANNEL_SETTING_PROTECT: /* protected */
                        return AGRP_PROTECTED;
                        
@@ -983,6 +986,9 @@ 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:
+                       return FCURVE_MOD_OFF;
+
                default: /* unsupported */
                        return 0;
        }
@@ -3998,7 +4004,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;
+
+                       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;
@@ -4091,6 +4103,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;
                                        
@@ -4258,7 +4271,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 73f2898..3f85511 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/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) */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to