UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FAttributesSetBase Class Reference

#include <MeshAttributeArray.h>

+ Inheritance diagram for FAttributesSetBase:

Public Member Functions

 FAttributesSetBase ()
 
template<typename T >
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > RegisterAttributeInternal (const FName AttributeName, const int32 NumberOfChannels=1, const typename TMeshAttributesRegisterType< T >::RealAttributeType &Default=typename TMeshAttributesRegisterType< T >::RealAttributeType(), const EMeshAttributeFlags Flags=EMeshAttributeFlags::None)
 
template<typename T , typename TEnableIf<!TIsArray< T >::Value, int >::Type = 0>
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > RegisterAttribute (const FName AttributeName, const int32 NumberOfChannels=1, const T &Default=T(), const EMeshAttributeFlags Flags=EMeshAttributeFlags::None)
 
template<typename T , typename TEnableIf< TIsArray< T >::Value, int >::Type = 0>
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > RegisterAttribute (const FName AttributeName, const int32 NumberOfChannels=1, const typename TMeshAttributesRegisterType< T >::RealAttributeType &Default=typename TMeshAttributesRegisterType< T >::RealAttributeType(), const EMeshAttributeFlags Flags=EMeshAttributeFlags::None)
 
template<typename T , typename TEnableIf< std::is_same_v< typename TMeshAttributesRegisterType< T >::RealAttributeType, int >, int >::Type = 0>
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > RegisterIndexAttribute (const FName AttributeName, const int32 NumberOfChannels=1, const EMeshAttributeFlags Flags=EMeshAttributeFlags::None)
 
void UnregisterAttribute (const FName AttributeName)
 
bool HasAttribute (const FName AttributeName) const
 
template<typename T >
bool HasAttributeOfType (const FName AttributeName) const
 
void Initialize (const int32 Count)
 
void SetNumElements (const int32 Count)
 
int32 GetNumElements () const
 
void Remap (const TSparseArray< int32 > &IndexRemap)
 
template<typename Allocator >
void GetAttributeNames (TArray< FName, Allocator > &OutAttributeNames) const
 
bool DoesAttributeHaveAnyFlags (const FName AttributeName, EMeshAttributeFlags AttributeFlags) const
 
bool DoesAttributeHaveAllFlags (const FName AttributeName, EMeshAttributeFlags AttributeFlags) const
 
uint32 GetHash (const FName AttributeName) const
 
void Insert (const int32 Index)
 
void Remove (const int32 Index)
 
template<typename T >
TMeshAttributesConstRef< int32, typename TMeshAttributesRefType< T >::ConstRefType > GetAttributesRef (const FName AttributeName) const
 
template<typename T >
TMeshAttributesRef< int32, typename TMeshAttributesRefType< T >::RefType > GetAttributesRef (const FName AttributeName)
 
void AppendAttributesFrom (const FAttributesSetBase &OtherAttributesSet)
 

Protected Attributes

TMap< FName, FAttributesSetEntryMap
 
int32 NumElements
 

Friends

MESHDESCRIPTION_API FArchiveoperator<< (FArchive &Ar, FAttributesSetBase &AttributesSet)
 
template<typename T >
void SerializeLegacy (FArchive &Ar, FAttributesSetBase &AttributesSet)
 

Detailed Description

This is the container for all attributes and their arrays. It wraps a TMap, mapping from attribute name to attribute array. An attribute may be of any arbitrary type; we use a mixture of polymorphism and compile-time templates to handle the different types.

Constructor & Destructor Documentation

◆ FAttributesSetBase()

FAttributesSetBase::FAttributesSetBase ( )
inline

Constructor

Member Function Documentation

◆ AppendAttributesFrom()

void FAttributesSetBase::AppendAttributesFrom ( const FAttributesSetBase OtherAttributesSet)

◆ DoesAttributeHaveAllFlags()

bool FAttributesSetBase::DoesAttributeHaveAllFlags ( const FName  AttributeName,
EMeshAttributeFlags  AttributeFlags 
) const
inline

Determine whether an attribute has all of the given flags

◆ DoesAttributeHaveAnyFlags()

bool FAttributesSetBase::DoesAttributeHaveAnyFlags ( const FName  AttributeName,
EMeshAttributeFlags  AttributeFlags 
) const
inline

Determine whether an attribute has any of the given flags

◆ GetAttributeNames()

template<typename Allocator >
void FAttributesSetBase::GetAttributeNames ( TArray< FName, Allocator > &  OutAttributeNames) const
inline

Returns an array of all the attribute names registered

◆ GetAttributesRef() [1/2]

template<typename T >
TMeshAttributesRef< int32, typename TMeshAttributesRefType< T >::RefType > FAttributesSetBase::GetAttributesRef ( const FName  AttributeName)
inline

◆ GetAttributesRef() [2/2]

template<typename T >
TMeshAttributesConstRef< int32, typename TMeshAttributesRefType< T >::ConstRefType > FAttributesSetBase::GetAttributesRef ( const FName  AttributeName) const
inline

Get an attribute array with the given type and name. The attribute type must correspond to the type passed as the template parameter.

