diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-01 08:23:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-01 08:23:56 +0300 |
commit | 90dac47717b12f33d5dd738da12a337cfe4f2f14 (patch) | |
tree | 9f4fff2c54dd7586c7929eedd95608dbca99ba99 /source/blender/editors/transform | |
parent | 838b6ec48af6fb767089784193d8525c5f5faf13 (diff) |
Cleanup: remove redundant strstr calls
Rely on BLI_str_quoted_substrN to detect if the prefix exists since
this function exists early there is no need to check before calling.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_convert_armature.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index 5627a910ab4..98e00c20170 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -145,31 +145,29 @@ static void autokeyframe_pose( if (act) { for (fcu = act->curves.first; fcu; fcu = fcu->next) { /* only insert keyframes for this F-Curve if it affects the current bone */ - if (strstr(fcu->rna_path, "bones") == NULL) { + char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones["); + if (pchanName == NULL) { continue; } - char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones["); /* only if bone name matches too... * NOTE: this will do constraints too, but those are ok to do here too? */ - if (pchanName) { - if (STREQ(pchanName, pchan->name)) { - insert_keyframe(bmain, - reports, - id, - act, - ((fcu->grp) ? (fcu->grp->name) : (NULL)), - fcu->rna_path, - fcu->array_index, - &anim_eval_context, - ts->keyframe_type, - &nla_cache, - flag); - } - - MEM_freeN(pchanName); + if (STREQ(pchanName, pchan->name)) { + insert_keyframe(bmain, + reports, + id, + act, + ((fcu->grp) ? (fcu->grp->name) : (NULL)), + fcu->rna_path, + fcu->array_index, + &anim_eval_context, + ts->keyframe_type, + &nla_cache, + flag); } + + MEM_freeN(pchanName); } } } |