Navigation
API > API/Runtime > API/Runtime/MovieScene > API/Runtime/MovieScene/Variants
References
| Module | MovieScene |
| Header | /Engine/Source/Runtime/MovieScene/Public/Variants/MovieSceneNumericVariant.h |
| Include | #include "Variants/MovieSceneNumericVariant.h" |
Syntax
USTRUCT (BlueprintType )
struct FMovieSceneNumericVariant
Remarks
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)
Constructors
| Type | Name | Description | |
|---|---|---|---|
| Default constructor - initializes this variant to a value of 0.0 | |||
FMovieSceneNumericVariant
(
ENoInit |
No init constructor that leaves the underlying memory uninitialized | ||
FMovieSceneNumericVariant
(
double InValue |
Initialize this variant to an explicit literal value | ||
FMovieSceneNumericVariant
(
UMovieSceneNumericVariantGetter* InGetter |
Initialize this variant to an object pointer that provides a value | ||
| Move-assign and constructible |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddStructReferencedObjects
(
FReferenceCollector& Collector |
||
| FMovieSceneNumericVariant | DeepCopy
(
UObject* NewOuter |
Make a deep copy of this variant by duplicating the underlying UMovieSceneNumericVariantGetter into a new outer if necessary. | |
| bool | ExportTextItem
(
FString& ValueStr, |
||
| double | Get () |
Retrieve this variant's numeric value | |
| UMovieSceneNumericVariantGetter * | GetCustomPtr () |
Retrieves this variant as a UMovieSceneNumericVariantGetter pointer. | |
| double | GetLiteral () |
Retrieves this variant as a literal double representation. | |
| float | Retrieves this variant as a literal double representation, clamped to the range of a float. | ||
| void | GetPreloadDependencies
(
TArray< UObject* >& OutDeps |
||
| uint8 | GetTypeBits () |
Retrieve the type flags for this variant. | |
| bool | Identical
(
const FMovieSceneNumericVariant* Other, |
||
| bool | ImportTextItem
(
const TCHAR*& Buffer, |
||
| bool | IsCustomPtr () |
Checks whether this variant is a UMovieSceneNumericVariantGetter pointer (ie, GetCustomPtr is valid to call). | |
| bool | IsLiteral () |
Checks whether this variant is a literal double value or a different type | |
| bool | Serialize
(
FArchive& Ar |
For StructOpsTypeTraits | |
| bool | SerializeCustom
(
FArchive& Ar, |
||
| bool | SerializeFromMismatchedTag
(
const FPropertyTag& Tag, |
||
| void | Set
(
double InLiteralValue |
Assign a new literal value to this variant, clearing any knowledge of a previously assigned value. | |
| void | Set
(
UMovieSceneNumericVariantGetter* InDynamicValue |
Assign a new dynamic value to this variant. | |
| void | SetTypeBits
(
uint8 InType |
Set the type flags for this variant - should only be used where custom typed data is assigned | |
| void | SetTypedData
(
const T& InValue, |
Assign new, implementation defined typed data to this variant. | |
| FMovieSceneNumericVariant | ShallowCopy () |
Make a shallow (bitwise) copy of this variant. | |
| T | Cast this variant to a user-defined type. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| FMovieSceneNumericVariant & | operator=
(
FMovieSceneNumericVariant&& In |
Constants
| Name | Description |
|---|---|
| EXP_Bits | |
| HIGH_Bits | Flags specifying different regions on an IEEE 754 double. |
| PAYLOAD_Bits | |
| QUIET_Bit | |
| SIGN_Bit | |
| TAGGED_Bits | |
| TYPE_Bits | |
| TYPE_CustomPtr |