From 67a3b8be9086a187bc008f2536f11018195b42fa Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 2 Sep 2013 23:32:21 +0000 Subject: Graph Editor: Preserve active curve when using AKEY to toggle selection status of keyframe verts Previously, every time you toggled the selection of all keyframes (using AKEY), the active curve would get deselected and deactivated. However, this was a pain when trying to tweak the shape of a particular curve, as doing this would cause that curve to either fade into the background or into the jumble of other curves. --- source/blender/editors/space_graph/graph_select.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_graph') diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index aaaafa93bb0..d87bd9a5077 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -149,17 +149,37 @@ static void deselect_graph_keys(bAnimContext *ac, short test, short sel, short d static int graphkeys_deselectall_exec(bContext *C, wmOperator *op) { bAnimContext ac; + bAnimListElem *ale_active = NULL; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - + + /* find active F-Curve, and preserve this for later + * or else it becomes annoying with the current active + * curve keeps fading out even while you're editing it + */ + ale_active = get_active_fcurve_channel(&ac); + /* 'standard' behavior - check if selected, then apply relevant selection */ if (RNA_boolean_get(op->ptr, "invert")) deselect_graph_keys(&ac, 0, SELECT_INVERT, TRUE); else deselect_graph_keys(&ac, 1, SELECT_ADD, TRUE); + /* restore active F-Curve... */ + if (ale_active) { + FCurve *fcu = (FCurve *)ale_active->data; + + /* all others should not be disabled, so we should be able to just set this directly... + * - selection needs to be set too, or else this won't work... + */ + fcu->flag |= (FCURVE_SELECTED | FCURVE_ACTIVE); + + MEM_freeN(ale_active); + ale_active = NULL; + } + /* set notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL); -- cgit v1.2.3