diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_slide.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_slide.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc index 007bff0b170..e65d81a4225 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc @@ -112,6 +112,8 @@ struct SlideOperationExecutor { Object *surface_ob_eval_ = nullptr; Mesh *surface_eval_ = nullptr; + Span<MVert> surface_verts_eval_; + Span<MLoop> surface_loops_eval_; Span<MLoopTri> surface_looptris_eval_; VArraySpan<float2> surface_uv_map_eval_; BVHTreeFromMesh surface_bvh_eval_; @@ -175,8 +177,8 @@ struct SlideOperationExecutor { if (surface_orig_->totpoly == 0) { report_empty_original_surface(stroke_extension.reports); return; - } - surface_looptris_orig_ = {BKE_mesh_runtime_looptri_ensure(surface_orig_), + } + surface_looptris_orig_ = {BKE_mesh_runtime_looptri_ensure(surface_orig_), BKE_mesh_runtime_looptri_len(surface_orig_)}; surface_uv_map_orig_ = bke::mesh_attributes(*surface_orig_).lookup<float2>(uv_map_name, ATTR_DOMAIN_CORNER); @@ -205,6 +207,8 @@ struct SlideOperationExecutor { } surface_looptris_eval_ = {BKE_mesh_runtime_looptri_ensure(surface_eval_), BKE_mesh_runtime_looptri_len(surface_eval_)}; + surface_verts_eval_ = surface_eval_->vertices(); + surface_loops_eval_ = surface_eval_->loops(); surface_uv_map_eval_ = bke::mesh_attributes(*surface_eval_).lookup<float2>(uv_map_name, ATTR_DOMAIN_CORNER); if (surface_uv_map_eval_.is_empty()) { @@ -319,8 +323,8 @@ struct SlideOperationExecutor { { const float4x4 brush_transform_inv = brush_transform.inverted(); - const Span<MVert> verts_orig_su{surface_orig_->mvert, surface_orig_->totvert}; - const Span<MLoop> loops_orig{surface_orig_->mloop, surface_orig_->totloop}; + const Span<MVert> verts_orig_su = surface_orig_->vertices(); + const Span<MLoop> loops_orig = surface_orig_->loops(); MutableSpan<float3> positions_orig_cu = curves_orig_->positions_for_write(); MutableSpan<float2> surface_uv_coords = curves_orig_->surface_uv_coords_for_write(); @@ -383,7 +387,7 @@ struct SlideOperationExecutor { /* Compute the uv of the new surface position on the evaluated mesh. */ const MLoopTri &looptri_eval = surface_looptris_eval_[looptri_index_eval]; const float3 bary_weights_eval = bke::mesh_surface_sample::compute_bary_coord_in_triangle( - *surface_eval_, looptri_eval, hit_pos_eval_su); + surface_verts_eval_, surface_loops_eval_, looptri_eval, hit_pos_eval_su); const float2 uv = attribute_math::mix3(bary_weights_eval, surface_uv_map_eval_[looptri_eval.tri[0]], surface_uv_map_eval_[looptri_eval.tri[1]], |