BLI: refactor IndexMask for better performance and memory usage #104629
|
@ -175,7 +175,7 @@ class CurvesGeometry : public ::CurvesGeometry {
|
|||
*/
|
||||
IndexMask indices_for_curve_type(CurveType type, IndexMaskMemory &memory) const;
|
||||
IndexMask indices_for_curve_type(CurveType type,
|
||||
IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
IndexMaskMemory &memory) const;
|
||||
|
||||
Array<int> point_to_curve_map() const;
|
||||
|
@ -361,16 +361,16 @@ class CurvesGeometry : public ::CurvesGeometry {
|
|||
|
||||
void calculate_bezier_auto_handles();
|
||||
|
||||
void remove_points(IndexMask points_to_delete,
|
||||
void remove_points(const IndexMask &points_to_delete,
|
||||
const AnonymousAttributePropagationInfo &propagation_info = {});
|
||||
void remove_curves(IndexMask curves_to_delete,
|
||||
void remove_curves(const IndexMask &curves_to_delete,
|
||||
const AnonymousAttributePropagationInfo &propagation_info = {});
|
||||
|
||||
/**
|
||||
* Change the direction of selected curves (switch the start and end) without changing their
|
||||
* shape.
|
||||
*/
|
||||
void reverse_curves(IndexMask curves_to_reverse);
|
||||
void reverse_curves(cosnt IndexMask &curves_to_reverse);
|
||||
|
||||
/**
|
||||
* Remove any attributes that are unused based on the types in the curves.
|
||||
|
|
|
@ -32,27 +32,27 @@ void sample_point_attribute(Span<int> corner_verts,
|
|||
Span<int> looptri_indices,
|
||||
Span<float3> bary_coords,
|
||||
const GVArray &src,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
GMutableSpan dst);
|
||||
|
||||
void sample_corner_attribute(Span<MLoopTri> looptris,
|
||||
Span<int> looptri_indices,
|
||||
Span<float3> bary_coords,
|
||||
const GVArray &src,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
GMutableSpan dst);
|
||||
|
||||
void sample_corner_normals(Span<MLoopTri> looptris,
|
||||
Span<int> looptri_indices,
|
||||
Span<float3> bary_coords,
|
||||
Span<float3> src,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
MutableSpan<float3> dst);
|
||||
|
||||
void sample_face_attribute(Span<int> looptri_polys,
|
||||
Span<int> looptri_indices,
|
||||
const GVArray &src,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
GMutableSpan dst);
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ class BaryWeightFromPositionFn : public mf::MultiFunction {
|
|||
|
||||
public:
|
||||
BaryWeightFromPositionFn(GeometrySet geometry);
|
||||
void call(IndexMask mask, mf::Params params, mf::Context context) const;
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context context) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ class CornerBaryWeightFromPositionFn : public mf::MultiFunction {
|
|||
|
||||
public:
|
||||
CornerBaryWeightFromPositionFn(GeometrySet geometry);
|
||||
void call(IndexMask mask, mf::Params params, mf::Context context) const;
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context context) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -175,7 +175,7 @@ class BaryWeightSampleFn : public mf::MultiFunction {
|
|||
public:
|
||||
BaryWeightSampleFn(GeometrySet geometry, fn::GField src_field);
|
||||
|
||||
void call(IndexMask mask, mf::Params params, mf::Context context) const;
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context context) const;
|
||||
|
||||
private:
|
||||
void evaluate_source(fn::GField src_field);
|
||||
|
|
|
@ -555,7 +555,7 @@ IndexMask CurvesGeometry::indices_for_curve_type(const CurveType type,
|
|||
}
|
||||
|
||||
IndexMask CurvesGeometry::indices_for_curve_type(const CurveType type,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
IndexMaskMemory &memory) const
|
||||
{
|
||||
return curves::indices_for_type(
|
||||
|
@ -1116,7 +1116,7 @@ static void copy_construct_data(const GSpan src, GMutableSpan dst)
|
|||
|
||||
static CurvesGeometry copy_with_removed_points(
|
||||
const CurvesGeometry &curves,
|
||||
const IndexMask points_to_delete,
|
||||
const IndexMask &points_to_delete,
|
||||
const AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
/* Use a map from points to curves to facilitate using an #IndexMask input. */
|
||||
|
@ -1217,7 +1217,7 @@ static CurvesGeometry copy_with_removed_points(
|
|||
return new_curves;
|
||||
}
|
||||
|
||||
void CurvesGeometry::remove_points(const IndexMask points_to_delete,
|
||||
void CurvesGeometry::remove_points(const IndexMask &points_to_delete,
|
||||
const AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
if (points_to_delete.is_empty()) {
|
||||
|
@ -1231,7 +1231,7 @@ void CurvesGeometry::remove_points(const IndexMask points_to_delete,
|
|||
|
||||
static CurvesGeometry copy_with_removed_curves(
|
||||
const CurvesGeometry &curves,
|
||||
const IndexMask curves_to_delete,
|
||||
const IndexMask &curves_to_delete,
|
||||
const AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
const OffsetIndices old_points_by_curve = curves.points_by_curve();
|
||||
|
@ -1328,7 +1328,7 @@ static CurvesGeometry copy_with_removed_curves(
|
|||
return new_curves;
|
||||
}
|
||||
|
||||
void CurvesGeometry::remove_curves(const IndexMask curves_to_delete,
|
||||
void CurvesGeometry::remove_curves(const IndexMask &curves_to_delete,
|
||||
const AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
if (curves_to_delete.is_empty()) {
|
||||
|
@ -1343,7 +1343,7 @@ void CurvesGeometry::remove_curves(const IndexMask curves_to_delete,
|
|||
|
||||
template<typename T>
|
||||
static void reverse_curve_point_data(const CurvesGeometry &curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
MutableSpan<T> data)
|
||||
{
|
||||
const OffsetIndices points_by_curve = curves.points_by_curve();
|
||||
|
@ -1356,7 +1356,7 @@ static void reverse_curve_point_data(const CurvesGeometry &curves,
|
|||
|
||||
template<typename T>
|
||||
static void reverse_swap_curve_point_data(const CurvesGeometry &curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
MutableSpan<T> data_a,
|
||||
MutableSpan<T> data_b)
|
||||
{
|
||||
|
@ -1379,7 +1379,7 @@ static void reverse_swap_curve_point_data(const CurvesGeometry &curves,
|
|||
});
|
||||
}
|
||||
|
||||
void CurvesGeometry::reverse_curves(const IndexMask curves_to_reverse)
|
||||
void CurvesGeometry::reverse_curves(const IndexMask &curves_to_reverse)
|
||||
{
|
||||
Set<StringRef> bezier_handle_names{{ATTR_HANDLE_POSITION_LEFT,
|
||||
ATTR_HANDLE_POSITION_RIGHT,
|
||||
|
|
|
@ -134,7 +134,7 @@ const Instances *GeometryFieldContext::instances() const
|
|||
}
|
||||
|
||||
GVArray GeometryFieldInput::get_varray_for_context(const fn::FieldContext &context,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
ResourceScope & /*scope*/) const
|
||||
{
|
||||
if (const GeometryFieldContext *geometry_context = dynamic_cast<const GeometryFieldContext *>(
|
||||
|
@ -169,7 +169,7 @@ std::optional<eAttrDomain> GeometryFieldInput::preferred_domain(
|
|||
}
|
||||
|
||||
GVArray MeshFieldInput::get_varray_for_context(const fn::FieldContext &context,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
ResourceScope & /*scope*/) const
|
||||
{
|
||||
if (const GeometryFieldContext *geometry_context = dynamic_cast<const GeometryFieldContext *>(
|
||||
|
@ -191,7 +191,7 @@ std::optional<eAttrDomain> MeshFieldInput::preferred_domain(const Mesh & /*mesh*
|
|||
}
|
||||
|
||||
GVArray CurvesFieldInput::get_varray_for_context(const fn::FieldContext &context,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
ResourceScope & /*scope*/) const
|
||||
{
|
||||
if (const GeometryFieldContext *geometry_context = dynamic_cast<const GeometryFieldContext *>(
|
||||
|
@ -215,7 +215,7 @@ std::optional<eAttrDomain> CurvesFieldInput::preferred_domain(
|
|||
}
|
||||
|
||||
GVArray PointCloudFieldInput::get_varray_for_context(const fn::FieldContext &context,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
ResourceScope & /*scope*/) const
|
||||
{
|
||||
if (const GeometryFieldContext *geometry_context = dynamic_cast<const GeometryFieldContext *>(
|
||||
|
@ -234,7 +234,7 @@ GVArray PointCloudFieldInput::get_varray_for_context(const fn::FieldContext &con
|
|||
}
|
||||
|
||||
GVArray InstancesFieldInput::get_varray_for_context(const fn::FieldContext &context,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
ResourceScope & /*scope*/) const
|
||||
{
|
||||
if (const GeometryFieldContext *geometry_context = dynamic_cast<const GeometryFieldContext *>(
|
||||
|
@ -253,7 +253,7 @@ GVArray InstancesFieldInput::get_varray_for_context(const fn::FieldContext &cont
|
|||
}
|
||||
|
||||
GVArray AttributeFieldInput::get_varray_for_context(const GeometryFieldContext &context,
|
||||
const IndexMask /*mask*/) const
|
||||
const IndexMask & /*mask*/) const
|
||||
{
|
||||
const eCustomDataType data_type = cpp_type_to_custom_data_type(*type_);
|
||||
if (auto attributes = context.attributes()) {
|
||||
|
@ -308,7 +308,7 @@ static StringRef get_random_id_attribute_name(const eAttrDomain domain)
|
|||
}
|
||||
|
||||
GVArray IDAttributeFieldInput::get_varray_for_context(const GeometryFieldContext &context,
|
||||
const IndexMask mask) const
|
||||
const IndexMask &mask) const
|
||||
{
|
||||
|
||||
const StringRef name = get_random_id_attribute_name(context.domain());
|
||||
|
@ -340,7 +340,7 @@ bool IDAttributeFieldInput::is_equal_to(const fn::FieldNode &other) const
|
|||
}
|
||||
|
||||
GVArray AnonymousAttributeFieldInput::get_varray_for_context(const GeometryFieldContext &context,
|
||||
const IndexMask /*mask*/) const
|
||||
const IndexMask & /*mask*/) const
|
||||
{
|
||||
const eCustomDataType data_type = cpp_type_to_custom_data_type(*type_);
|
||||
return *context.attributes()->lookup(*anonymous_id_, context.domain(), data_type);
|
||||
|
@ -391,7 +391,7 @@ std::optional<eAttrDomain> AnonymousAttributeFieldInput::preferred_domain(
|
|||
namespace blender::bke {
|
||||
|
||||
GVArray NormalFieldInput::get_varray_for_context(const GeometryFieldContext &context,
|
||||
const IndexMask mask) const
|
||||
const IndexMask &mask) const
|
||||
{
|
||||
if (const Mesh *mesh = context.mesh()) {
|
||||
return mesh_normals_varray(*mesh, mask, context.domain());
|
||||
|
|
|
@ -20,7 +20,7 @@ BLI_NOINLINE static void sample_point_attribute(const Span<int> corner_verts,
|
|||
const Span<int> looptri_indices,
|
||||
const Span<float3> bary_coords,
|
||||
const VArray<T> &src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<T> dst)
|
||||
{
|
||||
for (const int i : mask) {
|
||||
|
@ -37,7 +37,7 @@ void sample_point_attribute(const Span<int> corner_verts,
|
|||
const Span<int> looptri_indices,
|
||||
const Span<float3> bary_coords,
|
||||
const GVArray &src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const GMutableSpan dst)
|
||||
{
|
||||
BLI_assert(src.type() == dst.type());
|
||||
|
@ -60,7 +60,7 @@ BLI_NOINLINE static void sample_corner_attribute(const Span<MLoopTri> looptris,
|
|||
const Span<int> looptri_indices,
|
||||
const Span<float3> bary_coords,
|
||||
const VArray<T> &src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<T> dst)
|
||||
{
|
||||
for (const int i : mask) {
|
||||
|
@ -79,7 +79,7 @@ void sample_corner_normals(const Span<MLoopTri> looptris,
|
|||
const Span<int> looptri_indices,
|
||||
const Span<float3> bary_coords,
|
||||
const Span<float3> src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<float3> dst)
|
||||
{
|
||||
for (const int i : mask) {
|
||||
|
@ -93,7 +93,7 @@ void sample_corner_attribute(const Span<MLoopTri> looptris,
|
|||
const Span<int> looptri_indices,
|
||||
const Span<float3> bary_coords,
|
||||
const GVArray &src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const GMutableSpan dst)
|
||||
{
|
||||
BLI_assert(src.type() == dst.type());
|
||||
|
@ -110,7 +110,7 @@ template<typename T>
|
|||
void sample_face_attribute(const Span<int> looptri_polys,
|
||||
const Span<int> looptri_indices,
|
||||
const VArray<T> &src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<T> dst)
|
||||
{
|
||||
for (const int i : mask) {
|
||||
|
@ -123,7 +123,7 @@ void sample_face_attribute(const Span<int> looptri_polys,
|
|||
void sample_face_attribute(const Span<int> looptri_polys,
|
||||
const Span<int> looptri_indices,
|
||||
const GVArray &src,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const GMutableSpan dst)
|
||||
{
|
||||
BLI_assert(src.type() == dst.type());
|
||||
|
@ -141,7 +141,7 @@ static void sample_barycentric_weights(const Span<float3> vert_positions,
|
|||
const Span<MLoopTri> looptris,
|
||||
const Span<int> looptri_indices,
|
||||
const Span<float3> sample_positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
MutableSpan<float3> bary_coords)
|
||||
{
|
||||
for (const int i : mask) {
|
||||
|
@ -163,7 +163,7 @@ static void sample_nearest_weights(const Span<float3> vert_positions,
|
|||
const Span<MLoopTri> looptris,
|
||||
const Span<int> looptri_indices,
|
||||
const Span<float3> sample_positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
MutableSpan<float3> bary_coords)
|
||||
{
|
||||
for (const int i : mask) {
|
||||
|
@ -376,7 +376,7 @@ BaryWeightFromPositionFn::BaryWeightFromPositionFn(GeometrySet geometry)
|
|||
looptris_ = mesh.looptris();
|
||||
}
|
||||
|
||||
void BaryWeightFromPositionFn::call(IndexMask mask,
|
||||
void BaryWeightFromPositionFn::call(const IndexMask &mask,
|
||||
mf::Params params,
|
||||
mf::Context /*context*/) const
|
||||
{
|
||||
|
@ -412,7 +412,7 @@ CornerBaryWeightFromPositionFn::CornerBaryWeightFromPositionFn(GeometrySet geome
|
|||
looptris_ = mesh.looptris();
|
||||
}
|
||||
|
||||
void CornerBaryWeightFromPositionFn::call(IndexMask mask,
|
||||
void CornerBaryWeightFromPositionFn::call(const IndexMask &mask,
|
||||
mf::Params params,
|
||||
mf::Context /*context*/) const
|
||||
{
|
||||
|
@ -441,7 +441,7 @@ BaryWeightSampleFn::BaryWeightSampleFn(GeometrySet geometry, fn::GField src_fiel
|
|||
this->set_signature(&signature_);
|
||||
}
|
||||
|
||||
void BaryWeightSampleFn::call(const IndexMask mask,
|
||||
void BaryWeightSampleFn::call(const IndexMask &mask,
|
||||
mf::Params params,
|
||||
mf::Context /*context*/) const
|
||||
{
|
||||
|
|
|
@ -41,7 +41,10 @@ inline void copy(const Span<T> src, MutableSpan<T> dst, const int64_t grain_size
|
|||
* Fill the destination span by copying masked values from the `src` array. Threaded based on
|
||||
* grain-size.
|
||||
*/
|
||||
void copy(const GVArray &src, IndexMask selection, GMutableSpan dst, int64_t grain_size = 4096);
|
||||
void copy(const GVArray &src,
|
||||
const IndexMask &selection,
|
||||
GMutableSpan dst,
|
||||
int64_t grain_size = 4096);
|
||||
|
||||
/**
|
||||
* Fill the destination span by copying values from the `src` array. Threaded based on
|
||||
|
@ -49,7 +52,7 @@ void copy(const GVArray &src, IndexMask selection, GMutableSpan dst, int64_t gra
|
|||
*/
|
||||
template<typename T>
|
||||
inline void copy(const Span<T> src,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
MutableSpan<T> dst,
|
||||
const int64_t grain_size = 4096)
|
||||
{
|
||||
|
@ -94,7 +97,7 @@ inline void gather(const VArray<T> &src,
|
|||
*/
|
||||
template<typename T, typename IndexT>
|
||||
inline void gather(const Span<T> src,
|
||||
const IndexMask indices,
|
||||
const IndexMask &indices,
|
||||
MutableSpan<T> dst,
|
||||
const int64_t grain_size = 4096)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ void copy(const GVArray &src, GMutableSpan dst, const int64_t grain_size)
|
|||
}
|
||||
|
||||
void copy(const GVArray &src,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
GMutableSpan dst,
|
||||
const int64_t grain_size)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ void copy(const GVArray &src,
|
|||
}
|
||||
|
||||
void gather(const GVArray &src,
|
||||
const IndexMask indices,
|
||||
const IndexMask &indices,
|
||||
GMutableSpan dst,
|
||||
const int64_t grain_size)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ void gather(const GVArray &src,
|
|||
});
|
||||
}
|
||||
|
||||
void gather(const GSpan src, const IndexMask indices, GMutableSpan dst, const int64_t grain_size)
|
||||
void gather(const GSpan src, const IndexMask &indices, GMutableSpan dst, const int64_t grain_size)
|
||||
{
|
||||
gather(GVArray::ForSpan(src), indices, dst, grain_size);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ void report_invalid_uv_map(ReportList *reports)
|
|||
}
|
||||
|
||||
void CurvesConstraintSolver::initialize(const bke::CurvesGeometry &curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const bool use_surface_collision)
|
||||
{
|
||||
use_surface_collision_ = use_surface_collision;
|
||||
|
@ -448,7 +448,7 @@ void CurvesConstraintSolver::initialize(const bke::CurvesGeometry &curves,
|
|||
}
|
||||
|
||||
void CurvesConstraintSolver::solve_step(bke::CurvesGeometry &curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const Mesh *surface,
|
||||
const CurvesSurfaceTransforms &transforms)
|
||||
{
|
||||
|
|
|
@ -155,11 +155,11 @@ struct CurvesConstraintSolver {
|
|||
|
||||
public:
|
||||
void initialize(const bke::CurvesGeometry &curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const bool use_surface_collision);
|
||||
|
||||
void solve_step(bke::CurvesGeometry &curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const Mesh *surface,
|
||||
const CurvesSurfaceTransforms &transforms);
|
||||
|
||||
|
|
|
@ -8,16 +8,16 @@ namespace blender::geometry::curve_constraints {
|
|||
|
||||
void compute_segment_lengths(OffsetIndices<int> points_by_curve,
|
||||
Span<float3> positions,
|
||||
IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
MutableSpan<float> r_segment_lengths);
|
||||
|
||||
void solve_length_constraints(OffsetIndices<int> points_by_curve,
|
||||
IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
Span<float> segment_lenghts,
|
||||
MutableSpan<float3> positions);
|
||||
|
||||
void solve_length_and_collision_constraints(OffsetIndices<int> points_by_curve,
|
||||
IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
Span<float> segment_lengths,
|
||||
Span<float3> start_positions,
|
||||
const Mesh &surface,
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace blender::geometry {
|
|||
|
||||
bke::CurvesGeometry fillet_curves_poly(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const VArray<float> &radius,
|
||||
const VArray<int> &counts,
|
||||
bool limit_radius,
|
||||
|
@ -19,7 +19,7 @@ bke::CurvesGeometry fillet_curves_poly(
|
|||
|
||||
bke::CurvesGeometry fillet_curves_bezier(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const VArray<float> &radius,
|
||||
bool limit_radius,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info);
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace blender::geometry {
|
|||
* avoid copying the input. Otherwise returns the new mesh with merged geometry.
|
||||
*/
|
||||
std::optional<Mesh *> mesh_merge_by_distance_all(const Mesh &mesh,
|
||||
IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
float merge_distance);
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace blender::geometry {
|
|||
PointCloud *point_merge_by_distance(
|
||||
const PointCloud &src_points,
|
||||
const float merge_distance,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info);
|
||||
|
||||
} // namespace blender::geometry
|
||||
|
|
|
@ -26,7 +26,7 @@ bool try_curves_conversion_in_place(const IndexMask &selection,
|
|||
* Change the types of the selected curves, potentially changing the total point count.
|
||||
*/
|
||||
bke::CurvesGeometry convert_curves(const bke::CurvesGeometry &src_curves,
|
||||
IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
CurveType dst_type,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace blender::geometry {
|
|||
*/
|
||||
bke::CurvesGeometry subdivide_curves(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const VArray<int> &cuts,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace blender::geometry {
|
|||
* between the start and end points.
|
||||
*/
|
||||
bke::CurvesGeometry trim_curves(const bke::CurvesGeometry &src_curves,
|
||||
IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const VArray<float> &starts,
|
||||
const VArray<float> &ends,
|
||||
GeometryNodeCurveSampleMode mode,
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace blender::geometry::curve_constraints {
|
|||
|
||||
void compute_segment_lengths(const OffsetIndices<int> points_by_curve,
|
||||
const Span<float3> positions,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
MutableSpan<float> r_segment_lengths)
|
||||
{
|
||||
BLI_assert(r_segment_lengths.size() == points_by_curve.total_size());
|
||||
|
@ -37,7 +37,7 @@ void compute_segment_lengths(const OffsetIndices<int> points_by_curve,
|
|||
}
|
||||
|
||||
void solve_length_constraints(const OffsetIndices<int> points_by_curve,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const Span<float> segment_lenghts,
|
||||
MutableSpan<float3> positions)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ void solve_length_constraints(const OffsetIndices<int> points_by_curve,
|
|||
}
|
||||
|
||||
void solve_length_and_collision_constraints(const OffsetIndices<int> points_by_curve,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const Span<float> segment_lengths_cu,
|
||||
const Span<float3> start_positions_cu,
|
||||
const Mesh &surface,
|
||||
|
|
|
@ -28,7 +28,7 @@ static void threaded_slice_fill(const Span<T> src,
|
|||
template<typename T>
|
||||
static void duplicate_fillet_point_data(const OffsetIndices<int> src_points_by_curve,
|
||||
const OffsetIndices<int> dst_points_by_curve,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const Span<int> all_point_offsets,
|
||||
const Span<T> src,
|
||||
MutableSpan<T> dst)
|
||||
|
@ -45,7 +45,7 @@ static void duplicate_fillet_point_data(const OffsetIndices<int> src_points_by_c
|
|||
|
||||
static void duplicate_fillet_point_data(const OffsetIndices<int> src_points_by_curve,
|
||||
const OffsetIndices<int> dst_points_by_curve,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<int> all_point_offsets,
|
||||
const GSpan src,
|
||||
GMutableSpan dst)
|
||||
|
@ -62,7 +62,7 @@ static void duplicate_fillet_point_data(const OffsetIndices<int> src_points_by_c
|
|||
}
|
||||
|
||||
static void calculate_result_offsets(const OffsetIndices<int> src_points_by_curve,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<IndexRange> unselected_ranges,
|
||||
const VArray<float> &radii,
|
||||
const VArray<int> &counts,
|
||||
|
@ -393,7 +393,7 @@ static void calculate_bezier_handles_poly_mode(const Span<float3> src_handles_l,
|
|||
|
||||
static bke::CurvesGeometry fillet_curves(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const VArray<float> &radius_input,
|
||||
const VArray<int> &counts,
|
||||
const bool limit_radius,
|
||||
|
@ -549,7 +549,7 @@ static bke::CurvesGeometry fillet_curves(
|
|||
|
||||
bke::CurvesGeometry fillet_curves_poly(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const VArray<float> &radius,
|
||||
const VArray<int> &count,
|
||||
const bool limit_radius,
|
||||
|
@ -561,7 +561,7 @@ bke::CurvesGeometry fillet_curves_poly(
|
|||
|
||||
bke::CurvesGeometry fillet_curves_bezier(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask curve_selection,
|
||||
const IndexMask &curve_selection,
|
||||
const VArray<float> &radius,
|
||||
const bool limit_radius,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info)
|
||||
|
|
|
@ -1727,7 +1727,7 @@ static Mesh *create_merged_mesh(const Mesh &mesh,
|
|||
* \{ */
|
||||
|
||||
std::optional<Mesh *> mesh_merge_by_distance_all(const Mesh &mesh,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const float merge_distance)
|
||||
{
|
||||
Array<int> vert_dest_map(mesh.totvert, OUT_OF_CONTEXT);
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace blender::geometry {
|
|||
|
||||
PointCloud *point_merge_by_distance(const PointCloud &src_points,
|
||||
const float merge_distance,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
const bke::AttributeAccessor src_attributes = src_points.attributes();
|
||||
|
|
|
@ -279,7 +279,7 @@ static int to_nurbs_size(const CurveType src_type, const int src_size)
|
|||
|
||||
static bke::CurvesGeometry convert_curves_to_bezier(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
const OffsetIndices src_points_by_curve = src_curves.points_by_curve();
|
||||
|
@ -324,7 +324,7 @@ static bke::CurvesGeometry convert_curves_to_bezier(
|
|||
propagation_info,
|
||||
attributes_to_skip);
|
||||
|
||||
auto catmull_rom_to_bezier = [&](IndexMask selection) {
|
||||
auto catmull_rom_to_bezier = [&](const IndexMask &selection) {
|
||||
bke::curves::fill_points<int8_t>(
|
||||
dst_points_by_curve, selection, BEZIER_HANDLE_ALIGN, dst_types_l);
|
||||
bke::curves::fill_points<int8_t>(
|
||||
|
@ -347,7 +347,7 @@ static bke::CurvesGeometry convert_curves_to_bezier(
|
|||
}
|
||||
};
|
||||
|
||||
auto poly_to_bezier = [&](IndexMask selection) {
|
||||
auto poly_to_bezier = [&](const IndexMask &selection) {
|
||||
bke::curves::copy_point_data(
|
||||
src_points_by_curve, dst_points_by_curve, selection, src_positions, dst_positions);
|
||||
bke::curves::fill_points<int8_t>(
|
||||
|
@ -361,7 +361,7 @@ static bke::CurvesGeometry convert_curves_to_bezier(
|
|||
}
|
||||
};
|
||||
|
||||
auto bezier_to_bezier = [&](IndexMask selection) {
|
||||
auto bezier_to_bezier = [&](const IndexMask &selection) {
|
||||
const VArraySpan<int8_t> src_types_l = src_curves.handle_types_left();
|
||||
const VArraySpan<int8_t> src_types_r = src_curves.handle_types_right();
|
||||
const Span<float3> src_handles_l = src_curves.handle_positions_left();
|
||||
|
@ -386,7 +386,7 @@ static bke::CurvesGeometry convert_curves_to_bezier(
|
|||
}
|
||||
};
|
||||
|
||||
auto nurbs_to_bezier = [&](IndexMask selection) {
|
||||
auto nurbs_to_bezier = [&](const IndexMask &selection) {
|
||||
bke::curves::fill_points<int8_t>(
|
||||
dst_points_by_curve, selection, BEZIER_HANDLE_ALIGN, dst_types_l);
|
||||
bke::curves::fill_points<int8_t>(
|
||||
|
@ -463,7 +463,7 @@ static bke::CurvesGeometry convert_curves_to_bezier(
|
|||
|
||||
static bke::CurvesGeometry convert_curves_to_nurbs(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
const OffsetIndices src_points_by_curve = src_curves.points_by_curve();
|
||||
|
@ -500,7 +500,7 @@ static bke::CurvesGeometry convert_curves_to_nurbs(
|
|||
"handle_left",
|
||||
"nurbs_weight"});
|
||||
|
||||
auto fill_weights_if_necessary = [&](const IndexMask selection) {
|
||||
auto fill_weights_if_necessary = [&](const IndexMask &selection) {
|
||||
if (src_attributes.contains("nurbs_weight")) {
|
||||
bke::curves::fill_points(
|
||||
dst_points_by_curve, selection, 1.0f, dst_curves.nurbs_weights_for_write());
|
||||
|
@ -589,7 +589,7 @@ static bke::CurvesGeometry convert_curves_to_nurbs(
|
|||
}
|
||||
};
|
||||
|
||||
auto nurbs_to_nurbs = [&](IndexMask selection) {
|
||||
auto nurbs_to_nurbs = [&](const IndexMask &selection) {
|
||||
bke::curves::copy_point_data(
|
||||
src_points_by_curve, dst_points_by_curve, selection, src_positions, dst_positions);
|
||||
|
||||
|
@ -631,7 +631,7 @@ static bke::CurvesGeometry convert_curves_to_nurbs(
|
|||
}
|
||||
|
||||
static bke::CurvesGeometry convert_curves_trivial(const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const CurveType dst_type)
|
||||
{
|
||||
bke::CurvesGeometry dst_curves(src_curves);
|
||||
|
@ -641,7 +641,7 @@ static bke::CurvesGeometry convert_curves_trivial(const bke::CurvesGeometry &src
|
|||
}
|
||||
|
||||
bke::CurvesGeometry convert_curves(const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const CurveType dst_type,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
|
@ -658,7 +658,7 @@ bke::CurvesGeometry convert_curves(const bke::CurvesGeometry &src_curves,
|
|||
return {};
|
||||
}
|
||||
|
||||
bool try_curves_conversion_in_place(const IndexMask selection,
|
||||
bool try_curves_conversion_in_place(const IndexMask &selection,
|
||||
const CurveType dst_type,
|
||||
FunctionRef<bke::CurvesGeometry &()> get_writable_curves_fn)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace blender::geometry {
|
||||
|
||||
static void calculate_result_offsets(const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<IndexRange> unselected_ranges,
|
||||
const VArray<int> &cuts,
|
||||
const Span<bool> cyclic,
|
||||
|
@ -64,7 +64,7 @@ static inline void linear_interpolation(const T &a, const T &b, MutableSpan<T> d
|
|||
template<typename T>
|
||||
static void subdivide_attribute_linear(const OffsetIndices<int> src_points_by_curve,
|
||||
const OffsetIndices<int> dst_points_by_curve,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<int> all_point_offsets,
|
||||
const Span<T> src,
|
||||
MutableSpan<T> dst)
|
||||
|
@ -92,7 +92,7 @@ static void subdivide_attribute_linear(const OffsetIndices<int> src_points_by_cu
|
|||
|
||||
static void subdivide_attribute_linear(const OffsetIndices<int> src_points_by_curve,
|
||||
const OffsetIndices<int> dst_points_by_curve,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<int> all_point_offsets,
|
||||
const GSpan src,
|
||||
GMutableSpan dst)
|
||||
|
@ -111,7 +111,7 @@ static void subdivide_attribute_linear(const OffsetIndices<int> src_points_by_cu
|
|||
template<typename T>
|
||||
static void subdivide_attribute_catmull_rom(const OffsetIndices<int> src_points_by_curve,
|
||||
const OffsetIndices<int> dst_points_by_curve,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<int> all_point_offsets,
|
||||
const Span<bool> cyclic,
|
||||
const Span<T> src,
|
||||
|
@ -131,7 +131,7 @@ static void subdivide_attribute_catmull_rom(const OffsetIndices<int> src_points_
|
|||
|
||||
static void subdivide_attribute_catmull_rom(const OffsetIndices<int> src_points_by_curve,
|
||||
const OffsetIndices<int> dst_points_by_curve,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<int> all_point_offsets,
|
||||
const Span<bool> cyclic,
|
||||
const GSpan src,
|
||||
|
@ -290,7 +290,7 @@ static void subdivide_bezier_positions(const Span<float3> src_positions,
|
|||
|
||||
bke::CurvesGeometry subdivide_curves(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const VArray<int> &cuts,
|
||||
const bke::AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ void simulation_state_to_values(const Span<NodeSimulationItem> node_simulation_i
|
|||
|
||||
void copy_with_checked_indices(const GVArray &src,
|
||||
const VArray<int> &indices,
|
||||
IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
GMutableSpan dst);
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
|
|
@ -148,7 +148,7 @@ static Array<Vector<int>> build_vert_to_vert_by_edge_map(const Span<int2> edges,
|
|||
|
||||
static Array<Vector<int>> build_edge_to_edge_by_vert_map(const Span<int2> edges,
|
||||
const int verts_num,
|
||||
const IndexMask edge_mask)
|
||||
const IndexMask &edge_mask)
|
||||
{
|
||||
Array<Vector<int>> map(edges.size());
|
||||
Array<Vector<int>> vert_to_edge_map = bke::mesh_topology::build_vert_to_edge_map(edges,
|
||||
|
@ -190,7 +190,7 @@ static Array<Vector<int>> build_face_to_edge_by_loop_map(const OffsetIndices<int
|
|||
static Array<Vector<int>> build_face_to_face_by_edge_map(const OffsetIndices<int> polys,
|
||||
const Span<int> corner_edges,
|
||||
const int edges_num,
|
||||
const IndexMask poly_mask)
|
||||
const IndexMask &poly_mask)
|
||||
{
|
||||
Array<Vector<int>> map(polys.size());
|
||||
Array<Vector<int>> faces_by_edge = build_face_to_edge_by_loop_map(
|
||||
|
|
|
@ -64,7 +64,7 @@ struct IndexAttributes {
|
|||
/** \name Utility Functions
|
||||
* \{ */
|
||||
|
||||
static OffsetIndices<int> accumulate_counts_to_offsets(const IndexMask selection,
|
||||
static OffsetIndices<int> accumulate_counts_to_offsets(const IndexMask &selection,
|
||||
const VArray<int> &counts,
|
||||
Array<int> &r_offset_data)
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ static OffsetIndices<int> accumulate_counts_to_offsets(const IndexMask selection
|
|||
/* Utility functions for threaded copying of attribute data where possible. */
|
||||
template<typename T>
|
||||
static void threaded_slice_fill(const OffsetIndices<int> offsets,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const Span<T> src,
|
||||
MutableSpan<T> dst)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ static void threaded_slice_fill(const OffsetIndices<int> offsets,
|
|||
}
|
||||
|
||||
static void threaded_slice_fill(const OffsetIndices<int> offsets,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const GSpan src,
|
||||
GMutableSpan dst)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ static void threaded_id_offset_copy(const OffsetIndices<int> offsets,
|
|||
/** Create the copy indices for the duplication domain. */
|
||||
static void create_duplicate_index_attribute(bke::MutableAttributeAccessor attributes,
|
||||
const eAttrDomain output_domain,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const IndexAttributes &attribute_outputs,
|
||||
const OffsetIndices<int> offsets)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ static void copy_stable_id_point(const OffsetIndices<int> offsets,
|
|||
}
|
||||
|
||||
static void copy_attributes_without_id(const OffsetIndices<int> offsets,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const AnonymousAttributePropagationInfo &propagation_info,
|
||||
const eAttrDomain domain,
|
||||
const bke::AttributeAccessor src_attributes,
|
||||
|
@ -209,7 +209,7 @@ static void copy_attributes_without_id(const OffsetIndices<int> offsets,
|
|||
*/
|
||||
static void copy_curve_attributes_without_id(
|
||||
const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const OffsetIndices<int> curve_offsets,
|
||||
const AnonymousAttributePropagationInfo &propagation_info,
|
||||
bke::CurvesGeometry &dst_curves)
|
||||
|
@ -258,7 +258,7 @@ static void copy_curve_attributes_without_id(
|
|||
* then loop over the remaining ones point by point, hashing their ids to the new ids.
|
||||
*/
|
||||
static void copy_stable_id_curves(const bke::CurvesGeometry &src_curves,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const OffsetIndices<int> offsets,
|
||||
bke::CurvesGeometry &dst_curves)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ static void copy_face_attributes_without_id(
|
|||
const Span<int> vert_mapping,
|
||||
const Span<int> loop_mapping,
|
||||
const OffsetIndices<int> offsets,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const AnonymousAttributePropagationInfo &propagation_info,
|
||||
const bke::AttributeAccessor src_attributes,
|
||||
bke::MutableAttributeAccessor dst_attributes)
|
||||
|
@ -429,7 +429,7 @@ static void copy_face_attributes_without_id(
|
|||
* `face->edge->vert` mapping would mean creating a 1/1 mapping to allow for it, is it worth it?
|
||||
*/
|
||||
static void copy_stable_id_faces(const Mesh &mesh,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const OffsetIndices<int> poly_offsets,
|
||||
const Span<int> vert_mapping,
|
||||
const bke::AttributeAccessor src_attributes,
|
||||
|
@ -593,7 +593,7 @@ static void duplicate_faces(GeometrySet &geometry_set,
|
|||
static void copy_edge_attributes_without_id(
|
||||
const Span<int> point_mapping,
|
||||
const OffsetIndices<int> offsets,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const AnonymousAttributePropagationInfo &propagation_info,
|
||||
const bke::AttributeAccessor src_attributes,
|
||||
bke::MutableAttributeAccessor dst_attributes)
|
||||
|
@ -625,7 +625,7 @@ static void copy_edge_attributes_without_id(
|
|||
* and the duplicate number. This function is used for points when duplicating the edge domain.
|
||||
*/
|
||||
static void copy_stable_id_edges(const Mesh &mesh,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const OffsetIndices<int> offsets,
|
||||
const bke::AttributeAccessor src_attributes,
|
||||
bke::MutableAttributeAccessor dst_attributes)
|
||||
|
|
|
@ -20,7 +20,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
|
||||
static Curves *edge_paths_to_curves_convert(
|
||||
const Mesh &mesh,
|
||||
const IndexMask start_verts_mask,
|
||||
const IndexMask &start_verts_mask,
|
||||
const Span<int> next_indices,
|
||||
const AnonymousAttributePropagationInfo &propagation_info)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
}
|
||||
|
||||
static void edge_paths_to_selection(const Mesh &src_mesh,
|
||||
const IndexMask start_selection,
|
||||
const IndexMask &start_selection,
|
||||
const Span<int> next_indices,
|
||||
MutableSpan<bool> r_selection)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ EvaluateAtIndexInput::EvaluateAtIndexInput(Field<int> index_field,
|
|||
}
|
||||
|
||||
GVArray EvaluateAtIndexInput::get_varray_for_context(const bke::GeometryFieldContext &context,
|
||||
const IndexMask mask) const
|
||||
const IndexMask &mask) const
|
||||
{
|
||||
const std::optional<AttributeAccessor> attributes = context.attributes();
|
||||
if (!attributes) {
|
||||
|
|
|
@ -71,7 +71,7 @@ struct AttributeOutputs {
|
|||
static void save_selection_as_attribute(Mesh &mesh,
|
||||
const AnonymousAttributeID *id,
|
||||
const eAttrDomain domain,
|
||||
const IndexMask selection)
|
||||
const IndexMask &selection)
|
||||
{
|
||||
MutableAttributeAccessor attributes = mesh.attributes_for_write();
|
||||
BLI_assert(!attributes.contains(id));
|
||||
|
|
|
@ -18,7 +18,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_output<decl::Bool>(N_("Has Neighbor")).field_source();
|
||||
}
|
||||
|
||||
static KDTree_3d *build_kdtree(const Span<float3> positions, const IndexMask mask)
|
||||
static KDTree_3d *build_kdtree(const Span<float3> positions, const IndexMask &mask)
|
||||
{
|
||||
KDTree_3d *tree = BLI_kdtree_3d_new(mask.size());
|
||||
for (const int index : mask) {
|
||||
|
@ -38,7 +38,7 @@ static int find_nearest_non_self(const KDTree_3d &tree, const float3 &position,
|
|||
|
||||
static void find_neighbors(const KDTree_3d &tree,
|
||||
const Span<float3> positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
MutableSpan<int> r_indices)
|
||||
{
|
||||
threading::parallel_for(mask.index_range(), 1024, [&](const IndexRange range) {
|
||||
|
@ -62,7 +62,7 @@ class IndexOfNearestFieldInput final : public bke::GeometryFieldInput {
|
|||
}
|
||||
|
||||
GVArray get_varray_for_context(const bke::GeometryFieldContext &context,
|
||||
const IndexMask mask) const final
|
||||
const IndexMask &mask) const final
|
||||
{
|
||||
if (!context.attributes()) {
|
||||
return {};
|
||||
|
@ -110,15 +110,15 @@ class IndexOfNearestFieldInput final : public bke::GeometryFieldInput {
|
|||
result.reinitialize(domain_size);
|
||||
}
|
||||
|
||||
const auto build_group_masks = [&](const IndexMask mask,
|
||||
const auto build_group_masks = [&](const IndexMask &mask,
|
||||
MutableSpan<Vector<int64_t>> r_groups) {
|
||||
for (const int index : mask) {
|
||||
mask.foreach_index([&](const int index) {
|
||||
const int group_id = group_ids_span[index];
|
||||
const int index_of_group = group_indexing.index_of_try(group_id);
|
||||
if (index_of_group != -1) {
|
||||
r_groups[index_of_group].append(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
threading::parallel_invoke(
|
||||
|
@ -187,7 +187,7 @@ class HasNeighborFieldInput final : public bke::GeometryFieldInput {
|
|||
}
|
||||
|
||||
GVArray get_varray_for_context(const bke::GeometryFieldContext &context,
|
||||
const IndexMask mask) const final
|
||||
const IndexMask &mask) const final
|
||||
{
|
||||
if (!context.attributes()) {
|
||||
return {};
|
||||
|
|
|
@ -22,7 +22,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
|
||||
static VArray<bool> select_mesh_faces_by_material(const Mesh &mesh,
|
||||
const Material *material,
|
||||
const IndexMask face_mask)
|
||||
const IndexMask &face_mask)
|
||||
{
|
||||
Vector<int> slots;
|
||||
for (const int slot_i : IndexRange(mesh.totcol)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ static void geo_proximity_init(bNodeTree * /*tree*/, bNode *node)
|
|||
}
|
||||
|
||||
static bool calculate_mesh_proximity(const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const Mesh &mesh,
|
||||
const GeometryNodeProximityTargetType type,
|
||||
const MutableSpan<float> r_distances,
|
||||
|
@ -91,7 +91,7 @@ static bool calculate_mesh_proximity(const VArray<float3> &positions,
|
|||
}
|
||||
|
||||
static bool calculate_pointcloud_proximity(const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const PointCloud &pointcloud,
|
||||
MutableSpan<float> r_distances,
|
||||
MutableSpan<float3> r_locations)
|
||||
|
@ -150,7 +150,7 @@ class ProximityFunction : public mf::MultiFunction {
|
|||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
void call(IndexMask mask, mf::Params params, mf::Context /*context*/) const override
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<float3> &src_positions = params.readonly_single_input<float3>(0,
|
||||
"Source Position");
|
||||
|
|
|
@ -118,7 +118,7 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
|
|||
}
|
||||
}
|
||||
|
||||
static void raycast_to_mesh(IndexMask mask,
|
||||
static void raycast_to_mesh(const IndexMask &mask,
|
||||
const Mesh &mesh,
|
||||
const VArray<float3> &ray_origins,
|
||||
const VArray<float3> &ray_directions,
|
||||
|
@ -216,7 +216,7 @@ class RaycastFunction : public mf::MultiFunction {
|
|||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
void call(IndexMask mask, mf::Params params, mf::Context /*context*/) const override
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const override
|
||||
{
|
||||
BLI_assert(target_.has_mesh());
|
||||
const Mesh &mesh = *target_.get_mesh_for_read();
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace blender::nodes {
|
|||
template<typename T>
|
||||
void copy_with_checked_indices(const VArray<T> &src,
|
||||
const VArray<int> &indices,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
MutableSpan<T> dst)
|
||||
{
|
||||
const IndexRange src_range = src.index_range();
|
||||
|
@ -37,7 +37,7 @@ void copy_with_checked_indices(const VArray<T> &src,
|
|||
|
||||
void copy_with_checked_indices(const GVArray &src,
|
||||
const VArray<int> &indices,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
GMutableSpan dst)
|
||||
{
|
||||
bke::attribute_math::convert_to_static_type(src.type(), [&](auto dummy) {
|
||||
|
@ -172,7 +172,7 @@ static const GeometryComponent *find_source_component(const GeometrySet &geometr
|
|||
template<typename T>
|
||||
void copy_with_clamped_indices(const VArray<T> &src,
|
||||
const VArray<int> &indices,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
MutableSpan<T> dst)
|
||||
{
|
||||
const int last_index = src.index_range().last();
|
||||
|
@ -237,7 +237,7 @@ class SampleIndexFunction : public mf::MultiFunction {
|
|||
src_data_ = &evaluator_->get_evaluated(0);
|
||||
}
|
||||
|
||||
void call(IndexMask mask, mf::Params params, mf::Context /*context*/) const override
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<int> &indices = params.readonly_single_input<int>(0, "Index");
|
||||
GMutableSpan dst = params.uninitialized_single_output(1, "Value");
|
||||
|
@ -336,7 +336,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
index = std::clamp(index, 0, domain_size - 1);
|
||||
}
|
||||
if (index >= 0 && index < domain_size) {
|
||||
const IndexMask mask = IndexRange(index, 1);
|
||||
const IndexMask &mask = IndexRange(index, 1);
|
||||
const bke::GeometryFieldContext geometry_context(*component, domain);
|
||||
FieldEvaluator evaluator(geometry_context, &mask);
|
||||
evaluator.add(value_field);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace blender::nodes {
|
|||
|
||||
void get_closest_in_bvhtree(BVHTreeFromMesh &tree_data,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_indices,
|
||||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
|
@ -69,7 +69,7 @@ static void node_init(bNodeTree * /*tree*/, bNode *node)
|
|||
|
||||
static void get_closest_pointcloud_points(const PointCloud &pointcloud,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_indices,
|
||||
const MutableSpan<float> r_distances_sq)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ static void get_closest_pointcloud_points(const PointCloud &pointcloud,
|
|||
|
||||
static void get_closest_mesh_points(const Mesh &mesh,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_point_indices,
|
||||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
|
@ -110,7 +110,7 @@ static void get_closest_mesh_points(const Mesh &mesh,
|
|||
|
||||
static void get_closest_mesh_edges(const Mesh &mesh,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_edge_indices,
|
||||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
|
@ -124,7 +124,7 @@ static void get_closest_mesh_edges(const Mesh &mesh,
|
|||
|
||||
static void get_closest_mesh_looptris(const Mesh &mesh,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_looptri_indices,
|
||||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
|
@ -139,7 +139,7 @@ static void get_closest_mesh_looptris(const Mesh &mesh,
|
|||
|
||||
static void get_closest_mesh_polys(const Mesh &mesh,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_poly_indices,
|
||||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
|
@ -159,7 +159,7 @@ static void get_closest_mesh_polys(const Mesh &mesh,
|
|||
/* The closest corner is defined to be the closest corner on the closest face. */
|
||||
static void get_closest_mesh_corners(const Mesh &mesh,
|
||||
const VArray<float3> &positions,
|
||||
const IndexMask mask,
|
||||
const IndexMask &mask,
|
||||
const MutableSpan<int> r_corner_indices,
|
||||
const MutableSpan<float> r_distances_sq,
|
||||
const MutableSpan<float3> r_positions)
|
||||
|
@ -251,7 +251,7 @@ class SampleNearestFunction : public mf::MultiFunction {
|
|||
this->set_signature(&signature_);
|
||||
}
|
||||
|
||||
void call(IndexMask mask, mf::Params params, mf::Context /*context*/) const override
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<float3> &positions = params.readonly_single_input<float3>(0, "Position");
|
||||
MutableSpan<int> indices = params.uninitialized_single_output<int>(1, "Index");
|
||||
|
|
|
@ -135,7 +135,7 @@ class ReverseUVSampleFunction : public mf::MultiFunction {
|
|||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
void call(IndexMask mask, mf::Params params, mf::Context /*context*/) const override
|
||||
void call(const IndexMask &mask, mf::Params params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArraySpan<float2> sample_uvs = params.readonly_single_input<float2>(0, "Sample UV");
|
||||
MutableSpan<bool> is_valid = params.uninitialized_single_output_if_required<bool>(1,
|
||||
|
|
|
@ -237,7 +237,8 @@ static void scale_vertex_islands_on_axis(Mesh &mesh,
|
|||
BKE_mesh_tag_positions_changed(&mesh);
|
||||
}
|
||||
|
||||
static Vector<ElementIsland> prepare_face_islands(const Mesh &mesh, const IndexMask face_selection)
|
||||
static Vector<ElementIsland> prepare_face_islands(const Mesh &mesh,
|
||||
const IndexMask &face_selection)
|
||||
{
|
||||
const OffsetIndices polys = mesh.polys();
|
||||
const Span<int> corner_verts = mesh.corner_verts();
|
||||
|
@ -328,7 +329,8 @@ static void scale_faces_uniformly(Mesh &mesh, const UniformScaleFields &fields)
|
|||
scale_vertex_islands_uniformly(mesh, island, params, get_face_verts);
|
||||
}
|
||||
|
||||
static Vector<ElementIsland> prepare_edge_islands(const Mesh &mesh, const IndexMask edge_selection)
|
||||
static Vector<ElementIsland> prepare_edge_islands(const Mesh &mesh,
|
||||
const IndexMask &edge_selection)
|
||||
{
|
||||
const Span<int2> edges = mesh.edges();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
|
||||
}
|
||||
|
||||
static void assign_material_to_faces(Mesh &mesh, const IndexMask selection, Material *material)
|
||||
static void assign_material_to_faces(Mesh &mesh, const IndexMask &selection, Material *material)
|
||||
{
|
||||
if (selection.size() != mesh.totpoly) {
|
||||
/* If the entire mesh isn't selected, and there is no material slot yet, add an empty
|
||||
|
|
|
@ -26,7 +26,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
|||
static void set_computed_position_and_offset(GeometryComponent &component,
|
||||
const VArray<float3> &in_positions,
|
||||
const VArray<float3> &in_offsets,
|
||||
const IndexMask selection)
|
||||
const IndexMask &selection)
|
||||
{
|
||||
MutableAttributeAccessor attributes = *component.attributes_for_write();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ static void geo_triangulate_init(bNodeTree * /*tree*/, bNode *node)
|
|||
static Mesh *triangulate_mesh_selection(const Mesh &mesh,
|
||||
const int quad_method,
|
||||
const int ngon_method,
|
||||
const IndexMask selection,
|
||||
const IndexMask &selection,
|
||||
const int min_vertices)
|
||||
{
|
||||
CustomData_MeshMasks cd_mask_extra = {
|
||||
|
|
Loading…
Reference in New Issue