UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FMovieSceneNumericVariant Struct Reference

#include <MovieSceneNumericVariant.h>

Public Member Functions

 FMovieSceneNumericVariant (ENoInit)
 
MOVIESCENE_API FMovieSceneNumericVariant ()
 
MOVIESCENE_API FMovieSceneNumericVariant (double InValue)
 
MOVIESCENE_API FMovieSceneNumericVariant (UMovieSceneNumericVariantGetter *InGetter)
 
 FMovieSceneNumericVariant (FMovieSceneNumericVariant &&In)=default
 
FMovieSceneNumericVariantoperator= (FMovieSceneNumericVariant &&In)=default
 
MOVIESCENE_API void Set (double InLiteralValue)
 
MOVIESCENE_API void Set (UMovieSceneNumericVariantGetter *InDynamicValue)
 
MOVIESCENE_API void SetWeakUnsafe (UMovieSceneNumericVariantGetter *InDynamicValue)
 
MOVIESCENE_API void MakeWeakUnsafe ()
 
MOVIESCENE_API double Get () const
 
MOVIESCENE_API UMovieSceneNumericVariantGetterGetCustomPtr () const
 
bool IsLiteral () const
 
double GetLiteral () const
 
float GetLiteralAsFloat () const
 
bool IsCustomPtr () const
 
MOVIESCENE_API FMovieSceneNumericVariant ShallowCopy () const
 
MOVIESCENE_API FMovieSceneNumericVariant DeepCopy (UObject *NewOuter) const
 
bool Serialize (FArchive &Ar)
 
bool Identical (const FMovieSceneNumericVariant *Other, uint32 PortFlags) const
 
void AddStructReferencedObjects (FReferenceCollector &Collector)
 
bool SerializeFromMismatchedTag (const FPropertyTag &Tag, FStructuredArchive::FSlot Slot)
 
bool ExportTextItem (FString &ValueStr, const FMovieSceneNumericVariant &DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope) const
 
bool ImportTextItem (const TCHAR *&Buffer, int32 PortFlags, UObject *Parent, FOutputDevice *ErrorText, FArchive *InSerializingArchive=nullptr)
 
void GetPreloadDependencies (TArray< UObject * > &OutDeps)
 
bool SerializeCustom (FArchive &Ar, TFunctionRef< void(FArchive &, uint8 &, void *)>)
 
template<typename T >
void SetTypedData (const T &InValue, uint8 InType)
 
template<typename T >
UnsafePayloadCast () const
 
MOVIESCENE_API void SetTypeBits (uint8 InType)
 
MOVIESCENE_API uint8 GetTypeBits () const
 
 FMovieSceneNumericVariant (const FMovieSceneNumericVariant &Other)=default
 
FMovieSceneNumericVariantoperator= (const FMovieSceneNumericVariant &Other)=default
 

Friends

MOVIESCENE_API friend bool operator== (const FMovieSceneNumericVariant &A, const FMovieSceneNumericVariant &B)
 
MOVIESCENE_API friend bool operator!= (const FMovieSceneNumericVariant &A, const FMovieSceneNumericVariant &B)
 

Detailed Description

A variant type that masquerades as a numeric (double) value.

This type is 8 bytes (sizeof(double)) and uses a technique called NaN-boxing to encode variants into those 8-bytes, while a literal double value maintains the exact same bits in-memory as a double. By default this variant can only represent a double, or a UMovieSceneNumericVariantGetter*, but additional variant types can be encoded by deriving from this type and associating type 'IDs' to typed-data (upto 48 bit in size), where the type bits are encoded into the nan bits of the double.

Extensive reading around NaN-boxing techniques can be found elsewhere.

UMovieSceneNumericVariantGetter may be used to assign an external, dynamic value to this variant.

The benefit of using this technique is that this type can be used as a drop-in replacement for any double member variable to provide it with dynamic getter functionality without inflating the size of the class, and with barely any runtime overhead whatsoever. Automatic UPROPERTY upgrade exists for all numeric property types that make sense: int64 and uint64 are not supported in this variant due to loss of precision (doubles only have 52 bits of mantissa)

