本文整理汇总了C++中UK2Node_CallFunction::PinConnectionListChanged方法的典型用法代码示例。如果您正苦于以下问题:C++ UK2Node_CallFunction::PinConnectionListChanged方法的具体用法?C++ UK2Node_CallFunction::PinConnectionListChanged怎么用?C++ UK2Node_CallFunction::PinConnectionListChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UK2Node_CallFunction
的用法示例。
在下文中一共展示了UK2Node_CallFunction::PinConnectionListChanged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FString
bool UK2Node_LatentAbilityCall::ConnectSpawnProperties(UClass* ClassToSpawn, const UEdGraphSchema_K2* Schema, class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph, UEdGraphPin*& LastThenPin, UEdGraphPin* SpawnedActorReturnPin)
{
bool bIsErrorFree = true;
for (auto SpawnVarPin : SpawnParmPins)
{
const bool bHasDefaultValue = !SpawnVarPin->DefaultValue.IsEmpty() || !SpawnVarPin->DefaultTextValue.IsEmpty() || SpawnVarPin->DefaultObject;
if (SpawnVarPin->LinkedTo.Num() > 0 || bHasDefaultValue)
{
if (SpawnVarPin->LinkedTo.Num() == 0)
{
UProperty* Property = FindField<UProperty>(ClassToSpawn, *SpawnVarPin->PinName);
// NULL property indicates that this pin was part of the original node, not the
// class we're assigning to:
if (!Property)
{
continue;
}
if (ClassToSpawn->ClassDefaultObject != nullptr)
{
// We don't want to generate an assignment node unless the default value
// differs from the value in the CDO:
FString DefaultValueAsString;
FBlueprintEditorUtils::PropertyValueToString(Property, (uint8*)ClassToSpawn->ClassDefaultObject, DefaultValueAsString);
if (DefaultValueAsString == SpawnVarPin->DefaultValue)
{
continue;
}
}
}
UFunction* SetByNameFunction = Schema->FindSetVariableByNameFunction(SpawnVarPin->PinType);
if (SetByNameFunction)
{
UK2Node_CallFunction* SetVarNode = NULL;
if (SpawnVarPin->PinType.bIsArray)
{
SetVarNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallArrayFunction>(this, SourceGraph);
}
else
{
SetVarNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
}
SetVarNode->SetFromFunction(SetByNameFunction);
SetVarNode->AllocateDefaultPins();
// Connect this node into the exec chain
bIsErrorFree &= Schema->TryCreateConnection(LastThenPin, SetVarNode->GetExecPin());
LastThenPin = SetVarNode->GetThenPin();
static FString ObjectParamName = FString(TEXT("Object"));
static FString ValueParamName = FString(TEXT("Value"));
static FString PropertyNameParamName = FString(TEXT("PropertyName"));
// Connect the new actor to the 'object' pin
UEdGraphPin* ObjectPin = SetVarNode->FindPinChecked(ObjectParamName);
SpawnedActorReturnPin->MakeLinkTo(ObjectPin);
// Fill in literal for 'property name' pin - name of pin is property name
UEdGraphPin* PropertyNamePin = SetVarNode->FindPinChecked(PropertyNameParamName);
PropertyNamePin->DefaultValue = SpawnVarPin->PinName;
UEdGraphPin* ValuePin = SetVarNode->FindPinChecked(ValueParamName);
if (SpawnVarPin->LinkedTo.Num() == 0 &&
SpawnVarPin->DefaultValue != FString() &&
SpawnVarPin->PinType.PinCategory == Schema->PC_Byte &&
SpawnVarPin->PinType.PinSubCategoryObject.IsValid() &&
SpawnVarPin->PinType.PinSubCategoryObject->IsA<UEnum>())
{
// Pin is an enum, we need to alias the enum value to an int:
UK2Node_EnumLiteral* EnumLiteralNode = CompilerContext.SpawnIntermediateNode<UK2Node_EnumLiteral>(this, SourceGraph);
EnumLiteralNode->Enum = CastChecked<UEnum>(SpawnVarPin->PinType.PinSubCategoryObject.Get());
EnumLiteralNode->AllocateDefaultPins();
EnumLiteralNode->FindPinChecked(Schema->PN_ReturnValue)->MakeLinkTo(ValuePin);
UEdGraphPin* InPin = EnumLiteralNode->FindPinChecked(UK2Node_EnumLiteral::GetEnumInputPinName());
InPin->DefaultValue = SpawnVarPin->DefaultValue;
}
else
{
// Move connection from the variable pin on the spawn node to the 'value' pin
CompilerContext.MovePinLinksToIntermediate(*SpawnVarPin, *ValuePin);
SetVarNode->PinConnectionListChanged(ValuePin);
}
}
}
}
return bIsErrorFree;
}
示例2: FString
//.........这里部分代码省略.........
// Copy the world context connection from the spawn node to 'begin spawn' if necessary
if (SpawnWorldContextPin)
{
CompilerContext.MovePinLinksToIntermediate(*SpawnWorldContextPin, *CallBeginWorldContextPin);
}
// Copy the 'transform' connection from the spawn node to 'begin spawn'
CompilerContext.MovePinLinksToIntermediate(*SpawnNodeTransform, *CallBeginTransform);
// Copy the 'bNoCollisionFail' connection from the spawn node to 'begin spawn'
CompilerContext.MovePinLinksToIntermediate(*SpawnNodeNoCollisionFail, *CallBeginNoCollisionFail);
//////////////////////////////////////////////////////////////////////////
// create 'finish spawn' call node
UK2Node_CallFunction* CallFinishSpawnNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallFinishSpawnNode->FunctionReference.SetExternalMember(FinishSpawningFuncName, UGameplayStatics::StaticClass());
CallFinishSpawnNode->AllocateDefaultPins();
UEdGraphPin* CallFinishExec = CallFinishSpawnNode->GetExecPin();
UEdGraphPin* CallFinishThen = CallFinishSpawnNode->GetThenPin();
UEdGraphPin* CallFinishActor = CallFinishSpawnNode->FindPinChecked(ActorParamName);
UEdGraphPin* CallFinishTransform = CallFinishSpawnNode->FindPinChecked(TransformParamName);
UEdGraphPin* CallFinishResult = CallFinishSpawnNode->GetReturnValuePin();
// Move 'then' connection from spawn node to 'finish spawn'
CompilerContext.MovePinLinksToIntermediate(*SpawnNodeThen, *CallFinishThen);
// Copy transform connection
CompilerContext.CopyPinLinksToIntermediate(*CallBeginTransform, *CallFinishTransform);
// Connect output actor from 'begin' to 'finish'
CallBeginResult->MakeLinkTo(CallFinishActor);
// Move result connection from spawn node to 'finish spawn'
CallFinishResult->PinType = SpawnNodeResult->PinType; // Copy type so it uses the right actor subclass
CompilerContext.MovePinLinksToIntermediate(*SpawnNodeResult, *CallFinishResult);
//////////////////////////////////////////////////////////////////////////
// create 'set var' nodes
// Get 'result' pin from 'begin spawn', this is the actual actor we want to set properties on
UK2Node_CallFunction* LastNode = CallBeginSpawnNode;
// Create 'set var by name' nodes and hook them up
for(int32 PinIdx=0; PinIdx < Pins.Num(); PinIdx++)
{
// Only create 'set param by name' node if this pin is linked to something
UEdGraphPin* SpawnVarPin = Pins[PinIdx];
if(SpawnVarPin->LinkedTo.Num() > 0)
{
UFunction* SetByNameFunction = Schema->FindSetVariableByNameFunction(SpawnVarPin->PinType);
if(SetByNameFunction)
{
UK2Node_CallFunction* SetVarNode = NULL;
if(SpawnVarPin->PinType.bIsArray)
{
SetVarNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallArrayFunction>(this, SourceGraph);
}
else
{
SetVarNode = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
}
SetVarNode->SetFromFunction(SetByNameFunction);
SetVarNode->AllocateDefaultPins();
// Connect this node into the exec chain
UEdGraphPin* LastThen = LastNode->GetThenPin();
UEdGraphPin* SetVarExec = SetVarNode->GetExecPin();
LastThen->MakeLinkTo(SetVarExec);
// Connect the new actor to the 'object' pin
UEdGraphPin* ObjectPin = SetVarNode->FindPinChecked(ObjectParamName);
CallBeginResult->MakeLinkTo(ObjectPin);
// Fill in literal for 'property name' pin - name of pin is property name
UEdGraphPin* PropertyNamePin = SetVarNode->FindPinChecked(PropertyNameParamName);
PropertyNamePin->DefaultValue = SpawnVarPin->PinName;
// Move connection from the variable pin on the spawn node to the 'value' pin
UEdGraphPin* ValuePin = SetVarNode->FindPinChecked(ValueParamName);
CompilerContext.MovePinLinksToIntermediate(*SpawnVarPin, *ValuePin);
if(SpawnVarPin->PinType.bIsArray)
{
SetVarNode->PinConnectionListChanged(ValuePin);
}
// Update 'last node in sequence' var
LastNode = SetVarNode;
}
}
}
// Make exec connection between 'then' on last node and 'finish'
UEdGraphPin* LastThen = LastNode->GetThenPin();
LastThen->MakeLinkTo(CallFinishExec);
// Break any links to the expanded node
BreakAllNodeLinks();
}
}