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

Method ProcessGroupFlow

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

Source from the content-addressed store, hash-verified

974}
975
976void VisualScriptExecutor::ProcessGroupFlow(Box* boxBase, Node* node, Value& value)
977{
978 switch (node->TypeID)
979 {
980 // If
981 case 1:
982 {
983 const bool condition = (bool)tryGetValue(node->GetBox(1), Value::Zero);
984 boxBase = node->GetBox(condition ? 2 : 3);
985 if (boxBase->HasConnection())
986 eatBox(node, boxBase->FirstConnection());
987 break;
988 }
989 // For Loop
990 case 2:
991 {
992 const auto scope = ThreadStacks.Get().Stack->Scope;
993 int32 iteratorIndex = 0;
994 for (; iteratorIndex < scope->ReturnedValues.Count(); iteratorIndex++)
995 {
996 const auto& e = scope->ReturnedValues[iteratorIndex];
997 if (e.NodeId == node->ID)
998 break;
999 }
1000 switch (boxBase->ID)
1001 {
1002 // Loop
1003 case 0:
1004 {
1005 if (iteratorIndex == scope->ReturnedValues.Count())
1006 scope->ReturnedValues.AddOne();
1007 auto& iteratorValue = scope->ReturnedValues[iteratorIndex];
1008 iteratorValue.NodeId = node->ID;
1009 iteratorValue.BoxId = 0;
1010 iteratorValue.Value = (int32)tryGetValue(node->GetBox(1), 0, Value::Zero);
1011 const int32 count = (int32)tryGetValue(node->GetBox(2), 1, Value::Zero);
1012 for (; iteratorValue.Value.AsInt < count; iteratorValue.Value.AsInt++)
1013 {
1014 boxBase = node->GetBox(4);
1015 if (boxBase->HasConnection())
1016 eatBox(node, boxBase->FirstConnection());
1017 }
1018 boxBase = node->GetBox(6);
1019 if (boxBase->HasConnection())
1020 eatBox(node, boxBase->FirstConnection());
1021 break;
1022 }
1023 // Break
1024 case 3:
1025 // Reset loop iterator
1026 if (iteratorIndex != scope->ReturnedValues.Count())
1027 scope->ReturnedValues[iteratorIndex].Value.AsInt = MAX_int32 - 1;
1028 break;
1029 // Index
1030 case 5:
1031 if (iteratorIndex != scope->ReturnedValues.Count())
1032 value = scope->ReturnedValues[iteratorIndex].Value;
1033 break;

Callers

nothing calls this directly

Calls 14

OnErrorFunction · 0.85
AddOneMethod · 0.80
GetIDMethod · 0.80
FormatFunction · 0.50
IteratorClass · 0.50
GetBoxMethod · 0.45
HasConnectionMethod · 0.45
FirstConnectionMethod · 0.45
GetMethod · 0.45
CountMethod · 0.45
StartMethod · 0.45
IndexMethod · 0.45

Tested by

no test coverage detected