Constructor & Destructor Documentation

◆ FMovieSceneNumericVariant() [1/6]

FMovieSceneNumericVariant::FMovieSceneNumericVariant ( ENoInit  )
inline

No init constructor that leaves the underlying memory uninitialized

◆ FMovieSceneNumericVariant() [2/6]

FMovieSceneNumericVariant::FMovieSceneNumericVariant ( )

Default constructor - initializes this variant to a value of 0.0

◆ FMovieSceneNumericVariant() [3/6]

FMovieSceneNumericVariant::FMovieSceneNumericVariant ( double  InValue)
explicit

Initialize this variant to an explicit literal value

◆ FMovieSceneNumericVariant() [4/6]

FMovieSceneNumericVariant::FMovieSceneNumericVariant ( UMovieSceneNumericVariantGetter InGetter)
explicit

Initialize this variant to an object pointer that provides a value

◆ FMovieSceneNumericVariant() [5/6]

FMovieSceneNumericVariant::FMovieSceneNumericVariant ( FMovieSceneNumericVariant &&  In)
default

Move-assign and constructible

◆ FMovieSceneNumericVariant() [6/6]

FMovieSceneNumericVariant::FMovieSceneNumericVariant ( const FMovieSceneNumericVariant Other)
default

Functionally non-copyable except to the reflection layer - use Deep/Shallow copy instead

Member Function Documentation

◆ AddStructReferencedObjects()

void FMovieSceneNumericVariant::AddStructReferencedObjects ( FReferenceCollector Collector)

◆ DeepCopy()

FMovieSceneNumericVariant FMovieSceneNumericVariant::DeepCopy ( UObject NewOuter) const

Make a deep copy of this variant by duplicating the underlying UMovieSceneNumericVariantGetter into a new outer if necessary.

◆ ExportTextItem()

bool FMovieSceneNumericVariant::ExportTextItem ( FString &  ValueStr,
const FMovieSceneNumericVariant DefaultValue,
UObject Parent,
int32  PortFlags,
UObject ExportRootScope 
) const

◆ Get()

double FMovieSceneNumericVariant::Get ( ) const

Retrieve this variant's numeric value

Parameters
InDynamicValueThe new dynamic value this variant should represent.

◆ GetCustomPtr()

UMovieSceneNumericVariantGetter * FMovieSceneNumericVariant::GetCustomPtr ( ) const

Retrieves this variant as a UMovieSceneNumericVariantGetter pointer.

Note
: Only safe to call if IsCustomPtr() returns true

◆ GetLiteral()

double FMovieSceneNumericVariant::GetLiteral ( ) const
inline

Retrieves this variant as a literal double representation.

◆ GetLiteralAsFloat()

float FMovieSceneNumericVariant::GetLiteralAsFloat ( ) const
inline

Retrieves this variant as a literal double representation, clamped to the range of a float.

◆ GetPreloadDependencies()

void FMovieSceneNumericVariant::GetPreloadDependencies ( TArray< UObject * > &  OutDeps)

◆ GetTypeBits()

uint8 FMovieSceneNumericVariant::GetTypeBits ( ) const

Retrieve the type flags for this variant.

Note
: Only valid to be called where IsLiteral() == false.

◆ Identical()

bool FMovieSceneNumericVariant::Identical ( const FMovieSceneNumericVariant Other,
uint32  PortFlags 
) const

◆ ImportTextItem()

bool FMovieSceneNumericVariant::ImportTextItem ( const TCHAR *&  Buffer,
int32  PortFlags,
UObject Parent,
FOutputDevice ErrorText,
FArchive InSerializingArchive = nullptr 
)

◆ IsCustomPtr()

bool FMovieSceneNumericVariant::IsCustomPtr ( ) const
inline

Checks whether this variant is a UMovieSceneNumericVariantGetter pointer (ie, GetCustomPtr is valid to call).

