diff options
Diffstat (limited to 'source')
55 files changed, 214 insertions, 274 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index e36163878a5..36f29c7fbb7 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -4,14 +4,13 @@ #include <mutex> -#include "FN_generic_span.hh" -#include "FN_generic_virtual_array.hh" - #include "BKE_anonymous_attribute.hh" #include "BKE_attribute.h" #include "BLI_color.hh" #include "BLI_function_ref.hh" +#include "BLI_generic_span.hh" +#include "BLI_generic_virtual_array.hh" #include "BLI_math_vec_types.hh" /** @@ -132,9 +131,9 @@ struct AttributeInitDefault : public AttributeInit { * Note that this can be used to fill the new attribute with the default */ struct AttributeInitVArray : public AttributeInit { - blender::fn::GVArray varray; + blender::GVArray varray; - AttributeInitVArray(blender::fn::GVArray varray) + AttributeInitVArray(blender::GVArray varray) : AttributeInit(Type::VArray), varray(std::move(varray)) { } @@ -165,9 +164,6 @@ using AttributeForeachCallback = blender::FunctionRef<bool( namespace blender::bke { -using fn::GVArray; -using fn::GVMutableArray; - const CPPType *custom_data_type_to_cpp_type(const CustomDataType type); CustomDataType cpp_type_to_custom_data_type(const CPPType &type); CustomDataType attribute_data_type_highest_complexity(Span<CustomDataType> data_types); @@ -237,7 +233,7 @@ class OutputAttribute { GVMutableArray varray_; AttributeDomain domain_ = ATTR_DOMAIN_AUTO; SaveFn save_; - std::unique_ptr<fn::GVMutableArray_GSpan> optional_span_varray_; + std::unique_ptr<GVMutableArray_GSpan> optional_span_varray_; bool ignore_old_values_ = false; bool save_has_been_called_ = false; @@ -254,13 +250,13 @@ class OutputAttribute { operator bool() const; GVMutableArray &operator*(); - fn::GVMutableArray *operator->(); + GVMutableArray *operator->(); GVMutableArray &varray(); AttributeDomain domain() const; const CPPType &cpp_type() const; CustomDataType custom_data_type() const; - fn::GMutableSpan as_span(); + GMutableSpan as_span(); template<typename T> MutableSpan<T> as_span(); void save(); @@ -374,16 +370,16 @@ class CustomDataAttributes { void clear(); - std::optional<blender::fn::GSpan> get_for_read(const AttributeIDRef &attribute_id) const; + std::optional<blender::GSpan> get_for_read(const AttributeIDRef &attribute_id) const; /** * Return a virtual array for a stored attribute, or a single value virtual array with the * default value if the attribute doesn't exist. If no default value is provided, the default * value for the type will be used. */ - blender::fn::GVArray get_for_read(const AttributeIDRef &attribute_id, - const CustomDataType data_type, - const void *default_value) const; + blender::GVArray get_for_read(const AttributeIDRef &attribute_id, + const CustomDataType data_type, + const void *default_value) const; template<typename T> blender::VArray<T> get_for_read(const AttributeIDRef &attribute_id, const T &default_value) const @@ -394,7 +390,7 @@ class CustomDataAttributes { return varray.typed<T>(); } - std::optional<blender::fn::GMutableSpan> get_for_write(const AttributeIDRef &attribute_id); + std::optional<blender::GMutableSpan> get_for_write(const AttributeIDRef &attribute_id); bool create(const AttributeIDRef &attribute_id, const CustomDataType data_type); bool create_by_move(const AttributeIDRef &attribute_id, const CustomDataType data_type, @@ -514,7 +510,7 @@ inline GVMutableArray &OutputAttribute::operator*() return varray_; } -inline fn::GVMutableArray *OutputAttribute::operator->() +inline GVMutableArray *OutputAttribute::operator->() { return &varray_; } diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh index 93b98a01fce..ea378c5a0a5 100644 --- a/source/blender/blenkernel/BKE_curves.hh +++ b/source/blender/blenkernel/BKE_curves.hh @@ -12,6 +12,7 @@ #include <mutex> #include "BLI_float4x4.hh" +#include "BLI_generic_virtual_array.hh" #include "BLI_index_mask.hh" #include "BLI_math_vec_types.hh" #include "BLI_span.hh" @@ -21,8 +22,6 @@ #include "BKE_attribute_access.hh" -#include "FN_generic_virtual_array.hh" - namespace blender::bke { template<typename T, BLI_ENABLE_IF(std::is_integral_v<T>)> @@ -287,9 +286,7 @@ class CurvesGeometry : public ::CurvesGeometry { * Attributes. */ - fn::GVArray adapt_domain(const fn::GVArray &varray, - AttributeDomain from, - AttributeDomain to) const; + GVArray adapt_domain(const GVArray &varray, AttributeDomain from, AttributeDomain to) const; }; namespace curves { @@ -375,7 +372,7 @@ int calculate_evaluated_size(int size, bool cyclic, int resolution); * Evaluate the Catmull Rom curve. The length of the #dst span should be calculated with * #calculate_evaluated_size and is expected to divide evenly by the #src span's segment size. */ -void interpolate_to_evaluated(fn::GSpan src, bool cyclic, int resolution, fn::GMutableSpan dst); +void interpolate_to_evaluated(GSpan src, bool cyclic, int resolution, GMutableSpan dst); } // namespace catmull_rom @@ -439,8 +436,8 @@ void calculate_basis_cache(int size, void interpolate_to_evaluated(const BasisCache &basis_cache, int8_t order, Span<float> control_weights, - fn::GSpan src, - fn::GMutableSpan dst); + GSpan src, + GMutableSpan dst); } // namespace nurbs diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index 372922a24d2..bd392057436 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -131,9 +131,9 @@ class GeometryComponent { * interpolate from one domain to another. * \return null if the interpolation is not implemented. */ - blender::fn::GVArray attribute_try_adapt_domain(const blender::fn::GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const + blender::GVArray attribute_try_adapt_domain(const blender::GVArray &varray, + const AttributeDomain from_domain, + const AttributeDomain to_domain) const { return this->attribute_try_adapt_domain_impl(varray, from_domain, to_domain); } @@ -177,17 +177,17 @@ class GeometryComponent { * and converted to the data type. Returns null when the attribute does not exist or cannot be * interpolated or converted. */ - blender::fn::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, - AttributeDomain domain, - const CustomDataType data_type) const; + blender::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, + AttributeDomain domain, + const CustomDataType data_type) const; /** * Get a virtual array that refers to the data of an attribute, interpolated to the given domain. * The data type is left unchanged. Returns null when the attribute does not exist or cannot be * interpolated. */ - blender::fn::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, - AttributeDomain domain) const; + blender::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, + AttributeDomain domain) const; /** * Get a virtual array that refers to the data of an attribute converted to the given data type. @@ -202,10 +202,10 @@ class GeometryComponent { * and converted to the data type. If that is not possible, the returned virtual array will * contain a default value. This never returns null. */ - blender::fn::GVArray attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id, - AttributeDomain domain, - const CustomDataType data_type, - const void *default_value = nullptr) const; + blender::GVArray attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id, + AttributeDomain domain, + const CustomDataType data_type, + const void *default_value = nullptr) const; /* Use instead of the method above when the type is known at compile time for type safety. */ template<typename T> blender::VArray<T> attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id, @@ -268,9 +268,9 @@ class GeometryComponent { private: virtual const blender::bke::ComponentAttributeProviders *get_attribute_providers() const; - virtual blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, - AttributeDomain from_domain, - AttributeDomain to_domain) const; + virtual blender::GVArray attribute_try_adapt_domain_impl(const blender::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const; }; template<typename T> @@ -568,9 +568,9 @@ class MeshComponent : public GeometryComponent { private: const blender::bke::ComponentAttributeProviders *get_attribute_providers() const final; - blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, - AttributeDomain from_domain, - AttributeDomain to_domain) const final; + blender::GVArray attribute_try_adapt_domain_impl(const blender::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const final; }; /** @@ -672,9 +672,9 @@ class CurveComponentLegacy : public GeometryComponent { private: const blender::bke::ComponentAttributeProviders *get_attribute_providers() const final; - blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, - AttributeDomain from_domain, - AttributeDomain to_domain) const final; + blender::GVArray attribute_try_adapt_domain_impl(const blender::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const final; }; /** @@ -729,9 +729,9 @@ class CurveComponent : public GeometryComponent { private: const blender::bke::ComponentAttributeProviders *get_attribute_providers() const final; - blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, - AttributeDomain from_domain, - AttributeDomain to_domain) const final; + blender::GVArray attribute_try_adapt_domain_impl(const blender::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const final; }; /** diff --git a/source/blender/blenkernel/BKE_mesh_sample.hh b/source/blender/blenkernel/BKE_mesh_sample.hh index a51dc7eef2f..a942f3bb7ed 100644 --- a/source/blender/blenkernel/BKE_mesh_sample.hh +++ b/source/blender/blenkernel/BKE_mesh_sample.hh @@ -6,8 +6,7 @@ * \ingroup bke */ -#include "FN_generic_virtual_array.hh" - +#include "BLI_generic_virtual_array.hh" #include "BLI_math_vec_types.hh" #include "BKE_attribute.h" @@ -21,10 +20,6 @@ class OutputAttribute; namespace blender::bke::mesh_surface_sample { -using fn::GMutableSpan; -using fn::GSpan; -using fn::GVArray; - void sample_point_attribute(const Mesh &mesh, Span<int> looptri_indices, Span<float3> bary_coords, diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh index 87f4ad6dc61..32330244c08 100644 --- a/source/blender/blenkernel/BKE_spline.hh +++ b/source/blender/blenkernel/BKE_spline.hh @@ -8,11 +8,10 @@ #include <mutex> -#include "FN_generic_virtual_array.hh" - #include "DNA_curves_types.h" #include "BLI_float4x4.hh" +#include "BLI_generic_virtual_array.hh" #include "BLI_math_vec_types.hh" #include "BLI_vector.hh" @@ -205,16 +204,16 @@ class Spline { * points) to arbitrary parameters in between the evaluated points. The interpolation is quite * simple, but this handles the cyclic and end point special cases. */ - void sample_with_index_factors(const blender::fn::GVArray &src, + void sample_with_index_factors(const blender::GVArray &src, blender::Span<float> index_factors, - blender::fn::GMutableSpan dst) const; + blender::GMutableSpan dst) const; template<typename T> void sample_with_index_factors(const blender::VArray<T> &src, blender::Span<float> index_factors, blender::MutableSpan<T> dst) const { this->sample_with_index_factors( - blender::fn::GVArray(src), index_factors, blender::fn::GMutableSpan(dst)); + blender::GVArray(src), index_factors, blender::GMutableSpan(dst)); } template<typename T> void sample_with_index_factors(blender::Span<T> src, @@ -229,11 +228,11 @@ class Spline { * evaluated points. For poly splines, the lifetime of the returned virtual array must not * exceed the lifetime of the input data. */ - virtual blender::fn::GVArray interpolate_to_evaluated(const blender::fn::GVArray &src) const = 0; - blender::fn::GVArray interpolate_to_evaluated(blender::fn::GSpan data) const; + virtual blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const = 0; + blender::GVArray interpolate_to_evaluated(blender::GSpan data) const; template<typename T> blender::VArray<T> interpolate_to_evaluated(blender::Span<T> data) const { - return this->interpolate_to_evaluated(blender::fn::GSpan(data)).typed<T>(); + return this->interpolate_to_evaluated(blender::GSpan(data)).typed<T>(); } protected: @@ -386,8 +385,7 @@ class BezierSpline final : public Spline { */ InterpolationData interpolation_data_from_index_factor(float index_factor) const; - virtual blender::fn::GVArray interpolate_to_evaluated( - const blender::fn::GVArray &src) const override; + virtual blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const override; void evaluate_segment(int index, int next_index, @@ -541,7 +539,7 @@ class NURBSpline final : public Spline { blender::Span<blender::float3> evaluated_positions() const final; - blender::fn::GVArray interpolate_to_evaluated(const blender::fn::GVArray &src) const final; + blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const final; protected: void correct_end_tangents() const final; @@ -599,7 +597,7 @@ class PolySpline final : public Spline { * the original data. Therefore the lifetime of the returned virtual array must not be longer * than the source data. */ - blender::fn::GVArray interpolate_to_evaluated(const blender::fn::GVArray &src) const final; + blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const final; protected: void correct_end_tangents() const final; diff --git a/source/blender/blenkernel/BKE_type_conversions.hh b/source/blender/blenkernel/BKE_type_conversions.hh index 8d3b2730a9c..5152989d137 100644 --- a/source/blender/blenkernel/BKE_type_conversions.hh +++ b/source/blender/blenkernel/BKE_type_conversions.hh @@ -56,11 +56,11 @@ class DataTypeConversions { const void *from_value, void *to_value) const; - void convert_to_initialized_n(fn::GSpan from_span, fn::GMutableSpan to_span) const; + void convert_to_initialized_n(GSpan from_span, GMutableSpan to_span) const; - fn::GVArray try_convert(fn::GVArray varray, const CPPType &to_type) const; + GVArray try_convert(GVArray varray, const CPPType &to_type) const; - fn::GVMutableArray try_convert(fn::GVMutableArray varray, const CPPType &to_type) const; + GVMutableArray try_convert(GVMutableArray varray, const CPPType &to_type) const; }; const DataTypeConversions &get_implicit_type_conversions(); diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index f79e8ee7653..50e35c3c7c2 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -28,14 +28,14 @@ static CLG_LogRef LOG = {"bke.attribute_access"}; using blender::float3; +using blender::GMutableSpan; +using blender::GSpan; +using blender::GVArrayImpl_For_GSpan; using blender::Set; using blender::StringRef; using blender::StringRefNull; using blender::bke::AttributeIDRef; using blender::bke::OutputAttribute; -using blender::fn::GMutableSpan; -using blender::fn::GSpan; -using blender::fn::GVArrayImpl_For_GSpan; namespace blender::bke { @@ -191,14 +191,14 @@ AttributeDomain attribute_domain_highest_priority(Span<AttributeDomain> domains) return highest_priority_domain; } -fn::GMutableSpan OutputAttribute::as_span() +GMutableSpan OutputAttribute::as_span() { if (!optional_span_varray_) { const bool materialize_old_values = !ignore_old_values_; - optional_span_varray_ = std::make_unique<fn::GVMutableArray_GSpan>(varray_, - materialize_old_values); + optional_span_varray_ = std::make_unique<GVMutableArray_GSpan>(varray_, + materialize_old_values); } - fn::GVMutableArray_GSpan &span_varray = *optional_span_varray_; + GVMutableArray_GSpan &span_varray = *optional_span_varray_; return span_varray; } @@ -917,8 +917,8 @@ blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read( return {}; } -blender::fn::GVArray GeometryComponent::attribute_try_adapt_domain_impl( - const blender::fn::GVArray &varray, +blender::GVArray GeometryComponent::attribute_try_adapt_domain_impl( + const blender::GVArray &varray, const AttributeDomain from_domain, const AttributeDomain to_domain) const { @@ -1101,15 +1101,15 @@ std::optional<AttributeMetaData> GeometryComponent::attribute_get_meta_data( return result; } -static blender::fn::GVArray try_adapt_data_type(blender::fn::GVArray varray, - const blender::CPPType &to_type) +static blender::GVArray try_adapt_data_type(blender::GVArray varray, + const blender::CPPType &to_type) { const blender::bke::DataTypeConversions &conversions = blender::bke::get_implicit_type_conversions(); return conversions.try_convert(std::move(varray), to_type); } -blender::fn::GVArray GeometryComponent::attribute_try_get_for_read( +blender::GVArray GeometryComponent::attribute_try_get_for_read( const AttributeIDRef &attribute_id, const AttributeDomain domain, const CustomDataType data_type) const @@ -1119,7 +1119,7 @@ blender::fn::GVArray GeometryComponent::attribute_try_get_for_read( return {}; } - blender::fn::GVArray varray = std::move(attribute.varray); + blender::GVArray varray = std::move(attribute.varray); if (!ELEM(domain, ATTR_DOMAIN_AUTO, attribute.domain)) { varray = this->attribute_try_adapt_domain(std::move(varray), attribute.domain, domain); if (!varray) { @@ -1139,8 +1139,8 @@ blender::fn::GVArray GeometryComponent::attribute_try_get_for_read( return varray; } -blender::fn::GVArray GeometryComponent::attribute_try_get_for_read( - const AttributeIDRef &attribute_id, const AttributeDomain domain) const +blender::GVArray GeometryComponent::attribute_try_get_for_read(const AttributeIDRef &attribute_id, + const AttributeDomain domain) const { if (!this->attribute_domain_supported(domain)) { return {}; @@ -1175,12 +1175,12 @@ blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read( return {conversions.try_convert(std::move(attribute.varray), *type), attribute.domain}; } -blender::fn::GVArray GeometryComponent::attribute_get_for_read(const AttributeIDRef &attribute_id, - const AttributeDomain domain, - const CustomDataType data_type, - const void *default_value) const +blender::GVArray GeometryComponent::attribute_get_for_read(const AttributeIDRef &attribute_id, + const AttributeDomain domain, + const CustomDataType data_type, + const void *default_value) const { - blender::fn::GVArray varray = this->attribute_try_get_for_read(attribute_id, domain, data_type); + blender::GVArray varray = this->attribute_try_get_for_read(attribute_id, domain, data_type); if (varray) { return varray; } @@ -1189,10 +1189,10 @@ blender::fn::GVArray GeometryComponent::attribute_get_for_read(const AttributeID default_value = type->default_value(); } const int domain_size = this->attribute_domain_size(domain); - return blender::fn::GVArray::ForSingle(*type, domain_size, default_value); + return blender::GVArray::ForSingle(*type, domain_size, default_value); } -class GVMutableAttribute_For_OutputAttribute : public blender::fn::GVArrayImpl_For_GSpan { +class GVMutableAttribute_For_OutputAttribute : public blender::GVArrayImpl_For_GSpan { public: GeometryComponent *component; std::string attribute_name; @@ -1201,7 +1201,7 @@ class GVMutableAttribute_For_OutputAttribute : public blender::fn::GVArrayImpl_F GVMutableAttribute_For_OutputAttribute(GMutableSpan data, GeometryComponent &component, const AttributeIDRef &attribute_id) - : blender::fn::GVArrayImpl_For_GSpan(data), component(&component) + : blender::GVArrayImpl_For_GSpan(data), component(&component) { if (attribute_id.is_named()) { this->attribute_name = attribute_id.name(); diff --git a/source/blender/blenkernel/intern/curve_catmull_rom.cc b/source/blender/blenkernel/intern/curve_catmull_rom.cc index a247c67066b..27687eb736f 100644 --- a/source/blender/blenkernel/intern/curve_catmull_rom.cc +++ b/source/blender/blenkernel/intern/curve_catmull_rom.cc @@ -96,10 +96,10 @@ static void interpolate_to_evaluated(const Span<T> src, }); } -void interpolate_to_evaluated(const fn::GSpan src, +void interpolate_to_evaluated(const GSpan src, const bool cyclic, const int resolution, - fn::GMutableSpan dst) + GMutableSpan dst) { attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc index 191a510947e..b2399f25638 100644 --- a/source/blender/blenkernel/intern/curve_eval.cc +++ b/source/blender/blenkernel/intern/curve_eval.cc @@ -20,6 +20,8 @@ using blender::Array; using blender::float3; using blender::float4x4; +using blender::GVArray; +using blender::GVArray_GSpan; using blender::IndexRange; using blender::Map; using blender::MutableSpan; @@ -32,8 +34,6 @@ using blender::bke::AttributeIDRef; using blender::bke::OutputAttribute; using blender::bke::OutputAttribute_Typed; using blender::bke::ReadAttributeLookup; -using blender::fn::GVArray; -using blender::fn::GVArray_GSpan; blender::Span<SplinePtr> CurveEval::splines() const { diff --git a/source/blender/blenkernel/intern/curve_nurbs.cc b/source/blender/blenkernel/intern/curve_nurbs.cc index 3bec01520e8..a4cdbbca654 100644 --- a/source/blender/blenkernel/intern/curve_nurbs.cc +++ b/source/blender/blenkernel/intern/curve_nurbs.cc @@ -230,8 +230,8 @@ static void interpolate_to_evaluated_rational(const BasisCache &basis_cache, void interpolate_to_evaluated(const BasisCache &basis_cache, const int8_t order, const Span<float> control_weights, - const fn::GSpan src, - fn::GMutableSpan dst) + const GSpan src, + GMutableSpan dst) { BLI_assert(dst.size() == basis_cache.start_indices.size()); diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc index 5d80ef47908..9b22a4c9726 100644 --- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc +++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc @@ -16,9 +16,6 @@ #include "BKE_curve_to_mesh.hh" -using blender::fn::GMutableSpan; -using blender::fn::GSpan; - namespace blender::bke { /** Information about the creation of one curve spline and profile spline combination. */ diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index ff24720e5e5..45f3bf36381 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -1055,9 +1055,9 @@ static GVArray adapt_curve_domain_curve_to_point(const CurvesGeometry &curves, return new_varray; } -fn::GVArray CurvesGeometry::adapt_domain(const fn::GVArray &varray, - const AttributeDomain from, - const AttributeDomain to) const +GVArray CurvesGeometry::adapt_domain(const GVArray &varray, + const AttributeDomain from, + const AttributeDomain to) const { if (!varray) { return {}; diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc index 0926d65b306..f409389e463 100644 --- a/source/blender/blenkernel/intern/geometry_component_curve.cc +++ b/source/blender/blenkernel/intern/geometry_component_curve.cc @@ -14,10 +14,10 @@ #include "attribute_access_intern.hh" -using blender::fn::GMutableSpan; -using blender::fn::GSpan; -using blender::fn::GVArray; -using blender::fn::GVArray_GSpan; +using blender::GMutableSpan; +using blender::GSpan; +using blender::GVArray; +using blender::GVArray_GSpan; /* -------------------------------------------------------------------- */ /** \name Geometry Component Implementation diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc index 86cbea9a9bb..7cf6fc5a03e 100644 --- a/source/blender/blenkernel/intern/geometry_component_curves.cc +++ b/source/blender/blenkernel/intern/geometry_component_curves.cc @@ -15,7 +15,7 @@ #include "attribute_access_intern.hh" -using blender::fn::GVArray; +using blender::GVArray; /* -------------------------------------------------------------------- */ /** \name Geometry Component Implementation diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc index 75384b5c420..0dc6f486d28 100644 --- a/source/blender/blenkernel/intern/geometry_component_instances.cc +++ b/source/blender/blenkernel/intern/geometry_component_instances.cc @@ -23,13 +23,13 @@ #include "BLI_cpp_type_make.hh" using blender::float4x4; +using blender::GSpan; using blender::IndexMask; using blender::Map; using blender::MutableSpan; using blender::Set; using blender::Span; using blender::VectorSet; -using blender::fn::GSpan; BLI_CPP_TYPE_MAKE(InstanceReference, InstanceReference, CPPTypeFlags::None) @@ -164,7 +164,7 @@ void InstancesComponent::remove_instances(const IndexMask mask) GSpan src = *src_attributes.get_for_read(id); dst_attributes.create(id, meta_data.data_type); - fn::GMutableSpan dst = *dst_attributes.get_for_write(id); + GMutableSpan dst = *dst_attributes.get_for_write(id); attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index a07957e999c..76c8a0054b3 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -746,8 +746,8 @@ static GVArray adapt_mesh_domain_edge_to_face(const Mesh &mesh, const GVArray &v } // namespace blender::bke -blender::fn::GVArray MeshComponent::attribute_try_adapt_domain_impl( - const blender::fn::GVArray &varray, +blender::GVArray MeshComponent::attribute_try_adapt_domain_impl( + const blender::GVArray &varray, const AttributeDomain from_domain, const AttributeDomain to_domain) const { diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc index dc5b1d28539..eecb374cd63 100644 --- a/source/blender/blenkernel/intern/spline_base.cc +++ b/source/blender/blenkernel/intern/spline_base.cc @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include "BLI_array.hh" +#include "BLI_generic_virtual_array.hh" #include "BLI_span.hh" #include "BLI_task.hh" #include "BLI_timeit.hh" @@ -9,19 +10,17 @@ #include "BKE_attribute_math.hh" #include "BKE_spline.hh" -#include "FN_generic_virtual_array.hh" - using blender::Array; using blender::float3; +using blender::GMutableSpan; +using blender::GSpan; +using blender::GVArray; using blender::IndexRange; using blender::MutableSpan; using blender::Span; using blender::VArray; using blender::attribute_math::convert_to_static_type; using blender::bke::AttributeIDRef; -using blender::fn::GMutableSpan; -using blender::fn::GSpan; -using blender::fn::GVArray; CurveType Spline::type() const { @@ -100,7 +99,7 @@ void Spline::reverse() this->attributes.foreach_attribute( [&](const AttributeIDRef &id, const AttributeMetaData &meta_data) { - std::optional<blender::fn::GMutableSpan> attribute = this->attributes.get_for_write(id); + std::optional<blender::GMutableSpan> attribute = this->attributes.get_for_write(id); if (!attribute) { BLI_assert_unreachable(); return false; diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index e9ae51b16f8..8e207f93bf5 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -8,11 +8,11 @@ using blender::Array; using blender::float3; +using blender::GVArray; using blender::IndexRange; using blender::MutableSpan; using blender::Span; using blender::VArray; -using blender::fn::GVArray; void BezierSpline::copy_settings(Spline &dst) const { diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc index a8a17b7aee6..9d1d5a53a43 100644 --- a/source/blender/blenkernel/intern/spline_nurbs.cc +++ b/source/blender/blenkernel/intern/spline_nurbs.cc @@ -9,11 +9,11 @@ using blender::Array; using blender::float3; +using blender::GVArray; using blender::IndexRange; using blender::MutableSpan; using blender::Span; using blender::VArray; -using blender::fn::GVArray; void NURBSpline::copy_settings(Spline &dst) const { diff --git a/source/blender/blenkernel/intern/spline_poly.cc b/source/blender/blenkernel/intern/spline_poly.cc index a5d3fd47ede..122f7f6c059 100644 --- a/source/blender/blenkernel/intern/spline_poly.cc +++ b/source/blender/blenkernel/intern/spline_poly.cc @@ -6,9 +6,9 @@ #include "BKE_spline.hh" using blender::float3; +using blender::GVArray; using blender::MutableSpan; using blender::Span; -using blender::fn::GVArray; void PolySpline::copy_settings(Spline &UNUSED(dst)) const { diff --git a/source/blender/blenkernel/intern/type_conversions.cc b/source/blender/blenkernel/intern/type_conversions.cc index 2e8b5b3433b..d10979eeee9 100644 --- a/source/blender/blenkernel/intern/type_conversions.cc +++ b/source/blender/blenkernel/intern/type_conversions.cc @@ -288,8 +288,7 @@ void DataTypeConversions::convert_to_uninitialized(const CPPType &from_type, functions->convert_single_to_uninitialized(from_value, to_value); } -void DataTypeConversions::convert_to_initialized_n(fn::GSpan from_span, - fn::GMutableSpan to_span) const +void DataTypeConversions::convert_to_initialized_n(GSpan from_span, GMutableSpan to_span) const { const CPPType &from_type = from_span.type(); const CPPType &to_type = to_span.type(); @@ -305,19 +304,17 @@ void DataTypeConversions::convert_to_initialized_n(fn::GSpan from_span, fn->call_auto(IndexRange(from_span.size()), params, context); } -class GVArray_For_ConvertedGVArray : public fn::GVArrayImpl { +class GVArray_For_ConvertedGVArray : public GVArrayImpl { private: - fn::GVArray varray_; + GVArray varray_; const CPPType &from_type_; ConversionFunctions old_to_new_conversions_; public: - GVArray_For_ConvertedGVArray(fn::GVArray varray, + GVArray_For_ConvertedGVArray(GVArray varray, const CPPType &to_type, const DataTypeConversions &conversions) - : fn::GVArrayImpl(to_type, varray.size()), - varray_(std::move(varray)), - from_type_(varray_.type()) + : GVArrayImpl(to_type, varray.size()), varray_(std::move(varray)), from_type_(varray_.type()) { old_to_new_conversions_ = *conversions.get_conversion_functions(from_type_, to_type); } @@ -340,18 +337,18 @@ class GVArray_For_ConvertedGVArray : public fn::GVArrayImpl { } }; -class GVMutableArray_For_ConvertedGVMutableArray : public fn::GVMutableArrayImpl { +class GVMutableArray_For_ConvertedGVMutableArray : public GVMutableArrayImpl { private: - fn::GVMutableArray varray_; + GVMutableArray varray_; const CPPType &from_type_; ConversionFunctions old_to_new_conversions_; ConversionFunctions new_to_old_conversions_; public: - GVMutableArray_For_ConvertedGVMutableArray(fn::GVMutableArray varray, + GVMutableArray_For_ConvertedGVMutableArray(GVMutableArray varray, const CPPType &to_type, const DataTypeConversions &conversions) - : fn::GVMutableArrayImpl(to_type, varray.size()), + : GVMutableArrayImpl(to_type, varray.size()), varray_(std::move(varray)), from_type_(varray_.type()) { @@ -384,7 +381,7 @@ class GVMutableArray_For_ConvertedGVMutableArray : public fn::GVMutableArrayImpl } }; -fn::GVArray DataTypeConversions::try_convert(fn::GVArray varray, const CPPType &to_type) const +GVArray DataTypeConversions::try_convert(GVArray varray, const CPPType &to_type) const { const CPPType &from_type = varray.type(); if (from_type == to_type) { @@ -393,11 +390,11 @@ fn::GVArray DataTypeConversions::try_convert(fn::GVArray varray, const CPPType & if (!this->is_convertible(from_type, to_type)) { return {}; } - return fn::GVArray::For<GVArray_For_ConvertedGVArray>(std::move(varray), to_type, *this); + return GVArray::For<GVArray_For_ConvertedGVArray>(std::move(varray), to_type, *this); } -fn::GVMutableArray DataTypeConversions::try_convert(fn::GVMutableArray varray, - const CPPType &to_type) const +GVMutableArray DataTypeConversions::try_convert(GVMutableArray varray, + const CPPType &to_type) const { const CPPType &from_type = varray.type(); if (from_type == to_type) { @@ -406,7 +403,7 @@ fn::GVMutableArray DataTypeConversions::try_convert(fn::GVMutableArray varray, if (!this->is_convertible(from_type, to_type)) { return {}; } - return fn::GVMutableArray::For<GVMutableArray_For_ConvertedGVMutableArray>( + return GVMutableArray::For<GVMutableArray_For_ConvertedGVMutableArray>( std::move(varray), to_type, *this); } diff --git a/source/blender/functions/FN_generic_array.hh b/source/blender/blenlib/BLI_generic_array.hh index c5388d27585..e1b6b29874a 100644 --- a/source/blender/functions/FN_generic_array.hh +++ b/source/blender/blenlib/BLI_generic_array.hh @@ -3,7 +3,7 @@ #pragma once /** \file - * \ingroup fn + * \ingroup bli * * This is a generic counterpart to #blender::Array, used when the type is not known at runtime. * @@ -15,10 +15,9 @@ #include "BLI_allocator.hh" #include "BLI_cpp_type.hh" +#include "BLI_generic_span.hh" -#include "FN_generic_span.hh" - -namespace blender::fn { +namespace blender { template< /** @@ -253,4 +252,4 @@ class GArray { } }; -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/FN_generic_pointer.hh b/source/blender/blenlib/BLI_generic_pointer.hh index 382d882e3f7..226f76c3d33 100644 --- a/source/blender/functions/FN_generic_pointer.hh +++ b/source/blender/blenlib/BLI_generic_pointer.hh @@ -4,7 +4,7 @@ #include "BLI_cpp_type.hh" -namespace blender::fn { +namespace blender { /** * A generic non-const pointer whose type is only known at runtime. @@ -120,4 +120,4 @@ class GPointer { } }; -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/FN_generic_span.hh b/source/blender/blenlib/BLI_generic_span.hh index c79cece138f..f4f93735e06 100644 --- a/source/blender/functions/FN_generic_span.hh +++ b/source/blender/blenlib/BLI_generic_span.hh @@ -3,13 +3,13 @@ #pragma once /** \file - * \ingroup fn + * \ingroup bli */ #include "BLI_cpp_type.hh" #include "BLI_span.hh" -namespace blender::fn { +namespace blender { /** * A generic span. It behaves just like a blender::Span<T>, but the type is only known at run-time. @@ -166,4 +166,4 @@ class GMutableSpan { } }; -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/FN_generic_value_map.hh b/source/blender/blenlib/BLI_generic_value_map.hh index 3807ada1c3c..bd8408526b8 100644 --- a/source/blender/functions/FN_generic_value_map.hh +++ b/source/blender/blenlib/BLI_generic_value_map.hh @@ -2,12 +2,11 @@ #pragma once +#include "BLI_generic_pointer.hh" #include "BLI_linear_allocator.hh" #include "BLI_map.hh" -#include "FN_generic_pointer.hh" - -namespace blender::fn { +namespace blender { /** * This is a map that stores key-value-pairs. What makes it special is that the type of values does @@ -109,4 +108,4 @@ template<typename Key> class GValueMap { } }; -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/FN_generic_vector_array.hh b/source/blender/blenlib/BLI_generic_vector_array.hh index d7416a0f5b9..c98817df4e3 100644 --- a/source/blender/functions/FN_generic_vector_array.hh +++ b/source/blender/blenlib/BLI_generic_vector_array.hh @@ -3,7 +3,7 @@ #pragma once /** \file - * \ingroup fn + * \ingroup bli * * A`GVectorArray` is a container for a fixed amount of dynamically growing vectors with a generic * data type. Its main use case is to store many small vectors with few separate allocations. Using @@ -11,11 +11,10 @@ */ #include "BLI_array.hh" +#include "BLI_generic_virtual_vector_array.hh" #include "BLI_linear_allocator.hh" -#include "FN_generic_virtual_vector_array.hh" - -namespace blender::fn { +namespace blender { /* An array of vectors containing elements of a generic type. */ class GVectorArray : NonCopyable, NonMovable { @@ -145,4 +144,4 @@ class GVVectorArray_For_GVectorArray : public GVVectorArray { } }; -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/blenlib/BLI_generic_virtual_array.hh index ced0c2b9546..f4c9e745cf9 100644 --- a/source/blender/functions/FN_generic_virtual_array.hh +++ b/source/blender/blenlib/BLI_generic_virtual_array.hh @@ -3,19 +3,18 @@ #pragma once /** \file - * \ingroup fn + * \ingroup bli * - * A generic virtual array is the same as a virtual array from blenlib, except for the fact that - * the data type is only known at runtime. + * A generic virtual array is the same as a virtual array, except for the fact that the data type + * is only known at runtime. */ +#include "BLI_generic_array.hh" +#include "BLI_generic_span.hh" #include "BLI_timeit.hh" #include "BLI_virtual_array.hh" -#include "FN_generic_array.hh" -#include "FN_generic_span.hh" - -namespace blender::fn { +namespace blender { /* -------------------------------------------------------------------- */ /** \name #GVArrayImpl and #GVMutableArrayImpl. @@ -875,4 +874,4 @@ template<typename T> inline VMutableArray<T> GVMutableArray::typed() const /** \} */ -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/FN_generic_virtual_vector_array.hh b/source/blender/blenlib/BLI_generic_virtual_vector_array.hh index 1f40366da04..364b1ab33c7 100644 --- a/source/blender/functions/FN_generic_virtual_vector_array.hh +++ b/source/blender/blenlib/BLI_generic_virtual_vector_array.hh @@ -3,17 +3,16 @@ #pragma once /** \file - * \ingroup fn + * \ingroup bli * - * A generic virtual vector array is essentially the same as a virtual vector array from blenlib, - * but its data type is only known at runtime. + * A generic virtual vector array is essentially the same as a virtual vector array, but its data + * type is only known at runtime. */ -#include "FN_generic_virtual_array.hh" - +#include "BLI_generic_virtual_array.hh" #include "BLI_virtual_vector_array.hh" -namespace blender::fn { +namespace blender { /* A generically typed version of `VVectorArray`. */ class GVVectorArray { @@ -171,4 +170,4 @@ template<typename T> class VVectorArray_For_GVVectorArray : public VVectorArray< } }; -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index 16fd706c99d..3aa25bf6819 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -31,10 +31,8 @@ namespace blender { /** Forward declarations for generic virtual arrays. */ -namespace fn { class GVArray; class GVMutableArray; -}; // namespace fn /** * Implements the specifics of how the elements of a virtual array are accessed. It contains a @@ -154,7 +152,7 @@ template<typename T> class VArrayImpl { * arrays in all cases. * Return true when the virtual array was assigned and false when nothing was done. */ - virtual bool try_assign_GVArray(fn::GVArray &UNUSED(varray)) const + virtual bool try_assign_GVArray(GVArray &UNUSED(varray)) const { return false; } @@ -211,7 +209,7 @@ template<typename T> class VMutableArrayImpl : public VArrayImpl<T> { /** * Similar to #VArrayImpl::try_assign_GVArray but for mutable virtual arrays. */ - virtual bool try_assign_GVMutableArray(fn::GVMutableArray &UNUSED(varray)) const + virtual bool try_assign_GVMutableArray(GVMutableArray &UNUSED(varray)) const { return false; } @@ -743,7 +741,7 @@ template<typename T> class VArrayCommon { } /** See #GVArrayImpl::try_assign_GVArray. */ - bool try_assign_GVArray(fn::GVArray &varray) const + bool try_assign_GVArray(GVArray &varray) const { return impl_->try_assign_GVArray(varray); } @@ -960,7 +958,7 @@ template<typename T> class VMutableArray : public VArrayCommon<T> { } /** See #GVMutableArrayImpl::try_assign_GVMutableArray. */ - bool try_assign_GVMutableArray(fn::GVMutableArray &varray) const + bool try_assign_GVMutableArray(GVMutableArray &varray) const { return this->get_impl()->try_assign_GVMutableArray(varray); } diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 057d94a6f39..6c216f873de 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -65,6 +65,9 @@ set(SRC intern/filereader_memory.c intern/filereader_zstd.c intern/fnmatch.c + intern/generic_vector_array.cc + intern/generic_virtual_array.cc + intern/generic_virtual_vector_array.cc intern/gsqueue.c intern/hash_md5.c intern/hash_mm2a.c @@ -195,6 +198,13 @@ set(SRC BLI_float4x4.hh BLI_fnmatch.h BLI_function_ref.hh + BLI_generic_array.hh + BLI_generic_pointer.hh + BLI_generic_span.hh + BLI_generic_value_map.hh + BLI_generic_vector_array.hh + BLI_generic_virtual_array.hh + BLI_generic_virtual_vector_array.hh BLI_ghash.h BLI_gsqueue.h BLI_hash.h @@ -413,6 +423,9 @@ if(WITH_GTESTS) tests/BLI_expr_pylike_eval_test.cc tests/BLI_fileops_test.cc tests/BLI_function_ref_test.cc + tests/BLI_generic_array_test.cc + tests/BLI_generic_span_test.cc + tests/BLI_generic_vector_array_test.cc tests/BLI_ghash_test.cc tests/BLI_hash_mm2a_test.cc tests/BLI_heap_simple_test.cc diff --git a/source/blender/functions/intern/generic_vector_array.cc b/source/blender/blenlib/intern/generic_vector_array.cc index b188b31b087..b32236bfada 100644 --- a/source/blender/functions/intern/generic_vector_array.cc +++ b/source/blender/blenlib/intern/generic_vector_array.cc @@ -1,10 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#include "FN_generic_vector_array.hh" -#include "FN_multi_function_params.hh" -#include "FN_multi_function_signature.hh" +#include "BLI_generic_vector_array.hh" -namespace blender::fn { +namespace blender { GVectorArray::GVectorArray(const CPPType &type, const int64_t array_size) : type_(type), element_size_(type.size()), items_(array_size) @@ -95,4 +93,4 @@ void GVectorArray::realloc_to_at_least(Item &item, int64_t min_capacity) item.capacity = new_capacity; } -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/intern/generic_virtual_array.cc b/source/blender/blenlib/intern/generic_virtual_array.cc index 4644323bd1f..c6abf3624e1 100644 --- a/source/blender/functions/intern/generic_virtual_array.cc +++ b/source/blender/blenlib/intern/generic_virtual_array.cc @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#include "FN_generic_virtual_array.hh" +#include "BLI_generic_virtual_array.hh" -namespace blender::fn { +namespace blender { /* -------------------------------------------------------------------- */ /** \name #GVArrayImpl @@ -721,4 +721,4 @@ GMutableSpan GVMutableArray::get_internal_span() const /** \} */ -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/intern/generic_virtual_vector_array.cc b/source/blender/blenlib/intern/generic_virtual_vector_array.cc index 7dc728a4460..8fd1fb50b72 100644 --- a/source/blender/functions/intern/generic_virtual_vector_array.cc +++ b/source/blender/blenlib/intern/generic_virtual_vector_array.cc @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#include "FN_generic_virtual_vector_array.hh" +#include "BLI_generic_virtual_vector_array.hh" -namespace blender::fn { +namespace blender { void GVArray_For_GVVectorArrayIndex::get(const int64_t index_in_vector, void *r_value) const { @@ -50,4 +50,4 @@ bool GVVectorArray_For_SingleGSpan::is_single_vector_impl() const return true; } -} // namespace blender::fn +} // namespace blender diff --git a/source/blender/functions/tests/FN_generic_array_test.cc b/source/blender/blenlib/tests/BLI_generic_array_test.cc index 5420a809ffc..52bc7728a6a 100644 --- a/source/blender/functions/tests/FN_generic_array_test.cc +++ b/source/blender/blenlib/tests/BLI_generic_array_test.cc @@ -5,10 +5,9 @@ #include "MEM_guardedalloc.h" #include "BLI_array.hh" +#include "BLI_generic_array.hh" -#include "FN_generic_array.hh" - -namespace blender::fn::tests { +namespace blender::tests { TEST(generic_array, TypeConstructor) { @@ -115,4 +114,4 @@ TEST(generic_array, InContainer) } } -} // namespace blender::fn::tests +} // namespace blender::tests diff --git a/source/blender/functions/tests/FN_generic_span_test.cc b/source/blender/blenlib/tests/BLI_generic_span_test.cc index 19b3ceaf44e..fe07a67d63b 100644 --- a/source/blender/functions/tests/FN_generic_span_test.cc +++ b/source/blender/blenlib/tests/BLI_generic_span_test.cc @@ -2,9 +2,9 @@ #include "testing/testing.h" -#include "FN_generic_span.hh" +#include "BLI_generic_span.hh" -namespace blender::fn::tests { +namespace blender::tests { TEST(generic_span, TypeConstructor) { @@ -50,4 +50,4 @@ TEST(generic_mutable_span, BufferAndSizeConstructor) EXPECT_EQ(values[2], 20); } -} // namespace blender::fn::tests +} // namespace blender::tests diff --git a/source/blender/functions/tests/FN_generic_vector_array_test.cc b/source/blender/blenlib/tests/BLI_generic_vector_array_test.cc index 6a83e6094b4..105f3603914 100644 --- a/source/blender/functions/tests/FN_generic_vector_array_test.cc +++ b/source/blender/blenlib/tests/BLI_generic_vector_array_test.cc @@ -2,9 +2,9 @@ #include "testing/testing.h" -#include "FN_generic_vector_array.hh" +#include "BLI_generic_vector_array.hh" -namespace blender::fn::tests { +namespace blender::tests { TEST(generic_vector_array, Construct) { @@ -40,4 +40,4 @@ TEST(generic_vector_array, Extend) EXPECT_EQ(vector_array[2].size(), 0); } -} // namespace blender::fn::tests +} // namespace blender::tests diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc index 28efc5be2e9..6225a68f53c 100644 --- a/source/blender/editors/geometry/geometry_attributes.cc +++ b/source/blender/editors/geometry/geometry_attributes.cc @@ -36,9 +36,6 @@ namespace blender::ed::geometry { -using fn::GArray; -using fn::GVArray; - /*********************** Attribute Operators ************************/ static bool geometry_attributes_poll(bContext *C) diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index b8d8335d47c..7f0c426922b 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -73,10 +73,10 @@ #include "node_intern.hh" /* own include */ +using blender::GPointer; using blender::fn::FieldCPPType; using blender::fn::FieldInput; using blender::fn::GField; -using blender::fn::GPointer; namespace geo_log = blender::nodes::geometry_nodes_eval_log; extern "C" { diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh b/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh index f4d07255e2d..7cf9238d34e 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_column_values.hh @@ -4,10 +4,9 @@ #include "DNA_space_types.h" +#include "BLI_generic_virtual_array.hh" #include "BLI_string_ref.hh" -#include "FN_generic_virtual_array.hh" - namespace blender::ed::spreadsheet { struct CellDrawParams; @@ -22,10 +21,10 @@ class ColumnValues final { protected: std::string name_; - fn::GVArray data_; + GVArray data_; public: - ColumnValues(std::string name, fn::GVArray data) : name_(std::move(name)), data_(std::move(data)) + ColumnValues(std::string name, GVArray data) : name_(std::move(name)), data_(std::move(data)) { /* The array should not be empty. */ BLI_assert(data_); @@ -48,7 +47,7 @@ class ColumnValues final { return data_.size(); } - const fn::GVArray &data() const + const GVArray &data() const { return data_; } diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc index 3c94c466da1..0ad64db1b6d 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc @@ -53,11 +53,11 @@ void ExtraColumns::foreach_default_column_ids( std::unique_ptr<ColumnValues> ExtraColumns::get_column_values( const SpreadsheetColumnID &column_id) const { - const fn::GSpan *values = columns_.lookup_ptr(column_id.name); + const GSpan *values = columns_.lookup_ptr(column_id.name); if (values == nullptr) { return {}; } - return std::make_unique<ColumnValues>(column_id.name, fn::GVArray::ForSpan(*values)); + return std::make_unique<ColumnValues>(column_id.name, GVArray::ForSpan(*values)); } void GeometryDataSource::foreach_default_column_ids( @@ -199,7 +199,7 @@ std::unique_ptr<ColumnValues> GeometryDataSource::get_column_values( if (!attribute) { return {}; } - fn::GVArray varray = std::move(attribute.varray); + GVArray varray = std::move(attribute.varray); if (attribute.domain != domain_) { return {}; } @@ -462,7 +462,7 @@ static void find_fields_to_evaluate(const SpaceSpreadsheet *sspreadsheet, } if (const geo_log::GenericValueLog *generic_value_log = dynamic_cast<const geo_log::GenericValueLog *>(value_log)) { - fn::GPointer value = generic_value_log->value(); + GPointer value = generic_value_log->value(); r_fields.add("Viewer", fn::make_constant_field(*value.type(), value.get())); } } @@ -508,7 +508,7 @@ class GeometryComponentCacheValue : public SpreadsheetCache::Value { public: /* Stores the result of fields evaluated on a geometry component. Without this, fields would have * to be reevaluated on every redraw. */ - Map<std::pair<AttributeDomain, GField>, fn::GArray<>> arrays; + Map<std::pair<AttributeDomain, GField>, GArray<>> arrays; }; static void add_fields_as_extra_columns(SpaceSpreadsheet *sspreadsheet, @@ -529,8 +529,8 @@ static void add_fields_as_extra_columns(SpaceSpreadsheet *sspreadsheet, const GField &field = item.value; /* Use the cached evaluated array if it exists, otherwise evaluate the field now. */ - fn::GArray<> &evaluated_array = cache.arrays.lookup_or_add_cb({domain, field}, [&]() { - fn::GArray<> evaluated_array(field.cpp_type(), domain_size); + GArray<> &evaluated_array = cache.arrays.lookup_or_add_cb({domain, field}, [&]() { + GArray<> evaluated_array(field.cpp_type(), domain_size); bke::GeometryComponentFieldContext field_context{component, domain}; fn::FieldEvaluator field_evaluator{field_context, domain_size}; diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh index 303f495e3df..8b281e5a558 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh @@ -21,10 +21,10 @@ namespace blender::ed::spreadsheet { class ExtraColumns { private: /** Maps column names to their data. The data is actually stored in the spreadsheet cache. */ - Map<std::string, fn::GSpan> columns_; + Map<std::string, GSpan> columns_; public: - void add(std::string name, fn::GSpan data) + void add(std::string name, GSpan data) { columns_.add(std::move(name), data); } diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc b/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc index 33fd7329e6d..db466f8ccf3 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc @@ -89,7 +89,7 @@ class SpreadsheetLayoutDrawer : public SpreadsheetDrawer { return; } - const fn::GVArray &data = column.data(); + const GVArray &data = column.data(); if (data.type().is<int>()) { const int value = data.get<int>(real_index); diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc index 1fddd751d78..e45317c2a5c 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc @@ -42,7 +42,7 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter, Vector<int64_t> &new_indices) { const ColumnValues &column = *columns.lookup(row_filter.column_name); - const fn::GVArray &column_data = column.data(); + const GVArray &column_data = column.data(); if (column_data.type().is<float>()) { const float value = row_filter.value_float; switch (row_filter.operation) { diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt index eef5b1e3ea6..f1298a7f5b7 100644 --- a/source/blender/functions/CMakeLists.txt +++ b/source/blender/functions/CMakeLists.txt @@ -13,9 +13,6 @@ set(INC_SYS set(SRC intern/cpp_types.cc intern/field.cc - intern/generic_vector_array.cc - intern/generic_virtual_array.cc - intern/generic_virtual_vector_array.cc intern/multi_function.cc intern/multi_function_builder.cc intern/multi_function_params.cc @@ -26,13 +23,6 @@ set(SRC FN_field.hh FN_field_cpp_type.hh - FN_generic_array.hh - FN_generic_pointer.hh - FN_generic_span.hh - FN_generic_value_map.hh - FN_generic_vector_array.hh - FN_generic_virtual_array.hh - FN_generic_virtual_vector_array.hh FN_multi_function.hh FN_multi_function_builder.hh FN_multi_function_context.hh @@ -71,9 +61,6 @@ blender_add_lib(bf_functions "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") if(WITH_GTESTS) set(TEST_SRC tests/FN_field_test.cc - tests/FN_generic_array_test.cc - tests/FN_generic_span_test.cc - tests/FN_generic_vector_array_test.cc tests/FN_multi_function_procedure_test.cc tests/FN_multi_function_test.cc diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh index 957b395e633..5a27cda0787 100644 --- a/source/blender/functions/FN_field.hh +++ b/source/blender/functions/FN_field.hh @@ -33,11 +33,11 @@ */ #include "BLI_function_ref.hh" +#include "BLI_generic_virtual_array.hh" #include "BLI_string_ref.hh" #include "BLI_vector.hh" #include "BLI_vector_set.hh" -#include "FN_generic_virtual_array.hh" #include "FN_multi_function_builder.hh" namespace blender::fn { diff --git a/source/blender/functions/FN_multi_function.hh b/source/blender/functions/FN_multi_function.hh index edeb1fed27e..015df179ef0 100644 --- a/source/blender/functions/FN_multi_function.hh +++ b/source/blender/functions/FN_multi_function.hh @@ -154,8 +154,6 @@ inline MFParamsBuilder::MFParamsBuilder(const MultiFunction &fn, const IndexMask } namespace multi_function_types { -using fn::GMutableSpan; -using fn::GSpan; using fn::MFContext; using fn::MFContextBuilder; using fn::MFDataType; diff --git a/source/blender/functions/FN_multi_function_params.hh b/source/blender/functions/FN_multi_function_params.hh index 38736527771..67f31a61dc4 100644 --- a/source/blender/functions/FN_multi_function_params.hh +++ b/source/blender/functions/FN_multi_function_params.hh @@ -13,11 +13,11 @@ #include <mutex> +#include "BLI_generic_pointer.hh" +#include "BLI_generic_vector_array.hh" +#include "BLI_generic_virtual_vector_array.hh" #include "BLI_resource_scope.hh" -#include "FN_generic_pointer.hh" -#include "FN_generic_vector_array.hh" -#include "FN_generic_virtual_vector_array.hh" #include "FN_multi_function_signature.hh" namespace blender::fn { diff --git a/source/blender/geometry/intern/mesh_to_curve_convert.cc b/source/blender/geometry/intern/mesh_to_curve_convert.cc index dad2612cabd..5ba9bc066fd 100644 --- a/source/blender/geometry/intern/mesh_to_curve_convert.cc +++ b/source/blender/geometry/intern/mesh_to_curve_convert.cc @@ -59,8 +59,8 @@ static Curves *create_curve_from_vert_indices(const MeshComponent &mesh_componen continue; } - const fn::GVArray mesh_attribute = mesh_component.attribute_try_get_for_read( - attribute_id, ATTR_DOMAIN_POINT); + const GVArray mesh_attribute = mesh_component.attribute_try_get_for_read(attribute_id, + ATTR_DOMAIN_POINT); /* Some attributes might not exist if they were builtin attribute on domains that don't * have any elements, i.e. a face attribute on the output of the line primitive node. */ if (!mesh_attribute) { diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index 96291be7a96..502f5f0232e 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -29,11 +29,6 @@ using blender::bke::object_get_evaluated_geometry_set; using blender::bke::OutputAttribute; using blender::bke::OutputAttribute_Typed; using blender::bke::ReadAttributeLookup; -using blender::fn::GArray; -using blender::fn::GMutableSpan; -using blender::fn::GSpan; -using blender::fn::GVArray; -using blender::fn::GVArray_GSpan; /** * An ordered set of attribute ids. Attributes are ordered to avoid name lookups in many places. @@ -272,7 +267,7 @@ static void threaded_copy(const GSpan src, GMutableSpan dst) }); } -static void threaded_fill(const fn::GPointer value, GMutableSpan dst) +static void threaded_fill(const GPointer value, GMutableSpan dst) { BLI_assert(*value.type() == dst.type()); threading::parallel_for(IndexRange(dst.size()), 1024, [&](const IndexRange range) { diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 5b41d46443a..e94f8e50fec 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -93,6 +93,10 @@ using blender::CPPType; using blender::destruct_ptr; using blender::float3; using blender::FunctionRef; +using blender::GMutablePointer; +using blender::GMutableSpan; +using blender::GPointer; +using blender::GVArray; using blender::IndexRange; using blender::Map; using blender::MultiValueMap; @@ -105,9 +109,6 @@ using blender::Vector; using blender::bke::OutputAttribute; using blender::fn::Field; using blender::fn::GField; -using blender::fn::GMutablePointer; -using blender::fn::GPointer; -using blender::fn::GVArray; using blender::fn::ValueOrField; using blender::fn::ValueOrFieldCPPType; using blender::nodes::FieldInferencingInterface; diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc index 398f7cb3cf8..8e5f9dc429f 100644 --- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc +++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc @@ -11,12 +11,12 @@ #include "FN_field.hh" #include "FN_field_cpp_type.hh" -#include "FN_generic_value_map.hh" #include "FN_multi_function.hh" #include "BLT_translation.h" #include "BLI_enumerable_thread_specific.hh" +#include "BLI_generic_value_map.hh" #include "BLI_stack.hh" #include "BLI_task.h" #include "BLI_task.hh" @@ -28,8 +28,6 @@ namespace blender::modifiers::geometry_nodes { using fn::Field; using fn::GField; -using fn::GValueMap; -using fn::GVArray; using fn::ValueOrField; using fn::ValueOrFieldCPPType; using nodes::GeoNodeExecParams; diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.hh b/source/blender/modifiers/intern/MOD_nodes_evaluator.hh index e981157da41..cbcbcab5679 100644 --- a/source/blender/modifiers/intern/MOD_nodes_evaluator.hh +++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.hh @@ -2,14 +2,13 @@ #pragma once +#include "BLI_generic_pointer.hh" #include "BLI_map.hh" #include "NOD_derived_node_tree.hh" #include "NOD_geometry_nodes_eval_log.hh" #include "NOD_multi_function.hh" -#include "FN_generic_pointer.hh" - #include "DNA_modifier_types.h" #include "FN_multi_function.hh" @@ -19,8 +18,6 @@ namespace geo_log = blender::nodes::geometry_nodes_eval_log; namespace blender::modifiers::geometry_nodes { using namespace nodes::derived_node_tree_types; -using fn::GMutablePointer; -using fn::GPointer; struct GeometryNodesEvaluationParams { blender::LinearAllocator<> allocator; diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index ce0c027da25..dc0965f5d71 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -38,14 +38,6 @@ using fn::FieldEvaluator; using fn::FieldInput; using fn::FieldOperation; using fn::GField; -using fn::GMutablePointer; -using fn::GMutableSpan; -using fn::GPointer; -using fn::GSpan; -using fn::GVArray; -using fn::GVArray_GSpan; -using fn::GVMutableArray; -using fn::GVMutableArray_GSpan; using fn::ValueOrField; using geometry_nodes_eval_log::NodeWarningType; diff --git a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh index 492c67a236f..319fcdeebb7 100644 --- a/source/blender/nodes/NOD_geometry_nodes_eval_log.hh +++ b/source/blender/nodes/NOD_geometry_nodes_eval_log.hh @@ -18,13 +18,12 @@ #include "BLI_enumerable_thread_specific.hh" #include "BLI_function_ref.hh" +#include "BLI_generic_pointer.hh" #include "BLI_linear_allocator.hh" #include "BLI_map.hh" #include "BKE_geometry_set.hh" -#include "FN_generic_pointer.hh" - #include "NOD_derived_node_tree.hh" #include <chrono> @@ -34,9 +33,6 @@ struct SpaceSpreadsheet; namespace blender::nodes::geometry_nodes_eval_log { -using fn::GMutablePointer; -using fn::GPointer; - /** Contains information about a value that has been computed during geometry nodes evaluation. */ class ValueLog { public: diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc index 2d5b0e58367..7f0ba950490 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BLI_generic_array.hh" #include "BLI_kdopbvh.h" #include "BLI_task.hh" @@ -12,8 +13,6 @@ #include "BKE_mesh_runtime.h" #include "BKE_mesh_sample.hh" -#include "FN_generic_array.hh" - #include "UI_interface.h" #include "UI_resources.h" @@ -24,7 +23,6 @@ namespace blender::nodes::node_geo_transfer_attribute_cc { using namespace blender::bke::mesh_surface_sample; -using blender::fn::GArray; NODE_STORAGE_FUNCS(NodeGeometryTransferAttribute) |