本文整理汇总了C++中UK2Node_CallFunction::FindPin方法的典型用法代码示例。如果您正苦于以下问题:C++ UK2Node_CallFunction::FindPin方法的具体用法?C++ UK2Node_CallFunction::FindPin怎么用?C++ UK2Node_CallFunction::FindPin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UK2Node_CallFunction
的用法示例。
在下文中一共展示了UK2Node_CallFunction::FindPin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetExecPin
void UK2Node_GenericCreateObject::ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
UK2Node_CallFunction* CallCreateNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallCreateNode->FunctionReference.SetExternalMember(GET_FUNCTION_NAME_CHECKED(UGameplayStatics, SpawnObject), UGameplayStatics::StaticClass());
CallCreateNode->AllocateDefaultPins();
bool bSucceeded = true;
//connect exe
{
auto SpawnExecPin = GetExecPin();
auto CallExecPin = CallCreateNode->GetExecPin();
bSucceeded &= SpawnExecPin && CallExecPin && CompilerContext.MovePinLinksToIntermediate(*SpawnExecPin, *CallExecPin).CanSafeConnect();
}
//connect class
{
auto SpawnClassPin = GetClassPin();
auto CallClassPin = CallCreateNode->FindPin(TEXT("ObjectClass"));
bSucceeded &= SpawnClassPin && CallClassPin && CompilerContext.MovePinLinksToIntermediate(*SpawnClassPin, *CallClassPin).CanSafeConnect();
}
//connect outer
{
auto SpawnOuterPin = GetOuterPin();
auto CallOuterPin = CallCreateNode->FindPin(TEXT("Outer"));
bSucceeded &= SpawnOuterPin && CallOuterPin && CompilerContext.MovePinLinksToIntermediate(*SpawnOuterPin, *CallOuterPin).CanSafeConnect();
}
UEdGraphPin* CallResultPin = nullptr;
//connect result
{
auto SpawnResultPin = GetResultPin();
CallResultPin = CallCreateNode->GetReturnValuePin();
// cast HACK. It should be safe. The only problem is native code generation.
if (SpawnResultPin && CallResultPin)
{
CallResultPin->PinType = SpawnResultPin->PinType;
}
bSucceeded &= SpawnResultPin && CallResultPin && CompilerContext.MovePinLinksToIntermediate(*SpawnResultPin, *CallResultPin).CanSafeConnect();
}
//assign exposed values and connect then
{
auto LastThen = FKismetCompilerUtilities::GenerateAssignmentNodes(CompilerContext, SourceGraph, CallCreateNode, this, CallResultPin, GetClassToSpawn());
auto SpawnNodeThen = GetThenPin();
bSucceeded &= SpawnNodeThen && LastThen && CompilerContext.MovePinLinksToIntermediate(*SpawnNodeThen, *LastThen).CanSafeConnect();
}
BreakAllNodeLinks();
if (!bSucceeded)
{
CompilerContext.MessageLog.Error(*LOCTEXT("GenericCreateObject_Error", "ICE: GenericCreateObject error @@").ToString(), this);
}
}
示例2: GetTargetFunction
//.........这里部分代码省略.........
UK2Node_CallFunction* FunctionCallNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
FunctionCallNode->bIsInterfaceCall = true;
FunctionCallNode->FunctionReference = FunctionReference;
FunctionCallNode->AllocateDefaultPins();
UEdGraphPin* CastToInterfaceValidPin = CastToInterfaceNode->GetValidCastPin();
check(CastToInterfaceValidPin != nullptr);
UEdGraphPin* LastOutCastFaildPin = CastToInterfaceNode->GetInvalidCastPin();
check(LastOutCastFaildPin != nullptr);
UEdGraphPin* LastOutCastSuccessPin = CastToInterfaceValidPin;
// Wire up the connections
if (UEdGraphPin* CallFunctionExecPin = Schema->FindExecutionPin(*FunctionCallNode, EGPD_Input))
{
CastToInterfaceValidPin->MakeLinkTo(CallFunctionExecPin);
LastOutCastSuccessPin = Schema->FindExecutionPin(*FunctionCallNode, EGPD_Output);
}
// Self pin
UEdGraphPin* FunctionCallSelfPin = Schema->FindSelfPin(*FunctionCallNode, EGPD_Input);
CastToInterfaceResultPin->MakeLinkTo(FunctionCallSelfPin);
UFunction* ArrayClearFunction = UKismetArrayLibrary::StaticClass()->FindFunctionByName(FName(TEXT("Array_Clear")));
check(ArrayClearFunction);
bool const bIsPureFunc = Super::IsNodePure();
// Variable pins - Try to associate variable inputs to the message node with the variable inputs and outputs to the call function node
for( int32 i = 0; i < Pins.Num(); i++ )
{
UEdGraphPin* CurrentPin = Pins[i];
if( CurrentPin && (CurrentPin->PinType.PinCategory != Schema->PC_Exec) && (CurrentPin->PinName != Schema->PN_Self) )
{
// Try to find a match for the pin on the function call node
UEdGraphPin* FunctionCallPin = FunctionCallNode->FindPin(CurrentPin->PinName);
if( FunctionCallPin )
{
// Move pin links if the pin is connected...
CompilerContext.MovePinLinksToIntermediate(*CurrentPin, *FunctionCallPin);
// when cast fails all return values must be cleared.
if (EEdGraphPinDirection::EGPD_Output == CurrentPin->Direction)
{
UEdGraphPin* VarOutPin = FunctionCallPin;
if (bIsPureFunc)
{
// since we cannot directly use the output from the
// function call node (since it is pure, and invoking
// it with a null target would cause an error), we
// have to use a temporary variable in it's place...
UK2Node_TemporaryVariable* TempVar = CompilerContext.SpawnIntermediateNode<UK2Node_TemporaryVariable>(this, SourceGraph);
TempVar->VariableType = CurrentPin->PinType;
TempVar->AllocateDefaultPins();
VarOutPin = TempVar->GetVariablePin();
// nodes using the function's outputs directly, now
// use this TempVar node instead
CompilerContext.MovePinLinksToIntermediate(*FunctionCallPin, *VarOutPin);
// on a successful cast, the temp var is filled with
// the function's value, on a failed cast, the var
// is filled with a default value (DefaultValueNode,
// below)... this is the node for the success case:
UK2Node_AssignmentStatement* AssignTempVar = CompilerContext.SpawnIntermediateNode<UK2Node_AssignmentStatement>(this, SourceGraph);
AssignTempVar->AllocateDefaultPins();
// assign the output from the pure function node to
示例3: GenerateFunctionRPN
FBlueprintCompiledStatement* FKCHandler_MathExpression::GenerateFunctionRPN(UEdGraphNode* CurrentNode, FKismetFunctionContext& Context, UK2Node_MathExpression& MENode, FBPTerminal* ResultTerm, TMap<UEdGraphPin*, UEdGraphPin*>& InnerToOuterInput)
{
UK2Node_CallFunction* CallFunctionNode = Cast<UK2Node_CallFunction>(CurrentNode);
UFunction* Function = CallFunctionNode ? CallFunctionNode->GetTargetFunction() : nullptr;
if (!CanBeCalledByMathExpression(Function))
{
CompilerContext.MessageLog.Error(*FString::Printf(*LOCTEXT("WrongFunction_Error", "Function '%s' cannot be called inside Math Expression @@ - @@").ToString(), *GetNameSafe(Function)), CallFunctionNode, &MENode);
return nullptr;
}
FBlueprintCompiledStatement* NewDetachedStatement = new FBlueprintCompiledStatement();
FBlueprintCompiledStatement& Statement = *NewDetachedStatement;
Statement.FunctionToCall = Function;
Statement.FunctionContext = nullptr;
Statement.Type = KCST_CallFunction;
Statement.LHS = ResultTerm; // required only for the first node
check(CallFunctionNode);
TArray<FBPTerminal*> RHSTerms;
for (TFieldIterator<UProperty> It(Function); It && (It->PropertyFlags & CPF_Parm); ++It)
{
UProperty* Property = *It;
if (Property && !Property->HasAnyPropertyFlags(CPF_ReturnParm | CPF_OutParm))
{
UEdGraphPin* PinToTry = nullptr;
{
UEdGraphPin* PinMatch = CallFunctionNode->FindPin(Property->GetName());
const bool bGoodPin = PinMatch && FKismetCompilerUtilities::IsTypeCompatibleWithProperty(PinMatch, Property, CompilerContext.MessageLog, CompilerContext.GetSchema(), Context.NewClass);
PinToTry = bGoodPin ? FEdGraphUtilities::GetNetFromPin(PinMatch) : nullptr;
}
FBPTerminal* RHSTerm = nullptr;
{
UEdGraphPin** OuterInputPtr = PinToTry ? InnerToOuterInput.Find(PinToTry) : nullptr;
UEdGraphPin* OuterInputNet = (OuterInputPtr && *OuterInputPtr) ? FEdGraphUtilities::GetNetFromPin(*OuterInputPtr) : nullptr;
FBPTerminal** OuterTerm = OuterInputNet ? Context.NetMap.Find(OuterInputNet) : nullptr;
// Input is an outer term
if (OuterTerm && *OuterTerm)
{
RHSTerm = *OuterTerm;
}
}
if (!RHSTerm)
{
FBPTerminal** Term = PinToTry ? Context.NetMap.Find(PinToTry) : nullptr;
const bool bValidTerm = Term && *Term;
// Input is a literal term
// Input is a variable
if (bValidTerm && ((*Term)->bIsLiteral || (*Term)->AssociatedVarProperty))
{
RHSTerm = *Term;
}
// Input is an InlineGeneratedParameter
else if (bValidTerm)
{
ensure(!(*Term)->InlineGeneratedParameter);
UEdGraphNode* SourceNode = PinToTry ? PinToTry->GetOwningNodeUnchecked() : nullptr;
FBlueprintCompiledStatement* InlineGeneratedParameterStatement = GenerateFunctionRPN(SourceNode, Context, MENode, nullptr, InnerToOuterInput);
if (InlineGeneratedParameterStatement)
{
Context.AllGeneratedStatements.Add(InlineGeneratedParameterStatement);
RHSTerm = *Term;
RHSTerm->InlineGeneratedParameter = InlineGeneratedParameterStatement;
}
}
}
if (RHSTerm)
{
RHSTerms.Add(RHSTerm);
}
else
{
CompilerContext.MessageLog.Error(*FString::Printf(*LOCTEXT("FindPinParameter_Error", "Could not find a pin for the parameter %s of %s on @@").ToString(), *GetNameSafe(Property), *GetNameSafe(Function)), CallFunctionNode);
}
}
}
Statement.RHS = RHSTerms;
return &Statement;
}
示例4: FindPinChecked
void UK2Node_EaseFunction::ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
Super::ExpandNode(CompilerContext, SourceGraph);
/**
At the end of this, the UK2Node_EaseFunction will not be a part of the Blueprint, it merely handles connecting
the other nodes into the Blueprint.
*/
UFunction* Function = UKismetMathLibrary::StaticClass()->FindFunctionByName(*EaseFunctionName);
if (Function == NULL)
{
CompilerContext.MessageLog.Error(*LOCTEXT("InvalidFunctionName", "BaseAsyncTask: Type not supported or not initialized. @@").ToString(), this);
return;
}
const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
// The call function does all the real work, each child class implementing easing for a given type provides
// the name of the desired function
UK2Node_CallFunction* CallFunction = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallFunction->SetFromFunction(Function);
CallFunction->AllocateDefaultPins();
CompilerContext.MessageLog.NotifyIntermediateObjectCreation(CallFunction, this);
// Move the ease function and the alpha connections from us to the call function
CompilerContext.MovePinLinksToIntermediate(*FindPin(FEaseFunctionNodeHelper::GetEaseFuncPinName()), *CallFunction->FindPin(TEXT("EasingFunc")));
CompilerContext.MovePinLinksToIntermediate(*FindPin(FEaseFunctionNodeHelper::GetAlphaPinName()), *CallFunction->FindPin(TEXT("Alpha")));
// Move base connections to the call function's connections
CompilerContext.MovePinLinksToIntermediate(*FindPin(FEaseFunctionNodeHelper::GetAPinName()), *CallFunction->FindPin(TEXT("A")));
CompilerContext.MovePinLinksToIntermediate(*FindPin(FEaseFunctionNodeHelper::GetBPinName()), *CallFunction->FindPin(TEXT("B")));
CompilerContext.MovePinLinksToIntermediate(*FindPin(FEaseFunctionNodeHelper::GetResultPinName()), *CallFunction->GetReturnValuePin());
// Now move the custom pins to their new locations
UEdGraphPin* ShortestPathPin = FindPinChecked(FEaseFunctionNodeHelper::GetShortestPathPinName());
if (!ShortestPathPin->bHidden)
{
CompilerContext.MovePinLinksToIntermediate(*ShortestPathPin, *CallFunction->FindPinChecked(TEXT("bShortestPath")));
}
UEdGraphPin* BlendExpPin = FindPinChecked(FEaseFunctionNodeHelper::GetBlendExpPinName());
if (!BlendExpPin->bHidden)
{
CompilerContext.MovePinLinksToIntermediate(*BlendExpPin, *CallFunction->FindPinChecked(FEaseFunctionNodeHelper::GetBlendExpPinName()));
}
UEdGraphPin* StepsPin = FindPinChecked(FEaseFunctionNodeHelper::GetStepsPinName());
if (!StepsPin->bHidden)
{
CompilerContext.MovePinLinksToIntermediate(*StepsPin, *CallFunction->FindPinChecked(FEaseFunctionNodeHelper::GetStepsPinName()));
}
// Cleanup links to ourself and we are done!
BreakAllNodeLinks();
}
示例5: FindArgumentPin
void UK2Node_FormatText::ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
Super::ExpandNode(CompilerContext, SourceGraph);
/**
At the end of this, the UK2Node_FormatText will not be a part of the Blueprint, it merely handles connecting
the other nodes into the Blueprint.
*/
const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
// Create a "Make Array" node to compile the list of arguments into an array for the Format function being called
UK2Node_MakeArray* MakeArrayNode = CompilerContext.SpawnIntermediateNode<UK2Node_MakeArray>(this, SourceGraph); //SourceGraph->CreateBlankNode<UK2Node_MakeArray>();
MakeArrayNode->AllocateDefaultPins();
CompilerContext.MessageLog.NotifyIntermediateObjectCreation(MakeArrayNode, this);
UEdGraphPin* ArrayOut = MakeArrayNode->GetOutputPin();
// This is the node that does all the Format work.
UK2Node_CallFunction* CallFunction = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallFunction->SetFromFunction(UKismetTextLibrary::StaticClass()->FindFunctionByName(GET_MEMBER_NAME_CHECKED(UKismetTextLibrary, Format)));
CallFunction->AllocateDefaultPins();
CompilerContext.MessageLog.NotifyIntermediateObjectCreation(CallFunction, this);
// Connect the output of the "Make Array" pin to the function's "InArgs" pin
ArrayOut->MakeLinkTo(CallFunction->FindPin(TEXT("InArgs")));
// This will set the "Make Array" node's type, only works if one pin is connected.
MakeArrayNode->PinConnectionListChanged(ArrayOut);
// For each argument, we will need to add in a "Make Struct" node.
for(int32 ArgIdx = 0; ArgIdx < PinNames.Num(); ++ArgIdx)
{
UEdGraphPin* ArgumentPin = FindArgumentPin(PinNames[ArgIdx]);
// Spawn a "Make Struct" node to create the struct needed for formatting the text.
UK2Node_MakeStruct* PinMakeStruct = CompilerContext.SpawnIntermediateNode<UK2Node_MakeStruct>(this, SourceGraph);
PinMakeStruct->StructType = FFormatTextArgument::StaticStruct();
PinMakeStruct->AllocateDefaultPins();
// Set the struct's "ArgumentName" pin literal to be the argument pin's name.
PinMakeStruct->GetSchema()->TrySetDefaultText(*PinMakeStruct->FindPin("ArgumentName"), FText::AsCultureInvariant(ArgumentPin->PinName));
// Move the connection of the argument pin to the struct's "TextValue" pin, this will move the literal value if present.
CompilerContext.MovePinLinksToIntermediate(*ArgumentPin, *PinMakeStruct->FindPin("TextValue"));
// The "Make Array" node already has one pin available, so don't create one for ArgIdx == 0
if(ArgIdx > 0)
{
MakeArrayNode->AddInputPin();
}
// Find the input pin on the "Make Array" node by index.
FString PinName = FString::Printf(TEXT("[%d]"), ArgIdx);
UEdGraphPin* InputPin = MakeArrayNode->FindPin(PinName);
// Find the output for the pin's "Make Struct" node and link it to the corresponding pin on the "Make Array" node.
FindOutputStructPinChecked(PinMakeStruct)->MakeLinkTo(InputPin);
}
// Move connection of FormatText's "Result" pin to the call function's return value pin.
CompilerContext.MovePinLinksToIntermediate(*FindPin(TEXT("Result")), *CallFunction->GetReturnValuePin());
// Move connection of FormatText's "Format" pin to the call function's "InPattern" pin
CompilerContext.MovePinLinksToIntermediate(*GetFormatPin(), *CallFunction->FindPin(TEXT("InPattern")));
BreakAllNodeLinks();
}
示例6: GetTargetFunction
void UK2Node_CallFunctionOnMember::ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
// This skips UK2Node_CallFunction::ExpandNode. Instead it spawns a new CallFunction node and does hookup that this is interested in,
// and then that CallFunction node will get its own Expansion to handle the parent portions
UK2Node::ExpandNode(CompilerContext, SourceGraph);
if (CompilerContext.bIsFullCompile)
{
const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
UFunction* Function = GetTargetFunction();
// Create real 'call function' node.
UK2Node_CallFunction* CallFuncNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallFuncNode->SetFromFunction(Function);
CallFuncNode->AllocateDefaultPins();
UEdGraphPin* CallFuncSelfPin = Schema->FindSelfPin(*CallFuncNode, EGPD_Input);
// Now because you can wire multiple variables to a self pin, need to iterate over each one and create a 'get var' node for each
UEdGraphPin* SelfPin = Schema->FindSelfPin(*this, EGPD_Input);
if(SelfPin != NULL)
{
if (SelfPin->LinkedTo.Num() == 0)
{
UK2Node_VariableGet* GetVarNode = CompilerContext.SpawnIntermediateNode<UK2Node_VariableGet>(this, SourceGraph);
GetVarNode->VariableReference.SetSelfMember(MemberVariableToCallOn.GetMemberName());
GetVarNode->AllocateDefaultPins();
if (UEdGraphPin* ValuePin = GetVarNode->GetValuePin())
{
ValuePin->MakeLinkTo(CallFuncSelfPin);
}
}
else
{
for (int32 TargetIdx = 0; TargetIdx < SelfPin->LinkedTo.Num(); TargetIdx++)
{
UEdGraphPin* SourcePin = SelfPin->LinkedTo[TargetIdx];
if (SourcePin != NULL)
{
// Create 'get var' node to get the member
UK2Node_VariableGet* GetVarNode = CompilerContext.SpawnIntermediateNode<UK2Node_VariableGet>(this, SourceGraph);
GetVarNode->VariableReference = MemberVariableToCallOn;
GetVarNode->AllocateDefaultPins();
UEdGraphPin* VarNodeSelfPin = Schema->FindSelfPin(*GetVarNode, EGPD_Input);
if (VarNodeSelfPin != NULL)
{
VarNodeSelfPin->MakeLinkTo(SourcePin);
UEdGraphPin* ValuePin = GetVarNode->GetValuePin();
ValuePin->MakeLinkTo(CallFuncSelfPin);
}
else
{
// Failed to find the member to call on for this expansion, so warn about it
CompilerContext.MessageLog.Warning(*LOCTEXT("CallFunctionOnInvalidMember_Warning", "Function node @@ called on invalid target member.").ToString(), this);
}
}
}
}
}
// Now move the rest of the connections (including exec connections...)
for(int32 SrcPinIdx=0; SrcPinIdx<Pins.Num(); SrcPinIdx++)
{
UEdGraphPin* SrcPin = Pins[SrcPinIdx];
if(SrcPin != NULL && SrcPin != SelfPin) // check its not the self pin
{
UEdGraphPin* DestPin = CallFuncNode->FindPin(SrcPin->PinName);
if(DestPin != NULL)
{
CompilerContext.MovePinLinksToIntermediate(*SrcPin, *DestPin); // Source node is assumed to be owner...
}
}
}
// Finally, break any remaining links on the 'call func on member' node
BreakAllNodeLinks();
}
}