82 if (type.
is<
float>()) {
103 if (type.
is<
bool>()) {
166 if (type.
is<
float>()) {
178 if (type.
is<
int>()) {
187 if (type.
is<
bool>()) {
212 "This attribute cannot be accessed in a procedural context");
234 if (attribute_name ==
".reference_index") {
285 int highest_complexity = INT_MIN;
288 for (
const AttrType data_type : data_types) {
290 if (complexity > highest_complexity) {
291 highest_complexity = complexity;
292 most_complex_type = data_type;
296 return most_complex_type;
329 int highest_priority = INT_MIN;
334 if (priority > highest_priority) {
335 highest_priority = priority;
336 highest_priority_domain = domain;
340 return highest_priority_domain;
355 switch (
GS(
id.name)) {
357 return reinterpret_cast<const Mesh &
>(
id).attributes();
359 return reinterpret_cast<const PointCloud &
>(
id).attributes();
371 const std::optional<AttrDomain> domain,
372 const std::optional<AttrType> data_type,
378 if (domain.has_value()) {
388 if (data_type.has_value()) {
402 const std::optional<AttrDomain> domain,
403 const std::optional<AttrType> data_type)
const
418 const void *default_value)
const
426 if (default_value ==
nullptr) {
442 bool found_anonymous =
false;
445 found_anonymous =
true;
449 return found_anonymous;
457 anonymous_ids.
append(name);
477 if (!this->finish_called) {
478 std::cerr <<
"Forgot to call `finish()` for '" << this->name <<
"'.\n";
491 auto checker = std::make_shared<FinishCallChecker>();
492 checker->name = name;
493 checker->real_finish_fn =
attribute.tag_modified_fn;
494 attribute.tag_modified_fn = [checker]() {
495 if (checker->real_finish_fn) {
496 checker->real_finish_fn();
498 checker->finish_called =
true;
521 if (meta_data.has_value()) {
522 if (meta_data->domain == domain && meta_data->data_type == data_type) {
527 if (this->
add(name, domain, data_type, initializer)) {
564 if (meta_data.has_value()) {
565 if (meta_data->domain == domain && meta_data->data_type == data_type) {
570 GVArray data_on_domain = *this->
lookup(name, domain, data_type);
579 converted_data->remove_user_and_delete_if_last();
588 this->
add(name, domain, data_type, initializer);
597 if (meta_data.has_value()) {
598 if (meta_data->domain == domain && meta_data->data_type == data_type) {
619 name, domain, data_type, initializer);
634 const bool overwrite)
637 map.
add_new(old_name, new_name);
642 const bool overwrite)
716 const int src_size = src_attributes.
domain_size(src_domain);
718 if (iter.
domain != src_domain) {
729 *src, iter.
name, dst_domain, iter.
data_type, dst_attributes))
759 copy_attributes(src_attributes, src_domain, dst_domain, attribute_filter, dst_attributes);
763 if (iter.
domain != src_domain) {
774 *src, iter.
name, dst_domain, iter.
data_type, dst_attributes))
799 if (selection.
size() == src_offsets.
size()) {
803 copy_attributes(src_attributes, src_domain, dst_domain, attribute_filter, dst_attributes);
808 if (iter.
domain != src_domain) {
843 if (iter.
domain != src_domain) {
910 if (iter.
domain != src_domain) {
924 const bool dst_already_exists = dst_attributes.
contains(iter.
name);
930 if (!dst_already_exists) {
959 if (iter.
domain != domain) {
1007 attributes.
remove(
"custom_normal");
1010 new_data->remove_user_and_delete_if_last();
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
ID and Library types, which are fundamental for SDNA.
#define PRF_scope(category)
#define BLI_assert_unreachable()
static const CPPType & get()
void fill_assign_n(const void *value, void *dst, int64_t n) const
bool is_equal(const void *a, const void *b) const
void fill_construct_n(const void *value, void *dst, int64_t n) const
const void * default_value() const
const void * data() const
CommonVArrayInfo common_info() const
GSpan get_internal_span() const
const CPPType & type() const
void materialize_to_uninitialized(void *dst) const
VArray< T > typed() const
static GVArray from_single(const CPPType &type, int64_t size, const void *value)
static GVArray from_single_ref(const CPPType &type, int64_t size, const void *value)
constexpr bool is_empty() const
constexpr IndexRange()=default
void add_new(const Key &key, const Value &value)
constexpr bool contains(const T &value) const
void append(const T &value)
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
Set< StringRefNull > all_names() const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
bool contains(StringRef name) const
static std::optional< AttributeAccessor > from_id(const ID &id)
GVArray adapt_domain(const GVArray &varray, const AttrDomain from_domain, const AttrDomain to_domain) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef name) const
GAttributeReader lookup(const StringRef name) const
int domain_size(const AttrDomain domain) const
GPointer get_builtin_default(const StringRef name) const
bool has_anonymous() const
const AttributeAccessorFunctions * fn_
bool is_builtin(const StringRef name) const
GAttributeReader get() const
const AttributeAccessor * accessor
GVArray try_convert(GVArray varray, const CPPType &to_type) const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
bool remove(const StringRef name)
GAttributeWriter lookup_or_add_for_write(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GSpanAttributeWriter convert_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GAttributeWriter convert_or_add_for_write(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GAttributeWriter lookup_for_write(StringRef name)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
GSpanAttributeWriter convert_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
GAttributeWriter convert_or_add_for_write_only(StringRef name, AttrDomain domain, AttrType data_type)
bool add_override(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_for_write_span(StringRef name)
bool rename(StringRef old_name, StringRef new_name, bool overwrite=false)
constexpr bool startswith(StringRef prefix) const
static FieldOperationPtr from(std::shared_ptr< const mf::MultiFunction > fn, Vector< GField > inputs)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
bool indices_are_range(Span< int > indices, IndexRange range)
void copy_group_to_group(OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
void gather(GSpan src, Span< int > map, GMutableSpan dst)
void gather_to_groups(OffsetIndices< int > dst_offsets, const IndexMask &src_selection, GSpan src, GMutableSpan dst)
void gather_group_to_group(OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, GSpan src, GMutableSpan dst)
bool attribute_name_is_anonymous(const StringRef name)
static GPointer get_default_for_fill(AttributeAccessor attributes, const CPPType &type, const StringRef name)
std::optional< eCustomDataType > cpp_type_to_custom_data_type(const CPPType &type)
void fill_attribute_range_default(MutableAttributeAccessor dst_attributes, AttrDomain domain, const AttributeFilter &attribute_filter, IndexRange range)
const CPPType * custom_data_type_to_cpp_type(eCustomDataType type)
void gather_attributes_to_groups(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, OffsetIndices< int > dst_offsets, const IndexMask &src_selection, MutableAttributeAccessor dst_attributes)
static GVArray try_adapt_data_type(GVArray varray, const CPPType &to_type)
const DataTypeConversions & get_implicit_type_conversions()
static int attribute_domain_priority(const AttrDomain domain)
bool allow_procedural_attribute_access(StringRef attribute_name)
void copy_attributes(const AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, MutableAttributeAccessor dst_attributes)
static bool try_add_single_value_attribute(const GVArray &src, const StringRef name, const AttrDomain dst_domain, const AttrType data_type, MutableAttributeAccessor &dst_attributes)
const char * no_procedural_access_message
Vector< AttributeTransferData > retrieve_attributes_for_transfer(const AttributeAccessor src_attributes, MutableAttributeAccessor dst_attributes, Span< AttrDomain > domains, const AttributeFilter &attribute_filter={})
void gather_attributes(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
static int attribute_data_type_complexity(const AttrType data_type)
AttrType attribute_data_type_highest_complexity(Span< AttrType > data_types)
AttrDomain attribute_domain_highest_priority(Span< AttrDomain > domains)
void transform_custom_normal_attribute(const float4x4 &transform, MutableAttributeAccessor &attributes)
void gather_attributes_group_to_group(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
void copy_attributes_group_to_group(AttributeAccessor src_attributes, AttrDomain src_domain, AttrDomain dst_domain, const AttributeFilter &attribute_filter, OffsetIndices< int > src_offsets, OffsetIndices< int > dst_offsets, const IndexMask &selection, MutableAttributeAccessor dst_attributes)
static GAttributeReader adapt_domain_and_type_if_necessary(GAttributeReader attribute, const std::optional< AttrDomain > domain, const std::optional< AttrType > data_type, const AttributeAccessor &accessor)
AttrType cpp_type_to_attribute_type(const CPPType &type)
const CPPType & attribute_type_to_cpp_type(AttrType type)
QuaternionBase< float > Quaternion
void transform_normals(const float3x3 &transform, MutableSpan< float3 > normals)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
BMesh const char void * data
MatBase< float, 3, 3 > float3x3
VecBase< int16_t, 2 > short2
ID_Type GS(const char *name)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
GAttributeWriter(*) lookup_for_write(void *owner, StringRef name)
Set< StringRef >(*) rename(void *owner, const Map< StringRef, StringRef > &map, bool overwrite)
bool allow_skip(const StringRef name) const
AttributeInitShared(const void *data, const ImplicitSharingInfo &sharing_info)
AttributeInitValue(const T &value)
const fn::multi_function::MultiFunction * function
fn::GField validate_field_if_necessary(const fn::GField &field) const
std::function< void()> real_finish_fn
const ImplicitSharingInfo * sharing_info
MutableVArraySpan< T > span