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-05-20 22:11:35 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-05-26 21:40:27 +0300
commit5f63344e849ea6435bfd2de5584389cd18b22aa6 (patch)
tree7032f465419680dbc376f8b3748e7563c6e28924 /source/blender/editors/sculpt_paint/sculpt.c
parenta1c9d425844c5c2299daf9a89438d164f605407c (diff)
Fix PBVH API returning wrong normal when using shape keys and modifiers
The implementation of this function should match the one in SCULPT_vertex_co_get. This does not solve the issue when sculpting with modifiers active but I think this code is wrong Reviewed By: sergey, brecht Differential Revision: https://developer.blender.org/D7805
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d2dda1be1e7..8443608cfa5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -156,9 +156,16 @@ const float *SCULPT_vertex_co_get(SculptSession *ss, int index)
void SCULPT_vertex_normal_get(SculptSession *ss, int index, float no[3])
{
switch (BKE_pbvh_type(ss->pbvh)) {
- case PBVH_FACES:
- normal_short_to_float_v3(no, ss->mvert[index].no);
- return;
+ case PBVH_FACES: {
+ if (ss->shapekey_active || ss->deform_modifiers_active) {
+ const MVert *mverts = BKE_pbvh_get_verts(ss->pbvh);
+ normal_short_to_float_v3(no, mverts[index].no);
+ }
+ else {
+ normal_short_to_float_v3(no, ss->mvert[index].no);
+ }
+ break;
+ }
case PBVH_BMESH:
copy_v3_v3(no, BM_vert_at_index(BKE_pbvh_get_bmesh(ss->pbvh), index)->no);
break;