fix for own bug in name flipping, was modifying the original name (very bad!).

This commit is contained in:
2010-01-17 16:00:54 +00:00
parent 870df309c5
commit e682febe24

View File

@@ -285,7 +285,7 @@ void unique_vertexgroup_name (bDeformGroup *dg, Object *ob)
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
/* if strip_number: removes number extensions */
void flip_vertexgroup_name (char *name_r, const char *name, int strip_number)
void flip_vertexgroup_name (char *name, const char *from_name, int strip_number)
{
int len;
char prefix[sizeof((bDeformGroup *)NULL)->name]={""}; /* The part before the facing */
@@ -294,9 +294,11 @@ void flip_vertexgroup_name (char *name_r, const char *name, int strip_number)
char number[sizeof((bDeformGroup *)NULL)->name]={""}; /* The number extension string */
char *index=NULL;
len= strlen(name);
len= strlen(from_name);
if(len<3) return; // we don't do names like .R or .L
strcpy(name, from_name);
/* We first check the case with a .### extension, let's find the last period */
if(isdigit(name[len-1])) {
index= strrchr(name, '.'); // last occurrence
@@ -392,7 +394,7 @@ void flip_vertexgroup_name (char *name_r, const char *name, int strip_number)
#undef IS_SEPARATOR
sprintf (name_r, "%s%s%s%s", prefix, replace, suffix, number);
sprintf (name, "%s%s%s%s", prefix, replace, suffix, number);
}