Blender V5.0
BKE_customdata.hh File Reference

CustomData interface, see also DNA_customdata_types.h. More...

#include <optional>
#include "BLI_implicit_sharing.h"
#include "BLI_memory_counter_fwd.hh"
#include "BLI_span.hh"
#include "BLI_string_ref.hh"
#include "BLI_sys_types.h"
#include "BLI_vector.hh"
#include "BKE_attribute_storage.hh"
#include "BKE_volume_enums.hh"
#include "DNA_customdata_types.h"

Go to the source code of this file.

Classes

struct  BMUVOffsets
struct  CDBlockBytes
struct  BMCustomDataCopyMap
struct  BMCustomDataCopyMap::TrivialCopy
struct  BMCustomDataCopyMap::Copy
struct  BMCustomDataCopyMap::TrivialDefault
struct  BMCustomDataCopyMap::Default
struct  BMCustomDataCopyMap::Free
struct  CustomDataTransferLayerMap

Namespaces

namespace  blender
namespace  blender::bke

Macros

#define UV_PINNED_NAME   "pn"
#define BMUVOFFSETS_NONE   {-1, -1}
#define ORIGINDEX_NONE   -1

Typedefs

using cd_interp = void (*)(const void **sources, const float *weights, int count, void *dest)
using cd_copy = void (*)(const void *source, void *dest, int count)
using cd_set_default_value = void (*)(void *data, int count)
using cd_free = void (*)(void *data, int count)
using cd_validate = bool (*)(void *item, uint totitems, bool do_fixes)
using cd_datatransfer_interp

Enumerations

enum  eCDAllocType { CD_SET_DEFAULT = 2 , CD_CONSTRUCT = 5 }
enum  { ME_VERT = 1 << 0 , ME_EDGE = 1 << 1 , ME_POLY = 1 << 2 , ME_LOOP = 1 << 3 }

Functions

