|
Blender V4.3
|
#include <BKE_attribute.hh>
Inherited by blender::bke::MutableAttributeAccessor.
Public Member Functions | |
| AttributeAccessor (const void *owner, const AttributeAccessorFunctions &fn) | |
| bool | domain_supported (const AttrDomain domain) const |
| int | domain_size (const AttrDomain domain) const |
| bool | is_builtin (const StringRef attribute_id) const |
| GAttributeReader | lookup (const StringRef attribute_id) const |
| GAttributeReader | lookup (const StringRef attribute_id, const AttrDomain domain) const |
| GAttributeReader | lookup (const StringRef attribute_id, const eCustomDataType data_type) const |
| template<typename T > | |
| AttributeReader< T > | lookup (const StringRef attribute_id, const std::optional< AttrDomain > domain=std::nullopt) const |
| template<typename T > | |
| AttributeReader< T > | lookup_or_default (const StringRef attribute_id, const AttrDomain domain, const T &default_value) const |
| AttributeValidator | lookup_validator (const StringRef attribute_id) const |
| GVArray | adapt_domain (const GVArray &varray, const AttrDomain from_domain, const AttrDomain to_domain) const |
| template<typename T > | |
| VArray< T > | adapt_domain (const VArray< T > &varray, const AttrDomain from_domain, const AttrDomain to_domain) const |
| void | foreach_attribute (const FunctionRef< void(const AttributeIter &)> fn) const |
Protected Attributes | |
| void * | owner_ |
| const AttributeAccessorFunctions * | fn_ |
Attribute API | |
| bool | contains (const StringRef attribute_id) const |
| std::optional< AttributeMetaData > | lookup_meta_data (const StringRef attribute_id) const |
| GAttributeReader | lookup (StringRef attribute_id, std::optional< AttrDomain > domain, std::optional< eCustomDataType > data_type) const |
| GAttributeReader | lookup_or_default (StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const |
| Set< StringRefNull > | all_ids () const |
| static std::optional< AttributeAccessor > | from_id (const ID &id) |
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 491 of file BKE_attribute.hh.
|
inline |
Definition at line 510 of file BKE_attribute.hh.
|
inline |
Interpolate data from one domain to another.
Definition at line 639 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::adapt_domain, fn_, and owner_.
Referenced by adapt_domain(), blender::bke::adapt_domain_and_type_if_necessary(), blender::ed::spreadsheet::GeometryDataSource::apply_selection_filter(), blender::geometry::extract_mesh_edges(), and blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group().
|
inline |
Interpolate data from one domain to another.
Definition at line 650 of file BKE_attribute.hh.
References adapt_domain(), and blender::GVArray::typed().
| Set< StringRefNull > blender::bke::AttributeAccessor::all_ids | ( | ) | const |
Get a set of all attributes.
Definition at line 675 of file attribute_access.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), and blender::bke::AttributeIter::name.
Referenced by blender::geometry::create_curve_from_vert_indices(), blender::ed::greasepencil::curves_geometry_is_equal(), blender::geometry::point_merge_by_distance(), blender::bke::compare_meshes::sort_domain_using_attributes(), blender::nodes::node_geo_dual_mesh_cc::transfer_attributes(), and blender::bke::compare_meshes::verify_attributes_compatible().
| bool blender::bke::AttributeAccessor::contains | ( | const StringRef | attribute_id | ) | const |
Definition at line 650 of file attribute_access.cc.
References foreach_attribute(), and blender::bke::AttributeIter::name.
Referenced by blender::bke::MutableAttributeAccessor::add(), blender::draw::overlay::add_attributes_to_text_cache(), blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::ed::greasepencil::apply_color_operation_for_mode(), BKE_grease_pencil_data_update(), blender::geometry::convert_curves_to_nurbs(), blender::bke::curve_to_mesh_sweep(), blender::ed::sculpt_paint::AddOperationExecutor::execute(), blender::bke::AttributeExistsFieldInput::get_varray_for_context(), blender::ed::sculpt_paint::grease_pencil_apply_fill(), grease_pencil_do_layer_adjustments(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), and blender::bke::compare_meshes::sort_domain_using_attributes().
|
inline |
Definition at line 541 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::domain_size, fn_, and owner_.
Referenced by blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::ed::spreadsheet::GreasePencilLayerCurvesDomainViewItem::build_row(), blender::bke::copy_attributes(), copy_attributes(), blender::bke::gather_attributes(), blender::bke::gather_attributes(), blender::nodes::node_geo_interpolate_curves_cc::generate_interpolated_curves(), blender::bke::AttributeExistsFieldInput::get_varray_for_context(), blender::bke::AttributeFieldInput::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::AccumulateFieldInput::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::TotalFieldInput::get_varray_for_context(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_main_items_and_geometry(), lookup_or_default(), lookup_or_default(), blender::nodes::LazyFunctionForForeachGeometryElementZone::prepare_components(), blender::bke::greasepencil::select_from_group(), blender::geometry::separate_curves_selection(), and blender::bke::try_sharing_point_data().
|
inline |
Definition at line 533 of file BKE_attribute.hh.
References blender::bke::AttributeAccessorFunctions::domain_supported, fn_, and owner_.
|
inline |
Run the provided function for every attribute. Attributes should not be removed or added during iteration.
Definition at line 661 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::foreach_attribute, and owner_.
Referenced by attr_create_generic(), attr_create_generic(), contains(), copy_attributes(), blender::bke::copy_attributes_group_to_group(), blender::nodes::node_geo_curve_to_points_cc::copy_curve_domain_attributes(), blender::ed::sculpt_paint::greasepencil::create_blank_curve(), blender::geometry::create_curve_from_vert_indices(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::bke::curve_to_mesh_sweep(), blender::ed::sculpt_paint::greasepencil::extend_curve(), blender::geometry::extract_mesh_edges(), blender::geometry::extract_mesh_faces(), blender::geometry::extract_mesh_vertices(), blender::bke::gather_attributes(), blender::bke::gather_attributes(), blender::bke::gather_attributes_group_to_group(), blender::bke::gather_attributes_to_groups(), blender::geometry::gather_attributes_to_propagate(), blender::geometry::gather_curve_attributes_to_interpolate(), blender::geometry::gather_point_attributes_to_interpolate(), blender::geometry::gather_point_attributes_to_interpolate(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), blender::nodes::node_geo_interpolate_curves_cc::interpolate_curve_attributes(), lookup_meta_data(), blender::bke::mesh_flip_faces(), blender::bke::mesh_remesh_reproject_attributes(), blender::nodes::node_geo_grease_pencil_to_curves_cc::node_geo_exec(), blender::geometry::prepare_attribute_fallbacks(), blender::bke::GeometrySet::propagate_attributes_from_layer_to_instances(), blender::geometry::reorder_and_flip_attributes_group_to_group(), blender::geometry::reorder_attributes_group_to_group(), blender::ed::curves::resize_curves(), blender::bke::retrieve_attributes_for_transfer(), and blender::ed::sculpt_paint::greasepencil::trim_end_points().
|
static |
Construct an AttributeAccessor from an ID.
Definition at line 571 of file attribute_access.cc.
|
inline |
Definition at line 550 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::is_builtin, and owner_.
Referenced by blender::geometry::create_curve_from_vert_indices(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::bke::get_attribute_domain_for_mesh(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), 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 559 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::lookup, and owner_.
Referenced by blender::draw::overlay::add_attributes_to_text_cache(), blender::draw::overlay::add_instance_attributes_to_text_cache(), blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::bke::Instances::almost_unique_ids(), attr_create_subd_uv_map(), attr_create_uv_map(), BKE_shrinkwrap_init_tree(), blender::bke::build_mesh_positions(), blender::nodes::node_geo_instances_to_points_cc::convert_instances_to_points(), 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_id_index_map(), create_mesh(), blender::ed::greasepencil::curves_geometry_is_equal(), ED_mesh_pick_vert(), export_hair_curves(), export_hair_curves_motion(), blender::ed::curves::extrude_curves(), blender::draw::pbvh::fill_vbos_mesh(), blender::bke::gather_attributes(), blender::nodes::node_geo_interpolate_curves_cc::generate_interpolated_curves(), blender::nodes::node_geo_mesh_to_points_cc::geometry_set_mesh_to_points(), blender::nodes::node_geo_points_to_vertices_cc::geometry_set_points_to_vertices(), blender::bke::AttributeFieldInput::get_varray_for_context(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), lookup(), lookup(), lookup(), lookup(), lookup_or_default(), lookup_or_default(), mesh_merge_transform(), MOD_solidify_nonmanifold_modifyMesh(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), blender::geometry::point_merge_by_distance(), blender::io::usd::populate_curve_widths(), blender::nodes::node_geo_distribute_points_on_faces_cc::propagate_existing_attributes(), blender::geometry::retrieve_attribute_spans(), blender::geometry::retrieve_attribute_spans(), SCULPT_cursor_geometry_info_update(), SCULPT_stroke_get_location_ex(), blender::ed::curves::snap_curves_to_surface::snap_curves_to_surface_exec_object(), blender::bke::compare_meshes::sort_domain_using_attributes(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::nodes::node_geo_dual_mesh_cc::transfer_attributes(), and blender::bke::compare_meshes::verify_attributes_compatible().
|
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 576 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 585 of file BKE_attribute.hh.
References lookup().
|
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 595 of file BKE_attribute.hh.
References blender::bke::cpp_type_to_custom_data_type(), blender::CPPType::get(), lookup(), and blender::bke::GAttributeReader::typed().
| GAttributeReader blender::bke::AttributeAccessor::lookup | ( | StringRef | attribute_id, |
| std::optional< AttrDomain > | domain, | ||
| 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 620 of file attribute_access.cc.
References blender::bke::adapt_domain_and_type_if_necessary(), and lookup().
| std::optional< AttributeMetaData > blender::bke::AttributeAccessor::lookup_meta_data | ( | const StringRef | attribute_id | ) | const |
Definition at line 662 of file attribute_access.cc.
References foreach_attribute(), blender::bke::AttributeIter::name, and blender::bke::AttributeIter::stop().
Referenced by ensure_weight_attribute_meta_data(), blender::ed::geometry::geometry_color_attribute_convert_poll(), blender::bke::get_attribute_domain_for_mesh(), blender::draw::request_attribute(), blender::ed::curves::retrieve_selected_curves(), blender::ed::sculpt_paint::undo::save_active_attribute(), and blender::ed::greasepencil::select_set_mode_exec().
|
inline |
Same as the generic version above, but should be used when the type is known at compile time.
Definition at line 618 of file BKE_attribute.hh.
References domain_size(), blender::VArray< T >::ForSingle(), and lookup().
| GAttributeReader blender::bke::AttributeAccessor::lookup_or_default | ( | StringRef | attribute_id, |
| AttrDomain | domain, | ||
| 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 633 of file attribute_access.cc.
References attribute, blender::bke::custom_data_type_to_cpp_type(), domain_size(), blender::GVArray::ForSingle(), blender::GVArray::ForSingleRef(), and lookup().
Referenced by blender::ed::greasepencil::bake_grease_pencil_animation_exec(), blender::ed::greasepencil::create_curves_outline(), blender::create_dashes(), blender::create_envelope_strokes(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::io::alembic::ABCCurveWriter::do_write(), blender::ed::sculpt_paint::CombOperationExecutor::execute(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::execute(), blender::ed::sculpt_paint::PinchOperationExecutor::execute(), blender::ed::sculpt_paint::PuffOperationExecutor::execute(), blender::ed::sculpt_paint::SlideOperationExecutor::execute(), blender::ed::sculpt_paint::SmoothOperationExecutor::execute(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::execute(), blender::modifier::greasepencil::get_filtered_layer_mask(), blender::nodes::node_geo_tool_selection_cc::EditSelectionFieldInput::get_varray_for_context(), blender::nodes::node_geo_tool_selection_cc::SculptSelectionFieldInput::get_varray_for_context(), grease_pencil_do_layer_adjustments(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), OVERLAY_grease_pencil_material_names(), paintface_flush_flags(), paintvert_flush_flags(), blender::geometry::point_merge_by_distance(), and blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::soft_eraser().
|
inline |
Same as the generic version above, but should be used when the type is known at compile time.
Definition at line 631 of file BKE_attribute.hh.
References fn_, blender::bke::AttributeAccessorFunctions::lookup_validator, and owner_.
|
protected |
Functions that know how to access the attributes stored in the owner above.
Definition at line 507 of file BKE_attribute.hh.
Referenced by adapt_domain(), blender::bke::MutableAttributeAccessor::add(), domain_size(), domain_supported(), foreach_attribute(), is_builtin(), lookup(), lookup_validator(), 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, foreach_attribute and is_builtin. We could potentially make these methods accessible without AttributeAccessor and then owner_ could always be non-null.
Definition at line 503 of file BKE_attribute.hh.
Referenced by adapt_domain(), blender::bke::MutableAttributeAccessor::add(), domain_size(), domain_supported(), foreach_attribute(), is_builtin(), lookup(), lookup_validator(), and blender::bke::MutableAttributeAccessor::remove().