Blender
V3.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_meshdata_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.h"
#include "BLT_translation.h"
#include "BKE_attribute.h"
#include "BKE_attribute.hh"
#include "BKE_curves.hh"
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
#include "BKE_pointcloud.h"
#include "BKE_report.h"
#include "RNA_access.h"
Go to the source code of this file.
Classes | |
struct | DomainInfo |
struct | AttrUniqueData |
Namespaces | |
blender | |
blender::bke | |
Implementation of generic geometry attributes management. This is built on top of CustomData, which manages individual domains.
Definition in file attribute.cc.
bool BKE_attribute_allow_procedural_access | ( | const char * | attribute_name | ) |
Definition at line 138 of file attribute.cc.
References blender::bke::allow_procedural_attribute_access().
Referenced by BKE_id_attributes_active_get().
Definition at line 203 of file attribute.cc.
References BLI_strncpy(), BLI_strncpy_utf8(), BLI_uniquename_cb(), data, IFACE_, MAX_CUSTOMDATA_LAYER_NAME, and unique_name_cb().
Referenced by BKE_id_attribute_duplicate(), BKE_id_attribute_new(), and BKE_id_attribute_rename().
void BKE_id_attribute_copy_domains_temp | ( | short | id_type, |
const CustomData * | vdata, | ||
const CustomData * | edata, | ||
const CustomData * | ldata, | ||
const CustomData * | pdata, | ||
const CustomData * | cdata, | ||
ID * | r_id | ||
) |
Definition at line 749 of file attribute.cc.
References curves, CustomData_reset(), Mesh::edata, Mesh::edit_mesh, ID_CV, ID_ME, ID_PT, Mesh::ldata, ID::name, Mesh::pdata, PointCloud::pdata, reset, and Mesh::vdata.
int BKE_id_attribute_data_length | ( | ID * | id, |
CustomDataLayer * | layer | ||
) |
Definition at line 413 of file attribute.cc.
References ARRAY_HAS_ITEM, ATTR_DOMAIN_NUM, BLI_assert_msg, DomainInfo::customdata, Mesh::edit_mesh, get_domains(), GS, id, ID_ME, CustomData::layers, DomainInfo::length, mesh, ID::name, and CustomData::totlayer.
eAttrDomain BKE_id_attribute_domain | ( | const ID * | id, |
const CustomDataLayer * | layer | ||
) |
Definition at line 396 of file attribute.cc.
References ARRAY_HAS_ITEM, ATTR_DOMAIN_NUM, ATTR_DOMAIN_POINT, BLI_assert_msg, DomainInfo::customdata, get_domains(), CustomData::layers, and CustomData::totlayer.
CustomDataLayer* BKE_id_attribute_duplicate | ( | struct ID * | id, |
const char * | name, | ||
struct ReportList * | reports | ||
) |
Creates a duplicate attribute layer.
Definition at line 256 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_id_attribute_calc_unique_name(), BKE_id_attribute_search(), BKE_report(), BLI_assert_unreachable, CD_MASK_PROP_ALL, blender::bke::cpp_type_to_custom_data_type(), Mesh::edit_mesh, blender::bke::get_attribute_accessor_for_write(), GS, id, ID_ME, MAX_CUSTOMDATA_LAYER_NAME, mesh, ID::name, RPT_ERROR, src, type, and UNUSED_VARS.
Referenced by blender::ed::geometry::geometry_color_attribute_duplicate_exec().
CustomDataLayer* BKE_id_attribute_find | ( | const ID * | id, |
const char * | name, | ||
const int | type, | ||
const eAttrDomain | domain | ||
) |
Definition at line 325 of file attribute.cc.
References ATTR_DOMAIN_NUM, DomainInfo::customdata, get_domains(), CustomData::layers, CustomDataLayer::name, STREQ, CustomData::totlayer, type, and CustomDataLayer::type.
Referenced by BKE_id_attributes_color_find().
CustomDataLayer* BKE_id_attribute_from_index | ( | ID * | id, |
int | lookup_index, | ||
eAttrDomainMask | domain_mask, | ||
eCustomDataMask | layer_mask | ||
) |
Definition at line 551 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK, DomainInfo::customdata, CustomDataLayer::flag, get_domains(), CustomData::layers, CustomData::totlayer, and CustomDataLayer::type.
Referenced by BKE_remesh_reproject_vertex_paint(), bmo_get_loop_color_ref(), and blender::ed::geometry::next_color_attribute().
CustomDataLayer* BKE_id_attribute_new | ( | struct ID * | id, |
const char * | name, | ||
int | type, | ||
eAttrDomain | domain, | ||
struct ReportList * | reports | ||
) |
Create a new attribute layer.
Definition at line 220 of file attribute.cc.
References ATTR_DOMAIN_NUM, BKE_id_attribute_calc_unique_name(), BKE_report(), BM_data_layer_add_named(), DomainInfo::customdata, CustomData_get_named_layer_index(), Mesh::edit_mesh, blender::bke::get_attribute_accessor_for_write(), get_domains(), GS, id, ID_ME, CustomData::layers, MAX_CUSTOMDATA_LAYER_NAME, mesh, ID::name, RPT_ERROR, and type.
Referenced by 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_id_attribute_remove | ( | ID * | id, |
const char * | name, | ||
ReportList * | reports | ||
) |
Definition at line 288 of file attribute.cc.
References ATTR_DOMAIN_NUM, BKE_id_attribute_required(), BKE_report(), BM_data_layer_free_named(), data, Mesh::edit_mesh, blender::bke::get_attribute_accessor_for_write(), get_domains(), GS, id, ID_ME, mesh, ID::name, and RPT_ERROR.
Referenced by blender::ed::geometry::geometry_attribute_remove_exec(), and blender::ed::geometry::geometry_color_attribute_remove_exec().
bool BKE_id_attribute_rename | ( | ID * | id, |
const char * | old_name, | ||
const char * | new_name, | ||
ReportList * | reports | ||
) |
Definition at line 143 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, BKE_id_attribute_calc_unique_name(), BKE_id_attribute_required(), BKE_id_attribute_search(), BKE_report(), BLI_assert_msg, BLI_strncpy_utf8(), CD_MASK_PROP_ALL, MAX_CUSTOMDATA_LAYER_NAME, CustomDataLayer::name, RPT_ERROR, and STREQ.
Definition at line 444 of file attribute.cc.
References BKE_curves_customdata_required(), BKE_pointcloud_customdata_required(), GS, id, ID_CV, ID_PT, and ID::name.
Referenced by BKE_id_attribute_remove(), and BKE_id_attribute_rename().
CustomDataLayer* BKE_id_attribute_search | ( | ID * | id, |
const char * | name, | ||
const eCustomDataMask | type_mask, | ||
const eAttrDomainMask | domain_mask | ||
) |
Definition at line 348 of file attribute.cc.
References ATTR_DOMAIN_AS_MASK, ATTR_DOMAIN_NUM, ATTR_DOMAIN_POINT, CD_TYPE_AS_MASK, DomainInfo::customdata, get_domains(), CustomData::layers, CustomDataLayer::name, STREQ, CustomData::totlayer, and CustomDataLayer::type.
Referenced by BKE_id_attribute_duplicate(), BKE_id_attribute_rename(), and sculpt_undo_set_active_layer().
CustomDataLayer* BKE_id_attribute_subset_active_get | ( | const ID * | id, |
int | active_flag, | ||
eAttrDomainMask | domain_mask, | ||
eCustomDataMask | mask | ||
) |
Definition at line 637 of file attribute.cc.
References ARRAY_SIZE, ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK, DomainInfo::customdata, CustomDataLayer::flag, get_domains(), get_domains_types(), CustomData::layers, mask(), CustomData::totlayer, and CustomDataLayer::type.
Referenced by BKE_id_attributes_active_color_get(), and BKE_id_attributes_render_color_get().
void BKE_id_attribute_subset_active_set | ( | ID * | id, |
CustomDataLayer * | layer, | ||
int | active_flag, | ||
eAttrDomainMask | domain_mask, | ||
eCustomDataMask | mask | ||
) |
Definition at line 674 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK, DomainInfo::customdata, CustomDataLayer::flag, get_domains(), get_domains_types(), CustomData::layers, mask(), CustomData::totlayer, and CustomDataLayer::type.
Referenced by BKE_id_attributes_active_color_set(), and BKE_id_attributes_render_color_set().
int BKE_id_attribute_to_index | ( | const ID * | id, |
const CustomDataLayer * | layer, | ||
eAttrDomainMask | domain_mask, | ||
eCustomDataMask | layer_mask | ||
) |
Definition at line 597 of file attribute.cc.
References ATTR_DOMAIN_NUM, CD_FLAG_TEMPORARY, CD_TYPE_AS_MASK, DomainInfo::customdata, CustomDataLayer::flag, get_domains(), get_domains_types(), CustomData::layers, CustomData::totlayer, and CustomDataLayer::type.
CustomDataLayer* BKE_id_attributes_active_color_get | ( | const ID * | id | ) |
Definition at line 709 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_id_attribute_subset_active_get(), CD_FLAG_COLOR_ACTIVE, and CD_MASK_COLOR_ALL.
void BKE_id_attributes_active_color_set | ( | ID * | id, |
CustomDataLayer * | active_layer | ||
) |
Definition at line 715 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_id_attribute_subset_active_set(), CD_FLAG_COLOR_ACTIVE, and CD_MASK_COLOR_ALL.
Referenced by BKE_remesh_reproject_vertex_paint(), BKE_sculpt_color_layer_create_if_needed(), blo_do_versions_300(), ED_mesh_color_ensure(), blender::ed::geometry::geometry_color_attribute_add_exec(), blender::ed::geometry::geometry_color_attribute_duplicate_exec(), blender::ed::geometry::next_color_attribute(), proj_paint_color_attribute_create(), and sculpt_undo_set_active_layer().
CustomDataLayer* BKE_id_attributes_active_get | ( | ID * | id | ) |
Definition at line 458 of file attribute.cc.
References ATTR_DOMAIN_MASK_ALL, ATTR_DOMAIN_NUM, BKE_attribute_allow_procedural_access(), BKE_id_attributes_active_index_p(), BKE_id_attributes_length(), CD_MASK_PROP_ALL, CD_TYPE_AS_MASK, DomainInfo::customdata, get_domains(), CustomData::layers, CustomDataLayer::name, CustomData::totlayer, and CustomDataLayer::type.
Referenced by blender::ed::geometry::geometry_attribute_convert_exec(), blender::ed::geometry::geometry_attribute_convert_poll(), blender::ed::geometry::geometry_attribute_remove_exec(), and blender::ed::geometry::geometry_attributes_remove_poll().
int* BKE_id_attributes_active_index_p | ( | ID * | id | ) |
Definition at line 512 of file attribute.cc.
References GS, id, ID_CV, ID_ME, ID_PT, and ID::name.
Referenced by BKE_id_attributes_active_get(), BKE_id_attributes_active_set(), ED_geometry_attribute_convert(), blender::ed::geometry::geometry_attribute_convert_exec(), and blender::ed::geometry::geometry_attribute_remove_exec().
void BKE_id_attributes_active_set | ( | ID * | id, |
CustomDataLayer * | active_layer | ||
) |
Definition at line 488 of file attribute.cc.
References ATTR_DOMAIN_NUM, BKE_id_attributes_active_index_p(), CD_MASK_PROP_ALL, CD_TYPE_AS_MASK, DomainInfo::customdata, get_domains(), CustomData::layers, CustomData::totlayer, and CustomDataLayer::type.
Referenced by blender::ed::geometry::geometry_attribute_add_exec().
CustomDataLayer* BKE_id_attributes_color_find | ( | const ID * | id, |
const char * | name | ||
) |
Definition at line 733 of file attribute.cc.
References ATTR_DOMAIN_CORNER, ATTR_DOMAIN_POINT, BKE_id_attribute_find(), CD_PROP_BYTE_COLOR, and CD_PROP_COLOR.
CustomData* BKE_id_attributes_iterator_next_domain | ( | ID * | id, |
CustomDataLayer * | layers | ||
) |
Definition at line 529 of file attribute.cc.
References ATTR_DOMAIN_NUM, DomainInfo::customdata, get_domains(), CustomData::layers, and CustomData::totlayer.
int BKE_id_attributes_length | ( | const ID * | id, |
eAttrDomainMask | domain_mask, | ||
eCustomDataMask | mask | ||
) |
Definition at line 378 of file attribute.cc.
References ATTR_DOMAIN_NUM, DomainInfo::customdata, CustomData_number_of_layers_typemask(), get_domains(), blender::math::length(), and mask().
Referenced by BKE_id_attributes_active_get().
CustomDataLayer* BKE_id_attributes_render_color_get | ( | const ID * | id | ) |
Definition at line 721 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_id_attribute_subset_active_get(), CD_FLAG_COLOR_RENDER, and CD_MASK_COLOR_ALL.
void BKE_id_attributes_render_color_set | ( | ID * | id, |
CustomDataLayer * | active_layer | ||
) |
Definition at line 727 of file attribute.cc.
References ATTR_DOMAIN_MASK_COLOR, BKE_id_attribute_subset_active_set(), CD_FLAG_COLOR_RENDER, and CD_MASK_COLOR_ALL.
Referenced by BKE_remesh_reproject_vertex_paint(), blo_do_versions_300(), blender::ed::geometry::geometry_color_attribute_add_exec(), blender::ed::geometry::geometry_color_attribute_set_render_exec(), blender::ed::geometry::next_color_attribute(), and proj_paint_color_attribute_create().
Definition at line 126 of file attribute.cc.
References ATTR_DOMAIN_NUM, and get_domains().
|
static |
Definition at line 46 of file attribute.cc.
References ATTR_DOMAIN_CORNER, ATTR_DOMAIN_CURVE, ATTR_DOMAIN_EDGE, ATTR_DOMAIN_FACE, ATTR_DOMAIN_NUM, ATTR_DOMAIN_POINT, BMEditMesh::bm, bm, curves, BMesh::edata, Mesh::edata, Mesh::edit_mesh, GS, id, ID_CV, ID_ME, ID_PT, BMesh::ldata, Mesh::ldata, mesh, ID::name, BMesh::pdata, Mesh::pdata, PointCloud::pdata, BMesh::totedge, Mesh::totedge, BMesh::totface, BMesh::totloop, Mesh::totloop, PointCloud::totpoint, Mesh::totpoly, BMesh::totvert, Mesh::totvert, BMesh::vdata, and Mesh::vdata.
Referenced by BKE_id_attribute_data_length(), BKE_id_attribute_domain(), BKE_id_attribute_find(), BKE_id_attribute_from_index(), BKE_id_attribute_new(), BKE_id_attribute_remove(), BKE_id_attribute_search(), BKE_id_attribute_subset_active_get(), BKE_id_attribute_subset_active_set(), BKE_id_attribute_to_index(), BKE_id_attributes_active_get(), BKE_id_attributes_active_set(), BKE_id_attributes_iterator_next_domain(), BKE_id_attributes_length(), BKE_id_attributes_supported(), and unique_name_cb().
|
static |
Get list of domain types but with ATTR_DOMAIN_FACE and ATTR_DOMAIN_CORNER swapped.
Definition at line 587 of file attribute.cc.
References ATTR_DOMAIN_CORNER, ATTR_DOMAIN_FACE, ATTR_DOMAIN_NUM, and SWAP.
Referenced by BKE_id_attribute_subset_active_get(), BKE_id_attribute_subset_active_set(), and BKE_id_attribute_to_index().
Definition at line 178 of file attribute.cc.
References ATTR_DOMAIN_NUM, DomainInfo::customdata, data, get_domains(), CustomData::layers, CustomDataLayer::name, STREQ, and CustomData::totlayer.
Referenced by BKE_id_attribute_calc_unique_name().