diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.cc | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 684fcdbff9e..3021e058719 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -106,10 +106,10 @@ const float *SCULPT_vertex_co_get(SculptSession *ss, PBVHVertRef vertex) switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { if (ss->shapekey_active || ss->deform_modifiers_active) { - const MVert *mverts = BKE_pbvh_get_verts(ss->pbvh); - return mverts[vertex.i].co; + const float(*positions)[3] = BKE_pbvh_get_positions(ss->pbvh); + return positions[vertex.i]; } - return ss->mvert[vertex.i].co; + return ss->positions[vertex.i]; } case PBVH_BMESH: return ((BMVert *)vertex.i)->co; @@ -185,12 +185,12 @@ const float *SCULPT_vertex_co_for_grab_active_get(SculptSession *ss, PBVHVertRef if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) { /* Always grab active shape key if the sculpt happens on shapekey. */ if (ss->shapekey_active) { - const MVert *mverts = BKE_pbvh_get_verts(ss->pbvh); - return mverts[vertex.i].co; + const float(*positions)[3] = BKE_pbvh_get_positions(ss->pbvh); + return positions[vertex.i]; } /* Sculpting on the base mesh. */ - return ss->mvert[vertex.i].co; + return ss->positions[vertex.i]; } /* Everything else, such as sculpting on multires. */ @@ -271,14 +271,14 @@ void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]) SCULPT_vertex_normal_get(ss, SCULPT_active_vertex_get(ss), normal); } -MVert *SCULPT_mesh_deformed_mverts_get(SculptSession *ss) +float (*SCULPT_mesh_deformed_positions_get(SculptSession *ss))[3] { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: if (ss->shapekey_active || ss->deform_modifiers_active) { - return BKE_pbvh_get_verts(ss->pbvh); + return BKE_pbvh_get_positions(ss->pbvh); } - return ss->mvert; + return ss->positions; case PBVH_BMESH: case PBVH_GRIDS: return nullptr; @@ -1500,7 +1500,7 @@ static void paint_mesh_restore_co_task_cb(void *__restrict userdata, else { copy_v3_v3(vd.fno, orig_data.no); } - if (vd.mvert) { + if (vd.is_mesh) { BKE_pbvh_vert_tag_update_normal(ss->pbvh, vd.vertex); } } @@ -3134,7 +3134,7 @@ static void do_gravity_task_cb_ex(void *__restrict userdata, mul_v3_v3fl(proxy[vd.i], offset, fade); - if (vd.mvert) { + if (vd.is_mesh) { BKE_pbvh_vert_tag_update_normal(ss->pbvh, vd.vertex); } } @@ -3202,12 +3202,7 @@ void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]) /* Modifying of basis key should update mesh. */ if (kb == me->key->refkey) { - MVert *verts = BKE_mesh_verts_for_write(me); - - for (a = 0; a < me->totvert; a++) { - copy_v3_v3(verts[a].co, vertCos[a]); - } - BKE_mesh_tag_coords_changed(me); + BKE_mesh_vert_coords_apply(me, vertCos); } /* Apply new coords on active key block, no need to re-allocate kb->data here! */ @@ -3636,9 +3631,9 @@ static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd) copy_v3_v3(ss->deform_cos[index], vd->co); copy_v3_v3(ss->orig_cos[index], newco); - MVert *verts = BKE_mesh_verts_for_write(me); + float(*positions)[3] = BKE_mesh_positions_for_write(me); if (!ss->shapekey_active) { - copy_v3_v3(verts[index].co, newco); + copy_v3_v3(positions[index], newco); } } |