◆ GetHash()

uint32 FAttributesSetBase::GetHash ( const FName  AttributeName) const
inline

◆ GetNumElements()

int32 FAttributesSetBase::GetNumElements ( ) const
inline

Gets the number of elements in the attribute set

◆ HasAttribute()

bool FAttributesSetBase::HasAttribute ( const FName  AttributeName) const
inline

Determines whether an attribute exists with the given name

◆ HasAttributeOfType()

template<typename T >
bool FAttributesSetBase::HasAttributeOfType ( const FName  AttributeName) const
inline

Determines whether an attribute of the given type exists with the given name

◆ Initialize()

void FAttributesSetBase::Initialize ( const int32  Count)
inline

Initializes all attributes to have the given number of elements with the default value

◆ Insert()

void FAttributesSetBase::Insert ( const int32  Index)
inline

Insert a new element at the given index. The public API version of this function takes an ID of ElementIDType instead of a typeless index.

◆ RegisterAttribute() [1/2]

template<typename T , typename TEnableIf<!TIsArray< T >::Value, int >::Type = 0>
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > FAttributesSetBase::RegisterAttribute ( const FName  AttributeName,
const int32  NumberOfChannels = 1,
const T &  Default = T(),
const EMeshAttributeFlags  Flags = EMeshAttributeFlags::None 
)
inline

Register a new simple attribute. e.g. RegisterAttribute<float>(...)

Obtain a reference to this with GetAttributesRef<float>(...)

◆ RegisterAttribute() [2/2]

template<typename T , typename TEnableIf< TIsArray< T >::Value, int >::Type = 0>
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > FAttributesSetBase::RegisterAttribute ( const FName  AttributeName,
const int32  NumberOfChannels = 1,
const typename TMeshAttributesRegisterType< T >::RealAttributeType &  Default = typename TMeshAttributesRegisterType<T>::RealAttributeType(),
const EMeshAttributeFlags  Flags = EMeshAttributeFlags::None 
)
inline

Register a new fixed array attribute. e.g. RegisterAttribute<float[3]>(...)

Obtain a reference to this with GetAttributesRef<TArrayView<float>>(...)

◆ RegisterAttributeInternal()

template<typename T >
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > FAttributesSetBase::RegisterAttributeInternal ( const FName  AttributeName,
const int32  NumberOfChannels = 1,
const typename TMeshAttributesRegisterType< T >::RealAttributeType &  Default = typename TMeshAttributesRegisterType<T>::RealAttributeType(),
const EMeshAttributeFlags  Flags = EMeshAttributeFlags::None 
)
inline

Register a new attribute name with the given type (must be a member of the AttributeTypes tuple). If the attribute name is already registered, it will update it to use the new type, number of channels and flags.

Example of use:

VertexInstanceAttributes().RegisterAttribute<FVector2f>( "UV", 8 );
                   . . .
TVertexInstanceAttributeArray<FVector2f>& UV0 = VertexInstanceAttributes().GetAttributes<FVector2f>( "UV", 0 );
UV0[ VertexInstanceID ] = FVector2f( 1.0f, 1.0f );

◆ RegisterIndexAttribute()

template<typename T , typename TEnableIf< std::is_same_v< typename TMeshAttributesRegisterType< T >::RealAttributeType, int >, int >::Type = 0>
TMeshAttributesArray< typename TMeshAttributesRegisterType< T >::RefType > FAttributesSetBase::RegisterIndexAttribute ( const FName  AttributeName,
const int32  NumberOfChannels = 1,
const EMeshAttributeFlags  Flags = EMeshAttributeFlags::None 
)
inline

Register a new unbounded array attribute. e.g. RegisterAttribute<float[]>(...)

Obtain a reference to this with GetAttributesRef<TArrayAttribute<float>>(...)

◆ Remap()

void FAttributesSetBase::Remap ( const TSparseArray< int32 > &  IndexRemap)

Applies the given remapping to the attributes set

◆ Remove()

void FAttributesSetBase::Remove ( const int32  Index)
inline

Remove an element at the given index. The public API version of this function takes an ID of ElementIDType instead of a typeless index.

◆ SetNumElements()

void FAttributesSetBase::SetNumElements ( const int32  Count)
inline

Sets all attributes to have the given number of elements, preserving existing values and filling extra elements with the default value

◆ UnregisterAttribute()

void FAttributesSetBase::UnregisterAttribute ( const FName  AttributeName)
inline

Unregister an attribute with the given name.

Friends And Related Symbol Documentation

◆ operator<<

MESHDESCRIPTION_API FArchive & operator<< ( FArchive Ar,
FAttributesSetBase AttributesSet 
)
friend

Serialization

◆ SerializeLegacy

template<typename T >
void SerializeLegacy ( FArchive Ar,
FAttributesSetBase AttributesSet 
)
friend

Member Data Documentation

◆ Map

TMap<FName, FAttributesSetEntry> FAttributesSetBase::Map
protected

The actual container

◆ NumElements

int32 FAttributesSetBase::NumElements
protected

The number of elements in each attribute array


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