Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-03-06 13:32:38 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-03-06 13:36:59 +0300
commitd8491cb7c6745f7c8335843470c7c0a9e2708a87 (patch)
treea2e0f6fd602eac36dd8dbb6bd9983eec6835df56 /source/blender/editors/animation/keyingsets.c
parent17e1fef85aa45f95d2e7c872901ca1c6140fad73 (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/keyingsets.c')
-rw-r--r--source/blender/editors/animation/keyingsets.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index d2e542772c2..721953f41c8 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -1030,7 +1030,7 @@ static eInsertKeyFlags keyingset_apply_keying_flags(const eInsertKeyFlags base_f
* This takes into account many of the different combinations of using KeyingSets.
*
* \returns the number of channels that key-frames were added or
- * #eModifyKey_Returns (a negative number).
+ * an #eModifyKey_Returns value (always a negative number).
*/
int ANIM_apply_keyingset(
bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
@@ -1043,7 +1043,7 @@ int ANIM_apply_keyingset(
const eInsertKeyFlags base_kflags = ANIM_get_keyframing_flags(scene, true);
const char *groupname = NULL;
eInsertKeyFlags kflag = 0;
- int success = 0;
+ int num_channels = 0;
char keytype = scene->toolsettings->keyframe_type;
/* sanity checks */
@@ -1131,20 +1131,20 @@ int ANIM_apply_keyingset(
for (; i < arraylen; i++) {
/* action to take depends on mode */
if (mode == MODIFYKEY_MODE_INSERT) {
- success += insert_keyframe(bmain,
- reports,
- ksp->id,
- act,
- groupname,
- ksp->rna_path,
- i,
- cfra,
- keytype,
- &nla_cache,
- kflag2);
+ num_channels += insert_keyframe(bmain,
+ reports,
+ ksp->id,
+ act,
+ groupname,
+ ksp->rna_path,
+ i,
+ cfra,
+ keytype,
+ &nla_cache,
+ kflag2);
}
else if (mode == MODIFYKEY_MODE_DELETE) {
- success += delete_keyframe(bmain, reports, ksp->id, act, ksp->rna_path, i, cfra);
+ num_channels += delete_keyframe(bmain, reports, ksp->id, act, ksp->rna_path, i, cfra);
}
}
@@ -1170,7 +1170,8 @@ int ANIM_apply_keyingset(
BKE_animsys_free_nla_keyframing_context_cache(&nla_cache);
/* return the number of channels successfully affected */
- return success;
+ BLI_assert(num_channels >= 0);
+ return num_channels;
}
/* ************************************************** */