From e0303d02974c914d4633e37d789e33b21689b5eb Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 16 Jan 2017 20:34:13 +0100 Subject: Cleanup/refactor: move BKE_deform_flip_side_name & co to BLI_string_utils Functions like that do not have anything to do in BKE really, even less when actually more used for bones than vgroups! --- source/blender/blenkernel/BKE_deform.h | 8 - source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/deform.c | 184 +-------------------- source/blender/blenkernel/intern/object_deform.c | 3 +- source/blender/blenlib/BLI_string_utils.h | 5 + source/blender/blenlib/intern/string_utils.c | 178 ++++++++++++++++++++ .../blender/editors/animation/keyframes_general.c | 3 +- source/blender/editors/armature/armature_add.c | 5 +- source/blender/editors/armature/armature_naming.c | 2 +- source/blender/editors/armature/armature_select.c | 11 +- .../blender/editors/armature/armature_skinning.c | 3 +- source/blender/editors/armature/armature_utils.c | 3 +- source/blender/editors/armature/pose_transform.c | 3 +- source/blender/editors/object/object_select.c | 3 +- source/blender/editors/sculpt_paint/paint_vertex.c | 3 +- 15 files changed, 211 insertions(+), 205 deletions(-) diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index a6d1139648d..3ce08a14177 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -116,12 +116,4 @@ void BKE_defvert_extract_vgroup_to_polyweights( struct MDeformVert *dvert, const int defgroup, const int num_verts, struct MLoop *loops, const int num_loops, struct MPoly *polys, const int num_polys, float *r_weights, const bool invert_vgroup); -/* utility function, note that MAX_VGROUP_NAME chars is the maximum string length since its only - * used with defgroups currently */ - -void BKE_deform_split_suffix(const char *string, char *r_body, char *r_suf, const size_t str_len); -void BKE_deform_split_prefix(const char *string, char *r_pre, char *r_body, const size_t str_len); - -void BKE_deform_flip_side_name(char *r_name, const char *from_name, const bool strip_number, const size_t name_len); - #endif /* __BKE_DEFORM_H__ */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index d1b0306c27c..1e33fe4ab46 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -495,7 +495,7 @@ bPoseChannel *BKE_pose_channel_get_mirrored(const bPose *pose, const char *name) { char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, name, false, sizeof(name_flip)); if (!STREQ(name_flip, name)) { return BKE_pose_channel_find_name(pose, name_flip); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 783455ef6f8..13b1aab5e1c 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -509,7 +509,7 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_default) if (use_default) map[i] = i; - BKE_deform_flip_side_name(name_flip, dg->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip)); if (!STREQ(name_flip, dg->name)) { flip_num = defgroup_name_index(ob, name_flip); @@ -545,7 +545,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, const bool use_defa dg = BLI_findlink(&ob->defbase, defgroup); - BKE_deform_flip_side_name(name_flip, dg->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip)); if (!STREQ(name_flip, dg->name)) { flip_num = defgroup_name_index(ob, name_flip); @@ -566,7 +566,7 @@ int defgroup_flip_index(Object *ob, int index, const bool use_default) if (dg) { char name_flip[sizeof(dg->name)]; - BKE_deform_flip_side_name(name_flip, dg->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip)); if (!STREQ(name_flip, dg->name)) { flip_index = defgroup_name_index(ob, name_flip); @@ -606,184 +606,6 @@ void defgroup_unique_name(bDeformGroup *dg, Object *ob) BLI_uniquename_cb(defgroup_unique_check, &data, DATA_("Group"), '.', dg->name, sizeof(dg->name)); } -static bool is_char_sep(const char c) -{ - return ELEM(c, '.', ' ', '-', '_'); -} - -/** - * based on `BLI_split_dirfile()` / `os.path.splitext()`, - * `"a.b.c"` -> (`"a.b"`, `".c"`). - */ -void BKE_deform_split_suffix(const char *string, char *r_body, char *r_suf, const size_t str_len) -{ - size_t len = BLI_strnlen(string, str_len); - size_t i; - - r_body[0] = r_suf[0] = '\0'; - - for (i = len; i > 0; i--) { - if (is_char_sep(string[i])) { - BLI_strncpy(r_body, string, i + 1); - BLI_strncpy(r_suf, string + i, (len + 1) - i); - return; - } - } - - memcpy(r_body, string, len + 1); -} - -/** - * `"a.b.c"` -> (`"a."`, `"b.c"`) - */ -void BKE_deform_split_prefix(const char *string, char *r_pre, char *r_body, const size_t str_len) -{ - size_t len = BLI_strnlen(string, str_len); - size_t i; - - r_body[0] = r_pre[0] = '\0'; - - for (i = 1; i < len; i++) { - if (is_char_sep(string[i])) { - i++; - BLI_strncpy(r_pre, string, i + 1); - BLI_strncpy(r_body, string + i, (len + 1) - i); - return; - } - } - - BLI_strncpy(r_body, string, len); -} - -/** - * Finds the best possible flipped (left/right) name. For renaming; check for unique names afterwards. - * - * \param r_name flipped name, assumed to be a pointer to a string of at least \a name_len size. - * \param from_name original name, assumed to be a pointer to a string of at least \a name_len size. - * \param strip_number If set, remove number extensions. - */ -void BKE_deform_flip_side_name(char *r_name, const char *from_name, const bool strip_number, const size_t name_len) -{ - size_t len; - char *prefix = alloca(name_len); /* The part before the facing */ - char *suffix = alloca(name_len); /* The part after the facing */ - char *replace = alloca(name_len); /* The replacement string */ - char *number = alloca(name_len); /* The number extension string */ - char *index = NULL; - bool is_set = false; - - *prefix = *suffix = *replace = *number = '\0'; - - /* always copy the name, since this can be called with an uninitialized string */ - BLI_strncpy(r_name, from_name, name_len); - - len = BLI_strnlen(from_name, name_len); - if (len < 3) { - /* we don't do names like .R or .L */ - return; - } - - /* We first check the case with a .### extension, let's find the last period */ - if (isdigit(r_name[len - 1])) { - index = strrchr(r_name, '.'); // last occurrence - if (index && isdigit(index[1])) { // doesnt handle case bone.1abc2 correct..., whatever! - if (strip_number == false) { - BLI_strncpy(number, index, name_len); - } - *index = 0; - len = BLI_strnlen(r_name, name_len); - } - } - - BLI_strncpy(prefix, r_name, name_len); - - /* first case; separator . - _ with extensions r R l L */ - if ((len > 1) && is_char_sep(r_name[len - 2])) { - is_set = true; - switch (r_name[len - 1]) { - case 'l': - prefix[len - 1] = 0; - strcpy(replace, "r"); - break; - case 'r': - prefix[len - 1] = 0; - strcpy(replace, "l"); - break; - case 'L': - prefix[len - 1] = 0; - strcpy(replace, "R"); - break; - case 'R': - prefix[len - 1] = 0; - strcpy(replace, "L"); - break; - default: - is_set = false; - } - } - - /* case; beginning with r R l L, with separator after it */ - if (!is_set && is_char_sep(r_name[1])) { - is_set = true; - switch (r_name[0]) { - case 'l': - strcpy(replace, "r"); - BLI_strncpy(suffix, r_name + 1, name_len); - prefix[0] = 0; - break; - case 'r': - strcpy(replace, "l"); - BLI_strncpy(suffix, r_name + 1, name_len); - prefix[0] = 0; - break; - case 'L': - strcpy(replace, "R"); - BLI_strncpy(suffix, r_name + 1, name_len); - prefix[0] = 0; - break; - case 'R': - strcpy(replace, "L"); - BLI_strncpy(suffix, r_name + 1, name_len); - prefix[0] = 0; - break; - default: - is_set = false; - } - } - - if (!is_set && len > 5) { - /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ - if (((index = BLI_strcasestr(prefix, "right")) == prefix) || - (index == prefix + len - 5)) - { - is_set = true; - if (index[0] == 'r') { - strcpy(replace, "left"); - } - else { - strcpy(replace, (index[1] == 'I') ? "LEFT" : "Left"); - } - *index = 0; - BLI_strncpy(suffix, index + 5, name_len); - } - else if (((index = BLI_strcasestr(prefix, "left")) == prefix) || - (index == prefix + len - 4)) - { - is_set = true; - if (index[0] == 'l') { - strcpy(replace, "right"); - } - else { - strcpy(replace, (index[1] == 'E') ? "RIGHT" : "Right"); - } - *index = 0; - BLI_strncpy(suffix, index + 4, name_len); - } - } - - BLI_snprintf(r_name, name_len, "%s%s%s%s", prefix, replace, suffix, number); -} - float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup) { MDeformWeight *dw = defvert_find_index(dvert, defgroup); diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index ce8c7919a22..ccf2aec5c7a 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -32,6 +32,7 @@ #include "BLI_utildefines.h" #include "BLI_ghash.h" #include "BLI_listbase.h" +#include "BLI_string_utils.h" #include "DNA_armature_types.h" #include "DNA_cloth_types.h" @@ -623,7 +624,7 @@ void BKE_object_defgroup_mirror_selection( if (dg_selection[i]) { char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, defgroup->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, defgroup->name, false, sizeof(name_flip)); i_mirr = STREQ(name_flip, defgroup->name) ? i : defgroup_name_index(ob, name_flip); if ((i_mirr >= 0 && i_mirr < defbase_tot) && (dg_flags_sel[i_mirr] == false)) { diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h index 81c06fbc20d..719d6e3c57b 100644 --- a/source/blender/blenlib/BLI_string_utils.h +++ b/source/blender/blenlib/BLI_string_utils.h @@ -46,6 +46,11 @@ typedef bool (*UniquenameCheckCallback)(void *arg, const char *name); int BLI_split_name_num(char *left, int *nr, const char *name, const char delim); +void BLI_string_split_suffix(const char *string, char *r_body, char *r_suf, const size_t str_len); +void BLI_string_split_prefix(const char *string, char *r_pre, char *r_body, const size_t str_len); + +void BLI_string_flip_side_name(char *r_name, const char *from_name, const bool strip_number, const size_t name_len); + bool BLI_uniquename_cb( UniquenameCheckCallback unique_check, void *arg, const char *defname, char delim, char *name, size_t name_len); bool BLI_uniquename( diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c index a7427b6848e..435a88d6e21 100644 --- a/source/blender/blenlib/intern/string_utils.c +++ b/source/blender/blenlib/intern/string_utils.c @@ -90,6 +90,184 @@ int BLI_split_name_num(char *left, int *nr, const char *name, const char delim) return name_len; } +static bool is_char_sep(const char c) +{ + return ELEM(c, '.', ' ', '-', '_'); +} + +/** + * based on `BLI_split_dirfile()` / `os.path.splitext()`, + * `"a.b.c"` -> (`"a.b"`, `".c"`). + */ +void BLI_string_split_suffix(const char *string, char *r_body, char *r_suf, const size_t str_len) +{ + size_t len = BLI_strnlen(string, str_len); + size_t i; + + r_body[0] = r_suf[0] = '\0'; + + for (i = len; i > 0; i--) { + if (is_char_sep(string[i])) { + BLI_strncpy(r_body, string, i + 1); + BLI_strncpy(r_suf, string + i, (len + 1) - i); + return; + } + } + + memcpy(r_body, string, len + 1); +} + +/** + * `"a.b.c"` -> (`"a."`, `"b.c"`) + */ +void BLI_string_split_prefix(const char *string, char *r_pre, char *r_body, const size_t str_len) +{ + size_t len = BLI_strnlen(string, str_len); + size_t i; + + r_body[0] = r_pre[0] = '\0'; + + for (i = 1; i < len; i++) { + if (is_char_sep(string[i])) { + i++; + BLI_strncpy(r_pre, string, i + 1); + BLI_strncpy(r_body, string + i, (len + 1) - i); + return; + } + } + + BLI_strncpy(r_body, string, len); +} + +/** + * Finds the best possible flipped (left/right) name. For renaming; check for unique names afterwards. + * + * \param r_name flipped name, assumed to be a pointer to a string of at least \a name_len size. + * \param from_name original name, assumed to be a pointer to a string of at least \a name_len size. + * \param strip_number If set, remove number extensions. + */ +void BLI_string_flip_side_name(char *r_name, const char *from_name, const bool strip_number, const size_t name_len) +{ + size_t len; + char *prefix = alloca(name_len); /* The part before the facing */ + char *suffix = alloca(name_len); /* The part after the facing */ + char *replace = alloca(name_len); /* The replacement string */ + char *number = alloca(name_len); /* The number extension string */ + char *index = NULL; + bool is_set = false; + + *prefix = *suffix = *replace = *number = '\0'; + + /* always copy the name, since this can be called with an uninitialized string */ + BLI_strncpy(r_name, from_name, name_len); + + len = BLI_strnlen(from_name, name_len); + if (len < 3) { + /* we don't do names like .R or .L */ + return; + } + + /* We first check the case with a .### extension, let's find the last period */ + if (isdigit(r_name[len - 1])) { + index = strrchr(r_name, '.'); // last occurrence + if (index && isdigit(index[1])) { // doesnt handle case bone.1abc2 correct..., whatever! + if (strip_number == false) { + BLI_strncpy(number, index, name_len); + } + *index = 0; + len = BLI_strnlen(r_name, name_len); + } + } + + BLI_strncpy(prefix, r_name, name_len); + + /* first case; separator . - _ with extensions r R l L */ + if ((len > 1) && is_char_sep(r_name[len - 2])) { + is_set = true; + switch (r_name[len - 1]) { + case 'l': + prefix[len - 1] = 0; + strcpy(replace, "r"); + break; + case 'r': + prefix[len - 1] = 0; + strcpy(replace, "l"); + break; + case 'L': + prefix[len - 1] = 0; + strcpy(replace, "R"); + break; + case 'R': + prefix[len - 1] = 0; + strcpy(replace, "L"); + break; + default: + is_set = false; + } + } + + /* case; beginning with r R l L, with separator after it */ + if (!is_set && is_char_sep(r_name[1])) { + is_set = true; + switch (r_name[0]) { + case 'l': + strcpy(replace, "r"); + BLI_strncpy(suffix, r_name + 1, name_len); + prefix[0] = 0; + break; + case 'r': + strcpy(replace, "l"); + BLI_strncpy(suffix, r_name + 1, name_len); + prefix[0] = 0; + break; + case 'L': + strcpy(replace, "R"); + BLI_strncpy(suffix, r_name + 1, name_len); + prefix[0] = 0; + break; + case 'R': + strcpy(replace, "L"); + BLI_strncpy(suffix, r_name + 1, name_len); + prefix[0] = 0; + break; + default: + is_set = false; + } + } + + if (!is_set && len > 5) { + /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ + if (((index = BLI_strcasestr(prefix, "right")) == prefix) || + (index == prefix + len - 5)) + { + is_set = true; + if (index[0] == 'r') { + strcpy(replace, "left"); + } + else { + strcpy(replace, (index[1] == 'I') ? "LEFT" : "Left"); + } + *index = 0; + BLI_strncpy(suffix, index + 5, name_len); + } + else if (((index = BLI_strcasestr(prefix, "left")) == prefix) || + (index == prefix + len - 4)) + { + is_set = true; + if (index[0] == 'l') { + strcpy(replace, "right"); + } + else { + strcpy(replace, (index[1] == 'E') ? "RIGHT" : "Right"); + } + *index = 0; + BLI_strncpy(suffix, index + 4, name_len); + } + } + + BLI_snprintf(r_name, name_len, "%s%s%s%s", prefix, replace, suffix, number); +} + /* Unique name utils. */ diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index ae1ca1c4d1e..c1e82583521 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -37,6 +37,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_string_utils.h" #include "DNA_anim_types.h" #include "DNA_object_types.h" @@ -668,7 +669,7 @@ static void flip_names(tAnimCopybufItem *aci, char **name) /* more ninja stuff, temporary substitute with NULL terminator */ str_start[length] = 0; - BKE_deform_flip_side_name(bname_new, str_start, false, sizeof(bname_new)); + BLI_string_flip_side_name(bname_new, str_start, false, sizeof(bname_new)); str_start[length] = '\"'; str_iter = *name = MEM_mallocN(sizeof(char) * (prefix_l + postfix_l + length + 1), "flipped_path"); diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 23c2739543c..bbc81f522fa 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -39,6 +39,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_ghash.h" +#include "BLI_string_utils.h" #include "BKE_action.h" #include "BKE_constraint.h" @@ -621,7 +622,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) { char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, ebone_iter->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, ebone_iter->name, false, sizeof(name_flip)); if (STREQ(name_flip, ebone_iter->name)) { /* if the name matches, we don't have the potential to be mirrored, just skip */ @@ -681,7 +682,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) { char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, ebone_iter->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, ebone_iter->name, false, sizeof(name_flip)); /* bones must have a side-suffix */ if (!STREQ(name_flip, ebone_iter->name)) { diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 8d949fb8c3d..fa192ed6f36 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -328,7 +328,7 @@ void ED_armature_bones_flip_names(bArmature *arm, ListBase *bones_names) /* Do not strip numbers, otherwise we'll end up with completely mismatched names in cases like * Bone.R, Bone.R.001, Bone.R.002, etc. */ - BKE_deform_flip_side_name(name_flip, name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, name, false, sizeof(name_flip)); ED_armature_bone_rename(arm, name, name_flip); diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index a34615e4402..e9946abba0b 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -35,9 +35,10 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLI_string_utils.h" #include "BKE_context.h" -#include "BKE_deform.h" +//#include "BKE_deform.h" #include "BKE_report.h" #include "BIF_gl.h" @@ -820,7 +821,7 @@ static void select_similar_prefix(bArmature *arm, EditBone *ebone_act) char body_tmp[MAXBONENAME]; char prefix_act[MAXBONENAME]; - BKE_deform_split_prefix(ebone_act->name, prefix_act, body_tmp, sizeof(ebone_act->name)); + BLI_string_split_prefix(ebone_act->name, prefix_act, body_tmp, sizeof(ebone_act->name)); if (prefix_act[0] == '\0') return; @@ -829,7 +830,7 @@ static void select_similar_prefix(bArmature *arm, EditBone *ebone_act) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (EBONE_SELECTABLE(arm, ebone)) { char prefix_other[MAXBONENAME]; - BKE_deform_split_prefix(ebone->name, prefix_other, body_tmp, sizeof(ebone->name)); + BLI_string_split_prefix(ebone->name, prefix_other, body_tmp, sizeof(ebone->name)); if (STREQ(prefix_act, prefix_other)) { ED_armature_ebone_select_set(ebone, true); } @@ -844,7 +845,7 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act) char body_tmp[MAXBONENAME]; char suffix_act[MAXBONENAME]; - BKE_deform_split_suffix(ebone_act->name, body_tmp, suffix_act, sizeof(ebone_act->name)); + BLI_string_split_suffix(ebone_act->name, body_tmp, suffix_act, sizeof(ebone_act->name)); if (suffix_act[0] == '\0') return; @@ -853,7 +854,7 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (EBONE_SELECTABLE(arm, ebone)) { char suffix_other[MAXBONENAME]; - BKE_deform_split_suffix(ebone->name, body_tmp, suffix_other, sizeof(ebone->name)); + BLI_string_split_suffix(ebone->name, body_tmp, suffix_other, sizeof(ebone->name)); if (STREQ(suffix_act, suffix_other)) { ED_armature_ebone_select_set(ebone, true); } diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 24146715f96..e8d41f722d7 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -39,6 +39,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLI_string_utils.h" #include "BKE_action.h" #include "BKE_armature.h" @@ -360,7 +361,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, if (dgroup && mirror) { char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, dgroup->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, dgroup->name, false, sizeof(name_flip)); dgroupflip[j] = defgroup_find_name(ob, name_flip); } } diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 0f783dbad69..a3b439536b7 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -34,6 +34,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLI_string_utils.h" #include "BKE_armature.h" #include "BKE_context.h" @@ -262,7 +263,7 @@ EditBone *ED_armature_bone_get_mirrored(const ListBase *edbo, EditBone *ebo) if (ebo == NULL) return NULL; - BKE_deform_flip_side_name(name_flip, ebo->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, ebo->name, false, sizeof(name_flip)); if (!STREQ(name_flip, ebo->name)) { return ED_armature_bone_find_name(edbo, name_flip); diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index a871a0e0966..063ba37f20d 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -36,6 +36,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLI_string_utils.h" #include "BKE_animsys.h" #include "BKE_action.h" @@ -286,7 +287,7 @@ static bPoseChannel *pose_bone_do_paste(Object *ob, bPoseChannel *chan, const bo /* get the name - if flipping, we must flip this first */ if (flip) - BKE_deform_flip_side_name(name, chan->name, false, sizeof(name)); + BLI_string_flip_side_name(name, chan->name, false, sizeof(name)); else BLI_strncpy(name, chan->name, sizeof(name)); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index a81b6ef20fc..b5131df3eaa 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -45,6 +45,7 @@ #include "BLI_math.h" #include "BLI_listbase.h" #include "BLI_rand.h" +#include "BLI_string_utils.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -1131,7 +1132,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op) { char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, primbase->object->id.name + 2, true, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, primbase->object->id.name + 2, true, sizeof(name_flip)); if (!STREQ(name_flip, primbase->object->id.name + 2)) { Object *ob = (Object *)BKE_libblock_find_name(ID_OB, name_flip); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 3c3763fc013..729dd9dc57b 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -36,6 +36,7 @@ #include "BLI_array_utils.h" #include "BLI_bitmap.h" #include "BLI_stack.h" +#include "BLI_string_utils.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -275,7 +276,7 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active) int mirrdef; char name_flip[MAXBONENAME]; - BKE_deform_flip_side_name(name_flip, defgroup->name, false, sizeof(name_flip)); + BLI_string_flip_side_name(name_flip, defgroup->name, false, sizeof(name_flip)); mirrdef = defgroup_name_index(ob, name_flip); if (mirrdef == -1) { if (BKE_defgroup_new(ob, name_flip)) { -- cgit v1.2.3