From b00c3b801bf07a67b98b604ee834e2d93dff0f39 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Feb 2013 04:09:04 +0000 Subject: new weight paint draw option to display unweighted vertices with the option to check on the active group or all groups. notes: - vertices with zero weights are considered the same as vertices outside of a group. - currently these show black but this can be made a theme color. - multi-paint overrides this option (noted in description) --- source/blender/blenkernel/intern/deform.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/deform.c') diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index de15100de0b..439180e8d76 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -41,14 +41,13 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "BKE_deform.h" - #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BKE_deform.h" /* own include */ void defgroup_copy_list(ListBase *outbase, ListBase *inbase) { @@ -787,6 +786,24 @@ int defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b) return -1; } +/** + * return true if has no weights + */ +bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot) +{ + MDeformWeight *dw = dvert->dw; + unsigned int i; + for (i = dvert->totweight; i != 0; i--, dw++) { + if (dw->weight != 0.0f) { + /* check the group is in-range, happens on rare situations */ + if (LIKELY(dw->def_nr < defgroup_tot)) { + return false; + } + } + } + return true; +} + /* -------------------------------------------------------------------- */ /* Defvert Array functions */ -- cgit v1.2.3