MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Invoke

Method Invoke

Source/Engine/Content/Assets/VisualScript.cpp:105–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void VisualScriptExecutor::Invoke(const Guid& scriptId, int32 nodeId, int32 boxId, const Guid& instanceId, Variant& result) const
106{
107 auto script = Content::Load<VisualScript>(scriptId);
108 if (!script)
109 return;
110 const auto node = script->Graph.GetNode(nodeId);
111 if (!node)
112 return;
113 const auto box = node->GetBox(boxId);
114 if (!box)
115 return;
116 auto instance = Scripting::FindObject<ScriptingObject>(instanceId);
117
118 // Add to the calling stack
119 VisualScripting::ScopeContext scope;
120 auto& stack = ThreadStacks.Get();
121 VisualScripting::StackFrame frame;
122 frame.Script = script;
123 frame.Node = node;
124 frame.Box = box;
125 frame.Instance = instance;
126 frame.PreviousFrame = stack.Stack;
127 frame.Scope = &scope;
128 stack.Stack = &frame;
129 stack.StackFramesCount++;
130
131 // Call per group custom processing event
132 const auto func = VisualScriptingExecutor._perGroupProcessCall[node->GroupID];
133 (VisualScriptingExecutor.*func)(box, node, result);
134
135 // Remove from the calling stack
136 stack.StackFramesCount--;
137 stack.Stack = frame.PreviousFrame;
138}
139
140void VisualScriptExecutor::OnError(Node* node, Box* box, const StringView& message)
141{

Callers 1

RunMethod · 0.45

Calls 4

GetNodeMethod · 0.45
GetBoxMethod · 0.45
GetMethod · 0.45
IsLoadedMethod · 0.45

Tested by

no test coverage detected