| 548 | } |
| 549 | |
| 550 | Array<ManagedEditor::VisualScriptLocal> ManagedEditor::GetVisualScriptLocals() |
| 551 | { |
| 552 | Array<VisualScriptLocal> result; |
| 553 | const auto stack = VisualScripting::GetThreadStackTop(); |
| 554 | if (stack && stack->Scope) |
| 555 | { |
| 556 | const int32 count = stack->Scope->Parameters.Length() + stack->Scope->ReturnedValues.Count(); |
| 557 | result.Resize(count); |
| 558 | VisualScriptLocal local; |
| 559 | local.NodeId = MAX_uint32; |
| 560 | if (stack->Scope->Parameters.Length() != 0) |
| 561 | { |
| 562 | auto s = stack; |
| 563 | while (s->PreviousFrame && s->PreviousFrame->Scope == stack->Scope) |
| 564 | s = s->PreviousFrame; |
| 565 | if (s) |
| 566 | local.NodeId = s->Node->ID; |
| 567 | } |
| 568 | for (int32 i = 0; i < stack->Scope->Parameters.Length(); i++) |
| 569 | { |
| 570 | auto& v = stack->Scope->Parameters[i]; |
| 571 | local.BoxId = i + 1; |
| 572 | local.Value = v.ToString(); |
| 573 | local.ValueTypeName = v.Type.GetTypeName(); |
| 574 | result[i] = local; |
| 575 | } |
| 576 | for (int32 i = 0; i < stack->Scope->ReturnedValues.Count(); i++) |
| 577 | { |
| 578 | auto& v = stack->Scope->ReturnedValues[i]; |
| 579 | local.NodeId = v.NodeId; |
| 580 | local.BoxId = v.BoxId; |
| 581 | local.Value = v.Value.ToString(); |
| 582 | local.ValueTypeName = v.Value.Type.GetTypeName(); |
| 583 | result[stack->Scope->Parameters.Length() + i] = local; |
| 584 | } |
| 585 | } |
| 586 | return result; |
| 587 | } |
| 588 | |
| 589 | bool ManagedEditor::EvaluateVisualScriptLocal(VisualScript* script, VisualScriptLocal& local) |
| 590 | { |