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
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
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h2
-rw-r--r--source/blender/blenkernel/intern/pbvh.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c11
3 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index a26148d11bf..3971b248a2e 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -470,6 +470,8 @@ void BKE_pbvh_parallel_range(const int start,
PBVHParallelRangeFunc func,
const struct PBVHParallelSettings *settings);
+struct MVert *BKE_pbvh_get_verts(const PBVH *bvh);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index efe13fc8817..95e7218a920 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -2885,3 +2885,9 @@ void BKE_pbvh_parallel_range_settings(PBVHParallelSettings *settings,
memset(settings, 0, sizeof(*settings));
settings->use_threading = use_threading && totnode > 1;
}
+
+MVert *BKE_pbvh_get_verts(const PBVH *bvh)
+{
+ BLI_assert(bvh->type == PBVH_FACES);
+ return bvh->verts;
+}
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: {