diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-22 21:19:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-22 21:19:05 +0400 |
commit | 23baf8c9c366a6f4e029de0119e72de45722d1f0 (patch) | |
tree | 16bf608f71c21878ae02d554d9bb0455db9d4bf2 /source/blender/modifiers/intern/MOD_weightvgmix.c | |
parent | 612768760ada094b0a6d47982d747394830a7a71 (diff) |
code cleanup: check defgroup_name_index() return value != -1, rather then checking >= 0.
also remove unused bmesh decimator code.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgmix.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgmix.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 2961082b448..5883b176317 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -225,7 +225,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der MDeformVert *dvert = NULL; MDeformWeight **dw1, **tdw1, **dw2, **tdw2; int numVerts; - int defgrp_idx, defgrp_idx2 = -1; + int defgrp_index, defgrp_index_other = -1; float *org_w; float *new_w; int *tidx, *indices = NULL; @@ -246,13 +246,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der return dm; /* Get vgroup idx from its name. */ - defgrp_idx = defgroup_name_index(ob, wmd->defgrp_name_a); - if (defgrp_idx < 0) + defgrp_index = defgroup_name_index(ob, wmd->defgrp_name_a); + if (defgrp_index == -1) return dm; /* Get seconf vgroup idx from its name, if given. */ if (wmd->defgrp_name_b[0] != (char)0) { - defgrp_idx2 = defgroup_name_index(ob, wmd->defgrp_name_b); - if (defgrp_idx2 < 0) + defgrp_index_other = defgroup_name_index(ob, wmd->defgrp_name_b); + if (defgrp_index_other == -1) return dm; } @@ -277,10 +277,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der case MOD_WVG_SET_A: /* All vertices in first vgroup. */ for (i = 0; i < numVerts; i++) { - MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx); + MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_index); if (dw) { tdw1[numIdx] = dw; - tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2); + tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_index_other); tidx[numIdx++] = i; } } @@ -288,9 +288,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der case MOD_WVG_SET_B: /* All vertices in second vgroup. */ for (i = 0; i < numVerts; i++) { - MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2); + MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_index_other); if (dw) { - tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx); + tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_index); tdw2[numIdx] = dw; tidx[numIdx++] = i; } @@ -299,8 +299,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der case MOD_WVG_SET_OR: /* All vertices in one vgroup or the other. */ for (i = 0; i < numVerts; i++) { - MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx); - MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2); + MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_index); + MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_index_other); if (adw || bdw) { tdw1[numIdx] = adw; tdw2[numIdx] = bdw; @@ -311,8 +311,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der case MOD_WVG_SET_AND: /* All vertices in both vgroups. */ for (i = 0; i < numVerts; i++) { - MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx); - MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2); + MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_index); + MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_index_other); if (adw && bdw) { tdw1[numIdx] = adw; tdw2[numIdx] = bdw; @@ -324,8 +324,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der default: /* Use all vertices. */ for (i = 0; i < numVerts; i++) { - tdw1[i] = defvert_find_index(&dvert[i], defgrp_idx); - tdw2[i] = defvert_find_index(&dvert[i], defgrp_idx2); + tdw1[i] = defvert_find_index(&dvert[i], defgrp_index); + tdw2[i] = defvert_find_index(&dvert[i], defgrp_index_other); } numIdx = -1; break; @@ -377,7 +377,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Update (add to) vgroup. * XXX Depending on the MOD_WVG_SET_xxx option chosen, we might have to add vertices to vgroup. */ - weightvg_update_vg(dvert, defgrp_idx, dw1, numIdx, indices, org_w, TRUE, -FLT_MAX, FALSE, 0.0f); + weightvg_update_vg(dvert, defgrp_index, dw1, numIdx, indices, org_w, TRUE, -FLT_MAX, FALSE, 0.0f); /* If weight preview enabled... */ #if 0 /* XXX Currently done in mod stack :/ */ |