本文整理汇总了C++中UK2Node_CallFunction::IsNodePure方法的典型用法代码示例。如果您正苦于以下问题:C++ UK2Node_CallFunction::IsNodePure方法的具体用法?C++ UK2Node_CallFunction::IsNodePure怎么用?C++ UK2Node_CallFunction::IsNodePure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UK2Node_CallFunction
的用法示例。
在下文中一共展示了UK2Node_CallFunction::IsNodePure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFunctionName
void UK2Node_CastByteToEnum::ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
Super::ExpandNode(CompilerContext, SourceGraph);
if (bSafe && Enum)
{
const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
// FUNCTION NODE
const FName FunctionName = GetFunctionName();
const UFunction* Function = UKismetNodeHelperLibrary::StaticClass()->FindFunctionByName(FunctionName);
check(NULL != Function);
UK2Node_CallFunction* CallValidation = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallValidation->SetFromFunction(Function);
CallValidation->AllocateDefaultPins();
check(CallValidation->IsNodePure());
// FUNCTION ENUM PIN
UEdGraphPin* FunctionEnumPin = CallValidation->FindPinChecked(TEXT("Enum"));
Schema->TrySetDefaultObject(*FunctionEnumPin, Enum);
check(FunctionEnumPin->DefaultObject == Enum);
// FUNCTION INPUT BYTE PIN
UEdGraphPin* OrgInputPin = FindPinChecked(ByteInputPinName);
UEdGraphPin* FunctionIndexPin = CallValidation->FindPinChecked(TEXT("EnumeratorIndex"));
check(EGPD_Input == FunctionIndexPin->Direction && Schema->PC_Byte == FunctionIndexPin->PinType.PinCategory);
CompilerContext.MovePinLinksToIntermediate(*OrgInputPin, *FunctionIndexPin);
// UNSAFE CAST NODE
UK2Node_CastByteToEnum* UsafeCast = CompilerContext.SpawnIntermediateNode<UK2Node_CastByteToEnum>(this, SourceGraph);
UsafeCast->Enum = Enum;
UsafeCast->bSafe = false;
UsafeCast->AllocateDefaultPins();
// UNSAFE CAST INPUT
UEdGraphPin* CastInputPin = UsafeCast->FindPinChecked(ByteInputPinName);
UEdGraphPin* FunctionReturnPin = CallValidation->GetReturnValuePin();
check(NULL != FunctionReturnPin);
Schema->TryCreateConnection(CastInputPin, FunctionReturnPin);
// OPUTPUT PIN
UEdGraphPin* OrgReturnPin = FindPinChecked(Schema->PN_ReturnValue);
UEdGraphPin* NewReturnPin = UsafeCast->FindPinChecked(Schema->PN_ReturnValue);
CompilerContext.MovePinLinksToIntermediate(*OrgReturnPin, *NewReturnPin);
BreakAllNodeLinks();
}
}
示例2: GetEnum
void UK2Node_GetEnumeratorName::ExpandNode(class FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
{
Super::ExpandNode(CompilerContext, SourceGraph);
UEnum* Enum = GetEnum();
if(NULL == Enum)
{
CompilerContext.MessageLog.Error(*FString::Printf(*NSLOCTEXT("K2Node", "GetEnumeratorNam_Error_MustHaveValidName", "@@ must have a valid enum defined").ToString()), this);
return;
}
const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
const UFunction* Function = UKismetNodeHelperLibrary::StaticClass()->FindFunctionByName( GetFunctionName() );
check(NULL != Function);
UK2Node_CallFunction* CallGetName = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
CallGetName->SetFromFunction(Function);
CallGetName->AllocateDefaultPins();
check(CallGetName->IsNodePure());
//OPUTPUT PIN
UEdGraphPin* OrgReturnPin = FindPinChecked(Schema->PN_ReturnValue);
UEdGraphPin* NewReturnPin = CallGetName->GetReturnValuePin();
check(NULL != NewReturnPin);
CompilerContext.MovePinLinksToIntermediate(*OrgReturnPin, *NewReturnPin);
//ENUM PIN
UEdGraphPin* EnumPin = CallGetName->FindPinChecked(TEXT("Enum"));
Schema->TrySetDefaultObject(*EnumPin, Enum);
check(EnumPin->DefaultObject == Enum);
//VALUE PIN
UEdGraphPin* OrgInputPin = FindPinChecked(EnumeratorPinName);
UEdGraphPin* IndexPin = CallGetName->FindPinChecked(TEXT("EnumeratorValue"));
check(EGPD_Input == IndexPin->Direction && Schema->PC_Byte == IndexPin->PinType.PinCategory);
CompilerContext.MovePinLinksToIntermediate(*OrgInputPin, *IndexPin);
if (!IndexPin->LinkedTo.Num())
{
//MAKE LITERAL BYTE FROM LITERAL ENUM
const FString EnumLiteral = IndexPin->GetDefaultAsString();
const int32 NumericValue = Enum->GetValueByName(*EnumLiteral);
if (NumericValue == INDEX_NONE)
{
CompilerContext.MessageLog.Error(*FString::Printf(*NSLOCTEXT("K2Node", "GetEnumeratorNam_Error_InvalidName", "@@ has invalid enum value '%s'").ToString(), *EnumLiteral), this);
return;
}
const FString DefaultByteValue = FString::FromInt(NumericValue);
// LITERAL BYTE FUNCTION
const FName FunctionName = GET_FUNCTION_NAME_CHECKED(UKismetSystemLibrary, MakeLiteralByte);
UK2Node_CallFunction* MakeLiteralByte = CompilerContext.SpawnIntermediateNode<UK2Node_CallFunction>(this, SourceGraph);
MakeLiteralByte->SetFromFunction(UKismetSystemLibrary::StaticClass()->FindFunctionByName(FunctionName));
MakeLiteralByte->AllocateDefaultPins();
UEdGraphPin* MakeLiteralByteReturnPin = MakeLiteralByte->FindPinChecked(Schema->PN_ReturnValue);
Schema->TryCreateConnection(MakeLiteralByteReturnPin, IndexPin);
UEdGraphPin* MakeLiteralByteInputPin = MakeLiteralByte->FindPinChecked(TEXT("Value"));
MakeLiteralByteInputPin->DefaultValue = DefaultByteValue;
}
BreakAllNodeLinks();
}