UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TAttributesSet< ElementIDType > Class Template Reference

#include <MeshAttributeArray.h>

+ Inheritance diagram for TAttributesSet< ElementIDType >:

Public Member Functions

template<typename T >
TMeshAttributesConstRef< ElementIDType, typename TMeshAttributesRefType< T >::ConstRefType > GetAttributesRef (const FName AttributeName) const
 
template<typename T >
TMeshAttributesRef< ElementIDType, typename TMeshAttributesRefType< T >::RefType > GetAttributesRef (const FName AttributeName)
 
int32 GetAttributeIndexCount (const FName AttributeName) const
 
int32 GetAttributeChannelCount (const FName AttributeName) const
 
template<typename AttributeType >
int32 GetAttributeIndexCount (const FName AttributeName) const
 
void SetAttributeIndexCount (const FName AttributeName, const int32 NumChannels)
 
void SetAttributeChannelCount (const FName AttributeName, const int32 NumChannels)
 
template<typename AttributeType >
void SetAttributeIndexCount (const FName AttributeName, const int32 NumIndices)
 
void InsertAttributeIndex (const FName AttributeName, const int32 Index)
 
void InsertAttributeChannel (const FName AttributeName, const int32 Index)
 
template<typename AttributeType >
void InsertAttributeIndex (const FName AttributeName, const int32 Index)
 
void RemoveAttributeIndex (const FName AttributeName, const int32 Index)
 
void RemoveAttributeChannel (const FName AttributeName, const int32 Index)
 
template<typename AttributeType >
void RemoveAttributeIndex (const FName AttributeName, const int32 Index)
 
template<typename T >
GetAttribute (const ElementIDType ElementID, const FName AttributeName, const int32 AttributeChannel=0) const
 
template<typename T >
void SetAttribute (const ElementIDType ElementID, const FName AttributeName, const int32 AttributeChannel, const T &AttributeValue)
 
void Insert (const ElementIDType ElementID)
 
void Remove (const ElementIDType ElementID)
 
template<typename ForEachFunc >
void ForEach (ForEachFunc Func)
 
template<typename ForEachFunc >
void ForEach (ForEachFunc Func) const
 
template<typename AttributeType , typename ForEachFunc >
void ForEachByType (ForEachFunc Func)
 
template<typename AttributeType , typename ForEachFunc >
void ForEachByType (ForEachFunc Func) const
 
- Public Member Functions inherited from FAttributesSetBase
 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)
 

Additional Inherited Members

- Protected Attributes inherited from FAttributesSetBase
TMap< FName, FAttributesSetEntryMap
 
int32 NumElements
 

Detailed Description

template<typename ElementIDType>
class TAttributesSet< ElementIDType >

This is a version of the attributes set container which accesses elements by typesafe IDs. This prevents access of (for example) vertex instance attributes by vertex IDs.

Member Function Documentation

◆ ForEach() [1/2]

Call the supplied function on each attribute. The prototype should be Func( const FName AttributeName, auto AttributesRef );

◆ ForEach() [2/2]

template<typename ElementIDType >
template<typename ForEachFunc >
void TAttributesSet< ElementIDType >::ForEach ( ForEachFunc  Func) const

Call the supplied function on each attribute. The prototype should be Func( const FName AttributeName, auto AttributesConstRef );

◆ ForEachByType() [1/2]

template<typename ElementIDType >
template<typename AttributeType , typename ForEachFunc >
void TAttributesSet< ElementIDType >::ForEachByType ( ForEachFunc  Func)

Call the supplied function on each attribute that matches the given type. The type can be given as either a plain type T, TArrayView<T> or TArrayAttribute<T>. The prototype should be Func( const FName AttributeName, auto AttributesRef );

◆ ForEachByType() [2/2]

template<typename ElementIDType >
template<typename AttributeType , typename ForEachFunc >
void TAttributesSet< ElementIDType >::ForEachByType ( ForEachFunc  Func) const

Call the supplied function on each attribute that matches the given type. The type can be given as either a plain type T, TArrayView<T> or TArrayAttribute<T>. The prototype should be Func( const FName AttributeName, auto AttributesConstRef );

◆ GetAttribute()

