Blender V4.5
blender::bke::Attribute Class Reference

#include <BKE_attribute_storage.hh>

Classes

struct  ArrayData
struct  SingleData

Public Types

using DataVariant = std::variant<ArrayData, SingleData>

Public Member Functions

StringRefNull name () const
AttrDomain domain () const
AttrType data_type () const
AttrStorageType storage_type () const
const DataVariantdata () const
DataVariantdata_for_write ()

Public Attributes

friend AttributeStorage

Detailed Description

Data and metadata for a single geometry attribute.

Definition at line 30 of file BKE_attribute_storage.hh.

Member Typedef Documentation

◆ DataVariant

Definition at line 52 of file BKE_attribute_storage.hh.

Member Function Documentation

◆ data()

const Attribute::DataVariant & Attribute::data ( ) const
inline

Low level access to the data stored for the attribute. The variant's type will correspond to the storage type.

Definition at line 203 of file BKE_attribute_storage.hh.

Referenced by blender::bke::attribute_storage_blend_write_prepare(), blender::bke::convert_storage_to_customdata(), data_for_write(), and blender::bke::tests::TEST().

◆ data_for_write()

Attribute::DataVariant & Attribute::data_for_write ( )

The same as data(), but if the attribute data is shared initially, it will be unshared and made mutable.

Warning
Does not yet support attributes stored as a single value (#AttrStorageType::Single).

Definition at line 92 of file attribute_storage.cc.

References blender::CPPType::alignment, blender::bke::attribute_type_to_cpp_type(), BLI_assert_unreachable, blender::CPPType::copy_construct_n(), blender::bke::create_sharing_info_for_array(), data(), MEM_malloc_arrayN_aligned, and blender::CPPType::size.

Referenced by blender::bke::tests::TEST(), and blender::bke::tests::TEST().

◆ data_type()

AttrType Attribute::data_type ( ) const
inline

The data type exposed to the user. Depending on the storage type, the actual internal values may not be the same type.

Definition at line 198 of file BKE_attribute_storage.hh.

Referenced by blender::bke::attribute_storage_blend_write_prepare(), blender::bke::convert_storage_to_customdata(), and blender::bke::tests::TEST().

◆ domain()

AttrDomain Attribute::domain ( ) const
inline

Which part of a geometry the attribute corresponds to.

Definition at line 193 of file BKE_attribute_storage.hh.

Referenced by blender::bke::attribute_storage_blend_write_prepare(), blender::bke::convert_storage_to_customdata(), and blender::bke::tests::TEST().

◆ name()

StringRefNull Attribute::name ( ) const
inline

Unique name across all domains.

Note
Compared to CustomData, which doesn't enforce uniqueness, across domains on its own, this is enforced by asserts when adding attributes. See #unique_name_calc() (which is also called during the conversion process).

The C++ wrapper needs to be the same size as the DNA struct.

Definition at line 188 of file BKE_attribute_storage.hh.

Referenced by blender::bke::attribute_storage_blend_write_prepare(), and blender::bke::convert_storage_to_customdata().

◆ storage_type()

AttrStorageType Attribute::storage_type ( ) const

The method used to store the data. This gives flexibility to optimize the internal storage even though conceptually the attribute is an array of values.

Definition at line 80 of file attribute_storage.cc.

References blender::bke::Array, BLI_assert_unreachable, and blender::bke::Single.

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

Member Data Documentation

◆ AttributeStorage

friend blender::bke::Attribute::AttributeStorage

Definition at line 53 of file BKE_attribute_storage.hh.


The documentation for this class was generated from the following files: