diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-07-27 00:35:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-07-27 00:35:44 +0300 |
commit | 11e95fcdd292f4f0c4dfcb05616c181aa9789fd9 (patch) | |
tree | 833ad8118e1b3a9749c6df364d7faec49ae3ac4e /source/blender/blenkernel/intern | |
parent | 48e8a1a1670101a38db5aa10970c4aa938bc9451 (diff) | |
parent | 5c963128ea2435375dbfcc0319e9d49df06881c5 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/deform.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index ffe9986d166..584942628fa 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -624,8 +624,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); } |