diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-12-24 14:30:51 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-01-12 14:32:05 +0300 |
commit | 58dae919e51547a8fe7e676e317de3ee17b49e64 (patch) | |
tree | 9b20da8fbdaccc89f36d8caaad6a499b442f0a38 /source/blender/blenkernel/BKE_deform.h | |
parent | f5c0ef52cf2f4ae333269eec33e5bd7a89a00a23 (diff) |
Weight Paint: avoid creating very small values with locked weights.
When painting using Auto-Normalize or Lock Relative with some
groups locked, the locked weights may not add up precisely to
1 because of precision limitations, which results in creating
nonzero weights close to FLT_EPSILON. With Lock Relative display
mode this is very obvious and annoying (random red points amid
black or blue), so add an epsilon check to consider less than
1e-6 unlocked weight to be the same as 0.
In addition, in cases when no weight can be painted due to locks,
don't create vertex group entries at all if they don't exist yet.
Also, don't run Auto Normalize when not painting a deform group.
Differential Revision: https://developer.blender.org/D10000
Diffstat (limited to 'source/blender/blenkernel/BKE_deform.h')
-rw-r--r-- | source/blender/blenkernel/BKE_deform.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 2f3ec69418f..8b5fdf69bb0 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -80,6 +80,9 @@ float BKE_defvert_multipaint_collective_weight(const struct MDeformVert *dv, int defbase_tot_sel, bool is_normalized); +/* This much unlocked weight is considered equivalent to none. */ +#define VERTEX_WEIGHT_LOCK_EPSILON 1e-6f + float BKE_defvert_calc_lock_relative_weight(float weight, float locked_weight, float unlocked_weight); |