patch from Jason Hays
--- Locking only redistributes or restricts weights when using bone groups. So, in addition to adding a NULL check to my last bit of code, I made has_locked_group() check for bone groups.
This commit is contained in:
@@ -1141,14 +1141,14 @@ static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, const
|
||||
See if the current deform vertex has a locked group
|
||||
*/
|
||||
static char has_locked_group(MDeformVert *dvert, const int defbase_tot,
|
||||
const char *lock_flags)
|
||||
const char *bone_groups, const char *lock_flags)
|
||||
{
|
||||
int i;
|
||||
MDeformWeight *dw;
|
||||
|
||||
for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
|
||||
if (dw->def_nr < defbase_tot) {
|
||||
if (lock_flags[dw->def_nr] && dw->weight > 0.0f) {
|
||||
if (bone_groups[dw->def_nr] && lock_flags[dw->def_nr] && dw->weight > 0.0f) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1325,7 +1325,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
|
||||
|
||||
char *change_status;
|
||||
|
||||
if(!lock_flags || !has_locked_group(ndv, defbase_tot, lock_flags)) {
|
||||
if(!lock_flags || !has_locked_group(ndv, defbase_tot, vgroup_validmap, lock_flags)) {
|
||||
return;
|
||||
}
|
||||
/* record if a group was changed, unlocked and not changed, or locked */
|
||||
@@ -1598,7 +1598,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert
|
||||
/* If there are no locks or multipaint,
|
||||
* then there is no need to run the more complicated checks */
|
||||
if ( (wpi->do_multipaint == FALSE || wpi->defbase_tot_sel <= 1) &&
|
||||
(wpi->lock_flags == NULL || has_locked_group(dv, wpi->defbase_tot, wpi->lock_flags) == FALSE))
|
||||
(wpi->lock_flags == NULL || has_locked_group(dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags) == FALSE))
|
||||
{
|
||||
wpaint_blend(wp, dw, uw, alpha, paintweight, wpi->do_flip, FALSE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user