diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 |
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 20b8f90df8b..5edd14cd8e3 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -968,7 +968,7 @@ static float tex_strength(SculptSession *ss, Brush *br, x += br->mtex.ofs[0]; y += br->mtex.ofs[1]; - avg = paint_get_tex_pixel(br, x, y, ss->tex_pool); + avg = paint_get_tex_pixel(&br->mtex, x, y, ss->tex_pool); avg += br->texture_sample_bias; } @@ -3220,8 +3220,15 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob) PBVHNode **nodes; float (*vertCos)[3] = NULL; - if (ss->kb) - vertCos = MEM_callocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts"); + if (ss->kb) { + vertCos = MEM_mallocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts"); + + /* mesh could have isolated verts which wouldn't be in BVH, + * to deal with this we copy old coordinates over new ones + * and then update coordinates for all vertices from BVH + */ + memcpy(vertCos, ss->orig_cos, 3 * sizeof(float) * me->totvert); + } BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode); |