Cleanup: Sculpt: Rename BMesh data scatter/gather functions
Remove "vert" from the name since it's inferred by the argument type.
This commit is contained in:
@@ -164,8 +164,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
scale_factors(factors, strength);
|
||||
|
||||
const MutableSpan<float3> translations = gather_data_vert_bmesh(
|
||||
all_translations, verts, tls.translations);
|
||||
const MutableSpan translations = gather_data_bmesh(all_translations, verts, tls.translations);
|
||||
scale_translations(translations, factors);
|
||||
|
||||
clip_and_lock_translations(sd, ss, positions, translations);
|
||||
@@ -229,7 +228,7 @@ static void calc_translations_bmesh(const bke::pbvh::BMeshNode &node,
|
||||
tls.translations.resize(verts.size());
|
||||
const MutableSpan<float3> translations = tls.translations;
|
||||
translations_from_new_positions(new_positions, positions, translations);
|
||||
scatter_data_vert_bmesh(translations.as_span(), verts, all_translations);
|
||||
scatter_data_bmesh(translations.as_span(), verts, all_translations);
|
||||
}
|
||||
|
||||
} // namespace enhance_details_cc
|
||||
|
||||
@@ -314,7 +314,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
calc_brush_texture_factors(ss, brush, positions, factors);
|
||||
|
||||
const MutableSpan<float> displacement_factors = gather_data_vert_bmesh(
|
||||
const MutableSpan<float> displacement_factors = gather_data_bmesh(
|
||||
layer_displacement_factor.as_span(), verts, tls.displacement_factors);
|
||||
|
||||
offset_displacement_factors(displacement_factors, factors, cache.bstrength);
|
||||
@@ -324,7 +324,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
|
||||
mask::gather_mask_bmesh(*ss.bm, verts, masks);
|
||||
clamp_displacement_factors(displacement_factors, masks);
|
||||
|
||||
scatter_data_vert_bmesh(displacement_factors.as_span(), verts, layer_displacement_factor);
|
||||
scatter_data_bmesh(displacement_factors.as_span(), verts, layer_displacement_factor);
|
||||
|
||||
Array<float3> orig_positions(verts.size());
|
||||
Array<float3> orig_normals(verts.size());
|
||||
|
||||
@@ -335,7 +335,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_bmesh(
|
||||
positions, orig_positions, average_positions, alpha, laplacian_disp, translations);
|
||||
scale_translations(translations, factors);
|
||||
|
||||
scatter_data_vert_bmesh(laplacian_disp.as_span(), verts, all_laplacian_disp);
|
||||
scatter_data_bmesh(laplacian_disp.as_span(), verts, all_laplacian_disp);
|
||||
|
||||
clip_and_lock_translations(sd, ss, positions, translations);
|
||||
apply_translations(translations, verts);
|
||||
@@ -347,7 +347,7 @@ BLI_NOINLINE static void do_surface_smooth_brush_bmesh(
|
||||
const MutableSpan positions = gather_bmesh_positions(verts, tls.positions);
|
||||
const Span<float> factors = all_factors.as_span().slice(node_offsets[pos]);
|
||||
|
||||
const MutableSpan<float3> laplacian_disp = gather_data_vert_bmesh(
|
||||
const MutableSpan<float3> laplacian_disp = gather_data_bmesh(
|
||||
all_laplacian_disp.as_span(), verts, tls.laplacian_disp);
|
||||
|
||||
tls.average_positions.resize(positions.size());
|
||||
|
||||
@@ -109,14 +109,12 @@ MutableSpan<T> gather_data_grids(const SubdivCCG &subdiv_ccg,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void gather_data_vert_bmesh(Span<T> src, const Set<BMVert *, 0> &verts, MutableSpan<T> node_data);
|
||||
void gather_data_bmesh(Span<T> src, const Set<BMVert *, 0> &verts, MutableSpan<T> node_data);
|
||||
template<typename T>
|
||||
MutableSpan<T> gather_data_vert_bmesh(const Span<T> src,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
Vector<T> &dst)
|
||||
MutableSpan<T> gather_data_bmesh(const Span<T> src, const Set<BMVert *, 0> &verts, Vector<T> &dst)
|
||||
{
|
||||
dst.resize(verts.size());
|
||||
gather_data_vert_bmesh(src, verts, dst.as_mutable_span());
|
||||
gather_data_bmesh(src, verts, dst.as_mutable_span());
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -128,7 +126,7 @@ void scatter_data_grids(const SubdivCCG &subdiv_ccg,
|
||||
Span<int> grids,
|
||||
MutableSpan<T> dst);
|
||||
template<typename T>
|
||||
void scatter_data_vert_bmesh(Span<T> node_data, const Set<BMVert *, 0> &verts, MutableSpan<T> dst);
|
||||
void scatter_data_bmesh(Span<T> node_data, const Set<BMVert *, 0> &verts, MutableSpan<T> dst);
|
||||
|
||||
/**
|
||||
* Note on the various positions arrays:
|
||||
|
||||
@@ -6582,9 +6582,9 @@ void gather_data_grids(const SubdivCCG &subdiv_ccg,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void gather_data_vert_bmesh(const Span<T> src,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<T> node_data)
|
||||
void gather_data_bmesh(const Span<T> src,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<T> node_data)
|
||||
{
|
||||
BLI_assert(verts.size() == node_data.size());
|
||||
|
||||
@@ -6622,9 +6622,9 @@ void scatter_data_grids(const SubdivCCG &subdiv_ccg,
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void scatter_data_vert_bmesh(const Span<T> node_data,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<T> dst)
|
||||
void scatter_data_bmesh(const Span<T> node_data,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<T> dst)
|
||||
{
|
||||
BLI_assert(verts.size() == node_data.size());
|
||||
|
||||
@@ -6649,13 +6649,11 @@ template void gather_data_grids<float3>(const SubdivCCG &,
|
||||
Span<float3>,
|
||||
Span<int>,
|
||||
MutableSpan<float3>);
|
||||
template void gather_data_vert_bmesh<int>(Span<int>, const Set<BMVert *, 0> &, MutableSpan<int>);
|
||||
template void gather_data_vert_bmesh<float>(Span<float>,
|
||||
const Set<BMVert *, 0> &,
|
||||
MutableSpan<float>);
|
||||
template void gather_data_vert_bmesh<float3>(Span<float3>,
|
||||
const Set<BMVert *, 0> &,
|
||||
MutableSpan<float3>);
|
||||
template void gather_data_bmesh<int>(Span<int>, const Set<BMVert *, 0> &, MutableSpan<int>);
|
||||
template void gather_data_bmesh<float>(Span<float>, const Set<BMVert *, 0> &, MutableSpan<float>);
|
||||
template void gather_data_bmesh<float3>(Span<float3>,
|
||||
const Set<BMVert *, 0> &,
|
||||
MutableSpan<float3>);
|
||||
|
||||
template void scatter_data_mesh<bool>(Span<bool>, Span<int>, MutableSpan<bool>);
|
||||
template void scatter_data_mesh<float>(Span<float>, Span<int>, MutableSpan<float>);
|
||||
@@ -6669,12 +6667,10 @@ template void scatter_data_grids<float3>(const SubdivCCG &,
|
||||
Span<float3>,
|
||||
Span<int>,
|
||||
MutableSpan<float3>);
|
||||
template void scatter_data_vert_bmesh<float>(Span<float>,
|
||||
const Set<BMVert *, 0> &,
|
||||
MutableSpan<float>);
|
||||
template void scatter_data_vert_bmesh<float3>(Span<float3>,
|
||||
const Set<BMVert *, 0> &,
|
||||
MutableSpan<float3>);
|
||||
template void scatter_data_bmesh<float>(Span<float>, const Set<BMVert *, 0> &, MutableSpan<float>);
|
||||
template void scatter_data_bmesh<float3>(Span<float3>,
|
||||
const Set<BMVert *, 0> &,
|
||||
MutableSpan<float3>);
|
||||
|
||||
void fill_factor_from_hide(const Mesh &mesh,
|
||||
const Span<int> verts,
|
||||
|
||||
@@ -1263,11 +1263,11 @@ static void calc_bend_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
|
||||
const MutableSpan<float> factors = gather_data_vert_bmesh(vert_factors, verts, tls.factors);
|
||||
const MutableSpan<float> factors = gather_data_bmesh(vert_factors, verts, tls.factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
const Span<int> propagation_steps = gather_data_vert_bmesh(
|
||||
const Span<int> propagation_steps = gather_data_bmesh(
|
||||
vert_propagation_steps, verts, tls.propagation_steps);
|
||||
|
||||
filter_uninitialized_verts(propagation_steps, factors);
|
||||
@@ -1275,9 +1275,9 @@ static void calc_bend_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
scale_factors(factors, strength);
|
||||
|
||||
const Span<float3> pivot_positions = gather_data_vert_bmesh(
|
||||
const Span<float3> pivot_positions = gather_data_bmesh(
|
||||
vert_pivot_positions, verts, tls.pivot_positions);
|
||||
const Span<float3> pivot_axes = gather_data_vert_bmesh(vert_pivot_axes, verts, tls.pivot_axes);
|
||||
const Span<float3> pivot_axes = gather_data_bmesh(vert_pivot_axes, verts, tls.pivot_axes);
|
||||
|
||||
tls.new_positions.resize(verts.size());
|
||||
const MutableSpan<float3> new_positions = tls.new_positions;
|
||||
@@ -1295,7 +1295,7 @@ static void calc_bend_bmesh(const Depsgraph &depsgraph,
|
||||
break;
|
||||
}
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
new_positions.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
@@ -1556,11 +1556,11 @@ static void calc_slide_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
|
||||
const MutableSpan<float> factors = gather_data_vert_bmesh(vert_factors, verts, tls.factors);
|
||||
const MutableSpan<float> factors = gather_data_bmesh(vert_factors, verts, tls.factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
const Span<int> propagation_steps = gather_data_vert_bmesh(
|
||||
const Span<int> propagation_steps = gather_data_bmesh(
|
||||
vert_propagation_steps, verts, tls.propagation_steps);
|
||||
|
||||
filter_uninitialized_verts(propagation_steps, factors);
|
||||
@@ -1568,7 +1568,7 @@ static void calc_slide_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
scale_factors(factors, strength);
|
||||
|
||||
const Span<float3> slide_directions = gather_data_vert_bmesh(
|
||||
const Span<float3> slide_directions = gather_data_bmesh(
|
||||
vert_slide_directions, verts, tls.pivot_positions);
|
||||
|
||||
tls.new_positions.resize(verts.size());
|
||||
@@ -1587,7 +1587,7 @@ static void calc_slide_bmesh(const Depsgraph &depsgraph,
|
||||
break;
|
||||
}
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
new_positions.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
@@ -1834,11 +1834,11 @@ static void calc_inflate_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
|
||||
const MutableSpan<float> factors = gather_data_vert_bmesh(vert_factors, verts, tls.factors);
|
||||
const MutableSpan<float> factors = gather_data_bmesh(vert_factors, verts, tls.factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
const Span<int> propagation_steps = gather_data_vert_bmesh(
|
||||
const Span<int> propagation_steps = gather_data_bmesh(
|
||||
vert_propagation_steps, verts, tls.propagation_steps);
|
||||
|
||||
filter_uninitialized_verts(propagation_steps, factors);
|
||||
@@ -1862,7 +1862,7 @@ static void calc_inflate_bmesh(const Depsgraph &depsgraph,
|
||||
break;
|
||||
}
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
new_positions.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
@@ -2108,11 +2108,11 @@ static void calc_grab_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
|
||||
const MutableSpan<float> factors = gather_data_vert_bmesh(vert_factors, verts, tls.factors);
|
||||
const MutableSpan<float> factors = gather_data_bmesh(vert_factors, verts, tls.factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
const Span<int> propagation_steps = gather_data_vert_bmesh(
|
||||
const Span<int> propagation_steps = gather_data_bmesh(
|
||||
vert_propagation_steps, verts, tls.propagation_steps);
|
||||
|
||||
filter_uninitialized_verts(propagation_steps, factors);
|
||||
@@ -2136,7 +2136,7 @@ static void calc_grab_bmesh(const Depsgraph &depsgraph,
|
||||
break;
|
||||
}
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
new_positions.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
@@ -2391,11 +2391,11 @@ static void calc_twist_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
|
||||
const MutableSpan<float> factors = gather_data_vert_bmesh(vert_factors, verts, tls.factors);
|
||||
const MutableSpan<float> factors = gather_data_bmesh(vert_factors, verts, tls.factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
const Span<int> propagation_steps = gather_data_vert_bmesh(
|
||||
const Span<int> propagation_steps = gather_data_bmesh(
|
||||
vert_propagation_steps, verts, tls.propagation_steps);
|
||||
|
||||
filter_uninitialized_verts(propagation_steps, factors);
|
||||
@@ -2419,7 +2419,7 @@ static void calc_twist_bmesh(const Depsgraph &depsgraph,
|
||||
break;
|
||||
}
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
new_positions.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
@@ -2783,9 +2783,9 @@ static void calc_smooth_bmesh(const Sculpt &sd,
|
||||
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
|
||||
const MutableSpan<float> factors = gather_data_vert_bmesh(vert_factors, verts, tls.factors);
|
||||
const MutableSpan<float> factors = gather_data_bmesh(vert_factors, verts, tls.factors);
|
||||
|
||||
const Span<int> propagation_steps = gather_data_vert_bmesh(
|
||||
const Span<int> propagation_steps = gather_data_bmesh(
|
||||
vert_propagation_steps, verts, tls.propagation_steps);
|
||||
|
||||
filter_uninitialized_verts(propagation_steps, factors);
|
||||
@@ -2818,7 +2818,7 @@ static void calc_smooth_bmesh(const Sculpt &sd,
|
||||
break;
|
||||
}
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
new_positions.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1297,12 +1297,11 @@ static void calc_constraint_factors(const Depsgraph &depsgraph,
|
||||
fill_factor_from_hide_and_mask(bm, verts, factors);
|
||||
auto_mask::calc_vert_factors(depsgraph, object, automasking, nodes[i], verts, factors);
|
||||
if (ss.cache) {
|
||||
const MutableSpan<float3> positions = gather_data_vert_bmesh(
|
||||
init_positions, verts, tls.positions);
|
||||
const MutableSpan positions = gather_data_bmesh(init_positions, verts, tls.positions);
|
||||
calc_brush_simulation_falloff(
|
||||
*brush, ss.cache->radius, sim_location, positions, factors);
|
||||
}
|
||||
scatter_data_vert_bmesh(factors.as_span(), verts, cloth_factors);
|
||||
scatter_data_bmesh(factors.as_span(), verts, cloth_factors);
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -1557,7 +1557,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
|
||||
positions, orig_positions, average_positions, alpha, laplacian_disp, translations);
|
||||
scale_translations(translations, factors);
|
||||
|
||||
scatter_data_vert_bmesh(laplacian_disp.as_span(), verts, all_laplacian_disp);
|
||||
scatter_data_bmesh(laplacian_disp.as_span(), verts, all_laplacian_disp);
|
||||
|
||||
zero_disabled_axis_components(*ss.filter_cache, translations);
|
||||
clip_and_lock_translations(sd, ss, orig_positions, translations);
|
||||
@@ -1582,7 +1582,7 @@ static void calc_surface_smooth_filter(const Depsgraph &depsgraph,
|
||||
scale_factors(factors, strength);
|
||||
clamp_factors(factors, 0.0f, 1.0f);
|
||||
|
||||
const MutableSpan<float3> laplacian_disp = gather_data_vert_bmesh(
|
||||
const MutableSpan<float3> laplacian_disp = gather_data_bmesh(
|
||||
all_laplacian_disp.as_span(), verts, tls.laplacian_disp);
|
||||
|
||||
tls.average_positions.resize(verts.size());
|
||||
@@ -1843,7 +1843,7 @@ static void calc_sharpen_filter(const Depsgraph &depsgraph,
|
||||
const MutableSpan<float3> smooth_positions = tls.smooth_positions;
|
||||
smooth::neighbor_position_average_bmesh(verts, smooth_positions);
|
||||
|
||||
const Span<float> sharpen_factors = gather_data_vert_bmesh(
|
||||
const Span<float> sharpen_factors = gather_data_bmesh(
|
||||
ss.filter_cache->sharpen_factor.as_span(), verts, tls.sharpen_factors);
|
||||
|
||||
tls.translations.resize(verts.size());
|
||||
@@ -1868,7 +1868,7 @@ static void calc_sharpen_filter(const Depsgraph &depsgraph,
|
||||
i++;
|
||||
}
|
||||
|
||||
const Span<float3> detail_directions = gather_data_vert_bmesh(
|
||||
const Span<float3> detail_directions = gather_data_bmesh(
|
||||
ss.filter_cache->detail_directions.as_span(), verts, tls.detail_directions);
|
||||
|
||||
calc_sharpen_detail_translations(*ss.filter_cache,
|
||||
@@ -1991,7 +1991,7 @@ static void calc_enhance_details_filter(const Depsgraph &depsgraph,
|
||||
depsgraph, object, ss.filter_cache->automasking.get(), nodes[i], verts, factors);
|
||||
scale_factors(factors, final_strength);
|
||||
|
||||
const MutableSpan translations = gather_data_vert_bmesh(
|
||||
const MutableSpan<float3> translations = gather_data_bmesh(
|
||||
ss.filter_cache->detail_directions.as_span(), verts, tls.translations);
|
||||
scale_translations(translations, factors);
|
||||
reset_translations_to_original(translations, positions, orig_positions);
|
||||
@@ -2201,12 +2201,12 @@ static void mesh_filter_sharpen_init(const Depsgraph &depsgraph,
|
||||
tls.smooth_directions.resize(verts.size());
|
||||
smooth::average_data_bmesh(
|
||||
detail_directions.as_span(), verts, tls.smooth_directions.as_mutable_span());
|
||||
scatter_data_vert_bmesh(tls.smooth_directions.as_span(), verts, detail_directions);
|
||||
scatter_data_bmesh(tls.smooth_directions.as_span(), verts, detail_directions);
|
||||
|
||||
tls.smooth_factors.resize(verts.size());
|
||||
smooth::average_data_bmesh(
|
||||
sharpen_factors.as_span(), verts, tls.smooth_factors.as_mutable_span());
|
||||
scatter_data_vert_bmesh(tls.smooth_factors.as_span(), verts, sharpen_factors);
|
||||
scatter_data_bmesh(tls.smooth_factors.as_span(), verts, sharpen_factors);
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -292,7 +292,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
|
||||
|
||||
for (const IKChainSegment &segment : cache.pose_ik_chain->segments) {
|
||||
calc_segment_translations(orig_positions, segment, segment_translations);
|
||||
gather_data_vert_bmesh(segment.weights.as_span(), verts, segment_weights);
|
||||
gather_data_bmesh(segment.weights.as_span(), verts, segment_weights);
|
||||
scale_translations(segment_translations, segment_weights);
|
||||
add_arrays(translations, segment_translations);
|
||||
}
|
||||
@@ -306,7 +306,7 @@ static void calc_bmesh(const Depsgraph &depsgraph,
|
||||
break;
|
||||
case BRUSH_DEFORM_TARGET_CLOTH_SIM:
|
||||
add_arrays(translations, orig_positions);
|
||||
scatter_data_vert_bmesh(
|
||||
scatter_data_bmesh(
|
||||
translations.as_span(), verts, cache.cloth_sim->deformation_pos.as_mutable_span());
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user