39 FNodeHandlingFunctor::RegisterNets(Context, Node);
45 FBPTerminal* Term = Context.CreateLocalTerminalFromPinAutoChooseScope(ReturnPin, Context.NetNameMap->MakeValidName(ReturnPin));
46 Context.NetMap.Add(ReturnPin, Term);
50 FBPTerminal* BoolTerm = Context.CreateLocalTerminal();
51 BoolTerm->Type.PinCategory = UEdGraphSchema_K2::PC_Boolean;
52 BoolTerm->Source = Node;
53 BoolTerm->Name = Context.NetNameMap->MakeValidName(Node) + TEXT(
"_CmpSuccess");
87 const TArray<UEdGraphPin*> OptionPins = SelectNode->
GetOptionPins();
90 const UEdGraphPin* VariableNameConditionPin = FEdGraphUtilities::GetNetFromPin(SelectNode->
GetVariableNamePin());
91 FBPTerminal** ConditionTerm = Context.NetMap.Find(VariableNameConditionPin);
95 FBPTerminal** ReturnTerm = Context.NetMap.Find(ReturnPin);
98 const UEdGraphPin* DefaultPin = FEdGraphUtilities::GetNetFromPin(SelectNode->
GetDefaultValuePin());
99 FBPTerminal** DefaultTerm = Context.NetMap.Find(DefaultPin);
102 if (ConditionTerm ==
nullptr || ReturnTerm ==
nullptr || DefaultTerm ==
nullptr)
112 FBPTerminal* BoolTerm =
BoolTermMap.FindRef(SelectNode);
115 FBlueprintCompiledStatement* PrevIfNotStatement =
nullptr;
118 TArray<FBlueprintCompiledStatement*> GotoStatementList;
121 const int32 OptionsNum = OptionPins.Num();
122 for (int32 OptionIndex = 0; OptionIndex < OptionsNum; OptionIndex++)
124 UEdGraphPin* OptionPin = OptionPins[OptionIndex];
130 FBlueprintCompiledStatement& CallConditionFunctionStatement = Context.AppendStatementForNode(Node);
131 CallConditionFunctionStatement.Type = KCST_CallFunction;
132 CallConditionFunctionStatement.FunctionToCall = ConditionFunction;
133 CallConditionFunctionStatement.FunctionContext =
nullptr;
134 CallConditionFunctionStatement.bIsParentContext =
false;
137 CallConditionFunctionStatement.LHS = BoolTerm;
141 CallConditionFunctionStatement.RHS.Add(*ConditionTerm);
144 FBPTerminal* LiteralTerm = Context.CreateLocalTerminal(ETerminalSpecification::TS_Literal);
145 LiteralTerm->bIsLiteral =
true;
148 LiteralTerm->Type.PinCategory = UEdGraphSchema_K2::PC_Name;
149 LiteralTerm->Name = OptionPin->PinName.ToString();
152 CallConditionFunctionStatement.RHS.Add(LiteralTerm);
155 if (PrevIfNotStatement)
157 CallConditionFunctionStatement.bIsJumpTarget =
true;
158 PrevIfNotStatement->TargetLabel = &CallConditionFunctionStatement;
163 FBlueprintCompiledStatement* IfNotStatement = &Context.AppendStatementForNode(Node);
164 IfNotStatement->Type = KCST_GotoIfNot;
165 IfNotStatement->LHS = BoolTerm;
170 FBlueprintCompiledStatement& AssignStatement = Context.AppendStatementForNode(Node);
171 AssignStatement.Type = KCST_Assignment;
172 AssignStatement.LHS = *ReturnTerm;
175 UEdGraphPin* OptionPinToTry = FEdGraphUtilities::GetNetFromPin(OptionPin);
176 FBPTerminal** OptionTerm = Context.NetMap.Find(OptionPinToTry);
179 Context.MessageLog.Error(*LOCTEXT(
"Error_UnregisterOptionPin",
"Unregister option pin @@").ToString(), OptionPin);
182 AssignStatement.RHS.Add(*OptionTerm);
186 FBlueprintCompiledStatement& GotoStatement = Context.AppendStatementForNode(Node);
187 GotoStatement.Type = KCST_UnconditionalGoto;
188 GotoStatementList.Add(&GotoStatement);
192 if (OptionIndex == OptionsNum - 1)
194 FBlueprintCompiledStatement& AssignStatement = Context.AppendStatementForNode(Node);
195 AssignStatement.Type = KCST_Assignment;
196 AssignStatement.bIsJumpTarget =
true;
197 AssignStatement.LHS = *ReturnTerm;
198 AssignStatement.RHS.Add(*DefaultTerm);
201 IfNotStatement->TargetLabel = &AssignStatement;
204 PrevIfNotStatement = IfNotStatement;
208 FBlueprintCompiledStatement& NopStatement = Context.AppendStatementForNode(Node);
209 NopStatement.Type = KCST_Nop;
210 NopStatement.bIsJumpTarget =
true;
213 for (FBlueprintCompiledStatement* GotoStatement : GotoStatementList)
215 GotoStatement->TargetLabel = &NopStatement;