BLI: move generic data structures to blenlib
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
This commit is contained in:
parent
c655146b87
commit
3e16f3b3ef
|
@ -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_;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "attribute_access_intern.hh"
|
||||
|
||||
using blender::fn::GVArray;
|
||||
using blender::GVArray;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Geometry Component Implementation
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -36,9 +36,6 @@
|
|||
|
||||
namespace blender::ed::geometry {
|
||||
|
||||
using fn::GArray;
|
||||
using fn::GVArray;
|
||||
|
||||
/*********************** Attribute Operators ************************/
|
||||
|
||||
static bool geometry_attributes_poll(bContext *C)
|
||||
|
|
|
@ -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" {
|
||||
|
|
|
@ -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_;
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue