Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-07-26 17:23:24 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-07-26 17:23:24 +0300
commit66e28a2827ab589756882983e07808742c198cb2 (patch)
treea22e5d3811976381611b6cd9f6116b4a9f9a9c71
parentedc6bec9d60204cb81d2e7533402630b076d0d32 (diff)
Fix T52176: Bevel doesn't correctly work with default empty Vgroup.
`defvert_array_find_weight_safe()` was confusing 'invalid vgroup' and 'valid but totally empty vgroup' cases. Note that this also affected at least ShrinkWrap and SimpleDeform modifiers.
-rw-r--r--source/blender/blenkernel/intern/deform.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 69baaf5e58a..eec8d2478da 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -621,8 +621,17 @@ float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup)
*/
float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup)
{
- if (defgroup == -1 || dvert == NULL)
+ /* Invalid defgroup index means the vgroup selected is invalid, does not exist, in that case it is OK to return 1.0
+ * (i.e. maximum weight, as if no vgroup was selected).
+ * But in case of valid defgroup and NULL dvert data pointer, it means that vgroup **is** valid,
+ * and just totally empty, so we shall return '0.0' value then!
+ */
+ if (defgroup == -1) {
return 1.0f;
+ }
+ else if (dvert == NULL) {
+ return 0.0f;
+ }
return defvert_find_weight(dvert + index, defgroup);
}