Cleanup/refactor: move BKE_deform_flip_side_name & co to BLI_string_utils
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 16 Jan 2017 19:34:13 +0000 (20:34 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 16 Jan 2017 19:36:23 +0000 (20:36 +0100)
Functions like that do not have anything to do in BKE really, even less
when actually more used for bones than vgroups!

15 files changed:
source/blender/blenkernel/BKE_deform.h
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/object_deform.c
source/blender/blenlib/BLI_string_utils.h
source/blender/blenlib/intern/string_utils.c
source/blender/editors/animation/keyframes_general.c
source/blender/editors/armature/armature_add.c
source/blender/editors/armature/armature_naming.c
source/blender/editors/armature/armature_select.c
source/blender/editors/armature/armature_skinning.c
source/blender/editors/armature/armature_utils.c
source/blender/editors/armature/pose_transform.c
source/blender/editors/object/object_select.c
source/blender/editors/sculpt_paint/paint_vertex.c

index a6d1139648d30d0527508540cb74438422e95649..3ce08a14177cd05d07885fae0f976d2d15370507 100644 (file)
@@ -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__ */
index d1b0306c27c6ccfaed97cb71f50e267c37631af1..1e33fe4ab462336168b2601261cbe770cbd10527 100644 (file)
@@ -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);
index 783455ef6f8ac1f284e7c974504cb3727acd5b41..13b1aab5e1c25b2b8fd002fd79d3222e5e666032 100644 (file)
@@ -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);
index ce8c7919a22b9b844eacd4f153cd6d98ec5491bf..ccf2aec5c7aa2ad9556ae6dcf8ca89aaf7a8b17c 100644 (file)
@@ -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)) {
index 81c06fbc20dd79d31d12900f45aef49d17d49a89..719d6e3c57b24c0ed26cc9e43cdac81f26f635f3 100644 (file)
@@ -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(
index a7427b6848e28b852f10dba0ee437b8f451d97e6..435a88d6e21b81803b8857a0373997290d9c7e1d 100644 (file)
@@ -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. */
 
index ae1ca1c4d1e3c4352b1ba44b7d802e05706c2f92..c1e82583521578860f674f1ae6ee8ca7b3262f81 100644 (file)
@@ -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");
index 23c2739543ceb34ac8b8cfe6823db013bd8073f1..bbc81f522fa7dcc839e7be8416dfe29e97bccfca 100644 (file)
@@ -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)) {
index 8d949fb8c3dfe6730ae25cec5db0a4b3111dc6ee..fa192ed6f360e5caf237ffd2b71796f0cdd9747a 100644 (file)
@@ -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);
 
index a34615e4402e6dc2a0beed18b9188350d33ca401..e9946abba0b7fa45162639f0895aeb3e5d75dacf 100644 (file)
 
 #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);
                        }
index 24146715f9692f09bf900e9e0f0141ad7cb4736b..e8d41f722d7ea5c9ec420bb0242226ae3f8462a4 100644 (file)
@@ -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);
                }
        }
index 0f783dbad6941935c7a19cd6e7dac07a0fdad60c..a3b439536b7e31fd3035a311e0b2706e6f446328 100644 (file)
@@ -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);
index a871a0e09665bcbf5f4034fb947b072369688460..063ba37f20d614b1e8add0e2ccfcc0f61f946055 100644 (file)
@@ -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));
        
index a81b6ef20fc63f0ff0b47475f77cc74428828eb4..b5131df3eaadff7800195bd2dbf9f1f5a09414bb 100644 (file)
@@ -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);
index 3c3763fc0136264550d26739c4fc56b051524c22..729dd9dc57b57274ff138d63668831e390115931 100644 (file)
@@ -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)) {