diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-16 21:30:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-16 22:23:05 +0400 |
commit | 4fd66d7c0c569958e4db8486e63f5f2a5e64f2cc (patch) | |
tree | 1d186ee1046e9ef2ac27a7fe2f4d9811db719465 /source/blender/editors/armature/armature_utils.c | |
parent | e62cdbb474c4a09b55f046b199d3036534fd259c (diff) |
code cleanup: armature functions
- added BKE_pose_channel_get_mirrored (matching editmode function ED_armature_bone_get_mirrored)
- editbone_name_exists -> ED_armature_bone_find_name
Diffstat (limited to 'source/blender/editors/armature/armature_utils.c')
-rw-r--r-- | source/blender/editors/armature/armature_utils.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 7efeeebcf1d..2cbfb52db91 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -175,28 +175,35 @@ void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]) copy_v3_v3(mat[3], ebone->head); } +/** + * Return a pointer to the bone of the given name + */ +EditBone *ED_armature_bone_find_name(const ListBase *edbo, const char *name) +{ + return BLI_findstring(edbo, name, offsetof(EditBone, name)); +} + + /* *************************************************************** */ /* Mirroring */ -/* context: editmode armature */ -EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo) +/** + * \see #BKE_pose_channel_get_mirrored (pose-mode, matching function) + */ +EditBone *ED_armature_bone_get_mirrored(const ListBase *edbo, EditBone *ebo) { - EditBone *eboflip = NULL; char name_flip[MAXBONENAME]; - + if (ebo == NULL) return NULL; BKE_deform_flip_side_name(name_flip, ebo->name, false); - for (eboflip = edbo->first; eboflip; eboflip = eboflip->next) { - if (ebo != eboflip) { - if (!strcmp(name_flip, eboflip->name)) - break; - } + if (!STREQ(name_flip, ebo->name)) { + return ED_armature_bone_find_name(edbo, name_flip); } - return eboflip; + return NULL; } /* ------------------------------------- */ |