diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2022-09-07 11:03:34 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-09-07 11:10:41 +0300 |
commit | 2b43173fa922b04e5e1db092964aa6c263450667 (patch) | |
tree | f23dd501dd9e91922e06f03cf4f755a7426e2ff0 /source/blender/blenkernel/intern/paint.cc | |
parent | ddfd2b764472af0890cd3f03c6c55dc7005bd523 (diff) |
Fix T100862: only leading deform modifiers used in weight/vertex paint.
It turns out upon close inspection that the 'deform only' mesh
only includes leading deform modifiers, rather than all of them
like crazyspace evaluation. This reduces the effect of the change
in rB9823a8f72be8 to using the fully evaluated mesh (all modifiers)
when the whole stack resulted in no topology change.
Diffstat (limited to 'source/blender/blenkernel/intern/paint.cc')
-rw-r--r-- | source/blender/blenkernel/intern/paint.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index a51d36a4a4e..73db00e7306 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -1744,27 +1744,30 @@ static void sculpt_update_object(Depsgraph *depsgraph, pbvh_show_face_sets_set(ss->pbvh, ss->show_face_sets); if (ss->deform_modifiers_active) { - /* Painting doesn't need crazyspace, use already evaluated mesh coordinates. */ + /* Painting doesn't need crazyspace, use already evaluated mesh coordinates if possible. */ + bool used_me_eval = false; + if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) { Mesh *me_eval_deform = ob_eval->runtime.mesh_deform_eval; /* If the fully evaluated mesh has the same topology as the deform-only version, use it. - * This matters because 'deform eval' is very restrictive and excludes even modifiers that - * simply recompute vertex weights. */ + * This matters because crazyspace evaluation is very restrictive and excludes even modifiers + * that simply recompute vertex weights (which can even include Geometry Nodes). */ if (me_eval_deform->polys().data() == me_eval->polys().data() && me_eval_deform->loops().data() == me_eval->loops().data() && me_eval_deform->totvert == me_eval->totvert) { - me_eval_deform = me_eval; - } + BKE_sculptsession_free_deformMats(ss); - BKE_sculptsession_free_deformMats(ss); + BLI_assert(me_eval_deform->totvert == me->totvert); - BLI_assert(me_eval_deform->totvert == me->totvert); + ss->deform_cos = BKE_mesh_vert_coords_alloc(me_eval, NULL); + BKE_pbvh_vert_coords_apply(ss->pbvh, ss->deform_cos, me->totvert); - ss->deform_cos = BKE_mesh_vert_coords_alloc(me_eval_deform, NULL); - BKE_pbvh_vert_coords_apply(ss->pbvh, ss->deform_cos, me->totvert); + used_me_eval = true; + } } - else if (!ss->orig_cos) { + + if (!ss->orig_cos && !used_me_eval) { int a; BKE_sculptsession_free_deformMats(ss); |