diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-11 12:14:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-19 12:51:25 +0300 |
commit | 5e332fd700fbddfbc4c7e543daa1d852809ad1c1 (patch) | |
tree | 22e7b5292b9ff90ed9535dd15a7b9a42e89645a9 /source/blender/blenkernel/intern/paint.c | |
parent | 74d27bb0efaddbd5f49eb58ff2ce1cfde2a53804 (diff) |
Fix T67934: Weight paint doesn't work with Subsurf/Multires
This is a regression since PBVH was introduced for weight paint.
The solution is: treat subsurf and multires modifiers as deforming
ones for the weight painting. This is an easiest solution to make
PBVH use subdivided location of original vertices.
This change could simplify some of the weight paint by removing
the grids check, since PBVH is not supposed to be built from grids
in this case anymore.
Differential Revision: https://developer.blender.org/D5751
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 9c56e505d91..983127372ca 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1104,6 +1104,12 @@ MultiresModifierData *BKE_sculpt_multires_active(Scene *scene, Object *ob) return NULL; } + /* Weight paint operates on original vertices, and needs to treat multires as regular modifier + * to make it so that PBVH vertices are at the multires surface. */ + if ((ob->mode & OB_MODE_SCULPT) == 0) { + return NULL; + } + for (md = modifiers_getVirtualModifierList(ob, &virtualModifierData); md; md = md->next) { if (md->type == eModifierType_Multires) { MultiresModifierData *mmd = (MultiresModifierData *)md; @@ -1149,7 +1155,10 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob) if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) { continue; } - if (ELEM(md->type, eModifierType_ShapeKey, eModifierType_Multires)) { + if (md->type == eModifierType_Multires && (ob->mode & OB_MODE_SCULPT)) { + continue; + } + if (md->type == eModifierType_ShapeKey) { continue; } @@ -1199,8 +1208,9 @@ static void sculpt_update_object( ss->kb = (mmd == NULL) ? BKE_keyblock_from_object(ob) : NULL; - /* VWPaint require mesh info for loop lookup, so require sculpt mode here */ - if (mmd && ob->mode & OB_MODE_SCULPT) { + /* NOTE: Weight pPaint require mesh info for loop lookup, but it never uses multires code path, + * so no extra checks is needed here. */ + if (mmd) { ss->multires = mmd; ss->totvert = me_eval->totvert; ss->totpoly = me_eval->totpoly; |