template<typename ElementIDType >
template<typename T >
T TAttributesSet< ElementIDType >::GetAttribute ( const ElementIDType  ElementID,
const FName  AttributeName,
const int32  AttributeChannel = 0 
) const
inline

Get an attribute value for the given element ID. Note: it is generally preferable to get a TMeshAttributesRef and access elements through that, if you wish to access more than one.

◆ GetAttributeChannelCount()

template<typename ElementIDType >
int32 TAttributesSet< ElementIDType >::GetAttributeChannelCount ( const FName  AttributeName) const
inline

Returns the number of indices for the attribute with the given name

◆ GetAttributeIndexCount() [1/2]

template<typename ElementIDType >
int32 TAttributesSet< ElementIDType >::GetAttributeIndexCount ( const FName  AttributeName) const
inline

◆ GetAttributeIndexCount() [2/2]

template<typename ElementIDType >
template<typename AttributeType >
int32 TAttributesSet< ElementIDType >::GetAttributeIndexCount ( const FName  AttributeName) const
inline

◆ GetAttributesRef() [1/2]

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

◆ GetAttributesRef() [2/2]

template<typename ElementIDType >
template<typename T >
TMeshAttributesConstRef< ElementIDType, typename TMeshAttributesRefType< T >::ConstRefType > TAttributesSet< ElementIDType >::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.

Example of use:

TVertexAttributesConstRef<FVector> VertexPositions = VertexAttributes().GetAttributesRef<FVector>( "Position" ); // note: assign to value type
for( const FVertexID VertexID : GetVertices().GetElementIDs() )
{
    const FVector Position = VertexPositions.Get( VertexID );
    DoSomethingWith( Position );
}

Note that the returned object is a value type which should be assigned and passed by value, not reference. It is valid for as long as this TAttributesSet object exists.

◆ Insert()

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::Insert ( const ElementIDType  ElementID)
inline

Inserts a default-initialized value for all attributes of the given ID

◆ InsertAttributeChannel()

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::InsertAttributeChannel ( const FName  AttributeName,
const int32  Index 
)
inline

Insert a new index for the attribute with the given name

◆ InsertAttributeIndex() [1/2]

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::InsertAttributeIndex ( const FName  AttributeName,
const int32  Index 
)
inline

◆ InsertAttributeIndex() [2/2]

template<typename ElementIDType >
template<typename AttributeType >
void TAttributesSet< ElementIDType >::InsertAttributeIndex ( const FName  AttributeName,
const int32  Index 
)
inline

◆ Remove()

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::Remove ( const ElementIDType  ElementID)
inline

Removes all attributes with the given ID

◆ RemoveAttributeChannel()

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::RemoveAttributeChannel ( const FName  AttributeName,
const int32  Index 
)
inline

Remove an existing index from the attribute with the given name

◆ RemoveAttributeIndex() [1/2]

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::RemoveAttributeIndex ( const FName  AttributeName,
const int32  Index 
)
inline

◆ RemoveAttributeIndex() [2/2]

template<typename ElementIDType >
template<typename AttributeType >
void TAttributesSet< ElementIDType >::RemoveAttributeIndex ( const FName  AttributeName,
const int32  Index 
)
inline

◆ SetAttribute()

template<typename ElementIDType >
template<typename T >
void TAttributesSet< ElementIDType >::SetAttribute ( const ElementIDType  ElementID,
const FName  AttributeName,
const int32  AttributeChannel,
const T &  AttributeValue 
)
inline

Set an attribute value for the given element ID. Note: it is generally preferable to get a TMeshAttributesRef and set multiple elements through that.

◆ SetAttributeChannelCount()

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::SetAttributeChannelCount ( const FName  AttributeName,
const int32  NumChannels 
)
inline

Sets the number of indices for the attribute with the given name

◆ SetAttributeIndexCount() [1/2]

template<typename ElementIDType >
void TAttributesSet< ElementIDType >::SetAttributeIndexCount ( const FName  AttributeName,
const int32  NumChannels 
)
inline

◆ SetAttributeIndexCount() [2/2]

template<typename ElementIDType >
template<typename AttributeType >
void TAttributesSet< ElementIDType >::SetAttributeIndexCount ( const FName  AttributeName,
const int32  NumIndices 
)
inline

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