Blender
V3.3
|
#include <BKE_attribute.hh>
Public Member Functions | |
MutableAttributeAccessor (void *owner, const AttributeAccessorFunctions &fn) | |
template<typename T > | |
AttributeWriter< T > | lookup_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< T > | lookup_or_add_for_write (const AttributeIDRef &attribute_id, const eAttrDomain domain, const AttributeInit &initializer=AttributeInitDefault()) |
template<typename T > | |
SpanAttributeWriter< T > | lookup_or_add_for_write_span (const AttributeIDRef &attribute_id, const eAttrDomain domain, const AttributeInit &initializer=AttributeInitDefault()) |
template<typename T > | |
SpanAttributeWriter< T > | lookup_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 () |
![]() | |
AttributeAccessor (const void *owner, const AttributeAccessorFunctions &fn) | |
bool | contains (const AttributeIDRef &attribute_id) const |
std::optional< AttributeMetaData > | lookup_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< T > | lookup (const AttributeIDRef &attribute_id, const std::optional< eAttrDomain > domain=std::nullopt) const |
template<typename T > | |
VArray< T > | lookup_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< T > | adapt_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< AttributeIDRef > | all_ids () const |
Additional Inherited Members | |
![]() | |
void * | owner_ |
const AttributeAccessorFunctions * | fn_ |
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.
|
inline |
Definition at line 531 of file BKE_attribute.hh.
|
inline |
Create a new attribute.
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().
GAttributeWriter blender::bke::MutableAttributeAccessor::lookup_for_write | ( | const AttributeIDRef & | attribute_id | ) |
Get a writable attribute or none if it does not exist. Make sure to call #finish after changes are done.
Debug utility that checks whether the #finish function of an #AttributeWriter has been called.
Definition at line 1014 of file attribute_access.cc.
References blender::bke::AttributeIDRef::anonymous_id(), attribute, BKE_anonymous_attribute_id_debug_name(), blender::bke::AttributeAccessor::fn_, blender::bke::AttributeIDRef::is_named(), blender::bke::AttributeAccessorFunctions::lookup_for_write, blender::bke::AttributeIDRef::name(), and blender::bke::AttributeAccessor::owner_.
Referenced by lookup_for_write(), lookup_or_add_for_write(), blender::nodes::node_geo_set_position_cc::set_computed_position_and_offset(), transform_active_color(), blender::nodes::node_geo_store_named_attribute_cc::try_capture_field_on_geometry(), and vertex_paint_from_weight().
|
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.
|
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().
GAttributeWriter blender::bke::MutableAttributeAccessor::lookup_or_add_for_write | ( | const AttributeIDRef & | attribute_id, |
const eAttrDomain | domain, | ||
const eCustomDataType | data_type, | ||
const AttributeInit & | initializer = AttributeInitDefault() |
||
) |
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 (e.g. because it already exists on a different domain or with a different type), none is returned.
Definition at line 1039 of file attribute_access.cc.
References add(), lookup_for_write(), and blender::bke::AttributeAccessor::lookup_meta_data().
Referenced by copy_attributes_between_components(), lookup_or_add_for_write(), lookup_or_add_for_write_only_span(), lookup_or_add_for_write_span(), blender::nodes::node_geo_set_spline_cyclic_cc::set_cyclic_in_component(), blender::nodes::node_geo_set_id_cc::set_id_in_component(), blender::nodes::node_geo_set_material_index_cc::set_material_index_in_component(), blender::nodes::node_geo_set_curve_radius_cc::set_radius_in_component(), blender::nodes::node_geo_set_point_radius_cc::set_radius_in_component(), blender::nodes::node_geo_set_spline_resolution_cc::set_resolution_in_component(), blender::nodes::node_geo_set_shade_smooth_cc::set_smooth_in_component(), blender::nodes::node_geo_set_curve_tilt_cc::set_tilt_in_component(), store_computed_output_attributes(), and blender::nodes::node_geo_attribute_capture_cc::try_capture_field_on_geometry().
|
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.
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().
|
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.
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() |
||
) |
Same as above, but returns a type that makes it easier to work with the attribute as a span. If the caller newly initializes the attribute, it's better to use lookup_or_add_for_write_only_span.
Definition at line 1058 of file attribute_access.cc.
References attribute, and lookup_or_add_for_write().
Referenced by blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_vertices(), blender::geometry::retrieve_generic_point_attributes(), blender::nodes::node_geo_set_id_cc::set_id_in_component(), blender::nodes::transform_pointcloud(), and blender::nodes::translate_pointcloud().
|
inline |
Remove an attribute.
Definition at line 655 of file BKE_attribute.hh.
References blender::bke::AttributeAccessor::fn_, blender::bke::AttributeAccessor::owner_, and blender::bke::AttributeAccessorFunctions::remove.
Referenced by blender::ed::curves::set_selection_domain::curves_set_selection_domain_exec(), ED_geometry_attribute_convert(), blender::ed::geometry::geometry_attribute_convert_exec(), remove_anonymous(), blender::ed::curves::select_all::select_all_exec(), store_computed_output_attributes(), and blender::nodes::node_geo_store_named_attribute_cc::try_capture_field_on_geometry().
void blender::bke::MutableAttributeAccessor::remove_anonymous | ( | ) |
Remove all anonymous attributes.
Definition at line 982 of file attribute_access.cc.
References blender::bke::AttributeAccessor::all_ids(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::pop_last(), and remove().
Referenced by BKE_mesh_new_from_object_to_bmain(), modifier_apply_obdata(), and object_convert_exec().