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:
authorPablo Dobarro <pablodp606@gmail.com>2020-02-28 17:58:04 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-02-28 18:53:34 +0300
commit793135e190c7450d30451617e9b8ae2d5ecec94a (patch)
treeb164ce4130357bb33aaf4cf4c86f235ab772ff4f /source/blender/editors
parentbc2ce31d794096d0785b469752451cc035688dcc (diff)
Fix wrong coordinates being read when using the sculpt API
The coordinates should be read from the PBVH when using deform modifiers. This is needed for the cloth brush to work with subdivisions, as it reads the vertex coordinates using this function when building and updating the constraints. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6967
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 7c51ddd597a..55ddc82c3f8 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -129,8 +129,15 @@ static int sculpt_vertex_count_get(SculptSession *ss)
const float *sculpt_vertex_co_get(SculptSession *ss, int index)
{
switch (BKE_pbvh_type(ss->pbvh)) {
- case PBVH_FACES:
- return ss->mvert[index].co;
+ case PBVH_FACES: {
+ if (ss->shapekey_active || ss->deform_modifiers_active) {
+ const MVert *mverts = BKE_pbvh_get_verts(ss->pbvh);
+ return mverts[index].co;
+ }
+ else {
+ return ss->mvert[index].co;
+ }
+ }
case PBVH_BMESH:
return BM_vert_at_index(BKE_pbvh_get_bmesh(ss->pbvh), index)->co;
case PBVH_GRIDS: {