diff options
author | gaiaclary <gaia.clary@machinimatrix.org> | 2014-07-26 19:54:18 +0400 |
---|---|---|
committer | gaiaclary <gaia.clary@machinimatrix.org> | 2014-07-26 19:54:18 +0400 |
commit | a6eeeee4abeabeffcacbb4c69d43f349723bc387 (patch) | |
tree | 0cbd9c0b60685f0d2fa40709169e5087ca09d47d /source/blender/editors/armature/armature_skinning.c | |
parent | e15cdec2d49ee47a85897db9838578a298146513 (diff) |
Adding Mask select mode to Assign weights from Bone Heat (when called in Weight Paint mode)
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D681
Diffstat (limited to 'source/blender/editors/armature/armature_skinning.c')
-rw-r--r-- | source/blender/editors/armature/armature_skinning.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index e898e600e9b..57ae03ccebe 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -200,10 +200,22 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i float distance; int i, iflip, j; bool use_topology = (mesh->editflag & ME_EDIT_MIRROR_TOPO) != 0; + bool use_mask = false; + + if ((ob->mode & OB_MODE_WEIGHT_PAINT) && + (mesh->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL))) + { + use_mask = true; + } /* for each vertex in the mesh */ for (i = 0; i < mesh->totvert; i++) { - iflip = (dgroupflip) ? mesh_get_x_mirror_vert(ob, i, use_topology) : 0; + + if (use_mask && !(mesh->mvert[i].flag & SELECT)) { + continue; + } + + iflip = (dgroupflip) ? mesh_get_x_mirror_vert(ob, i, use_topology) : -1; /* for each skinnable bone */ for (j = 0; j < numbones; ++j) { @@ -224,7 +236,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i ED_vgroup_vert_remove(ob, dgroup, i); /* do same for mirror */ - if (dgroupflip && dgroupflip[j] && iflip >= 0) { + if (dgroupflip && dgroupflip[j] && iflip != -1) { if (distance != 0.0f) ED_vgroup_vert_add(ob, dgroupflip[j], iflip, distance, WEIGHT_REPLACE); |