struct

VisualScriptValue

32 bytes on a 64-bit build: the tags, one 16-byte slot shared by every scalar, the quaternion and the object handle, and one pointer to the copy-on-write block holding strings, containers and struct instances. It used to carry all of those side by side (~240 bytes, then ~150), and pin outputs, variables and call arguments are copied by value on every evaluation.

Module
VisualScripting
Header
#include "VisualScripting/VisualScriptValue.h"
Namespace
Mowo

Only the slot member type names is meaningful. Writing one member and reading another reinterprets bytes, so a value must never carry two scalar facts at once (pack them into one member, as the Timeline state packs into v4) and cross-type readers go through the typed accessors below.

Properties

TypeNameDescription
FMValueTypetypeThe one-byte tags sit together so the struct pays a single padding run for all of them. Default FMValueType::Void.
VisualScriptContainercontainerDefault VisualScriptContainer::None.
FMValueTypekeyTypeMap only Default FMValueType::Void.
VisualScriptObjRefobjRefObject CONSTANT: how it resolves Default VisualScriptObjRef::None.
boolobjWeakObject pins hold a WEAK handle — never a hard pointer and never a GC root, so a graph can outlive its referent safely. objWeak distinguishes a live object value (resolve through object.weak) from a legacy raw pointer. Default false.
boolassetRefA String CONSTANT that names an asset: the graph serializer writes it as a typed reference so the cook, delete-safety and map check see it, and reading a typed value back sets it again. Runtime values ignore it. Default false.
FVisualScriptHeapRefheap

Public functions

ReturnsNameDescription
const std::string&StrStrings, container elements, map keys and struct instances live in the shared block.
std::string&MutableStr
const std::vector<VisualScriptValue>&ItemsArray elements / Map values / Set elements
std::vector<VisualScriptValue>&MutableItems
const std::vector<VisualScriptValue>&KeysMap keys (parallel to Items)
std::vector<VisualScriptValue>&MutableKeys
const FVisualScriptStructBox&StructCustom: the struct instance and its ops
FVisualScriptStructBox&MutableStruct
Vec2AsVec2The typed view of the shared slot, zero when type is something else.
Vec3AsVec3
Vec4AsVec4
QuatAsQuatA zero quaternion is not a rotation; it is what an unwritten Quat slot holds, and it has always meant the identity.
VisualScriptValueMakeBool
VisualScriptValueMakeInt
VisualScriptValueMakeUInt
VisualScriptValueMakeFloat
VisualScriptValueMakeVec2
VisualScriptValueMakeVec3
VisualScriptValueMakeVec4
VisualScriptValueMakeQuat
VisualScriptValueMakeObject
VisualScriptValueMakeString
VisualScriptValueMakeStructA default-constructed struct of the named type, or an empty Custom value (no storage — a call taking it is refused) when the type is not registered.
const char*StructName
VisualScriptValueFromObjectA live object pin from an MObject — captures a weak handle (the only GC-safe way to hold an object in a graph value).
VisualScriptValueMakeObjectRefA serialized object reference (Self / find-by-name / find-by-tag), resolved against the live world when the graph runs.
MObject*ResolveObjectThe live MObject behind an object pin, or nullptr when empty / collected / not an object at all — the handle shares the scalar slot, so another type's bytes must never be read as a pointer.
boolHasLiveWeakObjectA weak object handle that still resolves — what a constant object pin dropped in from the world carries.
boolIsObjectRef
VisualScriptValueMakeArray
VisualScriptValueMakeMap
VisualScriptValueMakeSet
boolIsArray
boolIsMap
boolIsSet
boolIsContainer
size_tCount
boolEqualsStructural equality — the comparison behind array Contains/Find and map key lookup.
intFindKeyIndex of key in a map's key list, or -1.
boolAsBoolean
int64_tAsInteger
doubleAsFloating
void*StoragePointer to the storage matching type (for the invoke ABI).
voidPrepareForReturnAllocate the right field for a given return type so Invoke can write it.

Function details

Str

C++
const std::string& Str() const

Strings, container elements, map keys and struct instances live in the shared block. The const views never allocate (an absent block reads empty); the Mutable ones create the block, or clone it when another value still shares it.

MutableStr

C++
std::string& MutableStr()

Items

