|
Blender V4.3
|
#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_utf8.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 "RNA_access.hh"Go to the source code of this file.
Classes | |
| struct | DomainInfo |
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
Implementation of generic geometry attributes management. This is built on top of CustomData, which manages individual domains.
Definition in file attribute.cc.
|
static |
Definition at line 337 of file attribute.cc.
References ATTR_DOMAIN_NUM, get_domains(), CustomData::layers, and CustomData::totlayer.
Referenced by BKE_attribute_calc_unique_name().
| std::string BKE_attribute_calc_unique_name | ( | const AttributeOwner & | owner, |
| const blender::StringRef | name ) |
Definition at line 359 of file attribute.cc.
References attribute_name_exists(), BLI_uniquename_cb(), and DATA_.
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(), and get_uv_attribute().
|
static |
Definition at line 412 of file attribute.cc.
References blender::bke::GAttributeReader::domain, 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 736 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 712 of file attribute.cc.
References ATTR_DOMAIN_NUM, BLI_assert_msg, blender::Span< T >::contains_ptr(), get_domains(), CustomData::layers, 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 730 of file attribute.cc.
References get_domains().
| CustomDataLayer * BKE_attribute_duplicate | ( | AttributeOwner & | owner, |
| const char * | name, | ||
| struct ReportList * | reports ) |
Creates a duplicate attribute layer.
Definition at line 432 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::GAttributeReader::domain, AttributeOwner::get_mesh(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, 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 char * | name, | ||
| const eCustomDataType | type, | ||
| const AttrDomain | domain ) |
Definition at line 611 of file attribute.cc.
References get_domains(), int, CustomData::layers, STREQ, and CustomData::totlayer.
| CustomDataLayer * BKE_attribute_from_index | ( | AttributeOwner & | owner, |
| int | lookup_index, | ||
| AttrDomainMask | domain_mask, | ||
| eCustomDataMask | layer_mask ) |
Definition at line 878 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK, CustomDataLayer::flag, get_domains(), 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, |
| const char * | name, | ||
| const eCustomDataType | type, | ||
| const AttrDomain | domain, | ||
| ReportList * | reports ) |
Definition at line 368 of file attribute.cc.
References BKE_attribute_calc_unique_name(), BKE_report(), BKE_reportf(), BM_data_layer_add_named(), CustomData_get_named_layer_index(), get_domains(), AttributeOwner::get_mesh(), int, CustomData::layers, Mesh, mesh_edit_mode_attribute_valid(), RPT_ERROR, RPT_WARNING, and AttributeOwner::type().
| bool BKE_attribute_remove | ( | AttributeOwner & | owner, |
| const char * | name, | ||
| ReportList * | reports ) |
Definition at line 501 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_pin_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(), CustomData_get_named_layer_index_notype(), get_domains(), AttributeOwner::get_mesh(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, 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 char * | old_name, | ||
| const char * | new_name, | ||
| ReportList * | reports ) |
Definition at line 253 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_attribute_calc_unique_name(), 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_pin_name_get(), BKE_uv_map_vert_select_name_get(), BLI_assert_msg, BLI_strncpy_utf8(), CD_MASK_PROP_ALL, CD_PROP_FLOAT2, CustomData_name_maxncpy_calc(), AttributeOwner::get_mesh(), MAX_CUSTOMDATA_LAYER_NAME, Mesh, mesh_edit_mode_attribute_valid(), RPT_ERROR, STREQ, STRNCPY_UTF8, and AttributeOwner::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(), and CD_MASK_PROP_ALL.
Referenced by BKE_attribute_rename().
| bool BKE_attribute_required | ( | const AttributeOwner & | owner, |
| const char * | name ) |
Definition at line 764 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 char * | name, | ||
| const eCustomDataMask | type_mask, | ||
| const AttrDomainMask | domain_mask ) |
Definition at line 636 of file attribute.cc.
References ATTR_DOMAIN_AS_MASK, ATTR_DOMAIN_NUM, CD_TYPE_AS_MASK, get_domains(), int, CustomData::layers, STREQ, and CustomData::totlayer.
Referenced by 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(), and edbm_rotate_colors_exec().
| CustomDataLayer * BKE_attribute_search_for_write | ( | AttributeOwner & | owner, |
| const char * | name, | ||
| const eCustomDataMask | type_mask, | ||
| const AttrDomainMask | domain_mask ) |
Definition at line 669 of file attribute.cc.
References BKE_attribute_domain(), BKE_attribute_search(), CustomData_ensure_data_is_mutable(), and get_domains().
Referenced by BKE_attribute_duplicate(), BKE_attribute_rename(), bke_attribute_rename_if_exists(), 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 911 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK, CustomDataLayer::flag, get_domains(), 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 827 of file attribute.cc.
References BKE_attributes_active_index_p().
| CustomDataLayer * BKE_attributes_active_get | ( | AttributeOwner & | owner | ) |
Definition at line 781 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(), CustomData::layers, and CustomData::totlayer.
Referenced by blender::ed::geometry::attribute_set_poll(), 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::curves::set_attribute_invoke(), and blender::ed::curves::set_attribute_ui().
| int * BKE_attributes_active_index_p | ( | AttributeOwner & | owner | ) |
Definition at line 832 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_get(), BKE_attributes_active_set(), blender::ed::geometry::geometry_attribute_convert_exec(), and blender::ed::geometry::geometry_attribute_remove_exec().
| void BKE_attributes_active_set | ( | AttributeOwner & | owner, |
| const char * | name ) |
Definition at line 817 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::curves::set_selection_domain::curves_set_selection_domain_exec(), and blender::ed::geometry::geometry_attribute_add_exec().
| CustomData * BKE_attributes_iterator_next_domain | ( | AttributeOwner & | owner, |
| CustomDataLayer * | layers ) |
Definition at line 854 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 690 of file attribute.cc.
References ATTR_DOMAIN_NUM, CustomData_number_of_layers_typemask(), get_domains(), and length().
Referenced by BKE_attributes_active_get(), and color_clamp_index().
| bool BKE_color_attribute_supported | ( | const Mesh & | mesh, |
| const blender::StringRef | name ) |
Definition at line 1016 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 981 of file attribute.cc.
References GS, ID_ME, and MEM_SAFE_FREE.
| const char * BKE_id_attributes_active_color_name | ( | const ID * | id | ) |
Definition at line 949 of file attribute.cc.
Referenced by BKE_attribute_rename().
| void BKE_id_attributes_active_color_set | ( | ID * | id, |
| const char * | name ) |
Definition at line 965 of file attribute.cc.
References BLI_strdup(), 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 char * | name ) |
Definition at line 1010 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_search(), CD_MASK_COLOR_ALL, and AttributeOwner::from_id().
| const char * BKE_id_attributes_default_color_name | ( | const ID * | id | ) |
Definition at line 957 of file attribute.cc.
Referenced by BKE_attribute_rename().
| void BKE_id_attributes_default_color_set | ( | ID * | id, |
| const char * | name ) |
Definition at line 994 of file attribute.cc.
References BLI_strdup(), 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().
| const char * BKE_uv_map_edge_select_name_get | ( | const char * | uv_map_name, |
| char * | buffer ) |
Definition at line 1040 of file attribute.cc.
References BLI_assert, BLI_snprintf(), MAX_CUSTOMDATA_LAYER_NAME, 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_ensure_edge_select_attr(), BM_uv_map_ensure_select_and_pin_attrs(), BM_uv_map_get_offsets_from_layer(), ED_mesh_uv_map_edge_select_layer_ensure(), and ED_mesh_uv_map_edge_select_layer_get().
| const char * BKE_uv_map_pin_name_get | ( | const char * | uv_map_name, |
| char * | buffer ) |
Definition at line 1048 of file attribute.cc.
References BLI_assert, BLI_snprintf(), MAX_CUSTOMDATA_LAYER_NAME, 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_ensure_pin_attr(), BM_uv_map_ensure_select_and_pin_attrs(), BM_uv_map_get_offsets_from_layer(), ED_mesh_uv_map_pin_layer_ensure(), and ED_mesh_uv_map_pin_layer_get().
| const char * BKE_uv_map_vert_select_name_get | ( | const char * | uv_map_name, |
| char * | buffer ) |
Definition at line 1032 of file attribute.cc.
References BLI_assert, BLI_snprintf(), MAX_CUSTOMDATA_LAYER_NAME, 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_ensure_select_and_pin_attrs(), BM_uv_map_ensure_vert_select_attr(), BM_uv_map_get_offsets_from_layer(), ED_mesh_uv_map_vert_select_layer_ensure(), and ED_mesh_uv_map_vert_select_layer_get().
|
static |
Definition at line 488 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attributes_length(), CD_MASK_COLOR_ALL, and min_ii().
Referenced by BKE_attribute_remove().
|
static |
Definition at line 494 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_attribute_from_index(), and CD_MASK_COLOR_ALL.
Referenced by BKE_attribute_remove().
|
static |
Definition at line 481 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, CurvesGeometry::curve_data, CurvesGeometry::curve_num, Curves, BMesh::edata, Curves::geometry, GreasePencilDrawing::geometry, AttributeOwner::get_curves(), AttributeOwner::get_grease_pencil(), AttributeOwner::get_grease_pencil_drawing(), AttributeOwner::get_mesh(), AttributeOwner::get_pointcloud(), GreasePencil, GreasePencilDrawing, int, GreasePencil::layers_data, BMesh::ldata, Mesh, BMesh::pdata, PointCloud::pdata, CurvesGeometry::point_data, CurvesGeometry::point_num, PointCloud, BMesh::totedge, BMesh::totface, BMesh::totloop, PointCloud::totpoint, BMesh::totvert, AttributeOwner::type(), and BMesh::vdata.
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_get(), BKE_attributes_iterator_next_domain(), and BKE_attributes_length().
|
static |
Definition at line 223 of file attribute.cc.
References BKE_report(), CD_PROP_INT32, ELEM, and RPT_ERROR.
Referenced by BKE_attribute_new(), and BKE_attribute_rename().