eCustomDataMask CD_TYPE_AS_MASK (eCustomDataType type)
void customData_mask_layers__print (const CustomData_MeshMasks *mask)
void CustomData_MeshMasks_update (CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
bool CustomData_MeshMasks_are_matching (const CustomData_MeshMasks *mask_ref, const CustomData_MeshMasks *mask_required)
bool CustomData_layer_has_math (const CustomData *data, int layer_n)
bool CustomData_layer_has_interp (const CustomData *data, int layer_n)
bool CustomData_has_math (const CustomData *data)
bool CustomData_has_interp (const CustomData *data)
bool CustomData_bmesh_has_free (const CustomData *data)
void CustomData_data_copy_value (eCustomDataType type, const void *source, void *dest)
void CustomData_data_set_default_value (eCustomDataType type, void *elem)
void CustomData_data_mix_value (eCustomDataType type, const void *source, void *dest, int mixmode, float mixfactor)
bool CustomData_data_equals (eCustomDataType type, const void *data1, const void *data2)
void CustomData_data_initminmax (eCustomDataType type, void *min, void *max)
void CustomData_data_dominmax (eCustomDataType type, const void *data, void *min, void *max)
void CustomData_data_multiply (eCustomDataType type, void *data, float fac)
void CustomData_data_add (eCustomDataType type, void *data1, const void *data2)
void CustomData_init_from (const CustomData *source, CustomData *dest, eCustomDataMask mask, int totelem)
void CustomData_init_layout_from (const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_update_typemap (CustomData *data)
bool CustomData_merge (const CustomData *source, CustomData *dest, eCustomDataMask mask, int totelem)
bool CustomData_merge_layout (const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_realloc (CustomData *data, int old_size, int new_size, eCDAllocType alloctype=CD_CONSTRUCT)
bool CustomData_bmesh_merge_layout (const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, BMesh *bm, char htype)
CustomData CustomData_shallow_copy_remove_non_bmesh_attributes (const CustomData *src, eCustomDataMask mask)
void CustomData_reset (CustomData *data)
void CustomData_free (CustomData *data)
void * CustomData_add_layer (CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
const void * CustomData_add_layer_with_data (CustomData *data, eCustomDataType type, void *layer_data, int totelem, const blender::ImplicitSharingInfo *sharing_info)
void * CustomData_add_layer_named (CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem, blender::StringRef name)
const void * CustomData_add_layer_named_with_data (CustomData *data, eCustomDataType type, void *layer_data, int totelem, blender::StringRef name, const blender::ImplicitSharingInfo *sharing_info)
bool CustomData_free_layer (CustomData *data, eCustomDataType type, int index)
bool CustomData_free_layer_named (CustomData *data, blender::StringRef name)
bool CustomData_free_layer_active (CustomData *data, eCustomDataType type)
void CustomData_free_layers (CustomData *data, eCustomDataType type)
bool CustomData_has_layer (const CustomData *data, eCustomDataType type)
bool CustomData_has_layer_named (const CustomData *data, eCustomDataType type, blender::StringRef name)
int CustomData_number_of_layers (const CustomData *data, eCustomDataType type)
int CustomData_number_of_anonymous_layers (const CustomData *data, eCustomDataType type)
int CustomData_number_of_layers_typemask (const CustomData *data, eCustomDataMask mask)
void CustomData_set_only_copy (const CustomData *data, eCustomDataMask mask)
void CustomData_copy_data (const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
void CustomData_copy_data_layer (const CustomData *source, CustomData *dest, int src_layer_index, int dst_layer_index, int src_index, int dst_index, int count)
void CustomData_copy_elements (eCustomDataType type, const void *src_data, void *dst_data, int count)
void CustomData_bmesh_copy_block (CustomData &data, void *src_block, void **dst_block)
BMCustomDataCopyMap CustomData_bmesh_copy_map_calc (const CustomData &src, const CustomData &dst, eCustomDataMask mask_exclude=0)
void CustomData_bmesh_copy_block (CustomData &dst_data, const BMCustomDataCopyMap &map, const void *src_block, void **dst_block)
void CustomData_copy_layer_type_data (const CustomData *source, CustomData *destination, eCustomDataType type, int source_index, int destination_index, int count)
void CustomData_free_elem (CustomData *data, int index, int count)
void CustomData_interp (const CustomData *source, CustomData *dest, const int *src_indices, const float *weights, int count, int dest_index)
void CustomData_bmesh_interp_n (CustomData *data, const void **src_blocks, const float *weights, int count, void *dst_block_ofs, int n)
void CustomData_bmesh_interp (CustomData *data, const void **src_blocks, const float *weights, int count, void *dst_block)
void CustomData_swap_corners (CustomData *data, int index, const int *corner_indices)
void CustomData_ensure_data_is_mutable (CustomDataLayer *layer, int totelem)
void CustomData_ensure_layers_are_mutable (CustomData *data, int totelem)
void * CustomData_get_for_write (CustomData *data, int index, eCustomDataType type, int totelem)
void * CustomData_get_n_for_write (CustomData *data, eCustomDataType type, int index, int n, int totelem)
void * CustomData_bmesh_get (const CustomData *data, void *block, eCustomDataType type)
void * CustomData_bmesh_get_n (const CustomData *data, void *block, eCustomDataType type, int n)
void * CustomData_bmesh_get_layer_n (const CustomData *data, void *block, int n)
bool CustomData_set_layer_name (CustomData *data, eCustomDataType type, int n, blender::StringRef name)
const char * CustomData_get_layer_name (const CustomData *data, eCustomDataType type, int n)
const void * CustomData_get_layer (const CustomData *data, eCustomDataType type)
void * CustomData_get_layer_for_write (CustomData *data, eCustomDataType type, int totelem)
const void * CustomData_get_layer_n (const CustomData *data, eCustomDataType type, int n)
void * CustomData_get_layer_n_for_write (CustomData *data, eCustomDataType type, int n, int totelem)
const void * CustomData_get_layer_named (const CustomData *data, eCustomDataType type, blender::StringRef name)
void * CustomData_get_layer_named_for_write (CustomData *data, eCustomDataType type, blender::StringRef name, int totelem)
int CustomData_get_offset (const CustomData *data, eCustomDataType type)
int CustomData_get_offset_named (const CustomData *data, eCustomDataType type, blender::StringRef name)
int CustomData_get_n_offset (const CustomData *data, eCustomDataType type, int n)
int CustomData_get_layer_index (const CustomData *data, eCustomDataType type)
int CustomData_get_layer_index_n (const CustomData *data, eCustomDataType type, int n)
int CustomData_get_named_layer_index (const CustomData *data, eCustomDataType type, blender::StringRef name)
int CustomData_get_named_layer_index_notype (const CustomData *data, blender::StringRef name)
int CustomData_get_active_layer_index (const CustomData *data, eCustomDataType type)
int CustomData_get_render_layer_index (const CustomData *data, eCustomDataType type)
int CustomData_get_clone_layer_index (const CustomData *data, eCustomDataType type)
int CustomData_get_stencil_layer_index (const CustomData *data, eCustomDataType type)
int CustomData_get_named_layer (const CustomData *data, eCustomDataType type, blender::StringRef name)
int CustomData_get_active_layer (const CustomData *data, eCustomDataType type)
int CustomData_get_render_layer (const CustomData *data, eCustomDataType type)
int CustomData_get_clone_layer (const CustomData *data, eCustomDataType type)
int CustomData_get_stencil_layer (const CustomData *data, eCustomDataType type)
const char * CustomData_get_active_layer_name (const CustomData *data, eCustomDataType type)
const char * CustomData_get_render_layer_name (const CustomData *data, eCustomDataType type)
bool CustomData_layer_is_anonymous (const CustomData *data, eCustomDataType type, int n)
void CustomData_bmesh_set_n (CustomData *data, void *block, eCustomDataType type, int n, const void *source)
void CustomData_set_layer_active (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_render (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_clone (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_stencil (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_active_index (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_render_index (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_clone_index (CustomData *data, eCustomDataType type, int n)
void CustomData_set_layer_flag (CustomData *data, eCustomDataType type, int flag)
void CustomData_bmesh_set_default (CustomData *data, void **block)
void CustomData_bmesh_free_block (CustomData *data, void **block)
void CustomData_bmesh_alloc_block (CustomData *data, void **block)
void CustomData_bmesh_free_block_data (CustomData *data, void *block)
int CustomData_sizeof (eCustomDataType type)
const char * CustomData_layertype_name (eCustomDataType type)
bool CustomData_layertype_is_singleton (eCustomDataType type)
bool CustomData_layertype_is_dynamic (eCustomDataType type)
int CustomData_layertype_layers_max (eCustomDataType type)
int CustomData_name_maxncpy_calc (blender::StringRef name)
void CustomData_set_layer_unique_name (CustomData *data, int index)
void CustomData_validate_layer_name (const CustomData *data, eCustomDataType type, blender::StringRef name, char *outname)
bool CustomData_verify_versions (CustomData *data, int index)
void CustomData_bmesh_init_pool (CustomData *data, int totelem, char htype)
bool CustomData_layer_validate (CustomDataLayer *layer, uint totitems, bool do_fixes)
void CustomData_external_add (CustomData *data, ID *id, eCustomDataType type, int totelem, const char *filepath)
void CustomData_external_remove (CustomData *data, ID *id, eCustomDataType type, int totelem)
bool CustomData_external_test (CustomData *data, eCustomDataType type)
void CustomData_external_write (CustomData *data, ID *id, eCustomDataMask mask, int totelem, int free)
void CustomData_external_read (CustomData *data, ID *id, eCustomDataMask mask, int totelem)
void CustomData_external_reload (CustomData *data, ID *id, eCustomDataMask mask, int totelem)
void CustomData_data_transfer (const MeshPairRemap *me_remap, const CustomDataTransferLayerMap *laymap)
void CustomData_blend_write_prepare (CustomData &data, blender::bke::AttrDomain domain, int domain_size, blender::Vector< CustomDataLayer, 16 > &layers_to_write, blender::bke::AttributeStorage::BlendWriteData &write_data)
void CustomData_blend_write (BlendWriter *writer, CustomData *data, blender::Span< CustomDataLayer > layers_to_write, int count, eCustomDataMask cddata_mask, ID *id)
void CustomData_blend_read (BlendDataReader *reader, CustomData *data, int count)
size_t CustomData_get_elem_size (const CustomDataLayer *layer)
void CustomData_count_memory (const CustomData &data, int totelem, blender::MemoryCounter &memory)
void CustomData_debug_info_from_layers (const CustomData *data, const char *indent, DynStr *dynstr)
Custom Data C++ API
std::optional< VolumeGridTypeblender::bke::custom_data_type_to_volume_grid_type (eCustomDataType type)
std::optional< eCustomDataTypeblender::bke::volume_grid_type_to_custom_data_type (VolumeGridType type)

Variables

const CustomData_MeshMasks CD_MASK_BAREMESH
const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX
const CustomData_MeshMasks CD_MASK_MESH
const CustomData_MeshMasks CD_MASK_DERIVEDMESH
const CustomData_MeshMasks CD_MASK_BMESH
const CustomData_MeshMasks CD_MASK_EVERYTHING

Detailed Description

CustomData interface, see also DNA_customdata_types.h.

Definition in file BKE_customdata.hh.

Macro Definition Documentation

◆ BMUVOFFSETS_NONE

◆ ORIGINDEX_NONE

#define ORIGINDEX_NONE   -1

For ORIGINDEX layer type, indicates no original index for this element.

Definition at line 75 of file BKE_customdata.hh.

Referenced by blender::ed::object::bake_targets_populate_pixels_color_attributes(), BKE_mesh_calc_edges_tessface(), BKE_mesh_foreach_mapped_edge(), BKE_mesh_foreach_mapped_face_center(), BKE_mesh_foreach_mapped_loop(), BKE_mesh_foreach_mapped_subdiv_face_center(), BKE_mesh_foreach_mapped_vert(), BKE_mesh_origindex_map_create(), BKE_object_as_kdtree(), blender::draw::bm_original_edge_get(), blender::draw::bm_original_face_get(), blender::draw::bm_original_vert_get(), bm_to_mesh_shape(), bm_to_mesh_vertex_map(), BM_vert_create(), blender::draw::calc_mesh_edge_visibility(), blender::draw::calc_vert_visibility_mapped_mesh(), blender::draw::calc_vert_visibility_mesh(), blender::draw::calc_visible_loose_edge_indices(), construct_param_handle_subsurfed(), ED_mesh_pick_edge(), ED_mesh_pick_face_vert(), blender::draw::extract_edituv_lines_mesh(), blender::draw::extract_edituv_points_mesh(), blender::draw::extract_lines_loose_geom_subdiv(), blender::draw::extract_lines_paint_mask_subdiv(), blender::draw::extract_points_subdiv_mesh(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_vertices(), blender::ed::object::find_original_loop(), layerDefault_origindex(), mesh_merge_transform(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), paintface_flush_flags(), paintvert_flush_flags(), project_paint_check_face_paintable(), psys_calc_dmcache(), skin_set_orig_indices(), blender::bke::subdiv::subdiv_copy_edge_data(), blender::bke::subdiv::subdiv_foreach_edges_all_patches_regular(), blender::bke::subdiv::subdiv_foreach_edges_all_patches_special(), blender::bke::subdiv::subdiv_foreach_edges_column(), blender::bke::subdiv::subdiv_foreach_loops_of_face(), blender::bke::subdiv::subdiv_mesh_face(), blender::bke::subdiv::subdiv_mesh_vertex_corner(), blender::bke::subdiv::subdiv_mesh_vertex_of_loose_edge_interpolate(), blender::bke::subdiv::subdiv_vertex_data_interpolate(), and texface_from_original_index().

◆ UV_PINNED_NAME

#define UV_PINNED_NAME   "pn"

These names are used as prefixes for UV layer names to find the associated boolean layers. They should never be longer than 2 chars, as MAX_CUSTOMDATA_LAYER_NAME has 4 extra bytes above what can be used for the base layer name, and these prefixes are placed between 2 '.'s at the start of the layer name. For example The uv vert selection layer of a layer named UVMap.001 will be called .pn.UVMap.001.

Definition at line 47 of file BKE_customdata.hh.

Referenced by blender::bke::allow_procedural_attribute_access(), BKE_uv_map_pin_name_get(), and CustomData_name_maxncpy_calc().

Typedef Documentation

◆ cd_copy

using cd_copy = void (*)(const void *source, void *dest, int count)

Definition at line 100 of file BKE_customdata.hh.

◆ cd_datatransfer_interp

Initial value:
void (*)(const CustomDataTransferLayerMap *laymap,
void *dest,
const void **sources,
const float *weights,
int count,
float mix_factor)
int count

Definition at line 658 of file BKE_customdata.hh.

◆ cd_free

using cd_free = void (*)(void *data, int count)

Definition at line 102 of file BKE_customdata.hh.

◆ cd_interp

using cd_interp = void (*)(const void **sources, const float *weights, int count, void *dest)

Definition at line 99 of file BKE_customdata.hh.

◆ cd_set_default_value

using cd_set_default_value = void (*)(void *data, int count)

Definition at line 101 of file BKE_customdata.hh.

◆ cd_validate

using cd_validate = bool (*)(void *item, uint totitems, bool do_fixes)

Definition at line 103 of file BKE_customdata.hh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ME_VERT 
ME_EDGE 
ME_POLY 
ME_LOOP 

Definition at line 665 of file BKE_customdata.hh.

◆ eCDAllocType

Add/copy/merge allocation types.

Enumerator
CD_SET_DEFAULT 

Allocate and set to default, which is usually just zeroed memory.

CD_CONSTRUCT 

Default construct new layer values. Does nothing for trivial types. This should be used if all layer values will be set by the caller after creating the layer.

Definition at line 82 of file BKE_customdata.hh.

Function Documentation

◆ CD_TYPE_AS_MASK()

◆ CustomData_add_layer()

void * CustomData_add_layer ( CustomData * data,
eCustomDataType type,
eCDAllocType alloctype,
int totelem )

Adds a layer of the given type to the CustomData object. The new layer is initialized based on the given alloctype.

Returns
The layer data.

Definition at line 3046 of file customdata.cc.

References customData_add_layer__internal(), CustomData_update_typemap(), CustomDataLayer::data, data, LayerTypeInfo::defaultname, and layerType_getInfo().

Referenced by BKE_mesh_calc_edges_tessface(), BKE_mesh_ensure_skin_customdata(), BKE_mesh_legacy_bevel_weight_to_layers(), BKE_mesh_legacy_edge_crease_to_layers(), BKE_mesh_new_nomain_from_template_ex(), BKE_mesh_orco_ensure(), BKE_sculpt_mask_layers_ensure(), BM_data_layer_add(), BM_mesh_bm_from_me(), convert_mfaces_to_mpolys(), copy_ccg_data(), customdata_version_242(), data_transfer_layersmapping_cdlayers(), data_transfer_layersmapping_cdlayers_multisrc_to_dst(), data_transfer_layersmapping_generate(), deform_verts(), blender::bke::CurvesGeometry::deform_verts_for_write(), blender::bke::editbmesh_calc_modifiers(), ensure_orig_index_layer(), blender::ed::mesh::join_objects_exec(), blender::ed::mesh::join_vertex_groups(), blender::bke::mesh_calc_modifiers(), blender::geometry::mesh_triangulate(), mesh_wrapper_ensure_subdivision(), modify_mesh(), modify_mesh(), modify_mesh(), blender::modifyGeometry(), multires_create_grids_in_unsubdivided_base_mesh(), multires_ensure_external_read(), multires_subdivide_create_tangent_displacement_linear_grids(), multiresModifier_subdivide_to_level(), blender::bke::orco_coord_layer_ensure(), blender::io::alembic::read_generated_coordinates(), sculpt_multires_modifier_get(), skin_set_orig_indices(), and triangulate_mesh().

◆ CustomData_add_layer_named()

◆ CustomData_add_layer_named_with_data()

◆ CustomData_add_layer_with_data()

const void * CustomData_add_layer_with_data ( CustomData * data,
eCustomDataType type,
void * layer_data,
int totelem,
const blender::ImplicitSharingInfo * sharing_info )

Adds a layer of the given type to the CustomData object. The new layer takes ownership of the passed in layer_data. If a ImplicitSharingInfo is passed in, its user count is increased.

Definition at line 3064 of file customdata.cc.

References customData_add_layer__internal(), CustomData_update_typemap(), CustomDataLayer::data, data, LayerTypeInfo::defaultname, and layerType_getInfo().

Referenced by blender::ed::object::add_shapekey_layers(), BKE_mesh_calc_edges_legacy(), customdata_version_242(), and mesh_tessface_calc().

◆ CustomData_blend_read()

◆ CustomData_blend_write()

void CustomData_blend_write ( BlendWriter * writer,
CustomData * data,
blender::Span< CustomDataLayer > layers_to_write,
int count,
eCustomDataMask cddata_mask,
ID * id )

◆ CustomData_blend_write_prepare()

void CustomData_blend_write_prepare ( CustomData & data,
blender::bke::AttrDomain domain,
int domain_size,
blender::Vector< CustomDataLayer, 16 > & layers_to_write,
blender::bke::AttributeStorage::BlendWriteData & write_data )

Prepare given custom data for file writing.

Parameters
dataThe custom-data to tweak for .blend file writing (modified in place).
layers_to_writeA reduced set of layers to be written to file.
write_dataAttributeStorage data to write, to support the option for writing the new format even when it isn't used at runtime.
Warning
This function invalidates the custom data struct by changing the layer counts and the #layers pointer, and by invalidating the type map. It expects to work on a shallow copy of the struct.

Definition at line 5013 of file customdata.cc.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::bke::Array, blender::bke::attribute_name_is_anonymous(), blender::bke::AttributeStorage::BlendWriteData::attributes, CD_FLAG_NOCOPY, CD_NUMTYPES, blender::ResourceScope::construct(), blender::bke::custom_data_type_to_attr_type(), Attribute::data, AttributeArray::data, data, Attribute::data_type, Attribute::domain, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), Attribute::name, name, blender::bke::AttributeStorage::BlendWriteData::scope, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and Attribute::storage_type.

Referenced by blender::bke::CurvesGeometry::blend_write_prepare(), and mesh_blend_write().

◆ CustomData_bmesh_alloc_block()

void CustomData_bmesh_alloc_block ( CustomData * data,
void ** block )

◆ CustomData_bmesh_copy_block() [1/2]

◆ CustomData_bmesh_copy_block() [2/2]

◆ CustomData_bmesh_copy_map_calc()

◆ CustomData_bmesh_free_block()

◆ CustomData_bmesh_free_block_data()

void CustomData_bmesh_free_block_data ( CustomData * data,
void * block )

Same as CustomData_bmesh_free_block but zero the memory rather than freeing.

Definition at line 3785 of file customdata.cc.

References data, LayerTypeInfo::free, i, layerType_getInfo(), and POINTER_OFFSET.

Referenced by bmo_inset_region_exec().

◆ CustomData_bmesh_get()

◆ CustomData_bmesh_get_layer_n()

void * CustomData_bmesh_get_layer_n ( const CustomData * data,
void * block,
int n )

Gets from the layer at physical index n,

Note
doesn't check type.

Definition at line 3969 of file customdata.cc.

References data, and POINTER_OFFSET.

Referenced by EDBM_verts_mirror_cache_clear(), and EDBM_verts_mirror_get().

◆ CustomData_bmesh_get_n()

void * CustomData_bmesh_get_n ( const CustomData * data,
void * block,
eCustomDataType type,
int n )

◆ CustomData_bmesh_has_free()

bool CustomData_bmesh_has_free ( const CustomData * data)

A non bmesh version would have to check layer->data.

Definition at line 4014 of file customdata.cc.

References data, LayerTypeInfo::free, i, and layerType_getInfo().

Referenced by BM_mesh_data_free().

◆ CustomData_bmesh_init_pool()

◆ CustomData_bmesh_interp()

◆ CustomData_bmesh_interp_n()

void CustomData_bmesh_interp_n ( CustomData * data,
const void ** src_blocks,
const float * weights,
int count,
void * dst_block_ofs,
int n )
Note
src_blocks_ofs & dst_block_ofs must be pointers to the data, offset by layer->offset already.

Definition at line 4139 of file customdata.cc.

References BLI_assert, count, data, LayerTypeInfo::interp, layerType_getInfo(), and CustomDataLayer::type.

Referenced by bm_edge_collapse_loop_customdata(), bm_vert_loop_groups_data_layer_merge__single(), bm_vert_loop_groups_data_layer_merge_weights__single(), and CustomData_bmesh_interp().

◆ CustomData_bmesh_merge_layout()

bool CustomData_bmesh_merge_layout ( const CustomData * source,
CustomData * dest,
eCustomDataMask mask,
eCDAllocType alloctype,
BMesh * bm,
char htype )

◆ CustomData_bmesh_set_default()

void CustomData_bmesh_set_default ( CustomData * data,
void ** block )

◆ CustomData_bmesh_set_n()

void CustomData_bmesh_set_n ( CustomData * data,
void * block,
eCustomDataType type,
int n,
const void * source )

◆ CustomData_copy_data()

void CustomData_copy_data ( const CustomData * source,
CustomData * dest,
int source_index,
int dest_index,
int count )

Copies data from one CustomData object to another objects need not be compatible, each source layer is copied to the first dest layer of correct type (if there is none, the layer is skipped).

NOTE: It's expected that the destination layers are mutable (CustomData_ensure_layers_are_mutable). These copy-functions could ensure that internally, but that would cause additional overhead when copying few elements at a time. It would also be necessary to pass the total size of the destination layers as parameter to make them mutable though. In most cases, these functions are used right after creating a new geometry, in which case there are no shared layers anyway.

Definition at line 3316 of file customdata.cc.

References count, CustomData_copy_data_layer(), CustomData::layers, CustomData::totlayer, and CustomDataLayer::type.

Referenced by add_interp_verts_copy_edges_to_new_mesh(), add_interpolated_faces_to_new_mesh(), arrayModifier_doArray(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_strip_loose_faces(), copy_masked_edges_to_new_mesh(), copy_masked_faces_to_new_mesh(), copy_masked_verts_to_new_mesh(), blender::geometry::create_merged_mesh(), blender::geometry::customdata_weld(), cutEdges(), explodeMesh(), get_dface(), blender::bke::subdiv::loop_interpolation_from_corner(), blender::geometry::merge_customdata_all(), mesh_add_edges(), mesh_add_faces(), mesh_add_loops(), mesh_add_verts(), mesh_merge_transform(), mesh_strip_edges(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), modify_mesh(), modify_mesh(), modify_mesh(), blender::geometry::reorder_customdata(), blender::geometry::reorder_customdata_groups(), strip_loose_faces_corners(), blender::bke::subdiv::subdiv_copy_edge_data(), blender::bke::subdiv::subdiv_mesh_face(), blender::bke::subdiv::subdiv_vertex_data_copy(), subdivide_base(), and blender::bke::subdiv::vertex_interpolation_from_corner().

◆ CustomData_copy_data_layer()

void CustomData_copy_data_layer ( const CustomData * source,
CustomData * dest,
int src_layer_index,
int dst_layer_index,
int src_index,
int dst_index,
int count )

◆ CustomData_copy_elements()

void CustomData_copy_elements ( eCustomDataType type,
const void * src_data,
void * dst_data,
int count )

◆ CustomData_copy_layer_type_data()

void CustomData_copy_layer_type_data ( const CustomData * source,
CustomData * destination,
eCustomDataType type,
int source_index,
int destination_index,
int count )

Copies data of a single layer of a given type.

Definition at line 3351 of file customdata.cc.

References count, CustomData_copy_data_layer(), and CustomData_get_layer_index().

Referenced by copy_ccg_data(), and blender::geometry::customdata_weld().

◆ CustomData_count_memory()

◆ CustomData_data_add()

void CustomData_data_add ( eCustomDataType type,
void * data1,
const void * data2 )

◆ CustomData_data_copy_value()

void CustomData_data_copy_value ( eCustomDataType type,
const void * source,
void * dest )

Copies the "value" (e.g. uv_map UV or mloopcol colors) from one block to another, while not overwriting anything else (e.g. flags). probably only implemented for uv_map/mloopcol, for now.

Definition at line 4037 of file customdata.cc.

References LayerTypeInfo::copy, layerType_getInfo(), and LayerTypeInfo::size.

Referenced by bm_loop_customdata_merge(), blender::bmesh_block_copy_to_mesh_attributes(), bmo_average_vert_facedata_exec(), bmo_collapsecon_do_layer(), and mesh_attributes_copy_to_bmesh_block().

◆ CustomData_data_dominmax()

void CustomData_data_dominmax ( eCustomDataType type,
const void * data,
void * min,
void * max )

◆ CustomData_data_equals()

bool CustomData_data_equals ( eCustomDataType type,
const void * data1,
const void * data2 )

Compares if data1 is equal to data2. type is a valid CustomData type enum (e.g. CD_PROP_FLOAT). the layer type's equal function is used to compare the data, if it exists, otherwise #memcmp is used.

Definition at line 4074 of file customdata.cc.

References LayerTypeInfo::equal, layerType_getInfo(), and LayerTypeInfo::size.

Referenced by bm_edge_collapse_loop_customdata(), BM_edge_is_contiguous_loop_cd(), bm_loop_customdata_merge(), bm_loop_walk_data(), bmw_UVEdgeWalker_step(), and contig_ldata_across_loops().

◆ CustomData_data_initminmax()

void CustomData_data_initminmax ( eCustomDataType type,
void * min,
void * max )

◆ CustomData_data_mix_value()

void CustomData_data_mix_value ( eCustomDataType type,
const void * source,
void * dest,
int mixmode,
float mixfactor )

Mixes the "value" (e.g. uv_map UV or mloopcol colors) from one block into another, while not overwriting anything else (e.g. flags).

Definition at line 4053 of file customdata.cc.

References LayerTypeInfo::copyvalue, layerType_getInfo(), and LayerTypeInfo::size.

Referenced by bm_loop_customdata_merge(), customdata_data_transfer_interp_generic(), and customdata_data_transfer_interp_normal_normals().

◆ CustomData_data_multiply()

void CustomData_data_multiply ( eCustomDataType type,
void * data,
float fac )

◆ CustomData_data_set_default_value()

void CustomData_data_set_default_value ( eCustomDataType type,
void * elem )

◆ CustomData_data_transfer()

◆ CustomData_debug_info_from_layers()

void CustomData_debug_info_from_layers ( const CustomData * data,
const char * indent,
DynStr * dynstr )

◆ CustomData_ensure_data_is_mutable()

void CustomData_ensure_data_is_mutable ( CustomDataLayer * layer,
int totelem )

Custom data layers can be shared through implicit sharing (BLI_implicit_sharing.h). This function makes sure that the layer is unshared if it was shared, which makes it mutable.

Definition at line 2499 of file customdata.cc.

References ensure_layer_data_is_mutable().

Referenced by BKE_attribute_search_for_write().

◆ CustomData_ensure_layers_are_mutable()

void CustomData_ensure_layers_are_mutable ( CustomData * data,
int totelem )

◆ CustomData_external_add()

void CustomData_external_add ( CustomData * data,
ID * id,
eCustomDataType type,
int totelem,
const char * filepath )

◆ CustomData_external_read()

◆ CustomData_external_reload()

void CustomData_external_reload ( CustomData * data,
ID * id,
eCustomDataMask mask,
int totelem )

◆ CustomData_external_remove()

◆ CustomData_external_test()

◆ CustomData_external_write()

◆ CustomData_free()

◆ CustomData_free_elem()

◆ CustomData_free_layer()

◆ CustomData_free_layer_active()

bool CustomData_free_layer_active ( CustomData * data,
eCustomDataType type )

Frees the layer index with the give type. returns 1 on success, 0 if no layer with the given type is found.

In edit-mode, use #EDBM_data_layer_free instead of this function.

Definition at line 3180 of file customdata.cc.

References CustomData_free_layer(), CustomData_get_active_layer_index(), and data.

Referenced by BKE_object_defgroup_remove_all_ex(), blo_do_versions_250(), BM_data_layer_free(), blender::ed::object::modifier_skin_customdata_delete(), multires_customdata_delete(), and object_defgroup_remove_common().

◆ CustomData_free_layer_named()

◆ CustomData_free_layers()

◆ CustomData_get_active_layer()

◆ CustomData_get_active_layer_index()

◆ CustomData_get_active_layer_name()

◆ CustomData_get_clone_layer()

◆ CustomData_get_clone_layer_index()

int CustomData_get_clone_layer_index ( const CustomData * data,
eCustomDataType type )

Definition at line 2731 of file customdata.cc.

References BLI_assert, customdata_typemap_is_valid(), and data.

◆ CustomData_get_elem_size()

size_t CustomData_get_elem_size ( const CustomDataLayer * layer)

◆ CustomData_get_for_write()

void * CustomData_get_for_write ( CustomData * data,
int index,
eCustomDataType type,
int totelem )

Retrieve a pointer to an element of the active layer of the given type, chosen by the index, if it exists.

Definition at line 3484 of file customdata.cc.

References BLI_assert, CustomData_get_layer_for_write(), data, layerType_getInfo(), POINTER_OFFSET, and size().

Referenced by bm_corners_to_loops_ex(), psys_face_mat(), and psys_get_dupli_texture().

◆ CustomData_get_layer()

const void * CustomData_get_layer ( const CustomData * data,
eCustomDataType type )

Retrieve the data array of the active layer of the given type, if it exists. Return null otherwise.

Definition at line 3509 of file customdata.cc.

References CustomData_get_active_layer_index(), and data.

Referenced by blender::ed::object::bake_targets_populate_pixels_color_attributes(), base_skin(), BKE_mesh_calc_edges_legacy(), BKE_mesh_convert_mfaces_to_mpolys(), BKE_mesh_do_versions_cd_flag_init(), BKE_mesh_do_versions_convert_mfaces_to_mpolys(), BKE_mesh_foreach_mapped_edge(), BKE_mesh_foreach_mapped_face_center(), BKE_mesh_foreach_mapped_loop(), BKE_mesh_foreach_mapped_subdiv_face_center(), BKE_mesh_foreach_mapped_vert(), BKE_mesh_legacy_convert_edges_to_generic(), BKE_mesh_legacy_convert_loops_to_corners(), BKE_mesh_legacy_convert_mpoly_to_material_indices(), BKE_mesh_legacy_convert_polys_to_offsets(), BKE_mesh_legacy_convert_verts_to_positions(), BKE_mesh_legacy_sharp_faces_from_flags(), BKE_mesh_new_nomain_from_template_ex(), BKE_object_as_kdtree(), BKE_subdiv_ccg_mask_init_from_paint(), blo_do_versions_280(), blo_do_versions_290(), blo_do_versions_300(), blender::ed::spreadsheet::build_mesh_debug_columns(), blender::ed::spreadsheet::calc_mesh_selection_mask(), blender::ed::spreadsheet::calc_mesh_selection_mask_faces(), cloth_from_object(), construct_param_handle_subsurfed(), convert_mfaces_to_mpolys(), create_mesh(), CustomData_debug_info_from_layers(), data_transfer_layersmapping_cdlayers(), blender::bke::CurvesGeometry::deform_verts(), deformVerts_do(), blender::bke::subdiv::displacement_init_data(), blender::draw::DRW_mesh_batch_cache_create_requested(), ED_mesh_pick_face_vert(), ED_mesh_uv_add(), ED_operator_uvmap_mesh(), blender::bke::editbmesh_calc_modifiers(), blender::draw::extract_orco(), blender::draw::extract_tan_init_common(), final_skin(), get_levels_from_disps(), get_particle_uv(), give_parvert(), blender::ed::mesh::join_objects_exec(), make_duplis_faces(), make_duplis_verts(), mask_init_data(), mesh_get_x_mirror_faces(), mesh_loops_to_tessdata(), blender::draw::mesh_render_data_create(), blender::geometry::mesh_triangulate(), multires_apply_smat(), multires_ensure_external_read(), multiresModifier_set_levels_from_disps(), paintface_flush_flags(), paintvert_flush_flags(), blender::draw::particle_calculate_parent_mcol(), blender::draw::particle_calculate_parent_uvs(), blender::draw::particle_interpolate_children_mcol(), blender::draw::particle_interpolate_children_uvs(), particle_intersect_mesh(), PE_mirror_x(), proj_paint_face_lookup_init(), proj_paint_layer_clone_init(), project_paint_begin(), project_paint_clone_face_skip(), project_paint_prepare_all_faces(), psys_calc_dmcache(), psys_face_mat(), psys_map_index_on_dm(), psys_particle_dm_face_lookup(), psys_particle_on_dm(), psys_thread_context_init_distribute(), recalc_emitter_field(), remap_hair_emitter(), sculpt_multires_modifier_get(), blender::draw::span_from_custom_data_layer(), subdivide_base(), blender::ed::curves::convert_to_particle_system::try_convert_single_object(), blender::io::hydra::HairData::write_curves(), and blender::io::alembic::write_generated_coordinates().

◆ CustomData_get_layer_for_write()

void * CustomData_get_layer_for_write ( CustomData * data,
eCustomDataType type,
int totelem )

Definition at line 3519 of file customdata.cc.

References CustomData_get_active_layer_index(), CustomDataLayer::data, data, and ensure_layer_data_is_mutable().

Referenced by BKE_mesh_calc_edges_legacy(), BKE_mesh_calc_edges_tessface(), BKE_mesh_is_valid(), BKE_mesh_runtime_is_valid(), BKE_mesh_validate(), blo_do_versions_250(), blo_do_versions_290(), blo_update_defaults_scene(), context_init_grid_pointers(), createFacepa(), CustomData_get_for_write(), cutEdges(), data_transfer_dtdata_type_postprocess(), data_transfer_layersmapping_cdlayers(), data_transfer_layersmapping_generate(), deform_verts(), blender::bke::CurvesGeometry::deform_verts_for_write(), distribute_children_exec(), distribute_from_faces_exec(), distribute_from_verts_exec(), distribute_from_volume_exec(), distribute_grid(), ensure_displacement_grids(), ensure_mask_grids(), explodeMesh(), get_dface(), blender::nodes::node_geo_extrude_mesh_cc::get_orig_index_layer(), get_particle_uv(), blender::bke::mesh_calc_modifiers(), blender::bke::mesh_flip_faces(), blender::bke::mesh_init_origspace(), mesh_merge_transform(), mesh_wrapper_ensure_subdivision(), MOD_solidify_extrude_modifyMesh(), MOD_solidify_nonmanifold_modifyMesh(), blender::ed::object::modifier_skin_armature_create(), modify_mesh(), modify_mesh(), modify_mesh(), multires_apply_uniform_scale(), multires_del_higher(), multires_set_tot_mdisps(), multires_subdivide_create_object_space_linear_grids(), multires_topology_changed(), multiresModifier_del_levels(), blender::bke::orco_coord_layer_ensure(), blender::geometry::propagate_edge_attributes(), blender::geometry::propagate_vert_attributes(), psys_face_mat(), psys_interpolate_value_from_verts(), psys_map_index_on_dm(), psys_particle_dm_face_lookup(), psys_particle_on_dm(), psys_thread_context_init_distribute(), blender::io::alembic::read_generated_coordinates(), blender::bke::subdiv::subdiv_mesh_ctx_cache_custom_data_layers(), subdivide_base(), and triangulate_mesh().

◆ CustomData_get_layer_index()

◆ CustomData_get_layer_index_n()

◆ CustomData_get_layer_n()

◆ CustomData_get_layer_n_for_write()

◆ CustomData_get_layer_name()

◆ CustomData_get_layer_named()

const void * CustomData_get_layer_named ( const CustomData * data,
eCustomDataType type,
blender::StringRef name )

◆ CustomData_get_layer_named_for_write()

◆ CustomData_get_n_for_write()

void * CustomData_get_n_for_write ( CustomData * data,
eCustomDataType type,
int index,
int n,
int totelem )

Retrieve a pointer to an element of the nth layer of the given type, chosen by the index, if it exists.

Definition at line 3497 of file customdata.cc.

References BLI_assert, CustomData_get_layer_n_for_write(), data, layerType_getInfo(), POINTER_OFFSET, and size().

Referenced by bm_corners_to_loops_ex().

◆ CustomData_get_n_offset()

◆ CustomData_get_named_layer()

◆ CustomData_get_named_layer_index()

◆ CustomData_get_named_layer_index_notype()

int CustomData_get_named_layer_index_notype ( const CustomData * data,
blender::StringRef name )

Definition at line 2706 of file customdata.cc.

References data, i, and name.

Referenced by BKE_attribute_remove().

◆ CustomData_get_offset()

int CustomData_get_offset ( const CustomData * data,
eCustomDataType type )

Definition at line 3580 of file customdata.cc.

References CustomData_get_active_layer_index(), and data.

Referenced by BKE_armature_deform_coords_with_editmesh(), BKE_object_defgroup_clear(), BM_custom_loop_normals_from_vector_layer(), BM_custom_loop_normals_to_vector_layer(), BM_edge_split(), BM_face_interp_multires(), BM_face_multires_bounds_smooth(), BM_face_normal_flip(), BM_face_split(), BM_face_triangulate(), BM_faces_join(), BM_faces_join_pair(), BM_loop_interp_multires(), BM_mesh_bm_from_me(), BM_mesh_calc_uvs_cube(), BM_mesh_esubdivide(), BM_mesh_remap(), BM_mesh_wireframe(), bm_to_mesh_shape(), bm_to_mesh_vertex_map(), BM_uv_vert_map_create(), BMD_mesh_bm_create(), bmo_create_circle_exec(), bmo_create_cone_exec(), bmo_create_cube_exec(), bmo_create_grid_exec(), bmo_create_icosphere_exec(), bmo_create_monkey_exec(), bmo_create_uvsphere_exec(), bmo_poke_exec(), bmo_reverse_faces_exec(), bmo_reverse_uvs_exec(), bmo_rotate_uvs_exec(), bmo_subd_init_shape_info(), bmo_transform_exec(), bpy_bm_utils_uv_select_check(), bpy_bm_uv_layer_offset_or_error(), bpy_bmesh_uv_select_sync_from_mesh(), blender::draw::compute_area_ratio(), construct_param_handle(), construct_param_handle_multi(), correct_uv_aspect(), correct_uv_aspect_per_face(), curve_deform_coords_impl(), deformVerts_do(), ED_mesh_active_dvert_get_em(), ED_uvedit_select_sync_flush(), edbm_decimate_exec(), EDBM_mesh_reveal(), EDBM_select_pick(), edbm_select_ungrouped_exec(), edbm_select_ungrouped_poll(), EDBM_selectmode_set(), blender::draw::extract_face_dots_uv_bm(), blender::draw::extract_skin_roots(), blender::draw::extract_uv_stretch_angle_bm(), blender::draw::extract_weights_bm(), blender::ed::object::get_vert_def_nr(), get_weights_array(), lattice_deform_coords_impl(), blender::geometry::boolean::mesh_bm_concat(), blender::ed::transform::mesh_customdatacorrect_init_container_generic(), object_defgroup_remove_edit_mode(), blender::ed::object::return_editmesh_vgroup(), select_linked_delimit_begin(), similar_vert_select_exec(), blender::ed::object::skin_root_mark_exec(), stitch_process_data(), undomesh_from_editmesh(), uv_copy_exec(), uv_copy_mirrored_faces(), uv_find_nearest_face_ex(), uv_find_nearest_loop_from_edge(), uv_find_nearest_loop_from_vert(), uv_from_view_exec(), uv_paste_exec(), uv_sculpt_stroke_apply(), uv_select_overlap(), uv_select_sync_update(), uvedit_sync_uvselect_flush_from_v3d(), v3d_editvertex_buts(), blender::ed::object::vgroup_assign_verts(), blender::ed::object::vgroup_copy_active_to_sel(), blender::ed::object::vgroup_copy_active_to_sel_single(), blender::ed::object::vgroup_do_remap(), blender::ed::object::vgroup_mirror(), blender::ed::object::vgroup_normalize_active_vertex(), blender::ed::object::vgroup_parray_alloc(), blender::ed::object::vgroup_select_verts(), and blender::ed::object::vgroup_vert_active_mirror().

◆ CustomData_get_offset_named()

int CustomData_get_offset_named ( const CustomData * data,
eCustomDataType type,
blender::StringRef name )

Definition at line 3599 of file customdata.cc.

References CustomData_get_named_layer_index(), data, and name.

Referenced by blender::ed::sculpt_paint::expand::any_nonzero_mask(), blender::ed::sculpt_paint::cloth::apply_filter_forces_bmesh(), blender::ed::sculpt_paint::mask::apply_mask_from_settings(), blender::ed::object::bake_targets_output_vertex_colors(), bevel_harden_normals(), BKE_pbvh_bmesh_after_stroke(), BM_custom_loop_normals_from_vector_layer(), BM_custom_loop_normals_to_vector_layer(), bm_lnorspace_ensure_from_free_normals(), BM_lnorspace_err(), BM_lnorspace_rebuild(), BM_lnorspacearr_store(), BM_log_all_added(), BM_log_before_all_removed(), bm_log_faces_restore(), bm_log_vert_values_swap(), bm_log_verts_restore(), bm_log_verts_unmake(), BM_loop_normal_editdata_array_init_with_htype(), BM_mesh_wireframe(), BM_uv_map_offsets_from_layer(), blender::draw::bmesh_attribute_exists(), blender::ed::sculpt_paint::undo::bmesh_push(), blender::bke::pbvh::bmesh_update_topology(), bmo_bevel_exec(), blender::ed::sculpt_paint::pose::calc_average_face_set_center(), blender::ed::sculpt_paint::filter::calc_relax_face_sets_filter(), blender::ed::sculpt_paint::filter::calc_relax_filter(), blender::ed::sculpt_paint::auto_mask::calc_vert_factors(), blender::ed::transform::createTransEdge(), blender::ed::transform::createTransMeshVertCData(), CustomData_bmesh_copy_map_calc(), blender::ed::sculpt_paint::brushes::do_mask_brush(), blender::ed::sculpt_paint::brushes::do_smooth_mask_brush(), blender::ed::sculpt_paint::mask::duplicate_mask(), edbm_average_normals_exec(), edbm_set_normals_from_faces_exec(), blender::ed::sculpt_paint::face_set::ensure_face_sets_bmesh(), blender::draw::extract_sculpt_data(), blender::ed::sculpt_paint::fill_factor_from_hide_and_mask(), blender::ed::sculpt_paint::mask::fill_mask_bmesh(), blender::ed::sculpt_paint::face_set::find_next_available_id(), blender::bke::pbvh::Tree::from_bmesh(), blender::ed::sculpt_paint::mask::gather_mask_bmesh(), geometry_extract_tag_face_set(), geometry_extract_tag_masked_faces(), blender::ed::sculpt_paint::mask::gesture_apply_for_symmetry_pass(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_bmesh(), blender::ed::sculpt_paint::pose::ik_chain_init_face_sets_fk_bmesh(), blender::ed::sculpt_paint::auto_mask::init_boundary_masking_bmesh(), blender::ed::sculpt_paint::boundary::init_falloff_bmesh(), blender::ed::sculpt_paint::expand::init_from_face_set_boundary(), blender::ed::sculpt_paint::mask::invert_mask_bmesh(), blender::draw::mesh_render_data_create(), blender::draw::mesh_render_data_update_corner_normals(), modify_mesh(), mouse_mesh_shortest_path_edge(), mouse_mesh_shortest_path_face(), mouse_mesh_shortest_path_vert(), multires_unsubdivide_extract_grids(), normals_split(), blender::ed::sculpt_paint::hide::partialvis_masked_update_bmesh(), reset_uv_map(), blender::ed::sculpt_paint::undo::restore_mask_from_undo_step(), blender::ed::sculpt_paint::mask::scatter_mask_bmesh(), blender::ed::sculpt_paint::mask::sculpt_mask_filter_exec(), blender::ed::sculpt_paint::mask::sculpt_mask_init_exec(), similar_edge_select_exec(), similar_face_select_exec(), similar_vert_select_exec(), slice_paint_mask(), blender::draw::pbvh::update_face_sets_bmesh(), blender::ed::sculpt_paint::expand::update_for_vert(), blender::bke::pbvh::update_mask_bmesh(), blender::draw::pbvh::update_masks_bmesh(), v3d_editvertex_buts(), and blender::ed::sculpt_paint::expand::write_mask_data().

◆ CustomData_get_render_layer()

◆ CustomData_get_render_layer_index()

int CustomData_get_render_layer_index ( const CustomData * data,
eCustomDataType type )

◆ CustomData_get_render_layer_name()

const char * CustomData_get_render_layer_name ( const CustomData * data,
eCustomDataType type )

◆ CustomData_get_stencil_layer()

◆ CustomData_get_stencil_layer_index()

int CustomData_get_stencil_layer_index ( const CustomData * data,
eCustomDataType type )

Definition at line 2738 of file customdata.cc.

References BLI_assert, customdata_typemap_is_valid(), and data.

◆ CustomData_has_interp()

bool CustomData_has_interp ( const CustomData * data)

Definition at line 4025 of file customdata.cc.

References CustomData_layer_has_interp(), data, and i.

Referenced by bm_grid_fill_array(), and BM_mesh_decimate_collapse().

◆ CustomData_has_layer()

bool CustomData_has_layer ( const CustomData * data,
eCustomDataType type )

Returns true if a layer with the specified type exists.

Definition at line 3204 of file customdata.cc.

References CustomData_get_layer_index(), and data.

Referenced by blender::ed::spreadsheet::add_mesh_debug_column_names(), blender::ed::object::bake(), BKE_main_mesh_legacy_convert_auto_smooth(), BKE_mesh_ensure_skin_customdata(), BKE_mesh_legacy_bevel_weight_to_layers(), BKE_mesh_legacy_convert_mpoly_to_material_indices(), BKE_mesh_legacy_convert_uvs_to_generic(), BKE_mesh_legacy_edge_crease_to_layers(), BKE_mesh_nomain_to_mesh(), BKE_mesh_orco_ensure(), BKE_sculpt_mask_layers_ensure(), BKE_view_layer_filter_edit_mesh_has_uvs(), blo_do_versions_280(), blo_update_defaults_scene(), bm_corners_to_loops_ex(), BM_custom_loop_normals_to_vector_layer(), BM_mesh_bm_from_me(), BM_mesh_bm_to_me(), BM_mesh_bm_to_me_compact(), bmesh_edit_begin(), bmesh_edit_end(), bmo_extrude_edge_only_exec(), bmo_extrude_face_region_exec(), bmo_extrude_vert_indiv_exec(), bpy_bmesh_dealloc(), bpy_bmlayercollection_new(), contarget_get_mesh_mat(), blender::ed::object::convert_mesh_to_mesh(), copy_ccg_data(), blender::ed::transform::createTransMeshSkin(), customData_add_layer__internal(), CustomData_bmesh_do_versions_update_active_layers(), CustomData_debug_info_from_layers(), blender::bke::subdiv::displacement_attach_from_multires(), dynamicPaint_createUVSurface(), ED_mesh_uv_add(), ED_uvedit_sync_uvselect_ensure_if_needed(), EDBM_uv_check(), EDBM_vert_color_check(), blender::bke::editbmesh_calc_modifiers(), ensure_orig_index_layer(), give_parvert(), blender::ed::mesh::join_vertex_groups(), math_layer_info_init(), blender::bke::mesh_calc_modifiers(), mesh_customdata_clear_exec__internal(), mesh_customdata_mask_clear_poll(), mesh_customdata_skin_state(), blender::ed::transform::mesh_customdatacorrect_create_impl(), mesh_loops_to_tessdata(), blender::geometry::mesh_triangulate(), MOD_get_texture_coords(), modify_mesh(), modify_mesh(), blender::modifyGeometry(), multires_ccg_settings_init(), multires_create_grids_in_unsubdivided_base_mesh(), multires_customdata_delete(), multires_subdivide_create_tangent_displacement_linear_grids(), blender::ed::object::multiresbake_check(), multiresModifier_subdivide_to_level(), blender::workbench::ObjectState::ObjectState(), paint_sample_color(), paintface_minmax(), blender::draw::particle_batch_cache_ensure_pos_and_seg(), proj_paint_state_mesh_eval_init(), blender::io::alembic::read_generated_coordinates(), select_linked_delimit_validate(), shape_itemf(), shape_propagate(), blender::ed::object::skin_armature_create_exec(), blender::ed::object::skin_loose_mark_clear_exec(), blender::ed::object::skin_radii_equalize_exec(), update_active_fdata_layers(), uvedit_ensure_uvs(), uvedit_unwrap(), blender::ed::object::vgroup_assign_verts(), and blender::io::alembic::write_custom_data().

◆ CustomData_has_layer_named()

◆ CustomData_has_math()

◆ CustomData_init_from()

void CustomData_init_from ( const CustomData * source,
CustomData * dest,
eCustomDataMask mask,
int totelem )

Initializes a CustomData object with the same layer setup as source. mask is a bit-field where (mask & (1 << (layer type))) indicates if a layer should be copied or not. Data layers using implicit-sharing will not actually be copied but will be shared between source and destination.

Warning
Does not free or release any internal resources in dest CustomData, code must call CustomData_free first if needed.

Definition at line 2573 of file customdata.cc.

References CustomData_merge(), CustomData_reset(), CustomData::external, mask(), and MEM_dupallocN().

Referenced by BKE_mesh_nomain_to_mesh(), blender::bke::CurvesGeometry::CurvesGeometry(), mesh_copy_data(), blender::ed::sculpt_paint::undo::restore_geometry_data(), blender::ed::sculpt_paint::undo::store_geometry_data(), and blender::bke::subdiv::subdiv_mesh_topology_info().

◆ CustomData_init_layout_from()

void CustomData_init_layout_from ( const CustomData * source,
CustomData * dest,
eCustomDataMask mask,
eCDAllocType alloctype,
int totelem )

◆ CustomData_interp()

void CustomData_interp ( const CustomData * source,
CustomData * dest,
const int * src_indices,
const float * weights,
int count,
int dest_index )

Interpolate given custom data source items into a single destination one.

Parameters
src_indicesIndices of every source items to interpolate into the destination one.
weightsThe weight to apply to each source value individually. If NULL, they will be averaged.
countThe number of source items to interpolate.
dest_indexIndex of the destination item, in which to put the result of the interpolation.

Definition at line 3391 of file customdata.cc.

References copy_vn_fl(), count, CustomDataLayer::data, ELEM, LayerTypeInfo::interp, CustomData::layers, layerType_getInfo(), MEM_freeN(), MEM_malloc_arrayN(), POINTER_OFFSET, LayerTypeInfo::size, SOURCE_BUF_SIZE, CustomData::totlayer, and CustomDataLayer::type.

Referenced by add_interp_verts_copy_edges_to_new_mesh(), add_interpolated_faces_to_new_mesh(), blender::geometry::customdata_weld(), blender::bke::subdiv::loop_interpolation_from_corner(), blender::bke::subdiv::loop_interpolation_init(), blender::bke::subdiv::subdiv_interpolate_corner_data(), blender::bke::subdiv::subdiv_mesh_vertex_of_loose_edge_interpolate(), blender::bke::subdiv::subdiv_vertex_data_interpolate(), blender::bke::subdiv::vertex_interpolation_from_corner(), and blender::bke::subdiv::vertex_interpolation_init().

◆ CustomData_layer_has_interp()

bool CustomData_layer_has_interp ( const CustomData * data,
int layer_n )

◆ CustomData_layer_has_math()

◆ CustomData_layer_is_anonymous()

◆ CustomData_layer_validate()

bool CustomData_layer_validate ( CustomDataLayer * layer,
uint totitems,
bool do_fixes )

Validate and fix data of layer, if possible (needs relevant callback in layer's type to be defined).

Returns
True if some errors were found.

Definition at line 4418 of file customdata.cc.

References BLI_assert, CustomData_layer_ensure_data_exists(), CustomDataLayer::data, layerType_getInfo(), CustomDataLayer::type, and LayerTypeInfo::validate.

Referenced by mesh_validate_customdata().

◆ CustomData_layertype_is_dynamic()

bool CustomData_layertype_is_dynamic ( eCustomDataType type)

Has dynamically allocated members. This is useful to know if operations such as #memcmp are valid when comparing data from two layers.

Definition at line 4220 of file customdata.cc.

References LayerTypeInfo::free, and layerType_getInfo().

Referenced by um_arraystore_cd_compact().

◆ CustomData_layertype_is_singleton()

◆ CustomData_layertype_layers_max()

int CustomData_layertype_layers_max ( eCustomDataType type)
Returns
Maximum number of layers of given type, -1 means 'no limit'.

Definition at line 4227 of file customdata.cc.

References LayerTypeInfo::defaultname, LayerTypeInfo::layers_max, and layerType_getInfo().

Referenced by customdata_merge_internal().

◆ CustomData_layertype_name()

const char * CustomData_layertype_name ( eCustomDataType type)

Get the name of a layer type.

Definition at line 4209 of file customdata.cc.

References layerType_getName().

Referenced by CustomData_debug_info_from_layers().

◆ customData_mask_layers__print()

void customData_mask_layers__print ( const CustomData_MeshMasks * mask)

Definition at line 2189 of file customdata.cc.

References CD_NUMTYPES, CD_TYPE_AS_MASK(), i, layerType_getName(), mask(), printf, and PRIx64.

◆ CustomData_merge()

bool CustomData_merge ( const CustomData * source,
CustomData * dest,
eCustomDataMask mask,
int totelem )

Copies all layers from source to destination that don't exist there yet.

Definition at line 2386 of file customdata.cc.

References customdata_merge_internal(), and mask().

Referenced by CustomData_init_from(), and blender::geometry::mesh_triangulate().

◆ CustomData_merge_layout()

bool CustomData_merge_layout ( const CustomData * source,
CustomData * dest,
eCustomDataMask mask,
eCDAllocType alloctype,
int totelem )

Copies all layers from source to destination that don't exist there yet. The layer data is not copied. Instead the newly created layers are initialized using the given alloctype.

Definition at line 2394 of file customdata.cc.

References customdata_merge_internal(), and mask().

Referenced by BM_mesh_bm_to_me_compact(), BM_mesh_copy_init_customdata_from_mesh_array(), CustomData_bmesh_merge_layout(), and CustomData_init_layout_from().

◆ CustomData_MeshMasks_are_matching()

bool CustomData_MeshMasks_are_matching ( const CustomData_MeshMasks * mask_ref,
const CustomData_MeshMasks * mask_required )

◆ CustomData_MeshMasks_update()

◆ CustomData_name_maxncpy_calc()

int CustomData_name_maxncpy_calc ( blender::StringRef name)
Returns
The maximum size in bytes needed for a layer name with the given prefix.

Definition at line 4270 of file customdata.cc.

References MAX_CUSTOMDATA_LAYER_NAME, MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX, name, and UV_PINNED_NAME.

Referenced by BKE_attribute_rename(), and CustomData_set_layer_unique_name().

◆ CustomData_number_of_anonymous_layers()

int CustomData_number_of_anonymous_layers ( const CustomData * data,
eCustomDataType type )

Definition at line 3222 of file customdata.cc.

References blender::bke::attribute_name_is_anonymous(), data, and i.

◆ CustomData_number_of_layers()

int CustomData_number_of_layers ( const CustomData * data,
eCustomDataType type )

Returns the number of layers with this type.

Definition at line 3209 of file customdata.cc.

References data, and i.

Referenced by arrayModifier_doArray(), bevel_merge_uvs(), BKE_mesh_legacy_convert_uvs_to_generic(), BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(), BKE_mesh_validate_all_customdata(), bm_edge_delimit_cdata(), blender::bm_face_loop_table_build(), BM_mesh_bm_from_me(), BM_mesh_decimate_dissolve_ex(), BM_uv_map_attr_pin_ensure_for_all_layers(), bmo_mirror_exec(), bmo_subd_init_shape_info(), bmo_transform_exec(), bpy_bmlayercollection_items(), bpy_bmlayercollection_keys(), bpy_bmlayercollection_length(), bpy_bmlayercollection_new(), bpy_bmlayercollection_values(), convert_mfaces_to_mpolys(), customdata_merge_internal(), CustomData_set_layer_active(), CustomData_set_layer_active_index(), CustomData_set_layer_clone(), CustomData_set_layer_clone_index(), CustomData_set_layer_render(), CustomData_set_layer_render_index(), CustomData_set_layer_stencil(), cutEdges(), data_transfer_layersmapping_cdlayers(), data_transfer_layersmapping_cdlayers_multisrc_to_dst(), determine_uv_vert_connectivity(), blender::ed::object::dt_add_vcol_layers(), blender::ed::object::dt_layers_select_src_itemf(), ED_mesh_uv_add(), ED_mesh_uv_ensure(), ED_paint_proj_mesh_data_check(), edbm_blend_from_shape_exec(), blender::bke::subdiv::eval_refine_from_mesh(), blender::bke::flip_custom_data_type(), blender::bke::subdiv::get_num_uv_layers(), mesh_ensure_tessellation_customdata(), mesh_loops_to_tessdata(), mesh_validate_customdata(), modify_mesh(), move_shapekey_layers_to_keyblocks(), blender::draw::particle_batch_cache_ensure_pos_and_seg(), shape_propagate(), skin_smooth_hulls(), blender::bke::subdiv::subdiv_mesh_ctx_cache_uv_layers(), uv_vert_map_init(), and blender::io::alembic::write_custom_data().

◆ CustomData_number_of_layers_typemask()

int CustomData_number_of_layers_typemask ( const CustomData * data,
eCustomDataMask mask )

Definition at line 3237 of file customdata.cc.

References CD_TYPE_AS_MASK(), data, i, and mask().

Referenced by BKE_attributes_length(), and CustomData_bmesh_merge_layout().

◆ CustomData_realloc()

void CustomData_realloc ( CustomData * data,
int old_size,
int new_size,
eCDAllocType alloctype = CD_CONSTRUCT )

◆ CustomData_reset()

◆ CustomData_set_layer_active()

◆ CustomData_set_layer_active_index()

void CustomData_set_layer_active_index ( CustomData * data,
eCustomDataType type,
int n )

◆ CustomData_set_layer_clone()

void CustomData_set_layer_clone ( CustomData * data,
eCustomDataType type,
int n )

◆ CustomData_set_layer_clone_index()

void CustomData_set_layer_clone_index ( CustomData * data,
eCustomDataType type,
int n )

◆ CustomData_set_layer_flag()

void CustomData_set_layer_flag ( CustomData * data,
eCustomDataType type,
int flag )

Adds flag to the layer flags.

Definition at line 2899 of file customdata.cc.

References data, flag, and i.

Referenced by BM_custom_loop_normals_to_vector_layer().

◆ CustomData_set_layer_name()

bool CustomData_set_layer_name ( CustomData * data,
eCustomDataType type,
int n,
blender::StringRef name )

Definition at line 3611 of file customdata.cc.

References CustomData_get_layer_index_n(), data, and name.

Referenced by blo_do_versions_270().

◆ CustomData_set_layer_render()

◆ CustomData_set_layer_render_index()

void CustomData_set_layer_render_index ( CustomData * data,
eCustomDataType type,
int n )

◆ CustomData_set_layer_stencil()

void CustomData_set_layer_stencil ( CustomData * data,
eCustomDataType type,
int n )

◆ CustomData_set_layer_unique_name()

void CustomData_set_layer_unique_name ( CustomData * data,
int index )

◆ CustomData_set_only_copy()

void CustomData_set_only_copy ( const CustomData * data,
eCustomDataMask mask )

Set the CD_FLAG_NOCOPY flag in custom data layers where the mask is zero for the layer type, so only layer types specified by the mask will be copied

Definition at line 3250 of file customdata.cc.

References CD_FLAG_NOCOPY, CD_TYPE_AS_MASK(), data, i, and mask().

Referenced by blender::bke::mesh_set_only_copy().

◆ CustomData_shallow_copy_remove_non_bmesh_attributes()

CustomData CustomData_shallow_copy_remove_non_bmesh_attributes ( const CustomData * src,
eCustomDataMask mask )

◆ CustomData_sizeof()

◆ CustomData_swap_corners()

void CustomData_swap_corners ( CustomData * data,
int index,
const int * corner_indices )

Swap data inside each item, for all layers. This only applies to item types that may store several sub-item data (e.g. corner data [UVs, VCol, ...] of tessellated faces).

Parameters
corner_indicesA mapping 'new_index -> old_index' of sub-item data.

Definition at line 3471 of file customdata.cc.

References data, i, layerType_getInfo(), POINTER_OFFSET, LayerTypeInfo::size, and LayerTypeInfo::swap.

Referenced by BKE_mesh_mface_index_validate().

◆ CustomData_update_typemap()

◆ CustomData_validate_layer_name()

◆ CustomData_verify_versions()

bool CustomData_verify_versions ( CustomData * data,
int index )

For file reading compatibility, returns false if the layer was freed, only after this test passes, layer->data should be assigned.

Definition at line 4335 of file customdata.cc.

References CD_NUMTYPES, CLOG_WARN, data, LayerTypeInfo::defaultname, ELEM, i, layerType_getInfo(), LOG, LayerTypeInfo::structnum, and CustomDataLayer::type.

Referenced by CustomData_blend_read().

Variable Documentation

◆ CD_MASK_BAREMESH

◆ CD_MASK_BAREMESH_ORIGINDEX

const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX
extern

Definition at line 2117 of file customdata.cc.

Referenced by blender::bke::mesh_calc_modifiers().

◆ CD_MASK_BMESH

◆ CD_MASK_DERIVEDMESH

◆ CD_MASK_EVERYTHING

◆ CD_MASK_MESH