From f6c09eadf06161d185835757afbf40c6512cc7cc Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 21 Sep 2016 20:05:49 +0200 Subject: UI: Make button driver and keying set shortcuts configurable --- source/blender/editors/animation/keyingsets.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index b907ad150aa..4408ec26b3f 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -296,6 +296,12 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) int index = 0, pflag = 0; const bool all = RNA_boolean_get(op->ptr, "all"); + /* try to add to keyingset using property retrieved from UI */ + if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } + /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) * - add a new one if it doesn't exist @@ -326,9 +332,6 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1); } - /* try to add to keyingset using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); - /* check if property is able to be added */ if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { path = RNA_path_from_ID_to_property(&ptr, prop); @@ -396,6 +399,12 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) short success = 0; int index = 0; + /* try to add to keyingset using property retrieved from UI */ + if (UI_context_active_but_prop_get(C, &ptr, &prop, &index)) { + /* pass event on if no active button found */ + return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); + } + /* verify the Keying Set to use: * - use the active one for now (more control over this can be added later) * - return error if it doesn't exist @@ -412,9 +421,6 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op) ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1); } - /* try to add to keyingset using property retrieved from UI */ - UI_context_active_but_prop_get(C, &ptr, &prop, &index); - if (ptr.id.data && ptr.data && prop) { path = RNA_path_from_ID_to_property(&ptr, prop); -- cgit v1.2.3