Blender  V3.3
Public Member Functions | List of all members
blender::bke::MutableAttributeAccessor Class Reference

#include <BKE_attribute.hh>

Inheritance diagram for blender::bke::MutableAttributeAccessor:
blender::bke::AttributeAccessor

Public Member Functions

 MutableAttributeAccessor (void *owner, const AttributeAccessorFunctions &fn)
 
template<typename T >
AttributeWriter< Tlookup_for_write (const AttributeIDRef &attribute_id)
 
bool add (const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer)
 
template<typename T >
AttributeWriter< Tlookup_or_add_for_write (const AttributeIDRef &attribute_id, const eAttrDomain domain, const AttributeInit &initializer=AttributeInitDefault())
 
template<typename T >
SpanAttributeWriter< Tlookup_or_add_for_write_span (const AttributeIDRef &attribute_id, const eAttrDomain domain, const AttributeInit &initializer=AttributeInitDefault())
 
template<typename T >
SpanAttributeWriter< Tlookup_or_add_for_write_only_span (const AttributeIDRef &attribute_id, const eAttrDomain domain)
 
bool remove (const AttributeIDRef &attribute_id)
 
Geometry Component
GAttributeWriter lookup_for_write (const AttributeIDRef &attribute_id)
 
GAttributeWriter lookup_or_add_for_write (const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefault())
 
GSpanAttributeWriter lookup_or_add_for_write_span (const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefault())
 
GSpanAttributeWriter lookup_or_add_for_write_only_span (const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type)
 
void remove_anonymous ()
 
- Public Member Functions inherited from blender::bke::AttributeAccessor
 AttributeAccessor (const void *owner, const AttributeAccessorFunctions &fn)
 
bool contains (const AttributeIDRef &attribute_id) const
 
std::optional< AttributeMetaDatalookup_meta_data (const AttributeIDRef &attribute_id) const
 
bool domain_supported (const eAttrDomain domain) const
 
int domain_size (const eAttrDomain domain) const
 
bool is_builtin (const AttributeIDRef &attribute_id) const
 
GAttributeReader lookup (const AttributeIDRef &attribute_id) const
 
GVArray lookup (const AttributeIDRef &attribute_id, const eAttrDomain domain) const
 
GVArray lookup (const AttributeIDRef &attribute_id, const eCustomDataType data_type) const
 
template<typename T >
VArray< Tlookup (const AttributeIDRef &attribute_id, const std::optional< eAttrDomain > domain=std::nullopt) const
 
template<typename T >
VArray< Tlookup_or_default (const AttributeIDRef &attribute_id, const eAttrDomain domain, const T &default_value) const
 
GVArray adapt_domain (const GVArray &varray, const eAttrDomain from_domain, const eAttrDomain to_domain) const
 
template<typename T >
VArray< Tadapt_domain (const VArray< T > &varray, const eAttrDomain from_domain, const eAttrDomain to_domain) const
 
bool for_all (const AttributeForeachCallback fn) const
 
GVArray lookup (const AttributeIDRef &attribute_id, const std::optional< eAttrDomain > domain, const std::optional< eCustomDataType > data_type) const
 
GVArray lookup_or_default (const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const void *default_value=nullptr) const
 
Set< AttributeIDRefall_ids () const
 

Additional Inherited Members

- Protected Attributes inherited from blender::bke::AttributeAccessor
voidowner_
 
const AttributeAccessorFunctionsfn_
 

Detailed Description

Extends AttributeAccessor with methods that allow modifying individual attributes as well as the set of attributes.

Definition at line 529 of file BKE_attribute.hh.

Constructor & Destructor Documentation

◆ MutableAttributeAccessor()

blender::bke::MutableAttributeAccessor::MutableAttributeAccessor ( void owner,
const AttributeAccessorFunctions fn 
)
inline

Definition at line 531 of file BKE_attribute.hh.

Member Function Documentation

◆ add()

bool blender::bke::MutableAttributeAccessor::add ( const AttributeIDRef attribute_id,
const eAttrDomain  domain,
const eCustomDataType  data_type,
const AttributeInit initializer 
)
inline

Create a new attribute.

Returns
True, when a new attribute has been created. False, when it's not possible to create this attribute or there is already an attribute with that id.

Definition at line 563 of file BKE_attribute.hh.

References blender::bke::AttributeAccessorFunctions::add, blender::bke::AttributeAccessor::fn_, and blender::bke::AttributeAccessor::owner_.

Referenced by ED_geometry_attribute_convert(), blender::ed::geometry::geometry_attribute_convert_exec(), lookup_or_add_for_write(), store_computed_output_attributes(), and blender::nodes::node_geo_store_named_attribute_cc::try_capture_field_on_geometry().

◆ lookup_for_write() [1/2]

GAttributeWriter blender::bke::MutableAttributeAccessor::lookup_for_write ( const AttributeIDRef attribute_id)

◆ lookup_for_write() [2/2]

template<typename T >
AttributeWriter<T> blender::bke::MutableAttributeAccessor::lookup_for_write ( const AttributeIDRef attribute_id)
inline

