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:
authorCampbell Barton <ideasman42@gmail.com>2021-09-01 08:23:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-01 08:23:56 +0300
commit90dac47717b12f33d5dd738da12a337cfe4f2f14 (patch)
tree9f4fff2c54dd7586c7929eedd95608dbca99ba99 /source/blender/editors/animation/keyframing.c
parent838b6ec48af6fb767089784193d8525c5f5faf13 (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/animation/keyframing.c')
-rw-r--r--source/blender/editors/animation/keyframing.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0a499232ba9..292d665caca 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -2216,9 +2216,8 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
/* in pose mode, only delete the F-Curve if it belongs to a selected bone */
if (ob->mode & OB_MODE_POSE) {
- if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones[")) {
-
- /* get bone-name, and check if this bone is selected */
+ if (fcu->rna_path) {
+ /* Get bone-name, and check if this bone is selected. */
char *bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
if (bone_name) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
@@ -2320,16 +2319,18 @@ static int delete_key_v3d_without_keying_set(bContext *C, wmOperator *op)
* NOTE: This is only done in pose mode.
* In object mode, we're dealing with the entire object.
*/
- if ((ob->mode & OB_MODE_POSE) && strstr(fcu->rna_path, "pose.bones[\"")) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan = NULL;
- /* get bone-name, and check if this bone is selected */
+ /* Get bone-name, and check if this bone is selected. */
char *bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
- if (bone_name) {
- pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
- MEM_freeN(bone_name);
+ if (bone_name == NULL) {
+ continue;
}
+ pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
+ MEM_freeN(bone_name);
+
/* skip if bone is not selected */
if ((pchan) && (pchan->bone)) {
/* bones are only selected/editable if visible... */