|
Blender V4.5
|
#include <cstring>#include <optional>#include "MEM_guardedalloc.h"#include "DNA_ID.h"#include "DNA_curves_types.h"#include "DNA_customdata_types.h"#include "DNA_mesh_types.h"#include "DNA_pointcloud_types.h"#include "BLI_index_range.hh"#include "BLI_string.h"#include "BLI_string_utils.hh"#include "BLT_translation.hh"#include "BKE_attribute.hh"#include "BKE_curves.hh"#include "BKE_customdata.hh"#include "BKE_editmesh.hh"#include "BKE_grease_pencil.hh"#include "BKE_mesh.hh"#include "BKE_pointcloud.hh"#include "BKE_report.hh"#include <fmt/format.h>Go to the source code of this file.
Classes | |
| struct | DomainInfo |
| class | IndexRange |
| class | StringRef |
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
Enumerations | |
| enum class | AttrDomain |
Implementation of generic geometry attributes management. This is built on top of CustomData, which manages individual domains.
Definition in file attribute.cc.
|
strong |
Definition at line 63 of file BKE_attribute.hh.
|
static |
Definition at line 361 of file attribute.cc.
References ATTR_DOMAIN_NUM, get_domains(), i, CustomData::layers, CustomDataLayer::name, and CustomData::totlayer.
Referenced by BKE_attribute_calc_unique_name().
| std::string BKE_attribute_calc_unique_name | ( | const AttributeOwner & | owner, |
| const StringRef | name ) |
Definition at line 383 of file attribute.cc.
References attribute_name_exists(), BLI_uniquename_cb(), DATA_, and blender::StringRefBase::is_empty().
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().
|
static |
Definition at line 435 of file attribute.cc.
References blender::bke::cpp_type_to_custom_data_type(), blender::bke::GAttributeReader::domain, blender::bke::get_attribute_accessor_for_write(), blender::GVArrayCommon::type(), and blender::bke::GAttributeReader::varray.
Referenced by BKE_attribute_duplicate().
| int BKE_attribute_data_length | ( | AttributeOwner & | owner, |
| CustomDataLayer * | layer ) |
Definition at line 757 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().
| AttrDomain BKE_attribute_domain | ( | const AttributeOwner & | owner, |
| const CustomDataLayer * | layer ) |
Definition at line 733 of file attribute.cc.
References ATTR_DOMAIN_NUM, BLI_assert_msg, blender::Span< T >::contains_ptr(), get_domains(), CustomData::layers, blender::bke::Point, and CustomData::totlayer.
Referenced by BKE_attribute_rename(), and BKE_attribute_search_for_write().
| int BKE_attribute_domain_size | ( | const AttributeOwner & | owner, |
| const int | domain ) |
Definition at line 751 of file attribute.cc.
References get_domains().
| CustomDataLayer * BKE_attribute_duplicate | ( | AttributeOwner & | owner, |
| blender::StringRef | name, | ||
| struct ReportList * | reports ) |
Creates a duplicate attribute layer.
Definition at line 455 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_edge_select_name_get(), BKE_uv_map_pin_name_get(), BKE_uv_map_vert_select_name_get(), BLI_assert_unreachable, CD_MASK_PROP_ALL, CD_PROP_FLOAT2, blender::bke::cpp_type_to_custom_data_type(), blender::bke::GAttributeReader::domain, blender::bke::get_attribute_accessor_for_write(), AttributeOwner::get_mesh(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, reports, RPT_ERROR, AttributeOwner::type(), blender::GVArrayCommon::type(), and blender::bke::GAttributeReader::varray.
Referenced by blender::ed::geometry::geometry_color_attribute_duplicate_exec().
| CustomDataLayer * BKE_attribute_find | ( | const AttributeOwner & | owner, |
| const StringRef | name, | ||
| const eCustomDataType | type, | ||
| const AttrDomain | domain ) |
Definition at line 632 of file attribute.cc.
References get_domains(), i, blender::StringRefBase::is_empty(), CustomData::layers, CustomDataLayer::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 899 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 bmo_get_loop_color_ref(), color_name_from_index(), data_transfer_mesh_attributes_transfer_active_color_string(), and data_transfer_mesh_attributes_transfer_default_color_string().
| 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 391 of file attribute.cc.
References BKE_attribute_calc_unique_name(), BKE_report(), BKE_reportf(), BM_data_layer_add_named(), CustomData_get_named_layer_index(), blender::bke::get_attribute_accessor_for_write(), get_domains(), AttributeOwner::get_mesh(), CustomData::layers, Mesh, mesh_attribute_valid(), nullptr, reports, 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, |
| const StringRef | name, | ||
| ReportList * | reports ) |
Definition at line 523 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_edge_select_name_get(), BKE_uv_map_edge_select_name_get(), BKE_uv_map_pin_name_get(), BKE_uv_map_pin_name_get(), BKE_uv_map_vert_select_name_get(), BKE_uv_map_vert_select_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::get_attribute_accessor_for_write(), get_domains(), AttributeOwner::get_mesh(), blender::StringRefBase::is_empty(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, reports, 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, |
| const StringRef | old_name, | ||
| const StringRef | new_name, | ||
| ReportList * | reports ) |
Definition at line 267 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_edge_select_name_get(), BKE_uv_map_edge_select_name_get(), BKE_uv_map_pin_name_get(), BKE_uv_map_pin_name_get(), BKE_uv_map_vert_select_name_get(), BKE_uv_map_vert_select_name_get(), BLI_assert_msg, CD_MASK_PROP_ALL, CD_PROP_FLOAT2, blender::StringRefBase::copy_utf8_truncated(), Curves, CustomData_name_maxncpy_calc(), Curves::geometry, AttributeOwner::get_curves(), AttributeOwner::get_mesh(), Mesh::id, blender::StringRefBase::is_empty(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, mesh_attribute_valid(), CustomDataLayer::name, name_valid_for_builtin_domain_and_type(), reports, RPT_ERROR, AttributeOwner::type(), and CustomDataLayer::type.
Referenced by bke_attribute_rename_if_exists(), and blo_do_versions_300().
|
static |
Definition at line 210 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_rename(), BKE_attribute_search_for_write(), CD_MASK_PROP_ALL, and reports.
Referenced by BKE_attribute_rename().
| bool BKE_attribute_required | ( | const AttributeOwner & | owner, |
| const StringRef | name ) |
Definition at line 785 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, PointCloud, and AttributeOwner::type().
Referenced by BKE_attribute_remove(), and BKE_attribute_rename().
| const CustomDataLayer * BKE_attribute_search | ( | const AttributeOwner & | owner, |
| const StringRef | name, | ||
| const eCustomDataMask | type_mask, | ||
| const AttrDomainMask | domain_mask ) |
Definition at line 657 of file attribute.cc.
References ATTR_DOMAIN_AS_MASK, ATTR_DOMAIN_NUM, CD_TYPE_AS_MASK, get_domains(), i, blender::StringRefBase::is_empty(), CustomData::layers, CustomDataLayer::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().
| CustomDataLayer * BKE_attribute_search_for_write | ( | AttributeOwner & | owner, |
| const StringRef | name, | ||
| const eCustomDataMask | type_mask, | ||
| const AttrDomainMask | domain_mask ) |
Definition at line 690 of file attribute.cc.
References BKE_attribute_domain(), BKE_attribute_search(), CustomData_ensure_data_is_mutable(), get_domains(), and length().
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 932 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 848 of file attribute.cc.
References BKE_attributes_active_index_p().
| int * BKE_attributes_active_index_p | ( | AttributeOwner & | owner | ) |
Definition at line 853 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 802 of file attribute.cc.
References blender::bke::allow_procedural_attribute_access(), ATTR_DOMAIN_MASK_ALL, ATTR_DOMAIN_NUM, BKE_attributes_active_index_p(), BKE_attributes_length(), CD_MASK_PROP_ALL, CD_TYPE_AS_MASK, get_domains(), i, CustomData::layers, CustomDataLayer::name, CustomData::totlayer, 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, |
| const StringRef | name ) |
Definition at line 838 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_search(), BKE_attribute_to_index(), BKE_attributes_active_index_p(), BLI_assert, and CD_MASK_PROP_ALL.
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, |
| CustomDataLayer * | layers ) |
Definition at line 875 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 711 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().
Definition at line 1037 of file attribute.cc.
References ATTR_DOMAIN_AS_MASK, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL, and CD_TYPE_AS_MASK.
| void BKE_id_attributes_active_color_clear | ( | ID * | id | ) |
Definition at line 1002 of file attribute.cc.
References GS, ID_ME, and MEM_SAFE_FREE.
Definition at line 970 of file attribute.cc.
Referenced by BKE_attribute_rename().
Definition at line 986 of file attribute.cc.
References BLI_strdupn(), GS, ID_ME, and MEM_SAFE_FREE.
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::bke::mesh_remesh_reproject_attributes(), proj_paint_color_attribute_create(), and blender::ed::sculpt_paint::undo::set_active_layer().
| const CustomDataLayer * BKE_id_attributes_color_find | ( | const ID * | id, |
| const StringRef | name ) |
Definition at line 1031 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_search(), CD_MASK_COLOR_ALL, and AttributeOwner::from_id().
Definition at line 978 of file attribute.cc.
Referenced by BKE_attribute_rename().
Definition at line 1015 of file attribute.cc.
References BLI_strdupn(), GS, ID_ME, and MEM_SAFE_FREE.
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::bke::mesh_remesh_reproject_attributes(), and proj_paint_color_attribute_create().
Definition at line 1062 of file attribute.cc.
References BLI_assert, MAX_CUSTOMDATA_LAYER_NAME, result, blender::StringRefBase::size(), and UV_EDGESEL_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_edge_select_ensure(), BM_uv_map_attr_select_and_pin_ensure(), BM_uv_map_offsets_from_layer(), ED_mesh_uv_map_edge_select_layer_ensure(), and ED_mesh_uv_map_edge_select_layer_get().
Definition at line 1071 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(), BM_uv_map_attr_pin_exists(), BM_uv_map_attr_select_and_pin_ensure(), BM_uv_map_offsets_from_layer(), ED_mesh_uv_map_pin_layer_ensure(), and ED_mesh_uv_map_pin_layer_get().
Definition at line 1053 of file attribute.cc.
References BLI_assert, MAX_CUSTOMDATA_LAYER_NAME, result, blender::StringRefBase::size(), and UV_VERTSEL_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_select_and_pin_ensure(), BM_uv_map_attr_vert_select_ensure(), BM_uv_map_attr_vert_select_exists(), BM_uv_map_offsets_from_layer(), ED_mesh_uv_map_vert_select_layer_ensure(), and ED_mesh_uv_map_vert_select_layer_get().
|
static |
Definition at line 510 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attributes_length(), CD_MASK_COLOR_ALL, length(), and min_ii().
Referenced by BKE_attribute_remove().
|
static |
Definition at line 516 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_from_index(), CD_MASK_COLOR_ALL, and CustomDataLayer::name.
Referenced by BKE_attribute_remove().
|
static |
Definition at line 503 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_search(), BKE_attribute_to_index(), and CD_MASK_COLOR_ALL.
Referenced by BKE_attribute_remove().
|
static |
Definition at line 112 of file attribute.cc.
References bm, Mesh::corner_data, Mesh::corners_num, CurvesGeometry::curve_data, CurvesGeometry::curve_num, Curves, Mesh::edge_data, Mesh::edges_num, Mesh::face_data, Mesh::faces_num, Curves::geometry, GreasePencilDrawing::geometry, AttributeOwner::get_curves(), AttributeOwner::get_grease_pencil(), AttributeOwner::get_grease_pencil_drawing(), AttributeOwner::get_mesh(), AttributeOwner::get_pointcloud(), GreasePencil, GreasePencilDrawing, GreasePencil::layers_data, Mesh, PointCloud::pdata, CurvesGeometry::point_data, CurvesGeometry::point_num, PointCloud, Mesh::runtime, PointCloud::totpoint, AttributeOwner::type(), Mesh::vert_data, and Mesh::verts_num.
Referenced by attribute_name_exists(), BKE_attribute_data_length(), BKE_attribute_domain(), BKE_attribute_domain_size(), BKE_attribute_find(), BKE_attribute_from_index(), BKE_attribute_new(), BKE_attribute_remove(), BKE_attribute_search(), BKE_attribute_search_for_write(), BKE_attribute_to_index(), BKE_attributes_active_name_get(), BKE_attributes_iterator_next_domain(), and BKE_attributes_length().
|
static |
Definition at line 247 of file attribute.cc.
References Geometry::attributes, BKE_report(), BM_attribute_stored_in_bmesh_builtin(), name_valid_for_builtin_domain_and_type(), reports, RPT_ERROR, and Mesh::runtime.
Referenced by BKE_attribute_new(), and BKE_attribute_rename().
|
static |
Definition at line 223 of file attribute.cc.
References BKE_reportf(), blender::bke::AttributeAccessor::get_builtin_domain_and_type(), reports, and RPT_ERROR.
Referenced by BKE_attribute_rename(), and mesh_attribute_valid().