diff options
-rw-r--r-- | release/scripts/ui/space_dopesheet.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/space_graph.py | 3 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_edit.c | 68 |
4 files changed, 87 insertions, 2 deletions
diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py index b416c9ee01a..c4b64275edc 100644 --- a/release/scripts/ui/space_dopesheet.py +++ b/release/scripts/ui/space_dopesheet.py @@ -202,6 +202,10 @@ class DOPESHEET_MT_channel(bpy.types.Menu): layout.separator() layout.operator_menu_enum("anim.channels_move", "direction", text="Move...") + layout.separator() + layout.operator("anim.channels_revive_fcurves") + + class DOPESHEET_MT_key(bpy.types.Menu): bl_label = "Key" diff --git a/release/scripts/ui/space_graph.py b/release/scripts/ui/space_graph.py index f33d5866d0b..f70f4ddb1a8 100644 --- a/release/scripts/ui/space_graph.py +++ b/release/scripts/ui/space_graph.py @@ -160,6 +160,9 @@ class GRAPH_MT_channel(bpy.types.Menu): layout.separator() layout.operator_menu_enum("anim.channels_move", "direction", text="Move...") + layout.separator() + layout.operator("anim.channels_revive_fcurves") + class GRAPH_MT_key(bpy.types.Menu): bl_label = "Key" diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 73c7cfd4381..9121d8cd66c 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ - +#include <stdio.h> #include "MEM_guardedalloc.h" @@ -61,6 +61,7 @@ #include "ED_keyframing.h" #include "BIF_gl.h" +#include "BIF_glutil.h" #include "WM_api.h" #include "WM_types.h" @@ -2785,6 +2786,17 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float offset += 3; UI_DrawString(offset, ytext, name); + + /* draw red underline if channel is disabled */ + if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) + { + // FIXME: replace hardcoded color here, and check on extents! + glColor3f(1.0f, 0.0f, 0.0f); + glLineWidth(2.0); + fdrawline((float)(offset), yminc, + (float)(v2d->cur.xmax), yminc); + glLineWidth(1.0); + } } /* step 6) draw backdrops behidn mute+protection toggles + (sliders) ....................... */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 3fe867fa3af..58b1ebda55a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1596,9 +1596,73 @@ void ANIM_OT_channels_collapse (wmOperatorType *ot) ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)"); } +/* ******************* Reenable Disabled Operator ******************* */ + +static int animchannels_revive_poll (bContext *C) +{ + ScrArea *sa= CTX_wm_area(C); + + /* channels region test */ + // TODO: could enhance with actually testing if channels region? + if (ELEM(NULL, sa, CTX_wm_region(C))) + return 0; + + /* animation editor test - Action/Dopesheet/etc. and Graph only */ + if (ELEM(sa->spacetype, SPACE_ACTION, SPACE_IPO) == 0) + return 0; + + return 1; +} + +static int animchannels_revive_exec (bContext *C, wmOperator *op) +{ + bAnimContext ac; + + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + /* get editor data */ + if (ANIM_animdata_get_context(C, &ac) == 0) + return OPERATOR_CANCELLED; + + /* filter data */ + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* loop through filtered data and clean curves */ + for (ale= anim_data.first; ale; ale= ale->next) { + FCurve *fcu = (FCurve *)ale->data; + fcu->flag &= ~FCURVE_DISABLED; + } + + /* free temp data */ + BLI_freelistN(&anim_data); + + /* send notifier that things have changed */ + WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); + + return OPERATOR_FINISHED; +} + +void ANIM_OT_channels_revive_fcurves (wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Revive Disabled F-Curves"; + ot->idname= "ANIM_OT_channels_revive_fcurves"; + ot->description= "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again"; + + /* api callbacks */ + ot->exec= animchannels_revive_exec; + ot->poll= animchannels_revive_poll; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /* ********************** Select All Operator *********************** */ -static int animchannels_deselectall_exec(bContext *C, wmOperator *op) +static int animchannels_deselectall_exec (bContext *C, wmOperator *op) { bAnimContext ac; @@ -2115,6 +2179,8 @@ void ED_operatortypes_animchannels(void) WM_operatortype_append(ANIM_OT_channels_visibility_toggle); WM_operatortype_append(ANIM_OT_channels_visibility_set); + + WM_operatortype_append(ANIM_OT_channels_revive_fcurves); } // TODO: check on a poll callback for this, to get hotkeys into menus |