C++
const std::vector<VisualScriptValue>& Items() const

Array elements / Map values / Set elements

MutableItems

C++
std::vector<VisualScriptValue>& MutableItems()

Keys

C++
const std::vector<VisualScriptValue>& Keys() const

Map keys (parallel to Items)

MutableKeys

C++
std::vector<VisualScriptValue>& MutableKeys()

Struct

C++
const FVisualScriptStructBox& Struct() const

Custom: the struct instance and its ops

MutableStruct

C++
FVisualScriptStructBox& MutableStruct()

AsVec2

C++
Vec2 AsVec2() const

The typed view of the shared slot, zero when type is something else.

AsVec3

C++
Vec3 AsVec3() const

AsVec4

C++
Vec4 AsVec4() const

AsQuat

C++
Quat AsQuat() const

A zero quaternion is not a rotation; it is what an unwritten Quat slot holds, and it has always meant the identity.

MakeBool

C++
static VisualScriptValue MakeBool(bool x)

MakeInt

C++
static VisualScriptValue MakeInt(int32_t x)

MakeUInt

C++
static VisualScriptValue MakeUInt(uint32_t x)

MakeFloat

C++
static VisualScriptValue MakeFloat(float x)

MakeVec2

C++
static VisualScriptValue MakeVec2(const Vec2& x)

MakeVec3

C++
static VisualScriptValue MakeVec3(const Vec3& x)

MakeVec4

C++
static VisualScriptValue MakeVec4(const Vec4& x)

MakeQuat

C++
static VisualScriptValue MakeQuat(const Quat& x)

MakeObject

C++
static VisualScriptValue MakeObject(void* p)

MakeString

C++
static VisualScriptValue MakeString(const std::string& s)

MakeStruct

C++
static VisualScriptValue MakeStruct(const FMStructOps* ops)

A default-constructed struct of the named type, or an empty Custom value (no storage — a call taking it is refused) when the type is not registered.

StructName

C++
const char* StructName() const

FromObject

C++
static VisualScriptValue FromObject(MObject* p)

A live object pin from an MObject — captures a weak handle (the only GC-safe way to hold an object in a graph value).

MakeObjectRef

C++
static VisualScriptValue MakeObjectRef(VisualScriptObjRef kind, const std::string& ref)

A serialized object reference (Self / find-by-name / find-by-tag), resolved against the live world when the graph runs.

ResolveObject

C++
MObject* ResolveObject() const

The live MObject behind an object pin, or nullptr when empty / collected / not an object at all — the handle shares the scalar slot, so another type's bytes must never be read as a pointer. Weak-checked, so a swept referent reads back as null (never a dangle).

HasLiveWeakObject

C++
bool HasLiveWeakObject() const

A weak object handle that still resolves — what a constant object pin dropped in from the world carries.

IsObjectRef

C++
bool IsObjectRef() const

MakeArray

C++
static VisualScriptValue MakeArray(FMValueType elemType)

MakeMap

C++
static VisualScriptValue MakeMap(FMValueType keyT, FMValueType valueT)

MakeSet

C++
static VisualScriptValue MakeSet(FMValueType elemType)

IsArray

C++
bool IsArray() const

IsMap

C++
bool IsMap() const

IsSet

C++
bool IsSet() const

IsContainer

C++
bool IsContainer() const

Count

C++
size_t Count() const

Equals

C++
static bool Equals(const VisualScriptValue& a, const VisualScriptValue& b)

Structural equality — the comparison behind array Contains/Find and map key lookup. Numeric types compare by value across int/float.

FindKey

C++
int FindKey(const VisualScriptValue& key) const

Index of key in a map's key list, or -1.

AsBoolean

C++
bool AsBoolean() const

AsInteger

C++
int64_t AsInteger() const

AsFloating

C++
double AsFloating() const

Storage

C++
void* Storage()

Pointer to the storage matching type (for the invoke ABI). Returns nullptr for Void / unsupported types and for containers (a container never marshals into a reflected call). A String or Custom value is made unshared first: the thunk may write through the pointer.

PrepareForReturn

C++
void PrepareForReturn(FMValueType retType)

Allocate the right field for a given return type so Invoke can write it.

Generated from VisualScripting/VisualScriptValue.h via visualscripting.json · Nov 5, 2026Version 1.0.0