297 UEdGraphPin* OutputPin =
nullptr;
299 for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex)
301 UEdGraphPin* Pin = Node->Pins[PinIndex];
302 if (Pin && (EGPD_Output == Pin->Direction))
309 UClass* Class = Cast<UClass>(StaticLoadObject(UClass::StaticClass(),
nullptr, TEXT(
"class'VaRest.VaRestJsonObject'")));
311 FBPTerminal** TargetTerm = Context.NetMap.Find(OutputPin);
312 if (TargetTerm ==
nullptr)
318 UClass* SubsystemClass = Cast<UClass>(StaticLoadObject(UClass::StaticClass(),
nullptr, TEXT(
"class'VaRest.VaRestSubsystem'")));
320 const FName FunctionName = TEXT(
"StaticConstructVaRestJsonObject");
321 UFunction* FunctionPtr = SubsystemClass->FindFunctionByName(FunctionName);
322 FBlueprintCompiledStatement& Statement = Context.AppendStatementForNode(Node);
323 Statement.Type = KCST_CallFunction;
324 Statement.FunctionToCall = FunctionPtr;
325 Statement.FunctionContext =
nullptr;
326 Statement.bIsParentContext =
false;
327 Statement.LHS = *TargetTerm;
328 FBPTerminal* NullTerm = Context.CreateLocalTerminal(ETerminalSpecification::TS_Literal);
329 NullTerm->Type.PinCategory = CompilerContext.GetSchema()->PC_Object;
330 NullTerm->ObjectLiteral =
nullptr;
331 NullTerm->SourcePin = OutputPin;
332 Statement.RHS.Add(NullTerm);
335 for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex)
337 UEdGraphPin* Pin = Node->Pins[PinIndex];
338 if (Pin && (EGPD_Input == Pin->Direction))
340 FBPTerminal** Source = Context.NetMap.Find(FEdGraphUtilities::GetNetFromPin(Pin));
342 const FName& FieldName = Pin->PinName;
343 const FName& FieldType = Pin->PinType.PinCategory;
345 FBPTerminal* FieldNameTerm = Context.CreateLocalTerminal(ETerminalSpecification::TS_Literal);
346 FieldNameTerm->Type.PinCategory = CompilerContext.GetSchema()->PC_String;
347 FieldNameTerm->SourcePin = Pin;
349 FieldNameTerm->Name = FieldName.ToString();
350 FieldNameTerm->TextLiteral = FText::FromName(FieldName);
352 FBlueprintCompiledStatement& Statement = Context.AppendStatementForNode(Node);
355 const bool bIsArray = Pin->PinType.ContainerType == EPinContainerType::Array;
356 if (FieldType == CompilerContext.GetSchema()->PC_Boolean)
358 FunctionName = bIsArray ? TEXT(
"SetBoolArrayField") : TEXT(
"SetBoolField");
360 else if (FieldType == CompilerContext.GetSchema()->PC_Float)
362 FunctionName = bIsArray ? TEXT(
"SetNumberArrayField") : TEXT(
"SetNumberField");
364 else if (FieldType == CompilerContext.GetSchema()->PC_String)
366 FunctionName = bIsArray ? TEXT(
"SetStringArrayField") : TEXT(
"SetStringField");
368 else if (FieldType == CompilerContext.GetSchema()->PC_Object)
370 FunctionName = bIsArray ? TEXT(
"SetObjectArrayField") : TEXT(
"SetObjectField");
377 UFunction* FunctionPtr = Class->FindFunctionByName(FunctionName);
378 Statement.Type = KCST_CallFunction;
379 Statement.FunctionToCall = FunctionPtr;
380 Statement.FunctionContext = *TargetTerm;
381 Statement.bIsParentContext =
false;
382 Statement.LHS =
nullptr;
383 Statement.RHS.Add(FieldNameTerm);
384 Statement.RHS.Add(*Source);