Open 3D Engine LmbrCentral Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
LmbrCentral::SplineAttribute< AttributeType > Class Template Reference

Attributes are used to attach auxilary data to each vertex in a spline. @description The elements of the attribute are of homogenous type. New elements can not be added or removed manually as the number of elements always matches the number of vertices in the spline. More...

#include <SplineAttribute.h>

Inherits SplineComponentNotificationBus::Handler.

Public Types

using Interpolator = AZStd::function< AttributeType(AttributeType, AttributeType, float)>
 Interpolation function.
 

Public Member Functions

 AZ_RTTI (SplineAttribute< AttributeType >, "{A8E73C3D-65DD-43D8-A25E-2E35674B4B78}")
 
 AZ_CLASS_ALLOCATOR (SplineAttribute< AttributeType >, AZ::SystemAllocator)
 
 SplineAttribute (size_t size)
 
void Activate (AZ::EntityId entityId)
 
void Deactivate ()
 
void SetElement (size_t index, AttributeType value)
 
AttributeType GetElement (size_t index) const
 
AttributeType GetElementInterpolated (size_t index, float fraction, Interpolator interpolator) const
 
AttributeType GetElementInterpolated (const AZ::SplineAddress &address, Interpolator interpolator) const
 
size_t Size () const
 
const AZ::Edit::ElementData & GetElementEditData () const
 
void SetElementEditData (const AZ::Edit::ElementData &elementData)
 

Static Public Member Functions

static void Reflect (AZ::SerializeContext &context)
 

Protected Member Functions

void OnVertexAdded (size_t index) override
 
void OnVertexRemoved (size_t index) override
 
void OnVerticesSet (const AZStd::vector< AZ::Vector3 > &vertices) override
 
void OnVerticesCleared () override
 

Static Protected Member Functions

static const AZ::Edit::ElementData * GetElementDynamicEditData (const void *handlerPtr, const void *elementPtr, const AZ::Uuid &elementType)
 

Protected Attributes

AZ::EntityId m_entityId
 
AZStd::vector< AttributeType > m_elements
 The attribute data elements.
 
AZ::Edit::ElementData m_elementEditData
 Custom editContext description to apply to each element.
 

Detailed Description

template<typename AttributeType>
class LmbrCentral::SplineAttribute< AttributeType >

Attributes are used to attach auxilary data to each vertex in a spline. @description The elements of the attribute are of homogenous type. New elements can not be added or removed manually as the number of elements always matches the number of vertices in the spline.

Member Function Documentation

◆ GetElement()

template<typename AttributeType >
AttributeType LmbrCentral::SplineAttribute< AttributeType >::GetElement ( size_t  index) const

Gets an element in the attribute.

Parameters
indexThe index of the element to get.
Returns
the value of the point at the index specified.

◆ GetElementDynamicEditData()

template<typename AttributeType >
const AZ::Edit::ElementData * LmbrCentral::SplineAttribute< AttributeType >::GetElementDynamicEditData ( const void *  handlerPtr,
const void *  elementPtr,
const AZ::Uuid &  elementType 
)
staticprotected

Dynamic edit data provider function. We use this to dynamically override the edit context for each element in the SplineAttribute. This enables components to set component-specific ranges and UI controls. handlerPtr: pointer to the object whose edit data registered the handler (i.e. the class instance pointer) elementPtr: pointer to the sub-member of handlePtr that we are querying edit data for (i.e. the member variable) elementType: uuid of the specific class type of the elementPtr The function can either return a pointer to the ElementData to use, or nullptr to use the default one.

◆ GetElementEditData()

template<typename AttributeType >
const AZ::Edit::ElementData & LmbrCentral::SplineAttribute< AttributeType >::GetElementEditData

Returns the custom edit context data that we're using for each element in the attribute

Returns
The custom edit context data that we're using for each element in the attribute.

◆ GetElementInterpolated() [1/2]

template<typename AttributeType >
AttributeType LmbrCentral::SplineAttribute< AttributeType >::GetElementInterpolated ( const AZ::SplineAddress &  address,
Interpolator  interpolator 
) const

Evaluates an interpolated value between two elements in the attribute.

Parameters
addressThe address along the spline.
interpolatorA function to interpolate between the elements.
Returns
the interpolated value.

◆ GetElementInterpolated() [2/2]

template<typename AttributeType >
AttributeType LmbrCentral::SplineAttribute< AttributeType >::GetElementInterpolated ( size_t  index,
float  fraction,
Interpolator  interpolator 
) const

Evaluates an interpolated value between two elements in the attribute.

Parameters
indexThe beginning index.
fractionThe percentage between this index and the next.
interpolatorA function to interpolate between the elements.
Returns
the interpolated value.

◆ SetElement()

template<typename AttributeType >
void LmbrCentral::SplineAttribute< AttributeType >::SetElement ( size_t  index,
AttributeType  value 
)

Sets an element in the spline attribute.

Parameters
indexThe index of the element to set.
valueThe value of the element to set.

◆ SetElementEditData()

template<typename AttributeType >
void LmbrCentral::SplineAttribute< AttributeType >::SetElementEditData ( const AZ::Edit::ElementData &  elementData)

Sets custom edit context data to use for each element in the attribute. This can be used to set sliders, ranges, etc on the SplineAttribute that are custom to a specific component.

Parameters
elementDataThe ElementData for us to copy and use for this instance of the SplineAttribute.

◆ Size()

template<typename AttributeType >
size_t LmbrCentral::SplineAttribute< AttributeType >::Size

Returns the number of elements in the attribute.

Returns
The number of elements in the attribute.

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