diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-04-30 13:50:31 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-04-30 13:59:40 +0300 |
commit | 7369c4f4d50ee02d8ad574bbb1a3320626e1bed3 (patch) | |
tree | 2a83a23adbf66701d95970c07d4e07082342114a /source/blender/editors/animation/keyframing.c | |
parent | debcd6b2177938feef619e0b2d65e1dbf00cfef8 (diff) |
Code Cleanup: Simplify Clear Keyframes operator's code
On second thought, the previous commit was just adding additional complexity which
wasn't needed, as the operator was wasting effort by doing this looping itself.
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 08b1889aff6..4e1e9320a37 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1865,7 +1865,7 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) PropertyRNA *prop = NULL; char *path; short success = 0; - int a, index, length; + int index; const bool all = RNA_boolean_get(op->ptr, "all"); /* try to insert keyframe using property retrieved from UI */ @@ -1876,28 +1876,11 @@ static int clear_key_button_exec(bContext *C, wmOperator *op) if (path) { if (all) { - length = RNA_property_array_length(&ptr, prop); - - if (length) index = 0; - else length = 1; - } - else - length = 1; - - for (a = 0; a < length; a++) { - AnimData *adt = BKE_animdata_from_id(ptr.id.data); - - success += clear_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, 0); - - /* T44558 - Stop if there's no animdata anymore - * This is needed if only the first item in an array is keyed, - * and we're clearing for the whole array - */ - if (ELEM(NULL, adt, adt->action)) { - break; - } + /* -1 indicates operating on the entire array (or the property itself otherwise) */ + index = -1; } + success += clear_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index, 0); MEM_freeN(path); } else if (G.debug & G_DEBUG) |