Blender V5.0
blender::bke::AttributeAccessor Class Reference

#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
std::optional< AttributeDomainAndTypeget_builtin_domain_and_type (const StringRef name) const
GPointer get_builtin_default (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 AttrType data_type) const
template<typename T>
AttributeReader< Tlookup (const StringRef attribute_id, const std::optional< AttrDomain > domain=std::nullopt) const
template<typename T>
AttributeReader< Tlookup_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< Tadapt_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 AttributeAccessorFunctionsfn_

Attribute API

bool contains (StringRef attribute_id) const
std::optional< AttributeMetaDatalookup_meta_data (StringRef attribute_id) const
GAttributeReader lookup (StringRef attribute_id, std::optional< AttrDomain > domain, std::optional< AttrType > data_type) const
GAttributeReader lookup_or_default (StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
Set< StringRefNullall_ids () const
static std::optional< AttributeAccessorfrom_id (const ID &id)

Detailed Description

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 524 of file BKE_attribute.hh.

Constructor & Destructor Documentation

◆ AttributeAccessor()

blender::bke::AttributeAccessor::AttributeAccessor ( const void * owner,
const AttributeAccessorFunctions & fn )
inline

Definition at line 543 of file BKE_attribute.hh.

References fn_, and owner_.

Referenced by blender::bke::MutableAttributeAccessor::MutableAttributeAccessor().

Member Function Documentation

◆ adapt_domain() [1/2]

◆ adapt_domain() [2/2]

template<typename T>
VArray< T > blender::bke::AttributeAccessor::adapt_domain ( const VArray< T > & varray,
const AttrDomain from_domain,
const AttrDomain to_domain ) const
inline

Interpolate data from one domain to another.

Definition at line 701 of file BKE_attribute.hh.

References adapt_domain(), T, and blender::GVArray::typed().

◆ all_ids()

◆ contains()

bool blender::bke::AttributeAccessor::contains ( StringRef attribute_id) const
Returns
True, when the attribute is available.

Definition at line 750 of file attribute_access.cc.

References foreach_attribute(), blender::bke::AttributeIter::name, and blender::bke::AttributeIter::stop().

Referenced by blender::bke::MutableAttributeAccessor::add(), blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::ed::greasepencil::apply_color_operation_for_mode(), blender::ed::greasepencil::apply_eval_grease_pencil_data(), BKE_mesh_legacy_convert_flags_to_hide_layers(), BKE_mesh_legacy_convert_flags_to_selection_layers(), BKE_mesh_legacy_convert_mpoly_to_material_indices(), BKE_mesh_legacy_sharp_edges_from_flags(), BKE_mesh_legacy_sharp_faces_from_flags(), BKE_mesh_legacy_uv_seam_from_flags(), BKE_object_eval_grease_pencil(), blender::ed::sculpt_paint::face_set::clear_face_sets(), blender::ed::geometry::convert_attribute(), blender::geometry::convert_curves_to_nurbs(), blender::bke::copy_attributes_group_to_group(), blender::ed::sculpt_paint::face_set::create_face_sets_mesh(), blender::bke::curve_to_mesh_sweep(), blender::ed::curves::curves_draw_exec(), blender::draw::DRW_pointcloud_evaluated_attribute(), blender::ed::sculpt_paint::face_set::edit_grow_shrink(), blender::ed::sculpt_paint::face_set::edit_is_operation_valid(), blender::draw::CurvesEvalCache::ensure_attributes(), blender::draw::CurvesEvalCache::ensure_attributes(), blender::ed::sculpt_paint::face_set::ensure_face_sets_mesh(), blender::ed::curves::ensure_selection_attribute(), blender::ed::pointcloud::ensure_selection_attribute(), blender::ed::curves::get_curves_bezier_selection_attribute_names(), blender::bke::AttributeExistsFieldInput::get_varray_for_context(), blender::ed::sculpt_paint::grease_pencil_apply_fill(), grease_pencil_do_layer_adjustments(), blender::ed::greasepencil::grease_pencil_primitive_init_curves(), blender::ed::greasepencil::grease_pencil_reset_uvs_exec(), blender::ed::greasepencil::grease_pencil_set_corner_type_exec(), blender::ed::sculpt_paint::hide::grow_shrink_visibility_mesh(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), blender::bke::bake::load_attributes(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), blender::nodes::node_geo_curve_set_handle_type_cc::node_geo_exec(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), blender::nodes::node_geo_set_curve_handles_cc::node_geo_exec(), blender::nodes::node_geo_set_grease_pencil_color_cc::node_geo_exec(), blender::draw::overlay::AttributeTexts::object_sync(), blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_done(), blender::ed::sculpt_paint::hide::partialvis_all_update_mesh(), blender::ed::sculpt_paint::hide::partialvis_gesture_update_mesh(), blender::ed::sculpt_paint::hide::partialvis_masked_update_mesh(), blender::draw::pointcloud_surface_shaded_get(), blender::geometry::preprocess_curves(), blender::geometry::preprocess_grease_pencils(), blender::geometry::preprocess_meshes(), blender::geometry::preprocess_pointclouds(), blender::ed::sculpt_paint::greasepencil::PaintOperationExecutor::process_extension_sample(), blender::ed::sculpt_paint::greasepencil::PaintOperationExecutor::process_start_sample(), blender::ed::sculpt_paint::face_set::randomize_colors_exec(), blender::bke::MutableAttributeAccessor::rename(), blender::draw::request_attribute(), blender::nodes::node_geo_extrude_mesh_cc::save_selection_as_attribute(), blender::nodes::node_geo_set_position_cc::set_curves_position(), blender::bke::compare_geometry::sort_domain_using_attributes(), transform_active_color_data(), and blender::bke::bake::try_load_instances().

◆ domain_size()

int blender::bke::AttributeAccessor::domain_size ( const AttrDomain domain) const
inline
Returns
Number of elements in the given domain.

Definition at line 574 of file BKE_attribute.hh.

References fn_, and owner_.

Referenced by blender::geometry::add_instance_attributes_to_single_geometry(), blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::nodes::node_geo_set_material_cc::assign_material_to_id_geometry(), blender::ed::spreadsheet::GreasePencilLayerCurvesDomainViewItem::build_row(), blender::ed::spreadsheet::calc_mesh_selection_mask(), blender::ed::spreadsheet::calc_mesh_selection_mask_faces(), blender::nodes::compute_attributes_to_store(), blender::bke::copy_attributes(), copy_attributes(), blender::ed::curves::set_selection_domain::curves_set_selection_domain_exec(), blender::ed::curves::ensure_selection_attribute(), blender::ed::greasepencil::ensure_selection_domain(), ensure_weight_attribute_meta_data(), blender::ed::sculpt_paint::float_selection_ensure(), blender::bke::gather_attributes(), blender::bke::gather_attributes(), blender::bke::gather_attributes_group_to_group(), blender::nodes::node_geo_interpolate_curves_cc::generate_interpolated_curves(), blender::ed::geometry::geometry_attribute_add_exec(), blender::nodes::node_geo_extrude_mesh_cc::get_orig_index_layer(), get_selected_indices(), blender::bke::AttributeExistsFieldInput::get_varray_for_context(), blender::bke::AttributeFieldInput::get_varray_for_context(), blender::bke::EvaluateOnDomainInput::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::node_geo_field_average_cc::FieldAverageInput::get_varray_for_context(), blender::nodes::node_geo_field_min_and_max_cc::FieldMinMaxInput::get_varray_for_context(), blender::nodes::node_geo_field_variance_cc::FieldVarianceInput::get_varray_for_context(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_main_items_and_geometry(), blender::bke::bake::load_attributes(), lookup_or_default(), lookup_or_default(), blender::nodes::node_geo_attribute_domain_size_cc::node_geo_exec(), blender::nodes::node_geo_set_grease_pencil_color_cc::node_geo_exec(), blender::nodes::LazyFunctionForForeachGeometryElementZone::prepare_components(), blender::ed::curves::remove_selection(), blender::nodes::node_geo_material_selection_cc::select_by_material(), blender::geometry::separate_curves_selection(), blender::geometry::separate_grease_pencil_layer_selection(), blender::geometry::separate_mesh_selection(), blender::bke::try_capture_fields_on_geometry(), blender::bke::try_sharing_point_data(), and view3d_lasso_select().

◆ domain_supported()

bool blender::bke::AttributeAccessor::domain_supported ( const AttrDomain domain) const
inline
Returns
True, when attributes can exist on that domain.

Definition at line 566 of file BKE_attribute.hh.

References fn_, and owner_.

Referenced by blender::bke::MutableAttributeAccessor::add(), blender::nodes::compute_attributes_to_store(), and blender::ed::geometry::geometry_attribute_add_exec().

◆ foreach_attribute()

void blender::bke::AttributeAccessor::foreach_attribute ( const FunctionRef< void(const AttributeIter &)> fn) const
inline

Run the provided function for every attribute. Attributes should not be removed or added during iteration.

Definition at line 712 of file BKE_attribute.hh.

References fn_, and owner_.

Referenced by blender::ed::greasepencil::add_single_curve(), all_ids(), blender::ed::greasepencil::apply_eval_grease_pencil_data(), attr_create_generic(), attr_create_generic(), blender::bke::GeometrySet::attribute_foreach(), blender::nodes::node_geo_extrude_mesh_cc::attribute_ids_by_domain(), BKE_mesh_merge_customdata_for_apply_modifier(), contains(), copy_attributes(), blender::bke::copy_attributes_group_to_group(), blender::nodes::node_geo_curve_to_points_cc::copy_curve_domain_attributes(), blender::ed::greasepencil::copy_layer_and_frames_to_target_object(), 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::io::usd::USDPointInstancerWriter::do_write(), blender::ed::curves::duplicate_curves(), blender::ed::curves::duplicate_points(), blender::geometry::extract_mesh_edges(), blender::geometry::extract_mesh_faces(), blender::geometry::extract_mesh_vertices(), blender::bke::fill_attribute_range_default(), 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::draw::get_first_uv_name(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), blender::nodes::node_geo_interpolate_curves_cc::interpolate_curve_attributes(), blender::nodes::node_geo_extrude_mesh_cc::is_empty_domain(), blender::io::ply::load_custom_attributes(), lookup_meta_data(), blender::bke::mesh_apply_spatial_organization(), blender::geometry::mesh_faces_to_curves_convert(), 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::geometry::reorder_and_flip_attributes_group_to_group(), blender::geometry::reorder_attributes_group_to_group(), blender::ed::curves::resize_curves(), blender::ed::greasepencil::resize_single_curve(), blender::bke::retrieve_attributes_for_transfer(), blender::bke::bake::serialize_attributes(), and blender::ed::sculpt_paint::greasepencil::trim_end_points().

◆ from_id()

std::optional< AttributeAccessor > blender::bke::AttributeAccessor::from_id ( const ID & id)
static

◆ get_builtin_default()

GPointer blender::bke::AttributeAccessor::get_builtin_default ( const StringRef attribute_id) const
inline
Returns
The default value defined by the #BuiltinAttributeProvider. The provided attribute_id must refer to a builtin attribute.

Definition at line 600 of file BKE_attribute.hh.

References BLI_assert, fn_, is_builtin(), and owner_.

Referenced by blender::bke::copy_attributes_group_to_group(), blender::bke::fill_attribute_range_default(), blender::geometry::initialize_curves_builtin_attribute_defaults(), and blender::bke::initialize_new_data().

◆ get_builtin_domain_and_type()

std::optional< AttributeDomainAndType > blender::bke::AttributeAccessor::get_builtin_domain_and_type ( const StringRef name) const
inline
Returns
The required domain and type for the attribute, if it is builtin.

Definition at line 591 of file BKE_attribute.hh.

References fn_, name, and owner_.

Referenced by name_valid_for_builtin_domain_and_type(), and blender::bke::try_capture_fields_on_geometry().

◆ is_builtin()

◆ lookup() [1/5]

GAttributeReader blender::bke::AttributeAccessor::lookup ( const StringRef attribute_id) const
inline

Get read-only access to the attribute. If the attribute does not exist, the return value is empty.

Definition at line 610 of file BKE_attribute.hh.

References fn_, and owner_.

Referenced by blender::ed::sculpt_paint::color::active_color_attribute(), blender::ed::sculpt_paint::face_set::active_face_set_get(), blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::ed::sculpt_paint::expand::any_nonzero_mask(), blender::ed::sculpt_paint::mask::apply_mask_from_settings(), attr_create_subd_uv_map(), attr_create_uv_map(), blender::ed::sculpt_paint::attribute_matches(), blender::ed::sculpt_paint::average_mask_border_position(), BKE_keyblock_mesh_calc_normals(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_remap_calc_loops_from_mesh(), BKE_sculpt_mask_layers_ensure(), BKE_shrinkwrap_init_tree(), blender::ed::sculpt_paint::smooth::blur_geometry_data_array(), BM_mesh_bm_from_me(), blender::ed::sculpt_paint::expand::boundary_from_enabled(), blender::bke::build_mesh_positions(), blender::ed::sculpt_paint::calc_area_center(), blender::ed::sculpt_paint::calc_area_normal(), blender::ed::sculpt_paint::calc_area_normal_and_center(), blender::ed::sculpt_paint::auto_mask::calc_blurred_cavity_mesh(), blender::ed::sculpt_paint::auto_mask::calc_face_factors(), blender::ed::sculpt_paint::auto_mask::calc_grids_factors(), blender::ed::sculpt_paint::filter::calc_inflate_filter(), blender::draw::pbvh::calc_material_indices(), blender::ed::sculpt_paint::filter::calc_relax_face_sets_filter(), blender::ed::sculpt_paint::filter::calc_relax_filter(), blender::io::obj::OBJMesh::calc_smooth_groups(), blender::ed::sculpt_paint::islands::calc_topology_islands_mesh(), blender::ed::sculpt_paint::auto_mask::calc_vert_factors(), calculate_average_color(), calculate_average_weight(), blender::ed::sculpt_paint::face_set::change_visibility_exec(), blender::ed::sculpt_paint::face_set::check_single_face_set(), blender::ed::sculpt_paint::face_set::clear_face_sets(), blender::bke::compute_local_mesh_groups(), blender::nodes::node_geo_instances_to_points_cc::convert_instances_to_points(), blender::ed::greasepencil::copy_layer_and_frames_to_target_object(), 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_mesh_primitive_ico_sphere_cc::create_ico_sphere_mesh(), blender::geometry::create_id_index_map(), create_mesh(), blender::ed::sculpt_paint::face_set::create_op_exec(), blender::ed::sculpt_paint::cursor_geometry_info_update(), blender::draw::curve_create_attribute(), blender::ed::greasepencil::curves_geometry_is_equal(), blender::ed::curves::set_selection_domain::curves_set_selection_domain_exec(), blender::nodes::node_geo_curve_to_points_cc::curves_to_points(), blender::ed::sculpt_paint::boundary::data_init_mesh(), data_transfer_dtdata_type_postprocess(), blender::ed::sculpt_paint::face_set::delete_geometry(), blender::ed::sculpt_paint::brushes::do_layer_brush(), blender::ed::sculpt_paint::brushes::do_mask_brush(), blender::ed::sculpt_paint::boundary::do_smooth_brush(), do_vpaint_brush_blur_loops(), do_vpaint_brush_blur_verts(), do_vpaint_brush_smear(), do_wpaint_brush_blur(), do_wpaint_brush_draw(), do_wpaint_brush_smear(), dynamicPaint_createUVSurface(), dynamicPaint_setInitialColor(), ED_mesh_pick_vert(), ED_mesh_split_faces(), blender::ed::sculpt_paint::face_set::edit_fairing(), blender::ed::sculpt_paint::face_set::edit_grow_shrink(), blender::ed::sculpt_paint::expand::enabled_state_to_bitmap(), blender::draw::ensure_control_point_attribute(), blender::ed::sculpt_paint::cloth::ensure_nodes_constraints(), blender::ed::greasepencil::ensure_selection_domain(), ensure_weight_attribute_meta_data(), envelope_bone_weighting(), blender::ed::sculpt_paint::flood_fill::FillDataMesh::execute(), export_hair_curves(), export_hair_curves_motion(), blender::draw::extract_attribute(), blender::draw::extract_attribute_subdiv(), blender::draw::extract_face_dots_uv_mesh(), blender::draw::extract_sculpt_data_subdiv(), blender::draw::extract_tan_init_common(), blender::draw::extract_uv_stretch_angle_mesh(), blender::ed::curves::extrude_curves(), face_corner_color_equalize_verts(), blender::ed::sculpt_paint::expand::face_sets_update(), blender::ed::sculpt_paint::fake_neighbor_search(), blender::draw::pbvh::fill_face_sets_grids(), blender::ed::sculpt_paint::mask::fill_mask_mesh(), blender::ed::sculpt_paint::fill_mesh_face_or_corner_attribute(), blender::draw::pbvh::fill_normals_grids(), blender::ed::sculpt_paint::face_set::find_next_available_id(), blender::ed::sculpt_paint::find_symm_verts_mesh(), blender::ed::sculpt_paint::float_selection_ensure(), blender::bke::gather_attributes(), blender::geometry::gather_realize_tasks_for_instances(), blender::nodes::node_geo_interpolate_curves_cc::generate_interpolated_curves(), blender::io::ply::generate_vertex_map(), blender::ed::sculpt_paint::expand::geodesic_falloff_create(), geometry_attribute_get_tarmat(), blender::ed::sculpt_paint::geometry_preview_lines_update(), 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::ed::sculpt_paint::face_set::gesture_apply_mesh(), blender::io::alembic::get_edge_creases(), blender::io::usd::get_edge_creases(), blender::bke::AttributeFieldInput::get_varray_for_context(), blender::nodes::node_geo_tool_selection_cc::SculptSelectionFieldInput::get_varray_for_context(), blender::nodes::node_geo_uv_tangent_cc::TangentFieldInput::get_varray_for_context(), blender::io::alembic::get_vert_creases(), blender::io::usd::get_vert_creases(), blender::ed::sculpt_paint::pose::grow_pose_factor(), blender::nodes::LazyFunctionForReduceForeachGeometryElement::handle_generation_items_group(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_mesh(), blender::ed::sculpt_paint::pose::ik_chain_init_topology(), imapaint_pick_uv(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_grids(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_mesh(), blender::ed::sculpt_paint::boundary::init_boundary_mesh(), blender::ed::sculpt_paint::auto_mask::init_face_sets_masking(), blender::ed::sculpt_paint::face_set::init_flood_fill(), blender::ed::sculpt_paint::expand::init_from_face_set_boundary(), blender::ed::sculpt_paint::face_set::init_op_exec(), blender::bke::subdiv::init_user_data(), blender::bke::initialize_new_data(), blender::ed::mesh::join_face_sets(), blender::ed::mesh::join_materials(), blender::ed::mesh::join_normals(), lineart_geometry_object_load(), lookup(), lookup(), lookup(), lookup(), lookup_or_default(), lookup_or_default(), mesh_calc_tri_tessface(), mesh_merge_transform(), blender::draw::mesh_render_data_create(), blender::bke::mesh::mesh_set_custom_normals(), blender::bke::mesh_sharp_edges_set_from_angle(), blender::ed::sculpt_paint::hide::mesh_show_all(), blender::ed::sculpt_paint::MeshAttributeData::MeshAttributeData(), meshobject_foreachScreenVert(), blender::bke::MeshTopologyState::MeshTopologyState(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), blender::modify_curves(), modify_mesh(), multires_reshape_context_create_from_object(), multires_reshape_context_create_from_subdiv(), multires_unsubdivide_extract_grids(), multires_unsubdivide_prepare_original_bmesh_for_extract(), blender::ed::object::multiresbake_check(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), normalEditModifier_do(), normalEditModifier_do_directional(), normalEditModifier_do_radial(), paint_weight_gradient_exec(), blender::ed::sculpt_paint::hide::partialvis_masked_update_mesh(), blender::geometry::point_merge_by_distance(), blender::draw::pointcloud_extract_position_and_radius(), blender::bke::subdiv::precalc_uv_layer(), 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::ed::sculpt_paint::face_set::randomize_colors_exec(), RE_bake_pixels_populate(), RE_generate_texturemargin_adjacentfaces(), blender::ed::greasepencil::remove_fill_guides(), blender::bke::MutableAttributeAccessor::rename(), blender::ed::sculpt_paint::replace_attribute(), blender::geometry::retrieve_attribute_spans(), blender::geometry::retrieve_attribute_spans(), blender::bke::MeshTopologyState::same_topology_as(), blender::ed::sculpt_paint::dyntopo::sample_detail_voxel(), blender::ed::sculpt_paint::cloth::sculpt_cloth_filter_modal(), blender::ed::sculpt_paint::expand::sculpt_expand_invoke(), blender::ed::sculpt_paint::mask::sculpt_mask_filter_exec(), blender::ed::curves::set_attribute_invoke(), blender::ed::pointcloud::set_attribute_invoke(), blender::ed::sculpt_paint::set_persistent_base_exec(), blender::bke::set_rest_position(), blender::ed::sculpt_paint::greasepencil::simplify_stroke(), blender::ed::curves::snap_curves_to_surface::snap_curves_to_surface_exec_object(), blender::bke::compare_geometry::sort_domain_using_attributes(), blender::ed::geometry::store_attributes_to_shape_keys(), blender::ed::sculpt_paint::undo::store_face_sets(), blender::ed::sculpt_paint::undo::store_face_visibility(), blender::ed::sculpt_paint::undo::store_mask_mesh(), blender::io::obj::OBJMesh::store_uv_coords_and_indices(), blender::ed::sculpt_paint::undo::store_vert_visibility_mesh(), blender::ed::sculpt_paint::stroke_get_location_bvh_ex(), 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(), blender::bke::transform_custom_normal_attribute(), blender::ed::sculpt_paint::greasepencil::trim_stroke_ends(), blender::bke::try_add_shared_field_attribute(), blender::bke::try_capture_fields_on_geometry(), blender::ed::sculpt_paint::mask::try_remove_mask_mesh(), blender::bke::Instances::unique_ids(), blender::draw::pbvh::update_face_sets_mesh(), blender::ed::sculpt_paint::expand::update_for_vert(), blender::draw::pbvh::update_generic_attribute_mesh(), blender::ed::sculpt_paint::mask::update_mask_mesh(), blender::draw::pbvh::update_masks_mesh(), blender::draw::pbvh::update_normals_mesh(), blender::bke::pbvh::pixels::update_pixels(), blender::bke::pbvh::update_visibility_faces(), blender::bke::compare_geometry::verify_attributes_compatible(), vertex_paint_from_weight(), vpaint_do_draw(), weight_paint_set(), and blender::ed::sculpt_paint::mask::write_mask_mesh().

◆ lookup() [2/5]

GAttributeReader blender::bke::AttributeAccessor::lookup ( const StringRef attribute_id,
const AttrDomain domain ) const
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 627 of file BKE_attribute.hh.

References lookup().

◆ lookup() [3/5]

GAttributeReader blender::bke::AttributeAccessor::lookup ( const StringRef attribute_id,
const AttrType data_type ) const
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 636 of file BKE_attribute.hh.

References lookup().

◆ lookup() [4/5]

template<typename T>
AttributeReader< T > blender::bke::AttributeAccessor::lookup ( const StringRef attribute_id,
const std::optional< AttrDomain > domain = std::nullopt ) const
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 646 of file BKE_attribute.hh.

References blender::bke::cpp_type_to_attribute_type(), blender::CPPType::get(), lookup(), T, and blender::bke::GAttributeReader::typed().

◆ lookup() [5/5]

GAttributeReader blender::bke::AttributeAccessor::lookup ( StringRef attribute_id,
std::optional< AttrDomain > domain,
std::optional< AttrType > 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 719 of file attribute_access.cc.

References blender::bke::adapt_domain_and_type_if_necessary(), and lookup().

◆ lookup_meta_data()

std::optional< AttributeMetaData > blender::bke::AttributeAccessor::lookup_meta_data ( StringRef attribute_id) const

◆ lookup_or_default() [1/2]

template<typename T>
AttributeReader< T > blender::bke::AttributeAccessor::lookup_or_default ( const StringRef attribute_id,
const AttrDomain domain,
const T & default_value ) const
inline

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

Definition at line 669 of file BKE_attribute.hh.

References domain_size(), blender::VArray< T >::from_single(), lookup(), and T.

◆ lookup_or_default() [2/2]

GAttributeReader blender::bke::AttributeAccessor::lookup_or_default ( StringRef attribute_id,
AttrDomain domain,
AttrType 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 733 of file attribute_access.cc.

References blender::bke::attribute_type_to_cpp_type(), blender::CPPType::default_value(), domain_size(), blender::GVArray::from_single(), blender::GVArray::from_single_ref(), and lookup().

Referenced by blender::ed::spreadsheet::GeometryDataSource::apply_selection_filter(), blender::bke::greasepencil::assign_to_vertex_group(), blender::ed::sculpt_paint::average_mask_border_position(), blender::ed::greasepencil::bake_grease_pencil_animation_exec(), BKE_grease_pencil_material_index_used(), BKE_mesh_material_index_used(), BKE_mesh_mselect_validate(), BKE_object_defgroup_clear(), BKE_sculpt_sync_face_visibility_to_grids(), build_poly_connections(), blender::ed::sculpt_paint::pose::calc_average_face_set_center(), blender::io::obj::OBJMesh::calc_face_order(), blender::ed::geometry::convert_attribute(), blender::ed::greasepencil::create_curves_outline(), blender::create_dashes(), blender::draw::create_edit_points_data(), blender::draw::create_edit_points_selection(), blender::create_envelope_strokes(), blender::ed::sculpt_paint::face_set::create_op_exec(), blender::ed::transform::pointcloud::createTransPointCloudVerts(), blender::nodes::node_geo_curves_to_grease_pencil_cc::curve_instances_to_grease_pencil_layers(), blender::bke::curve_normal_point_domain(), blender::ed::greasepencil::curves_merge_endpoints_by_distance(), blender::deform_drawing_as_envelope(), blender::draw::overlay::GreasePencil::draw_grease_pencil(), blender::ed::greasepencil::image_render::draw_grease_pencil_strokes(), blender::draw::draw_subdiv_cache_ensure_mat_offsets(), blender::ed::sculpt_paint::face_set::duplicate_face_sets(), blender::ed::sculpt_paint::mask::duplicate_mask(), ED_mesh_split_faces(), edbm_backbuf_check_and_select_faces_obmode(), edbm_backbuf_check_and_select_verts_obmode(), blender::ed::sculpt_paint::expand::enabled_state_to_bitmap(), blender::ed::curves::set_handle_type::exec(), blender::ed::sculpt_paint::flood_fill::FillDataMesh::execute(), blender::draw::extract_attr_viewer(), blender::ed::curves::pen_tool::extrude_curves(), blender::io::grease_pencil::GreasePencilExporter::foreach_stroke_in_layer(), blender::ed::geometry::geometry_attribute_convert_exec(), blender::ed::greasepencil::get_boundary_bounds(), get_corner_boolean_attribute(), blender::get_factor_from_draw_speed(), blender::modifier::greasepencil::get_filtered_layer_mask(), blender::modifier::greasepencil::get_filtered_stroke_mask(), blender::modifier::greasepencil::get_influence_vertex_weights(), blender::io::usd::get_loops_polys(), get_selected_indices(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), blender::nodes::node_geo_material_selection_cc::MaterialSelectionFieldInput::get_varray_for_context(), blender::nodes::node_geo_tool_selection_cc::EditSelectionFieldInput::get_varray_for_context(), blender::nodes::node_geo_tool_selection_cc::SculptSelectionFieldInput::get_varray_for_context(), blender::ed::greasepencil::get_visible_boundary_strokes(), blender::ed::transform::gizmo_3d_foreach_selected(), blender::ed::greasepencil::grease_pencil_copy_strokes_exec(), grease_pencil_do_layer_adjustments(), blender::draw::grease_pencil_geom_batch_ensure(), blender::ed::greasepencil::grease_pencil_material_lock_unselected_exec(), blender::ed::greasepencil::grease_pencil_set_handle_type_exec(), blender::ed::sculpt_paint::hide::grow_shrink_visibility_mesh(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::hard_eraser(), heat_bone_weighting(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_fk_grids(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_fk_mesh(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_grids(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_mesh(), imapaint_pick_uv(), blender::ed::sculpt_paint::greasepencil::GreasePencilStrokeOperationCommon::init_auto_masking(), blender::ed::sculpt_paint::face_set::init_op_exec(), blender::ed::greasepencil::insert_selected_values(), Freestyle::BlenderFileLoader::insertShapeNode(), blender::ed::mesh::join_generic_attributes(), lineart_geometry_object_load(), blender::io::ply::load_plydata(), blender::bke::loose_edges_no_hidden_mask_get(), blender::bke::loose_verts_no_hidden_mask_get(), blender::ed::sculpt_paint::mask::mask_by_color_contiguous_mesh(), blender::ed::sculpt_paint::mask::mask_by_color_full_mesh(), mesh_calc_tri_tessface(), blender::bke::mesh_hide_face_flush(), blender::bke::mesh_hide_vert_flush(), blender::bke::mesh_select_edge_flush(), blender::bke::mesh_select_face_flush(), blender::bke::mesh_select_vert_flush(), MOD_get_texture_coords(), blender::modify_fill_color(), blender::modify_fill_color(), blender::modify_stroke_by_material(), blender::modify_stroke_color(), blender::modify_stroke_color(), blender::ed::curves::pen_tool::move_handles_in_curve(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), paint_sample_color(), paint_weight_gradient_exec(), paintface_deselect_all_visible(), paintface_flush_flags(), paintface_minmax(), paintface_mouse_select(), paintface_reveal(), paintface_select_less(), paintface_select_linked_faces(), paintface_select_loop(), paintface_select_more(), paintvert_deselect_all_visible(), paintvert_flush_flags(), paintvert_reveal(), paintvert_select_less(), paintvert_select_more(), paintvert_select_ungrouped(), blender::draw::pointcloud_extract_attribute(), blender::geometry::preprocess_curves(), blender::geometry::preprocess_grease_pencils(), blender::geometry::preprocess_meshes(), blender::geometry::preprocess_pointclouds(), blender::bke::greasepencil::remove_from_vertex_group(), blender::ed::curves::remove_selection(), blender::ed::pointcloud::remove_selection(), blender::ed::greasepencil::render_strokes(), blender::ed::greasepencil::retrieve_editable_fill_strokes(), blender::ed::greasepencil::retrieve_editable_points(), blender::ed::greasepencil::retrieve_editable_strokes(), blender::ed::greasepencil::retrieve_editable_strokes_by_material(), blender::ed::curves::retrieve_selected_curves(), blender::ed::greasepencil::retrieve_visible_points(), blender::ed::greasepencil::retrieve_visible_strokes(), blender::ed::sculpt_paint::expand::sculpt_expand_invoke(), blender::ed::sculpt_paint::mask::sculpt_mask_init_exec(), blender::nodes::node_geo_material_selection_cc::select_by_material(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::soft_eraser(), stats_object_edit(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::stroke_eraser(), blender::bke::greasepencil::Drawing::texture_matrices(), blender::ed::transform::curves::update_vector_handle_types(), blender::ed::object::vgroup_assign_verts(), blender::ed::object::vgroup_copy_active_to_sel(), blender::ed::object::vgroup_copy_active_to_sel_single(), blender::ed::object::vgroup_mirror(), blender::ed::object::vgroup_parray_alloc(), blender::ed::object::vgroup_select_verts(), blender::io::hydra::CurvesData::write_curves(), blender::io::obj::OBJWriter::write_face_elements(), and blender::io::obj::OBJWriter::write_vertex_coords().

◆ lookup_validator()

AttributeValidator blender::bke::AttributeAccessor::lookup_validator ( const StringRef attribute_id) const
inline

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

Definition at line 682 of file BKE_attribute.hh.

References fn_, and owner_.

Referenced by blender::nodes::compute_attributes_to_store(), blender::bke::try_capture_fields_on_geometry(), blender::ed::curves::validate_value(), and blender::ed::pointcloud::validate_value().

Member Data Documentation

◆ fn_

◆ owner_

void* blender::bke::AttributeAccessor::owner_
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.

Note
This class cannot modify the owner's attributes, but the pointer is still non-const, so this class can be a base class for the mutable version.

Definition at line 536 of file BKE_attribute.hh.

Referenced by adapt_domain(), blender::bke::MutableAttributeAccessor::add(), AttributeAccessor(), domain_size(), domain_supported(), foreach_attribute(), get_builtin_default(), get_builtin_domain_and_type(), is_builtin(), lookup(), blender::bke::MutableAttributeAccessor::lookup_for_write(), lookup_validator(), and blender::bke::MutableAttributeAccessor::remove().


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