From cba88c17786baf83d535a051449491a083666e65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 Jan 2013 21:54:44 +0000 Subject: tweak to recent commit to clamp vertex range so new empty vgroups are in fact empty. - don't clamp if no empty groups are created - no need to call ED_vgroup_data_create, this was very old code for weight paint r1596 - weight paint works without adding 'dvert'array. --- source/blender/editors/armature/editarmature.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index f56bf8d5dfd..4a15d73c064 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4997,17 +4997,18 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, bArmature *arm = par->data; if (mode == ARM_GROUPS_NAME) { - /* its possible there are DWeight's outside the range of the current - * objects deform groups, in this case the new groups wont be empty [#33889] */ - ED_vgroup_data_clamp_range(ob->data, BLI_countlist(&ob->defbase)); - + const int defbase_tot = BLI_countlist(&ob->defbase); + int defbase_add; /* Traverse the bone list, trying to create empty vertex * groups corresponding to the bone. */ - bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); + defbase_add = bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); - if (ob->type == OB_MESH) - ED_vgroup_data_create(ob->data); + if (defbase_add) { + /* its possible there are DWeight's outside the range of the current + * objects deform groups, in this case the new groups wont be empty [#33889] */ + ED_vgroup_data_clamp_range(ob->data, defbase_tot); + } } else if (mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) { /* Traverse the bone list, trying to create vertex groups -- cgit v1.2.3