void USoundCueGraphNode::PostLoad()
{
	Super::PostLoad();

	// Fixup any SoundNode back pointers that may be out of date
	if (SoundNode)
	{
		SoundNode->GraphNode = this;
	}

	for (int32 Index = 0; Index < Pins.Num(); ++Index)
	{
		UEdGraphPin* Pin = Pins[Index];
		if (Pin->PinName.IsEmpty())
		{
			// Makes sure pin has a name for lookup purposes but user will never see it
			if (Pin->Direction == EGPD_Input)
			{
				Pin->PinName = CreateUniquePinName(TEXT("Input"));
			}
			else
			{
				Pin->PinName = CreateUniquePinName(TEXT("Output"));
			}
			Pin->PinFriendlyName = FText::FromString(TEXT(" "));
		}
	}
}
void UMaterialGraphNode::CreateInputPins()
{
	const TArray<FExpressionInput*> ExpressionInputs = MaterialExpression->GetInputs();

	for (int32 Index = 0; Index < ExpressionInputs.Num() ; ++Index)
	{
		FExpressionInput* Input = ExpressionInputs[Index];
		FString InputName = MaterialExpression->GetInputName(Index);

		// Shorten long expression input names.
		if ( !FCString::Stricmp( *InputName, TEXT("Coordinates") ) )
		{
			InputName = TEXT("UVs");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("TextureObject") ) )
		{
			InputName = TEXT("Tex");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("Input") ) )
		{
			InputName = TEXT("");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("Exponent") ) )
		{
			InputName = TEXT("Exp");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("AGreaterThanB") ) )
		{
			InputName = TEXT("A>=B");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("AEqualsB") ) )
		{
			InputName = TEXT("A==B");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("ALessThanB") ) )
		{
			InputName = TEXT("A<B");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("MipLevel") ) )
		{
			InputName = TEXT("Level");
		}
		else if ( !FCString::Stricmp( *InputName, TEXT("MipBias") ) )
		{
			InputName = TEXT("Bias");
		}

		const UMaterialGraphSchema* Schema = CastChecked<UMaterialGraphSchema>(GetSchema());
		FString PinCategory = MaterialExpression->IsInputConnectionRequired(Index) ? Schema->PC_Required : Schema->PC_Optional;
		FString PinSubCategory = TEXT("");

		UEdGraphPin* NewPin = CreatePin(EGPD_Input, PinCategory, PinSubCategory, NULL, /*bIsArray=*/ false, /*bIsReference=*/ false, InputName);
		if (NewPin->PinName.IsEmpty())
		{
			// Makes sure pin has a name for lookup purposes but user will never see it
			NewPin->PinName = CreateUniquePinName(TEXT("Input"));
			NewPin->PinFriendlyName = TEXT(" ");
		}
	}
}
void USoundCueGraphNode::CreateInputPin()
{
	UEdGraphPin* NewPin = CreatePin(EGPD_Input, TEXT("SoundNode"), TEXT(""), NULL, /*bIsArray=*/ false, /*bIsReference=*/ false, SoundNode->GetInputPinName(GetInputCount()).ToString());
	if (NewPin->PinName.IsEmpty())
	{
		// Makes sure pin has a name for lookup purposes but user will never see it
		NewPin->PinName = CreateUniquePinName(TEXT("Input"));
		NewPin->PinFriendlyName = FText::FromString(TEXT(" "));
	}
}
void UMaterialGraphNode::CreateOutputPins()
{
	TArray<FExpressionOutput>& Outputs = MaterialExpression->GetOutputs();

	for( int32 Index = 0 ; Index < Outputs.Num() ; ++Index )
	{
		const FExpressionOutput& ExpressionOutput = Outputs[Index];
		FString PinCategory = TEXT("");
		FString PinSubCategory = TEXT("");
		FString OutputName = TEXT("");

		const UMaterialGraphSchema* Schema = CastChecked<UMaterialGraphSchema>(GetSchema());
		
		if( ExpressionOutput.Mask )
		{
			PinCategory = Schema->PC_Mask;

			if ( ExpressionOutput.MaskR && !ExpressionOutput.MaskG && !ExpressionOutput.MaskB && !ExpressionOutput.MaskA)
			{
				PinSubCategory = Schema->PSC_Red;
			}
			else if	(!ExpressionOutput.MaskR &&  ExpressionOutput.MaskG && !ExpressionOutput.MaskB && !ExpressionOutput.MaskA)
			{
				PinSubCategory = Schema->PSC_Green;
			}
			else if	(!ExpressionOutput.MaskR && !ExpressionOutput.MaskG &&  ExpressionOutput.MaskB && !ExpressionOutput.MaskA)
			{
				PinSubCategory = Schema->PSC_Blue;
			}
			else if	(!ExpressionOutput.MaskR && !ExpressionOutput.MaskG && !ExpressionOutput.MaskB &&  ExpressionOutput.MaskA)
			{
				PinSubCategory = Schema->PSC_Alpha;
			}
		}

		if (MaterialExpression->bShowOutputNameOnPin)
		{
			OutputName = ExpressionOutput.OutputName;
		}

		UEdGraphPin* NewPin = CreatePin(EGPD_Output, PinCategory, PinSubCategory, NULL, /*bIsArray=*/ false, /*bIsReference=*/ false, OutputName);
		if (NewPin->PinName.IsEmpty())
		{
			// Makes sure pin has a name for lookup purposes but user will never see it
			NewPin->PinName = CreateUniquePinName(TEXT("Output"));
			NewPin->PinFriendlyName = TEXT(" ");
		}
	}
}
UEdGraphPin* UK2Node_EditablePinBase::CreateUserDefinedPin(const FString& InPinName, const FEdGraphPinType& InPinType)
{
	// Sanitize the name, if needed
	const FString NewPinName = CreateUniquePinName(InPinName);

	// First, add this pin to the user-defined pins
	TSharedPtr<FUserPinInfo> NewPinInfo = MakeShareable( new FUserPinInfo() );
	NewPinInfo->PinName = NewPinName;
	NewPinInfo->PinType = InPinType;
	UserDefinedPins.Add(NewPinInfo);

	// Then, add the pin to the actual Pins array
	UEdGraphPin* NewPin = CreatePinFromUserDefinition(NewPinInfo);
	
	check(NewPin);

	return NewPin;
}