Blender
V3.3
|
#include <BKE_attribute.hh>
Public Member Functions | |
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 |
Geometry Component | |
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 |
Protected Attributes | |
void * | owner_ |
const AttributeAccessorFunctions * | fn_ |
Provides read-only access to the set of attributes on some geometry.
Note, this does not own the attributes. When the owner is freed, it is invalid to access its attributes.
Definition at line 349 of file BKE_attribute.hh.
|
inline |
Definition at line 368 of file BKE_attribute.hh.
|
inline |
Interpolate data from one domain to another.
Definition at line 490 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::adapt_domain, fn_, and owner_.
Referenced by adapt_domain(), blender::ed::spreadsheet::GeometryDataSource::apply_selection_filter(), face_corner_color_equalize_vertices(), get_selected_indices(), blender::nodes::node_geo_accumulate_field_cc::AccumulateFieldInput< T >::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::TotalFieldInput< T >::get_varray_for_context(), lookup(), and vertex_paint_from_weight().
|
inline |
Interpolate data from one domain to another.
Definition at line 501 of file BKE_attribute.hh.
References adapt_domain(), T, and blender::GVArray::typed().
Set< AttributeIDRef > blender::bke::AttributeAccessor::all_ids | ( | ) | const |
Get a set of all attributes.
Definition at line 971 of file attribute_access.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), and for_all().
Referenced by blender::geometry::create_curve_from_vert_indices(), blender::geometry::point_merge_by_distance(), and blender::bke::MutableAttributeAccessor::remove_anonymous().
|
inline |
Definition at line 376 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::contains, fn_, and owner_.
Referenced by blender::bke::curve_to_mesh_sweep(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), blender::geometry::preprocess_curves(), blender::geometry::preprocess_meshes(), blender::geometry::preprocess_pointclouds(), and blender::nodes::node_geo_set_id_cc::set_id_in_component().
|
inline |
Definition at line 400 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::domain_size, fn_, and owner_.
Referenced by compute_attributes_to_store(), curves_batch_ensure_attribute(), blender::ed::spreadsheet::GeometryDataSource::foreach_default_column_ids(), blender::ed::spreadsheet::GeometryDataSource::get_column_values(), blender::nodes::node_geo_extrude_mesh_cc::get_orig_index_layer(), get_selected_indices(), lookup_or_default(), blender::nodes::node_geo_attribute_domain_size_cc::node_geo_exec(), blender::ed::spreadsheet::GeometryDataSource::tot_rows(), and blender::nodes::node_geo_store_named_attribute_cc::try_capture_field_on_geometry().
|
inline |
Definition at line 392 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::domain_supported, fn_, and owner_.
Referenced by compute_attributes_to_store().
|
inline |
Run the provided function for every attribute.
Definition at line 511 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::for_all, and owner_.
Referenced by all_ids(), copy_attributes_between_components(), blender::bke::curve_to_mesh_sweep(), 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::ed::spreadsheet::GeometryDataSource::foreach_default_column_ids(), blender::nodes::node_geo_flip_faces_cc::mesh_flip_faces(), blender::bke::retrieve_attributes_for_transfer(), and blender::geometry::retrieve_generic_point_attributes().
|
inline |
Definition at line 409 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::is_builtin, and owner_.
Referenced by blender::geometry::create_curve_from_vert_indices(), blender::bke::get_attribute_domain_for_mesh(), blender::geometry::retrieve_generic_point_attributes(), and blender::bke::should_add_attribute_to_mesh().
|
inline |
Get read-only access to the attribute. If the attribute does not exist, the return value is empty.
Definition at line 418 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::lookup, and owner_.
Referenced by 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(), copy_attributes_between_components(), 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::geometry::create_curve_from_vert_indices(), blender::bke::curve_to_mesh_sweep(), blender::ed::sculpt_paint::AddOperationExecutor::execute(), blender::ed::sculpt_paint::DensityAddOperationExecutor::execute(), blender::ed::sculpt_paint::SlideOperationExecutor::execute(), face_corner_color_equalize_vertices(), blender::ed::spreadsheet::GeometryDataSource::get_column_values(), lookup(), lookup_or_default(), mesh_calc_modifiers(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), blender::geometry::point_merge_by_distance(), blender::geometry::preprocess_curves(), blender::geometry::preprocess_meshes(), blender::geometry::preprocess_pointclouds(), blender::nodes::node_geo_distribute_points_on_faces_cc::propagate_existing_attributes(), blender::bke::retrieve_attributes_for_transfer(), blender::geometry::retrieve_generic_point_attributes(), blender::ed::curves::snap_curves_to_surface::snap_curves_to_surface_exec_object(), blender::nodes::node_geo_dual_mesh_cc::transfer_attributes(), and vertex_paint_from_weight().
|
inline |
Get read-only access to the attribute whereby the attribute is interpolated to the given domain. The result may be empty.
Definition at line 435 of file BKE_attribute.hh.
References lookup().
|
inline |
Get read-only access to the attribute whereby the attribute is converted to the given type. The result may be empty.
Definition at line 444 of file BKE_attribute.hh.
References lookup().
GVArray blender::bke::AttributeAccessor::lookup | ( | const AttributeIDRef & | attribute_id, |
const std::optional< eAttrDomain > | domain, | ||
const std::optional< eCustomDataType > | data_type | ||
) | const |
Get read-only access to the attribute. If necessary, the attribute is interpolated to the given domain, and converted to the given type, in that order. The result may be empty.
Definition at line 925 of file attribute_access.cc.
References adapt_domain(), attribute, blender::bke::custom_data_type_to_cpp_type(), lookup(), blender::bke::try_adapt_data_type(), blender::GVArrayCommon::type(), and type.
|
inline |
Get read-only access to the attribute. If necessary, the attribute is interpolated to the given domain and then converted to the given type, in that order. The result may be empty.
Definition at line 454 of file BKE_attribute.hh.
References blender::bke::cpp_type_to_custom_data_type(), lookup(), T, and blender::bke::GAttributeReader::typed().
|
inline |
Definition at line 384 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::lookup_meta_data, and owner_.
Referenced by face_corner_color_equalize_vertices(), blender::bke::get_attribute_domain_for_mesh(), blender::bke::MutableAttributeAccessor::lookup_or_add_for_write(), request_attribute(), and store_computed_output_attributes().
GVArray blender::bke::AttributeAccessor::lookup_or_default | ( | const AttributeIDRef & | attribute_id, |
const eAttrDomain | domain, | ||
const eCustomDataType | data_type, | ||
const void * | default_value = nullptr |
||
) | const |
Get read-only access to the attribute. If necessary, the attribute is interpolated to the given domain and then converted to the given data type, in that order. If the attribute does not exist, a virtual array with the given default value is returned. If the passed in default value is null, the default value of the type is used (generally 0).
Definition at line 954 of file attribute_access.cc.
References blender::bke::custom_data_type_to_cpp_type(), domain_size(), blender::GVArray::ForSingle(), blender::GVArray::ForSingleRef(), lookup(), and type.
Referenced by BKE_bvhtree_from_pointcloud_get(), BKE_pointcloud_from_mesh(), blender::bke::curve_to_mesh_sweep(), curves_batch_ensure_attribute(), curves_to_curve_eval(), ED_geometry_attribute_convert(), blender::ed::geometry::geometry_attribute_convert_exec(), point_cloud_bounds(), blender::geometry::point_merge_by_distance(), blender::geometry::preprocess_curves(), blender::geometry::preprocess_meshes(), blender::geometry::preprocess_pointclouds(), and blender::io::obj::OBJWriter::write_vertex_coords().
|
inline |
Same as the generic version above, but should be used when the type is known at compile time.
Definition at line 477 of file BKE_attribute.hh.
References domain_size(), and blender::VArray< T >::ForSingle().
|
protected |
Functions that know how to access the attributes stored in the owner above.
Definition at line 365 of file BKE_attribute.hh.
Referenced by adapt_domain(), blender::bke::MutableAttributeAccessor::add(), contains(), domain_size(), domain_supported(), for_all(), is_builtin(), lookup(), blender::bke::MutableAttributeAccessor::lookup_for_write(), lookup_meta_data(), and blender::bke::MutableAttributeAccessor::remove().
|
protected |
The data that actually owns the attributes, for example, a pointer to a Mesh or PointCloud Most commonly this is a pointer to a Mesh or PointCloud. Under some circumstances this can be null. In that case most methods can't be used. Allowed methods are domain_size, for_all and is_builtin. We could potentially make these methods accessible without AttributeAccessor and then owner_ could always be non-null.
Definition at line 361 of file BKE_attribute.hh.
Referenced by adapt_domain(), blender::bke::MutableAttributeAccessor::add(), contains(), domain_size(), domain_supported(), for_all(), is_builtin(), lookup(), blender::bke::MutableAttributeAccessor::lookup_for_write(), lookup_meta_data(), and blender::bke::MutableAttributeAccessor::remove().