| 2432 | #if VISUAL_SCRIPT_DEBUGGING |
| 2433 | |
| 2434 | bool VisualScripting::Evaluate(VisualScript* script, ScriptingObject* instance, uint32 nodeId, uint32 boxId, Variant& result) |
| 2435 | { |
| 2436 | if (!script) |
| 2437 | return false; |
| 2438 | const auto node = script->Graph.GetNode(nodeId); |
| 2439 | if (!node) |
| 2440 | return false; |
| 2441 | const auto box = node->GetBox(boxId); |
| 2442 | if (!box) |
| 2443 | return false; |
| 2444 | PROFILE_MEM(ScriptingVisual); |
| 2445 | |
| 2446 | // Add to the calling stack |
| 2447 | ScopeContext scope; |
| 2448 | auto& stack = ThreadStacks.Get(); |
| 2449 | StackFrame frame; |
| 2450 | frame.Script = script; |
| 2451 | frame.Node = node; |
| 2452 | frame.Box = box; |
| 2453 | frame.Instance = instance; |
| 2454 | frame.PreviousFrame = stack.Stack; |
| 2455 | frame.Scope = &scope; |
| 2456 | stack.Stack = &frame; |
| 2457 | stack.StackFramesCount++; |
| 2458 | |
| 2459 | // Call per group custom processing event |
| 2460 | const auto func = VisualScriptingExecutor._perGroupProcessCall[node->GroupID]; |
| 2461 | (VisualScriptingExecutor.*func)(box, node, result); |
| 2462 | |
| 2463 | // Remove from the calling stack |
| 2464 | stack.StackFramesCount--; |
| 2465 | stack.Stack = frame.PreviousFrame; |
| 2466 | |
| 2467 | return true; |
| 2468 | } |
| 2469 | |
| 2470 | #endif |