◆ IsLiteral()

bool FMovieSceneNumericVariant::IsLiteral ( ) const
inline

Checks whether this variant is a literal double value or a different type

◆ MakeWeakUnsafe()

void FMovieSceneNumericVariant::MakeWeakUnsafe ( )

If this variant wraps a UMovieSceneTimeWarpGetter, turn it into an unsafe weak reference.

Warning
: This will result in a dangling pointer if it is not referenced strongly elsewhere. Use with caution.

◆ operator=() [1/2]

FMovieSceneNumericVariant & FMovieSceneNumericVariant::operator= ( const FMovieSceneNumericVariant Other)
default

◆ operator=() [2/2]

FMovieSceneNumericVariant & FMovieSceneNumericVariant::operator= ( FMovieSceneNumericVariant &&  In)
default

◆ Serialize()

bool FMovieSceneNumericVariant::Serialize ( FArchive Ar)

For StructOpsTypeTraits

◆ SerializeCustom()

bool FMovieSceneNumericVariant::SerializeCustom ( FArchive Ar,
TFunctionRef< void(FArchive &, uint8 &, void *)>  InCustomSerializer 
)

◆ SerializeFromMismatchedTag()

bool FMovieSceneNumericVariant::SerializeFromMismatchedTag ( const FPropertyTag Tag,
FStructuredArchive::FSlot  Slot 
)

◆ Set() [1/2]

void FMovieSceneNumericVariant::Set ( double  InLiteralValue)

Assign a new literal value to this variant, clearing any knowledge of a previously assigned value.

Parameters
InLiteralValueThe new fixed value this variant should represent.

◆ Set() [2/2]

void FMovieSceneNumericVariant::Set ( UMovieSceneNumericVariantGetter InDynamicValue)

Assign a new dynamic value to this variant.

Parameters
InDynamicValueThe new dynamic value this variant should represent.

◆ SetTypeBits()

void FMovieSceneNumericVariant::SetTypeBits ( uint8  InType)

Set the type flags for this variant - should only be used where custom typed data is assigned

Note
: Only valid to be called where IsLiteral() == false.
Parameters
InTypeA unique, compiletime fixed ID that identifies the contained data. Must be <= 7.

◆ SetTypedData()

template<typename T >
void FMovieSceneNumericVariant::SetTypedData ( const T &  InValue,
uint8  InType 
)

Assign new, implementation defined typed data to this variant.

Note
: If the instance of this class is to be serialized, the parent class should override Serialize to provide robust serialization mechanisms besides the built-in bitwise serialization.
Parameters
InValueThe new value to assign. Must be <= 48 bits.
InTypeA unique, compiletime fixed ID that identifies 'T'. Must be <= 7.

◆ SetWeakUnsafe()

void FMovieSceneNumericVariant::SetWeakUnsafe ( UMovieSceneNumericVariantGetter InDynamicValue)

Assign a new dynamic value to this variant as an unsafe weak ptr.

Warning
: This will result in a dangling pointer if it is not referenced strongly elsewhere. Use with caution.
Parameters
InDynamicValueThe new dynamic value this variant should represent.

◆ ShallowCopy()

FMovieSceneNumericVariant FMovieSceneNumericVariant::ShallowCopy ( ) const

Make a shallow (bitwise) copy of this variant. Does not duplicate the underlying UMovieSceneNumericVariantGetter* if it is set: this function merely copies the ptr.

◆ UnsafePayloadCast()

template<typename T >
T FMovieSceneNumericVariant::UnsafePayloadCast ( ) const

Cast this variant to a user-defined type.

Note
: No type checking is performed other than checking !IsLiteral(). External protections must be made to ensure calling this function is safe.

Friends And Related Symbol Documentation

◆ operator!=

Inequality comparison

◆ operator==

MOVIESCENE_API friend bool operator== ( const FMovieSceneNumericVariant A,
const FMovieSceneNumericVariant B 
)
friend

Equality comparison


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