diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-05-01 23:46:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-05-01 23:46:05 +0400 |
commit | ca83969287be6e35ae6bad619e141aa94c0f035e (patch) | |
tree | 6c0e6d1fab83fa1237955a099394bbf6550d291f /source/blender/src/editdeform.c | |
parent | a87d82023a2790ae62032eb8c272bda0262c5a23 (diff) |
deleting a vertex group didn't update the buttons window when the 3d view wasnt open. it also didn't update the 3dview weight paint colors.
copying a group kept appending "_copy" and rose an error when the string was too long. now just add one _copy prefix and number uniquely.
Diffstat (limited to 'source/blender/src/editdeform.c')
-rw-r--r-- | source/blender/src/editdeform.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/src/editdeform.c b/source/blender/src/editdeform.c index 6d6a53fc59e..a072898327f 100644 --- a/source/blender/src/editdeform.c +++ b/source/blender/src/editdeform.c @@ -217,19 +217,25 @@ void duplicate_defgroup ( Object *ob ) dg = BLI_findlink (&ob->defbase, (ob->actdef-1)); if (!dg) return; - - BLI_snprintf (name, 32, "%s_copy", dg->name); - while (get_named_vertexgroup (ob, name)) { - if ((strlen (name) + 6) > 32) { - error ("Error: the name for the new group is > 32 characters"); - return; + + if (strstr(dg->name, "_copy")) { + BLI_strncpy (name, dg->name, 32); /* will be renamed _copy.001... etc */ + } else { + BLI_snprintf (name, 32, "%s_copy", dg->name); + while (get_named_vertexgroup (ob, name)) { + if ((strlen (name) + 6) > 32) { + error ("Error: the name for the new group is > 32 characters"); + return; + } + strcpy (s, name); + BLI_snprintf (name, 32, "%s_copy", s); } - strcpy (s, name); - BLI_snprintf (name, 32, "%s_copy", s); - } + } cdg = copy_defgroup (dg); strcpy (cdg->name, name); + unique_vertexgroup_name(cdg, ob); + BLI_addtail (&ob->defbase, cdg); idg = (ob->actdef-1); |