diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-09-21 21:05:49 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-09-21 21:09:37 +0300 |
commit | f6c09eadf06161d185835757afbf40c6512cc7cc (patch) | |
tree | 234a7d522dd0a6a23cfb4f1d6b66fd5e7ff78492 /source/blender/editors/animation | |
parent | a3d258bfb49c4560bdb91fbedbfa8536641e2133 (diff) |
UI: Make button driver and keying set shortcuts configurable
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 18 |
1 files changed, 12 insertions, 6 deletions
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); |