|
Blender V5.0
|
#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_attribute_legacy_convert.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 |
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 348 of file attribute.cc.
References ATTR_DOMAIN_NUM, get_domains(), i, CustomData::layers, CustomDataLayer::name, 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 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().
|
static |
Definition at line 429 of file attribute.cc.
References blender::bke::cpp_type_to_attribute_type(), blender::bke::GAttributeReader::domain, AttributeOwner::get_accessor(), 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 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().
| AttrDomain BKE_attribute_domain | ( | const AttributeOwner & | owner, |
| const CustomDataLayer * | layer ) |
Definition at line 715 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 733 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 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().
| CustomDataLayer * BKE_attribute_find | ( | const AttributeOwner & | owner, |
| const StringRef | name, | ||
| const eCustomDataType | type, | ||
| const 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().
| 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, |
| const StringRef | name, | ||
| 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, |
| const StringRef | old_name, | ||
| const StringRef | new_name, | ||
| 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().
|
static |
Definition at line 194 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_rename(), BKE_attribute_search_for_write(), and CD_MASK_PROP_ALL.
Referenced by BKE_attribute_rename().
| bool BKE_attribute_required | ( | const AttributeOwner & | owner, |
| const 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 CustomDataLayer * BKE_attribute_search | ( | const AttributeOwner & | owner, |
| const StringRef | name, | ||
| const eCustomDataMask | type_mask, | ||
| const 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().
| CustomDataLayer * BKE_attribute_search_for_write | ( | AttributeOwner & | owner, |
| const StringRef | name, | ||
| const eCustomDataMask | type_mask, | ||
| const 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, |
| const 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, |
| 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().
Definition at line 1036 of file attribute.cc.
References ATTR_DOMAIN_AS_MASK, ATTR_DOMAIN_MASK_COLOR, blender::bke::attr_type_to_custom_data_type(), CD_MASK_COLOR_ALL, CD_TYPE_AS_MASK(), and name.
| void BKE_id_attributes_active_color_clear | ( | ID * | id | ) |
Definition at line 1001 of file attribute.cc.
References GS, ID_ME, and MEM_SAFE_FREE.
Definition at line 969 of file attribute.cc.
Referenced by BKE_attribute_rename().
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 CustomDataLayer * BKE_id_attributes_color_find | ( | const ID * | id, |
| const StringRef | name ) |
Definition at line 1030 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_search(), CD_MASK_COLOR_ALL, AttributeOwner::from_id(), and name.
Definition at line 977 of file attribute.cc.
Referenced by BKE_attribute_rename().
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().
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().
|
static |
Definition at line 499 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 505 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 492 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_search(), BKE_attribute_to_index(), CD_MASK_COLOR_ALL, and name.
Referenced by BKE_attribute_remove().
|
static |
Definition at line 151 of file attribute.cc.
References BLI_assert_unreachable, bm, Mesh::corner_data, Mesh::corners_num, Curves, Mesh::edge_data, Mesh::edges_num, Mesh::face_data, Mesh::faces_num, AttributeOwner::get_mesh(), GreasePencil, GreasePencilDrawing, Mesh, PointCloud, Mesh::runtime, 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 231 of file attribute.cc.
References Geometry::attributes, BKE_report(), BM_attribute_stored_in_bmesh_builtin(), name, name_valid_for_builtin_domain_and_type(), RPT_ERROR, and Mesh::runtime.
Referenced by BKE_attribute_new(), and BKE_attribute_rename().
|
static |
Definition at line 207 of file attribute.cc.
References BKE_reportf(), blender::bke::AttributeAccessor::get_builtin_domain_and_type(), name, and RPT_ERROR.
Referenced by BKE_attribute_rename(), and mesh_attribute_valid().