diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-03-06 13:32:38 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-03-06 13:36:59 +0300 |
commit | d8491cb7c6745f7c8335843470c7c0a9e2708a87 (patch) | |
tree | a2e0f6fd602eac36dd8dbb6bd9983eec6835df56 /source/blender/editors/animation/keyframing.c | |
parent | 17e1fef85aa45f95d2e7c872901ca1c6140fad73 (diff) |
Cleanup: Animation, renamed and clarified 'success' variable
The `ANIM_apply_keyingset()` returns a value that indicates the number of
changed channels (if nonnegative) or an error state (negative). In the
places where the return value was actually used, this value was stored in
a badly named variable.
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index c80cfd77cf4..1c60dcfbd52 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1814,7 +1814,7 @@ static int insert_key_exec(bContext *C, wmOperator *op) bool ob_edit_mode = false; float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap - int success; + int num_channels; KeyingSet *ks = keyingset_get_from_op_with_error(op, op->type->prop, scene); if (ks == NULL) { @@ -1830,13 +1830,13 @@ static int insert_key_exec(bContext *C, wmOperator *op) } /* try to insert keyframes for the channels specified by KeyingSet */ - success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); + num_channels = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra); if (G.debug & G_DEBUG) { BKE_reportf(op->reports, RPT_INFO, "Keying set '%s' - successfully added %d keyframes", ks->name, - success); + num_channels); } /* restore the edit mode if necessary */ @@ -1845,17 +1845,17 @@ static int insert_key_exec(bContext *C, wmOperator *op) } /* report failure or do updates? */ - if (success == MODIFYKEY_INVALID_CONTEXT) { + if (num_channels == MODIFYKEY_INVALID_CONTEXT) { BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set"); return OPERATOR_CANCELLED; } - else if (success) { + else if (num_channels) { /* if the appropriate properties have been set, make a note that we've inserted something */ if (RNA_boolean_get(op->ptr, "confirm_success")) { BKE_reportf(op->reports, RPT_INFO, "Successfully added %d keyframes for keying set '%s'", - success, + num_channels, ks->name); } @@ -2018,7 +2018,7 @@ static int delete_key_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap - int success; + int num_channels; KeyingSet *ks = keyingset_get_from_op_with_error(op, op->type->prop, scene); if (ks == NULL) { @@ -2055,23 +2055,23 @@ static int delete_key_exec(bContext *C, wmOperator *op) } /* try to delete keyframes for the channels specified by KeyingSet */ - success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra); + num_channels = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra); if (G.debug & G_DEBUG) { - printf("KeyingSet '%s' - Successfully removed %d Keyframes\n", ks->name, success); + printf("KeyingSet '%s' - Successfully removed %d Keyframes\n", ks->name, num_channels); } /* report failure or do updates? */ - if (success == MODIFYKEY_INVALID_CONTEXT) { + if (num_channels == MODIFYKEY_INVALID_CONTEXT) { BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set"); return OPERATOR_CANCELLED; } - else if (success) { + else if (num_channels) { /* if the appropriate properties have been set, make a note that we've inserted something */ if (RNA_boolean_get(op->ptr, "confirm_success")) { BKE_reportf(op->reports, RPT_INFO, "Successfully removed %d keyframes for keying set '%s'", - success, + num_channels, ks->name); } |