Get a writable attribute or non if it does not exist. Make sure to call #finish after changes are done.

Definition at line 546 of file BKE_attribute.hh.

References attribute, lookup_for_write(), and T.

◆ lookup_or_add_for_write() [1/2]

template<typename T >
AttributeWriter<T> blender::bke::MutableAttributeAccessor::lookup_or_add_for_write ( const AttributeIDRef attribute_id,
const eAttrDomain  domain,
const AttributeInit initializer = AttributeInitDefault() 
)
inline

Same as above, but should be used when the type is known at compile time.

Definition at line 597 of file BKE_attribute.hh.

References blender::bke::cpp_type_to_custom_data_type(), lookup_or_add_for_write(), T, and blender::bke::GAttributeWriter::typed().

◆ lookup_or_add_for_write() [2/2]

GAttributeWriter blender::bke::MutableAttributeAccessor::lookup_or_add_for_write ( const AttributeIDRef attribute_id,
const eAttrDomain  domain,
const eCustomDataType  data_type,
const AttributeInit initializer = AttributeInitDefault() 
)

◆ lookup_or_add_for_write_only_span() [1/2]

template<typename T >
SpanAttributeWriter<T> blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_only_span ( const AttributeIDRef attribute_id,
const eAttrDomain  domain 
)
inline

Same as above, but should be used when the type is known at compile time.

Definition at line 640 of file BKE_attribute.hh.

References attribute.

◆ lookup_or_add_for_write_only_span() [2/2]

GSpanAttributeWriter blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_only_span ( const AttributeIDRef attribute_id,
const eAttrDomain  domain,
const eCustomDataType  data_type 
)

Find an attribute with the given id, domain and data type. If it does not exist, create a new attribute. If the attribute does not exist and can't be created, none is returned.

The "only" in the name indicates that the caller should not read existing values from the span. If the attribute is not stored as span internally, the existing values won't be copied over to the span.

Definition at line 1072 of file attribute_access.cc.

References attribute, and lookup_or_add_for_write().

Referenced by blender::nodes::calculate_cone_uvs(), blender::nodes::calculate_selection_outputs(), blender::nodes::node_geo_mesh_primitive_uv_sphere_cc::calculate_sphere_uvs(), blender::geometry::calculate_uvs(), blender::nodes::calculate_uvs(), blender::nodes::node_geo_delete_geometry_cc::copy_attributes(), blender::nodes::node_geo_delete_geometry_cc::copy_attributes_based_on_map(), blender::nodes::node_geo_delete_geometry_cc::copy_attributes_based_on_mask(), blender::nodes::node_geo_duplicate_elements_cc::copy_attributes_without_id(), blender::nodes::node_geo_duplicate_elements_cc::copy_curve_attributes_without_id(), blender::nodes::node_geo_duplicate_elements_cc::copy_edge_attributes_without_id(), blender::nodes::node_geo_duplicate_elements_cc::copy_face_attributes_without_id(), blender::nodes::node_geo_duplicate_elements_cc::copy_stable_id_curves(), blender::nodes::node_geo_duplicate_elements_cc::copy_stable_id_edges(), blender::nodes::node_geo_duplicate_elements_cc::copy_stable_id_faces(), blender::nodes::node_geo_duplicate_elements_cc::copy_stable_id_point(), blender::nodes::node_geo_string_to_curves_cc::create_attributes(), blender::nodes::node_geo_duplicate_elements_cc::create_duplicate_index_attribute(), curve_eval_to_curves(), blender::bke::curve_legacy_to_curves(), blender::geometry::execute_realize_curve_tasks(), blender::geometry::execute_realize_mesh_tasks(), blender::geometry::execute_realize_pointcloud_tasks(), mesh_calc_modifiers(), blender::nodes::node_geo_boolean_cc::node_geo_exec(), blender::geometry::point_merge_by_distance(), pointcloud_random(), blender::bke::retrieve_attributes_for_transfer(), and blender::nodes::node_geo_dual_mesh_cc::transfer_attributes().

◆ lookup_or_add_for_write_span() [1/2]

template<typename T >
SpanAttributeWriter<T> blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_span ( const AttributeIDRef attribute_id,
const eAttrDomain  domain,
const AttributeInit initializer = AttributeInitDefault() 
)
inline

Same as above, but should be used when the type is known at compile time.

Definition at line 611 of file BKE_attribute.hh.

References attribute.

◆ lookup_or_add_for_write_span() [2/2]

GSpanAttributeWriter blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_span ( const AttributeIDRef attribute_id,
const eAttrDomain  domain,
const eCustomDataType  data_type,
const AttributeInit initializer = AttributeInitDefault() 
)

◆ remove()

bool blender::bke::MutableAttributeAccessor::remove ( const AttributeIDRef attribute_id)
inline

◆ remove_anonymous()

void blender::bke::MutableAttributeAccessor::remove_anonymous ( )

The documentation for this class was generated from the following files: