Blender V4.3
attribute.cc File Reference
#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
 

Functions

static std::array< DomainInfo, ATTR_DOMAIN_NUMget_domains (const AttributeOwner &owner)
 
static std::optional< blender::bke::MutableAttributeAccessorblender::bke::get_attribute_accessor_for_write (AttributeOwner &owner)
 
static bool bke_attribute_rename_if_exists (AttributeOwner &owner, const char *old_name, const char *new_name, ReportList *reports)
 
static bool mesh_edit_mode_attribute_valid (const blender::StringRef name, const AttrDomain domain, const eCustomDataType data_type, ReportList *reports)
 
bool BKE_attribute_rename (AttributeOwner &owner, const char *old_name, const char *new_name, ReportList *reports)
 
static bool attribute_name_exists (const AttributeOwner &owner, const blender::StringRef name)
 
std::string BKE_attribute_calc_unique_name (const AttributeOwner &owner, const blender::StringRef name)
 
CustomDataLayerBKE_attribute_new (AttributeOwner &owner, const char *name, const eCustomDataType type, const AttrDomain domain, ReportList *reports)
 
static void bke_attribute_copy_if_exists (AttributeOwner &owner, const char *srcname, const char *dstname)
 
CustomDataLayerBKE_attribute_duplicate (AttributeOwner &owner, const char *name, ReportList *reports)
 
static int color_name_to_index (AttributeOwner &owner, const char *name)
 
static int color_clamp_index (AttributeOwner &owner, int index)
 
static const char * color_name_from_index (AttributeOwner &owner, int index)
 
bool BKE_attribute_remove (AttributeOwner &owner, const char *name, ReportList *reports)
 
CustomDataLayerBKE_attribute_find (const AttributeOwner &owner, const char *name, const eCustomDataType type, const AttrDomain domain)
 
const CustomDataLayerBKE_attribute_search (const AttributeOwner &owner, const char *name, const eCustomDataMask type_mask, const AttrDomainMask domain_mask)
 
CustomDataLayerBKE_attribute_search_for_write (AttributeOwner &owner, const char *name, const eCustomDataMask type_mask, const AttrDomainMask domain_mask)
 
int BKE_attributes_length (const AttributeOwner &owner, AttrDomainMask domain_mask, eCustomDataMask mask)
 
AttrDomain BKE_attribute_domain (const AttributeOwner &owner, const CustomDataLayer *layer)
 
int BKE_attribute_domain_size (const AttributeOwner &owner, const int domain)
 
int BKE_attribute_data_length (AttributeOwner &owner, CustomDataLayer *layer)
 
bool BKE_attribute_required (const AttributeOwner &owner, const char *name)
 
CustomDataLayerBKE_attributes_active_get (AttributeOwner &owner)
 
void BKE_attributes_active_set (AttributeOwner &owner, const char *name)
 
void BKE_attributes_active_clear (AttributeOwner &owner)
 
intBKE_attributes_active_index_p (AttributeOwner &owner)
 
CustomDataBKE_attributes_iterator_next_domain (AttributeOwner &owner, CustomDataLayer *layers)
 
CustomDataLayerBKE_attribute_from_index (AttributeOwner &owner, int lookup_index, AttrDomainMask domain_mask, eCustomDataMask layer_mask)
 
int BKE_attribute_to_index (const AttributeOwner &owner, const CustomDataLayer *layer, AttrDomainMask domain_mask, eCustomDataMask layer_mask)
 
const char * BKE_id_attributes_active_color_name (const ID *id)
 
const char * BKE_id_attributes_default_color_name (const ID *id)
 
void BKE_id_attributes_active_color_set (ID *id, const char *name)
 
void BKE_id_attributes_active_color_clear (ID *id)
 
void BKE_id_attributes_default_color_set (ID *id, const char *name)
 
const CustomDataLayerBKE_id_attributes_color_find (const ID *id, const char *name)
 
bool BKE_color_attribute_supported (const Mesh &mesh, const blender::StringRef name)
 
const char * BKE_uv_map_vert_select_name_get (const char *uv_map_name, char *buffer)
 
const char * BKE_uv_map_edge_select_name_get (const char *uv_map_name, char *buffer)
 
const char * BKE_uv_map_pin_name_get (const char *uv_map_name, char *buffer)
 

Detailed Description

Implementation of generic geometry attributes management. This is built on top of CustomData, which manages individual domains.

Definition in file attribute.cc.

Function Documentation

◆ attribute_name_exists()

static bool attribute_name_exists ( const AttributeOwner & owner,
const blender::StringRef name )
static

◆ BKE_attribute_calc_unique_name()

◆ bke_attribute_copy_if_exists()

static void bke_attribute_copy_if_exists ( AttributeOwner & owner,
const char * srcname,
const char * dstname )
static

◆ BKE_attribute_data_length()

◆ BKE_attribute_domain()

AttrDomain BKE_attribute_domain ( const AttributeOwner & owner,
const CustomDataLayer * layer )

◆ BKE_attribute_domain_size()

int BKE_attribute_domain_size ( const AttributeOwner & owner,
const int domain )

Definition at line 730 of file attribute.cc.

References get_domains().

◆ BKE_attribute_duplicate()

◆ BKE_attribute_find()

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.

◆ BKE_attribute_from_index()

◆ BKE_attribute_new()

◆ BKE_attribute_remove()

◆ BKE_attribute_rename()

◆ bke_attribute_rename_if_exists()

static bool bke_attribute_rename_if_exists ( AttributeOwner & owner,
const char * old_name,
const char * new_name,
ReportList * reports )
static

◆ BKE_attribute_required()

◆ BKE_attribute_search()

◆ BKE_attribute_search_for_write()

CustomDataLayer * BKE_attribute_search_for_write ( AttributeOwner & owner,
const char * name,
const eCustomDataMask type_mask,
const AttrDomainMask domain_mask )

◆ BKE_attribute_to_index()

int BKE_attribute_to_index ( const AttributeOwner & owner,
const CustomDataLayer * layer,
AttrDomainMask domain_mask,
eCustomDataMask layer_mask )

◆ BKE_attributes_active_clear()

void BKE_attributes_active_clear ( AttributeOwner & owner)

Definition at line 827 of file attribute.cc.

References BKE_attributes_active_index_p().

◆ BKE_attributes_active_get()

◆ BKE_attributes_active_index_p()

◆ BKE_attributes_active_set()

◆ BKE_attributes_iterator_next_domain()

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.

◆ BKE_attributes_length()

int BKE_attributes_length ( const AttributeOwner & owner,
AttrDomainMask domain_mask,
eCustomDataMask mask )

◆ BKE_color_attribute_supported()

bool BKE_color_attribute_supported ( const Mesh & mesh,
const blender::StringRef name )

◆ BKE_id_attributes_active_color_clear()

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.

◆ BKE_id_attributes_active_color_name()

const char * BKE_id_attributes_active_color_name ( const ID * id)

Definition at line 949 of file attribute.cc.

References GS, and ID_ME.

Referenced by BKE_attribute_rename().

◆ BKE_id_attributes_active_color_set()

◆ BKE_id_attributes_color_find()

const CustomDataLayer * BKE_id_attributes_color_find ( const ID * id,
const char * name )

◆ BKE_id_attributes_default_color_name()

const char * BKE_id_attributes_default_color_name ( const ID * id)

Definition at line 957 of file attribute.cc.

References GS, and ID_ME.

Referenced by BKE_attribute_rename().

◆ BKE_id_attributes_default_color_set()

◆ BKE_uv_map_edge_select_name_get()

◆ BKE_uv_map_pin_name_get()

◆ BKE_uv_map_vert_select_name_get()

◆ color_clamp_index()

static int color_clamp_index ( AttributeOwner & owner,
int index )
static

◆ color_name_from_index()

static const char * color_name_from_index ( AttributeOwner & owner,
int index )
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().

◆ color_name_to_index()

static int color_name_to_index ( AttributeOwner & owner,
const char * name )
static

◆ get_domains()

◆ mesh_edit_mode_attribute_valid()

static bool mesh_edit_mode_attribute_valid ( const blender::StringRef name,
const AttrDomain domain,
const eCustomDataType data_type,
ReportList * reports )
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().