VisualScriptVM
- Module
- VisualScripting
- Header
#include "VisualScripting/VisualScriptVM.h"- Namespace
Mowo
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Execute | Run graph in ctx. |
bool | Execute | Convenience: no variable store, no latent. |
bool | CallGraphFunctionByName | |
bool | Resume | Resume a suspended Delay continuation NOW (runs its saved stack). |
bool | Advance | Advance a continuation by dt seconds (call each frame). |
void | SetDebugHook | Install/clear the process-wide debug hook. |
void | ClearDebugHook | |
void | SetRandomSeed | Seed the RandomInt/RandomFloat/MultiGate-random stream for the CALLING thread (state is thread-local, so runs on other threads keep their own sequence). |
uint32_t | RandomBits | The raw xorshift draw behind RandomInt / RandomFloat / MultiGate-random. |
size_t | PooledFrameCapacity | Node-output slots held by the calling thread's reusable run frames. |
uint64_t | ResolveCacheMisses | Name resolutions (reflected function or property by name) the calling thread did NOT find in its cache. |
uint64_t | DataPinCopies | Data-pin reads on the calling thread that copied a value out of where it lives (a variable, a parameter, a stored output). |
Function details
Execute
static bool Execute(const VisualScriptGraph& graph, const VisualScriptContext& ctx, VisualScriptContinuation* outCont = nullptr)Run graph in ctx. Returns true if it ran without error. If a Delay suspends the run AND outCont is non-null, *outCont is filled with the continuation (active=true) for the caller to schedule; pass ctx.allowLatent = true to enable that. Without a sink, Delays run instantly.
Execute
static bool Execute(const VisualScriptGraph& graph, MObject* target, MClass* cls)Convenience: no variable store, no latent.
CallGraphFunctionByName
static bool CallGraphFunctionByName(const VisualScriptClass& cls, const std::string& functionName, const VisualScriptContext& ctx, const std::vector<VisualScriptValue>& args, VisualScriptValue& outReturn)Resume
static bool Resume(VisualScriptContinuation& cont, const VisualScriptContext& ctx)Resume a suspended Delay continuation NOW (runs its saved stack). If it suspends again, cont stays active; otherwise cont.active becomes false.
Advance
static bool Advance(VisualScriptContinuation& cont, float dt, const VisualScriptContext& ctx)Advance a continuation by dt seconds (call each frame). Delays resume when their timer elapses; Timelines pulse their update exec every frame (alpha 0..1 on the timeline node's data-out) and finish at the end. Returns true if still active (keep it queued), false when done.
SetDebugHook
static void SetDebugHook(const VisualScriptDebugHook& hook)Install/clear the process-wide debug hook. Not thread-safe with concurrent VM runs — install while the game thread is idle.
ClearDebugHook
static void ClearDebugHook()SetRandomSeed
static void SetRandomSeed(uint32_t seed)Seed the RandomInt/RandomFloat/MultiGate-random stream for the CALLING thread (state is thread-local, so runs on other threads keep their own sequence). Deterministic replays and tests seed before executing; a seed of 0 restores the default stream.
RandomBits
static uint32_t RandomBits()The raw xorshift draw behind RandomInt / RandomFloat / MultiGate-random. Exposed so TRANSPILED classes draw from the same seeded per-thread stream the VM does — a native body with its own generator would diverge from the interpreted one the moment a test seeded it.
PooledFrameCapacity
static size_t PooledFrameCapacity()Node-output slots held by the calling thread's reusable run frames. A run borrows the frame for its nesting depth and hands it back emptied, so this stops growing once the deepest graph has run once.
ResolveCacheMisses
static uint64_t ResolveCacheMisses()Name resolutions (reflected function or property by name) the calling thread did NOT find in its cache. A graph calling the same function a thousand times resolves it once, until a class registers, unregisters or a Visual Script class is rebuilt.
DataPinCopies
static uint64_t DataPinCopies()Data-pin reads on the calling thread that copied a value out of where it lives (a variable, a parameter, a stored output). Node evaluation reads those in place; what is left here is the by-value API at the edges (call arguments, setters, the debugger).