|
Blender V5.0
|
Generic geometry attributes built on CustomData. More...
#include <optional>#include <string>#include "BLI_string_ref.hh"#include "BLI_sys_types.h"#include "DNA_customdata_types.h"Go to the source code of this file.
Classes | |
| class | AttributeOwner |
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
Macros | |
| #define | ATTR_DOMAIN_AS_MASK(domain) |
| #define | ATTR_DOMAIN_MASK_COLOR ((AttrDomainMask)((ATTR_DOMAIN_MASK_POINT | ATTR_DOMAIN_MASK_CORNER))) |
Typedefs | |
| typedef enum AttrDomainMask | AttrDomainMask |
Enumerations | |
| enum | AttrDomainMask { ATTR_DOMAIN_MASK_POINT = (1 << 0) , ATTR_DOMAIN_MASK_EDGE = (1 << 1) , ATTR_DOMAIN_MASK_FACE = (1 << 2) , ATTR_DOMAIN_MASK_CORNER = (1 << 3) , ATTR_DOMAIN_MASK_CURVE = (1 << 4) , ATTR_DOMAIN_MASK_GREASE_PENCIL_LAYER = (1 << 6) , ATTR_DOMAIN_MASK_ALL = (1 << 7) - 1 } |
| enum class | AttributeOwnerType { Mesh , PointCloud , Curves , GreasePencil , GreasePencilDrawing } |
Generic geometry attributes built on CustomData.
Definition in file BKE_attribute.h.
| #define ATTR_DOMAIN_AS_MASK | ( | domain | ) |
Definition at line 78 of file BKE_attribute.h.
Referenced by blender::ed::sculpt_paint::color::active_color_attribute(), blender::ed::sculpt_paint::color::active_color_attribute_for_write(), BKE_attribute_search(), BKE_color_attribute_supported(), blender::ed::geometry::geometry_color_attribute_convert_poll(), blender::bke::mesh_ensure_default_color_attribute_on_add(), blender::bke::meta_data_matches(), blender::bke::retrieve_attributes_for_transfer(), and blender::ed::sculpt_paint::undo::save_active_attribute().
| #define ATTR_DOMAIN_MASK_COLOR ((AttrDomainMask)((ATTR_DOMAIN_MASK_POINT | ATTR_DOMAIN_MASK_CORNER))) |
Definition at line 81 of file BKE_attribute.h.
Referenced by blender::ed::sculpt_paint::color::active_color_attribute(), blender::ed::sculpt_paint::color::active_color_attribute_for_write(), BKE_color_attribute_supported(), BKE_id_attributes_color_find(), color_clamp_index(), color_name_from_index(), color_name_to_index(), data_transfer_mesh_attributes_transfer_active_color_string(), data_transfer_mesh_attributes_transfer_default_color_string(), blender::ed::geometry::geometry_color_attribute_convert_poll(), blender::bke::mesh_ensure_default_color_attribute_on_add(), blender::bke::mesh_remove_invalid_attribute_strings(), and blender::ed::sculpt_paint::undo::save_active_attribute().
| enum AttrDomainMask |
| Enumerator | |
|---|---|
| ATTR_DOMAIN_MASK_POINT | |
| ATTR_DOMAIN_MASK_EDGE | |
| ATTR_DOMAIN_MASK_FACE | |
| ATTR_DOMAIN_MASK_CORNER | |
| ATTR_DOMAIN_MASK_CURVE | |
| ATTR_DOMAIN_MASK_GREASE_PENCIL_LAYER | |
| ATTR_DOMAIN_MASK_ALL | |
Definition at line 36 of file BKE_attribute.h.
|
strong |
| Enumerator | |
|---|---|
| Mesh | |
| PointCloud | |
| Curves | |
| GreasePencil | |
| GreasePencilDrawing | |
Definition at line 47 of file BKE_attribute.h.
| std::string BKE_attribute_calc_unique_name | ( | const AttributeOwner & | owner, |
| blender::StringRef | name ) |
Definition at line 370 of file attribute.cc.
References attribute_name_exists(), BLI_uniquename_cb(), DATA_, AttributeOwner::get_storage(), Mesh, name, AttributeOwner::type(), and blender::bke::AttributeStorage::unique_name_calc().
Referenced by BKE_attribute_duplicate(), BKE_attribute_new(), BKE_attribute_rename(), BKE_sculpt_color_layer_create_if_needed(), ED_mesh_color_ensure(), ED_mesh_uv_add(), ensure_weight_attribute_meta_data(), get_uv_attribute(), blender::io::fbx::import_colors(), blender::io::fbx::import_uvs(), and blender::ed::object::mesh_data_to_grease_pencil().
| int BKE_attribute_data_length | ( | AttributeOwner & | owner, |
| struct CustomDataLayer * | layer ) |
Definition at line 739 of file attribute.cc.
References ATTR_DOMAIN_NUM, BLI_assert_msg, blender::Span< T >::contains_ptr(), get_domains(), AttributeOwner::get_mesh(), CustomData::layers, Mesh, CustomData::totlayer, and AttributeOwner::type().
| blender::bke::AttrDomain BKE_attribute_domain | ( | const AttributeOwner & | owner, |
| const struct CustomDataLayer * | layer ) |
Referenced by blender::ed::object::bake_targets_output_vertex_colors(), BKE_attribute_rename(), edbm_select_by_attribute_exec(), edbm_select_by_attribute_poll(), blender::ed::sculpt_paint::fill_mesh_color(), blender::ed::mesh::set_attribute::mesh_set_attribute_exec(), and blender::ed::mesh::set_attribute::mesh_set_attribute_invoke().
| int BKE_attribute_domain_size | ( | const AttributeOwner & | owner, |
| int | domain ) |
Definition at line 733 of file attribute.cc.
References get_domains().
| struct CustomDataLayer * BKE_attribute_duplicate | ( | AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| struct ReportList * | reports ) |
Creates a duplicate attribute layer.
Definition at line 451 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_calc_unique_name(), bke_attribute_copy_if_exists(), BKE_attribute_search_for_write(), BKE_report(), BKE_uv_map_pin_name_get(), BLI_assert_unreachable, CD_MASK_PROP_ALL, blender::bke::cpp_type_to_attribute_type(), blender::bke::GAttributeReader::domain, blender::bke::Float2, AttributeOwner::get_accessor(), AttributeOwner::get_mesh(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, name, RPT_ERROR, AttributeOwner::type(), blender::GVArrayCommon::type(), and blender::bke::GAttributeReader::varray.
Referenced by blender::ed::geometry::geometry_color_attribute_duplicate_exec().
| struct CustomDataLayer * BKE_attribute_find | ( | const AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| eCustomDataType | type, | ||
| blender::bke::AttrDomain | domain ) |
Definition at line 614 of file attribute.cc.
References get_domains(), i, CustomData::layers, CustomDataLayer::name, name, CustomData::totlayer, and CustomDataLayer::type.
Referenced by blender::ed::sculpt_paint::undo::set_active_layer().
| CustomDataLayer * BKE_attribute_from_index | ( | AttributeOwner & | owner, |
| int | lookup_index, | ||
| AttrDomainMask | domain_mask, | ||
| eCustomDataMask | layer_mask ) |
Definition at line 898 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK(), CustomDataLayer::flag, get_domains(), i, CustomData::layers, CustomData::totlayer, and CustomDataLayer::type.
Referenced by color_name_from_index(), data_transfer_mesh_attributes_transfer_active_color_string(), and data_transfer_mesh_attributes_transfer_default_color_string().
| struct CustomDataLayer * BKE_attribute_new | ( | AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| eCustomDataType | type, | ||
| blender::bke::AttrDomain | domain, | ||
| struct ReportList * | reports ) |
Create a new attribute layer.
Definition at line 382 of file attribute.cc.
References BKE_attribute_calc_unique_name(), BKE_report(), BKE_reportf(), BM_data_layer_add_named(), blender::bke::custom_data_type_to_attr_type(), CustomData_get_named_layer_index(), AttributeOwner::get_accessor(), get_domains(), AttributeOwner::get_mesh(), CustomData::layers, Mesh, mesh_attribute_valid(), name, nullptr, RPT_ERROR, RPT_WARNING, and AttributeOwner::type().
Referenced by ED_mesh_color_add(), blender::ed::geometry::geometry_attribute_add_exec(), blender::ed::geometry::geometry_color_attribute_add_exec(), proj_paint_color_attribute_create(), and blender::io::alembic::read_velocity().
| bool BKE_attribute_remove | ( | AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| struct ReportList * | reports ) |
Definition at line 512 of file attribute.cc.
References ATTR_DOMAIN_NUM, BKE_attribute_required(), BKE_id_attributes_active_color_set(), BKE_id_attributes_default_color_set(), BKE_report(), BKE_uv_map_pin_name_get(), BKE_uv_map_pin_name_get(), BLI_assert_unreachable, BM_data_layer_free_named(), CD_PROP_FLOAT2, color_clamp_index(), color_name_from_index(), color_name_to_index(), blender::bke::Corner, CustomData_get_named_layer_index_notype(), data, blender::bke::Float2, AttributeOwner::get_accessor(), get_domains(), AttributeOwner::get_mesh(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, name, RPT_ERROR, and AttributeOwner::type().
Referenced by blender::ed::geometry::geometry_attribute_remove_exec(), blender::ed::geometry::geometry_color_attribute_remove_exec(), mesh_customdata_mask_clear_exec(), mesh_uv_texture_remove_exec(), and output_toggle_exec().
| bool BKE_attribute_rename | ( | AttributeOwner & | owner, |
| blender::StringRef | old_name, | ||
| blender::StringRef | new_name, | ||
| struct ReportList * | reports ) |
Definition at line 251 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_calc_unique_name(), BKE_attribute_domain(), BKE_attribute_domain(), bke_attribute_rename_if_exists(), BKE_attribute_required(), BKE_attribute_search_for_write(), BKE_id_attributes_active_color_name(), BKE_id_attributes_active_color_set(), BKE_id_attributes_default_color_name(), BKE_id_attributes_default_color_set(), BKE_report(), BKE_uv_map_pin_name_get(), BKE_uv_map_pin_name_get(), BLI_assert_msg, CD_MASK_PROP_ALL, CD_PROP_FLOAT2, blender::StringRefBase::copy_utf8_truncated(), Curves, blender::bke::custom_data_type_to_attr_type(), CustomData_name_maxncpy_calc(), Curves::geometry, AttributeOwner::get_curves(), AttributeOwner::get_mesh(), AttributeOwner::get_storage(), Mesh::id, blender::StringRefBase::is_empty(), blender::bke::AttributeStorage::lookup(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, mesh_attribute_valid(), CustomDataLayer::name, name_valid_for_builtin_domain_and_type(), blender::bke::AttributeStorage::rename(), RPT_ERROR, AttributeOwner::type(), and CustomDataLayer::type.
Referenced by bke_attribute_rename_if_exists(), and blo_do_versions_300().
| bool BKE_attribute_required | ( | const AttributeOwner & | owner, |
| blender::StringRef | name ) |
Definition at line 767 of file attribute.cc.
References BKE_curves_attribute_required(), BKE_grease_pencil_drawing_attribute_required(), BKE_mesh_attribute_required(), BKE_pointcloud_attribute_required(), Curves, AttributeOwner::get_curves(), AttributeOwner::get_grease_pencil_drawing(), AttributeOwner::get_pointcloud(), GreasePencil, GreasePencilDrawing, Mesh, name, PointCloud, and AttributeOwner::type().
Referenced by BKE_attribute_remove(), and BKE_attribute_rename().
| const struct CustomDataLayer * BKE_attribute_search | ( | const AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| eCustomDataMask | type, | ||
| AttrDomainMask | domain_mask ) |
Definition at line 639 of file attribute.cc.
References ATTR_DOMAIN_AS_MASK, ATTR_DOMAIN_NUM, CD_TYPE_AS_MASK(), get_domains(), i, CustomData::layers, CustomDataLayer::name, name, blender::bke::Point, CustomData::totlayer, and CustomDataLayer::type.
Referenced by blender::ed::geometry::attribute_set_poll(), BKE_attribute_search_for_write(), BKE_attributes_active_set(), BKE_id_attributes_color_find(), color_name_to_index(), data_transfer_mesh_attributes_transfer_active_color_string(), data_transfer_mesh_attributes_transfer_default_color_string(), edbm_reverse_colors_exec(), edbm_rotate_colors_exec(), edbm_select_by_attribute_exec(), and edbm_select_by_attribute_poll().
| struct CustomDataLayer * BKE_attribute_search_for_write | ( | AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| eCustomDataMask | type, | ||
| AttrDomainMask | domain_mask ) |
Definition at line 672 of file attribute.cc.
References BKE_attribute_domain(), BKE_attribute_search(), CustomData_ensure_data_is_mutable(), get_domains(), length(), and name.
Referenced by BKE_attribute_duplicate(), BKE_attribute_rename(), bke_attribute_rename_if_exists(), blender::ed::mesh::set_attribute::mesh_set_attribute_exec(), blender::ed::mesh::set_attribute::mesh_set_attribute_invoke(), blender::ed::mesh::set_attribute::mesh_set_attribute_ui(), and blender::ed::sculpt_paint::undo::set_active_layer().
| int BKE_attribute_to_index | ( | const AttributeOwner & | owner, |
| const CustomDataLayer * | layer, | ||
| AttrDomainMask | domain_mask, | ||
| eCustomDataMask | layer_mask ) |
Layer is allowed to be nullptr; if so -1 (layer not found) will be returned.
Definition at line 931 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK(), CustomDataLayer::flag, get_domains(), i, CustomData::layers, CustomData::totlayer, and CustomDataLayer::type.
Referenced by BKE_attributes_active_set(), color_name_to_index(), edbm_reverse_colors_exec(), and edbm_rotate_colors_exec().
| void BKE_attributes_active_clear | ( | AttributeOwner & | owner | ) |
Definition at line 847 of file attribute.cc.
References BKE_attributes_active_index_p().
| int * BKE_attributes_active_index_p | ( | AttributeOwner & | owner | ) |
Definition at line 852 of file attribute.cc.
References CurvesGeometry::attributes_active_index, GreasePencil::attributes_active_index, Mesh::attributes_active_index, PointCloud::attributes_active_index, Curves, Curves::geometry, GreasePencilDrawing::geometry, AttributeOwner::get_curves(), AttributeOwner::get_grease_pencil(), AttributeOwner::get_grease_pencil_drawing(), AttributeOwner::get_mesh(), AttributeOwner::get_pointcloud(), GreasePencil, GreasePencilDrawing, Mesh, PointCloud, and AttributeOwner::type().
Referenced by BKE_attributes_active_clear(), BKE_attributes_active_name_get(), BKE_attributes_active_set(), blender::ed::geometry::geometry_attribute_convert_exec(), and blender::ed::geometry::geometry_attribute_remove_exec().
| std::optional< blender::StringRefNull > BKE_attributes_active_name_get | ( | AttributeOwner & | owner | ) |
Definition at line 784 of file attribute.cc.
References blender::bke::allow_procedural_attribute_access(), blender::bke::AttributeStorage::at_index(), ATTR_DOMAIN_MASK_ALL, ATTR_DOMAIN_NUM, BKE_attributes_active_index_p(), BKE_attributes_length(), CD_MASK_PROP_ALL, CD_TYPE_AS_MASK(), blender::IndexRange::contains(), blender::bke::AttributeStorage::count(), get_domains(), AttributeOwner::get_storage(), i, CustomData::layers, Mesh, blender::bke::Attribute::name(), CustomDataLayer::name, CustomData::totlayer, AttributeOwner::type(), and CustomDataLayer::type.
Referenced by blender::ed::geometry::attribute_set_poll(), blender::ed::geometry::convert_attribute(), blender::ed::curves::set_selection_domain::curves_set_selection_domain_exec(), edbm_select_by_attribute_exec(), edbm_select_by_attribute_poll(), blender::ed::geometry::geometry_attribute_convert_exec(), blender::ed::geometry::geometry_attribute_convert_invoke(), blender::ed::geometry::geometry_attribute_convert_poll(), blender::ed::geometry::geometry_attribute_remove_exec(), blender::ed::geometry::geometry_attributes_remove_poll(), blender::ed::mesh::set_attribute::mesh_set_attribute_exec(), blender::ed::mesh::set_attribute::mesh_set_attribute_invoke(), blender::ed::mesh::set_attribute::mesh_set_attribute_ui(), blender::ed::curves::set_attribute_exec(), blender::ed::pointcloud::set_attribute_exec(), blender::ed::curves::set_attribute_invoke(), blender::ed::pointcloud::set_attribute_invoke(), blender::ed::curves::set_attribute_ui(), and blender::ed::pointcloud::set_attribute_ui().
| void BKE_attributes_active_set | ( | AttributeOwner & | owner, |
| blender::StringRef | name ) |
Definition at line 830 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_search(), BKE_attribute_to_index(), BKE_attributes_active_index_p(), BLI_assert, CD_MASK_PROP_ALL, AttributeOwner::get_storage(), blender::bke::AttributeStorage::index_of(), Mesh, name, and AttributeOwner::type().
Referenced by blender::ed::geometry::convert_attribute(), blender::ed::curves::set_selection_domain::curves_set_selection_domain_exec(), blender::ed::geometry::geometry_attribute_add_exec(), and blender::ed::geometry::geometry_attribute_convert_exec().
| CustomData * BKE_attributes_iterator_next_domain | ( | AttributeOwner & | owner, |
| struct CustomDataLayer * | layers ) |
Definition at line 874 of file attribute.cc.
References ATTR_DOMAIN_NUM, get_domains(), CustomData::layers, and CustomData::totlayer.
| int BKE_attributes_length | ( | const AttributeOwner & | owner, |
| AttrDomainMask | domain_mask, | ||
| eCustomDataMask | mask ) |
Definition at line 693 of file attribute.cc.
References ATTR_DOMAIN_NUM, CustomData_number_of_layers_typemask(), get_domains(), length(), and mask().
Referenced by BKE_attributes_active_name_get(), and color_clamp_index().
| bool BKE_color_attribute_supported | ( | const struct Mesh & | mesh, |
| blender::StringRef | name ) |
References name.
Referenced by BKE_sculpt_color_layer_create_if_needed(), ED_mesh_color_ensure(), vertex_paint_mode_poll(), and vpaint_stroke_test_start().
| void BKE_id_attributes_active_color_clear | ( | struct ID * | id | ) |
Definition at line 1001 of file attribute.cc.
References GS, ID_ME, and MEM_SAFE_FREE.
| std::optional< blender::StringRef > BKE_id_attributes_active_color_name | ( | const struct ID * | id | ) |
Referenced by data_transfer_mesh_attributes_transfer_active_color_string(), blender::ed::geometry::geometry_color_attribute_duplicate_exec(), blender::ed::geometry::geometry_color_attribute_remove_exec(), blender::ed::geometry::geometry_color_attributes_duplicate_poll(), blender::ed::geometry::geometry_color_attributes_remove_poll(), and blender::ed::mesh::join_objects_exec().
| void BKE_id_attributes_active_color_set | ( | struct ID * | id, |
| std::optional< blender::StringRef > | name ) |
Definition at line 985 of file attribute.cc.
References BLI_strdupn(), GS, ID_ME, MEM_SAFE_FREE, and name.
Referenced by BKE_attribute_remove(), BKE_attribute_rename(), BKE_sculpt_color_layer_create_if_needed(), blo_do_versions_300(), blender::io::ply::convert_ply_to_mesh(), ED_mesh_color_add(), ED_mesh_color_ensure(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), blender::ed::geometry::geometry_color_attribute_add_exec(), blender::ed::geometry::geometry_color_attribute_duplicate_exec(), blender::ed::mesh::join_objects_exec(), blender::bke::mesh_remesh_reproject_attributes(), proj_paint_color_attribute_create(), and blender::ed::sculpt_paint::undo::set_active_layer().
| const struct CustomDataLayer * BKE_id_attributes_color_find | ( | const struct ID * | id, |
| blender::StringRef | name ) |
References name.
Referenced by blender::ed::object::bake_object_check(), blender::ed::object::bake_targets_init_vertex_colors(), blender::ed::object::bake_targets_output_vertex_colors(), ED_mesh_color_add(), blender::ed::sculpt_paint::fill_mesh_color(), fill_texpaint_slots_cb(), blender::ed::geometry::geometry_color_attribute_add_exec(), blender::ed::geometry::geometry_color_attribute_set_render_exec(), blender::ed::geometry::geometry_color_attributes_duplicate_poll(), and blender::ed::geometry::geometry_color_attributes_remove_poll().
| std::optional< blender::StringRef > BKE_id_attributes_default_color_name | ( | const struct ID * | id | ) |
| void BKE_id_attributes_default_color_set | ( | struct ID * | id, |
| std::optional< blender::StringRef > | name ) |
Definition at line 1014 of file attribute.cc.
References BLI_strdupn(), GS, ID_ME, MEM_SAFE_FREE, and name.
Referenced by BKE_attribute_remove(), BKE_attribute_rename(), BKE_sculpt_color_layer_create_if_needed(), blo_do_versions_300(), blender::io::ply::convert_ply_to_mesh(), ED_mesh_color_ensure(), blender::ed::geometry::geometry_color_attribute_add_exec(), blender::ed::geometry::geometry_color_attribute_set_render_exec(), blender::ed::mesh::join_objects_exec(), blender::bke::mesh_remesh_reproject_attributes(), and proj_paint_color_attribute_create().
|
nodiscard |
Definition at line 1052 of file attribute.cc.
References BLI_assert, MAX_CUSTOMDATA_LAYER_NAME, result, blender::StringRefBase::size(), and UV_PINNED_NAME.
Referenced by BKE_attribute_duplicate(), BKE_attribute_remove(), BKE_attribute_rename(), blender::bm_face_loop_table_build(), BM_mesh_bm_from_me(), BM_uv_map_attr_pin_ensure_for_all_layers(), BM_uv_map_attr_pin_ensure_named(), BM_uv_map_attr_pin_exists(), BM_uv_map_offsets_from_layer(), ED_mesh_uv_map_pin_layer_ensure(), and ED_mesh_uv_map_pin_layer_get().
| ENUM_OPERATORS | ( | AttrDomainMask | , |
| ATTR_DOMAIN_MASK_ALL | ) |
References ATTR_DOMAIN_MASK_ALL.