void UK2Node_EaseFunction::PostReconstructNode()
{
	Super::PostReconstructNode();

	// Check in which state we are at the moment
	RefreshPinVisibility();

	// Find a pin that has connections to use to jumpstart the wildcard process
	for (int32 PinIndex = 0; PinIndex < Pins.Num(); ++PinIndex)
	{
		if (Pins[PinIndex]->PinName == FEaseFunctionNodeHelper::GetAPinName() ||
			Pins[PinIndex]->PinName == FEaseFunctionNodeHelper::GetBPinName() ||
			Pins[PinIndex]->PinName == FEaseFunctionNodeHelper::GetResultPinName())
		{
			// Take default pin values into account in case we can securly convert the string default value into a PinType
			// this is currently not the case but could be considered in the future.
			if (Pins[PinIndex]->LinkedTo.Num() > 0)
			{
				PinTypeChanged(Pins[PinIndex]);
				break;
			}
		}
	}

	GenerateExtraPins();
}
Example #2
0
void UK2Node_Event::UpdateDelegatePin()
{
	UEdGraphPin* Pin = FindPinChecked(DelegateOutputName);
	checkSlow(EGPD_Output == Pin->Direction);
	const UObject* OldSignature = Pin->PinType.PinSubCategoryObject.Get();

	if(bOverrideFunction)
	{
		Pin->PinType.PinSubCategoryObject = EventSignatureClass->FindFunctionByName(EventSignatureName);
	}
	else if(UBlueprint* Blueprint = GetBlueprint())
	{
		Pin->PinType.PinSubCategoryObject = Blueprint->SkeletonGeneratedClass 
			? Blueprint->SkeletonGeneratedClass->FindFunctionByName(CustomFunctionName)
			: NULL;
	}
	else
	{
		Pin->PinType.PinSubCategoryObject = NULL;
	}

	if(OldSignature != Pin->PinType.PinSubCategoryObject.Get())
	{
		PinTypeChanged(Pin);
	}
}
void UK2Node_ConvertAsset::RefreshPinTypes()
{
	const UEdGraphSchema_K2* K2Schema = CastChecked<UEdGraphSchema_K2>(GetSchema());
	auto InutPin = FindPin(UK2Node_ConvertAssetImpl::InputPinName);
	auto OutputPin = FindPin(UK2Node_ConvertAssetImpl::OutputPinName);
	ensure(InutPin && OutputPin);
	if (InutPin && OutputPin)
	{
		const bool bIsConnected = InutPin->LinkedTo.Num() > 0;
		UClass* TargetType = bIsConnected ? GetTargetClass() : nullptr;
		const bool bIsAssetClass = bIsConnected ? IsAssetClassType() : false;

		const FString InputCategory = bIsConnected
			? (bIsAssetClass ? K2Schema->PC_AssetClass : K2Schema->PC_Asset)
			: K2Schema->PC_Wildcard;
		InutPin->PinType = FEdGraphPinType(InputCategory, FString(), TargetType, false, false);

		const FString OutputCategory = bIsConnected
			? (bIsAssetClass ? K2Schema->PC_Class : K2Schema->PC_Object)
			: K2Schema->PC_Wildcard;
		OutputPin->PinType = FEdGraphPinType(OutputCategory, FString(), TargetType, false, false);

		PinTypeChanged(InutPin);
		PinTypeChanged(OutputPin);

		if (OutputPin->LinkedTo.Num())
		{
			UClass const* CallingContext = NULL;
			if (UBlueprint const* Blueprint = GetBlueprint())
			{
				CallingContext = Blueprint->GeneratedClass;
				if (CallingContext == NULL)
				{
					CallingContext = Blueprint->ParentClass;
				}
			}

			for (auto TargetPin : OutputPin->LinkedTo)
			{
				if (TargetPin && !K2Schema->ArePinsCompatible(OutputPin, TargetPin, CallingContext))
				{
					OutputPin->BreakLinkTo(TargetPin);
				}
			}
		}
	}
}
void UK2Node_GetEnumeratorName::UpdatePinType()
{
	UEdGraphPin* EnumPin = FindPinChecked(EnumeratorPinName);
	UEnum* Enum = GetEnum();
	if (EnumPin->PinType.PinSubCategoryObject != Enum)
	{
		EnumPin->PinType.PinSubCategoryObject = Enum;
		PinTypeChanged(EnumPin);
	}
}
Example #5
0
void UK2Node_Select::PostPasteNode()
{
	Super::PostPasteNode();

	UEdGraphPin* IndexPin = GetIndexPin();

	// This information will be cleared and we want to restore it
	FString OldDefaultValue = IndexPin->DefaultValue;

	// Corrects data in the index pin that is not valid after pasting
	PinTypeChanged(GetIndexPin());

	// Restore the default value of the index pin
	IndexPin->DefaultValue = OldDefaultValue;
}
void UK2Node_EaseFunction::NotifyPinConnectionListChanged(UEdGraphPin* Pin)
{
	Super::NotifyPinConnectionListChanged(Pin);

	const auto EaseFuncPin = GetEaseFuncPin();
	if (Pin == EaseFuncPin)
	{
		RefreshPinVisibility();
		GetGraph()->NotifyGraphChanged();
	}
	else
	{
		PinTypeChanged(Pin);
	}
}
void UK2Node_EaseFunction::ResetToWildcards()
{
	FScopedTransaction Transaction(LOCTEXT("ResetToDefaultsTx", "ResetToDefaults"));
	Modify();

	// Get pin refs
	UEdGraphPin* APin = FindPin(FEaseFunctionNodeHelper::GetAPinName());
	UEdGraphPin* BPin = FindPin(FEaseFunctionNodeHelper::GetBPinName());
	UEdGraphPin* ResultPin = FindPin(FEaseFunctionNodeHelper::GetResultPinName());
	
	// Set all to defaults and break links
	APin->DefaultValue = TEXT("");
	BPin->DefaultValue = TEXT("");
	APin->BreakAllPinLinks();
	BPin->BreakAllPinLinks();
	ResultPin->BreakAllPinLinks();

	// Do the rest of the work, we will not recompile because the wildcard pins will prevent it
	PinTypeChanged(APin);
}
Example #8
0
void UK2Node_Select::ChangePinType(UEdGraphPin* Pin)
{
	PinTypeChanged(Pin);
}
void UK2Node_EaseFunction::ChangePinType(UEdGraphPin* Pin)
{
	PinTypeChanged(Pin);
}