You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Settings specific to Anim, Blueprint and Material Editor should probably be broken out into their own settings classes in the respective modules at some point. It feels a little strange that the GraphEditor needs to be aware of specific pin and node title types. At this time I did not want to refactor the existing graph editors though, and since many of the properties are currently being shared, pulling these settings out of UEditorUserSettings is at least a good first step. In the future I would like to see settings sections for specific graph based editors instead of having a generic 'Graph Editor' section that is shared by some or all editors. I exposed various color settings in the UI as many users seem to be quite excited about customizing their Editor. If you think that some settings should be added or removed, please feel free to make any desired changes or let me know. Thanks! #CodeReview: nick.whiting [CL 2079703 by Max Preussner in Main branch]
117 lines
4.1 KiB
C++
117 lines
4.1 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BlueprintGraphPrivatePCH.h"
|
|
|
|
#include "CompilerResultsLog.h"
|
|
#include "KismetCompiler.h"
|
|
|
|
UK2Node_InputAction::UK2Node_InputAction(const class FPostConstructInitializeProperties& PCIP)
|
|
: Super(PCIP)
|
|
{
|
|
bConsumeInput = true;
|
|
bOverrideParentBinding = true;
|
|
}
|
|
|
|
void UK2Node_InputAction::PostLoad()
|
|
{
|
|
Super::PostLoad();
|
|
|
|
if (GetLinkerUE4Version() < VER_UE4_BLUEPRINT_INPUT_BINDING_OVERRIDES)
|
|
{
|
|
// Don't change existing behaviors
|
|
bOverrideParentBinding = false;
|
|
}
|
|
}
|
|
|
|
void UK2Node_InputAction::AllocateDefaultPins()
|
|
{
|
|
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
|
|
|
|
CreatePin(EGPD_Output, K2Schema->PC_Exec, TEXT(""), NULL, false, false, TEXT("Pressed"));
|
|
CreatePin(EGPD_Output, K2Schema->PC_Exec, TEXT(""), NULL, false, false, TEXT("Released"));
|
|
|
|
Super::AllocateDefaultPins();
|
|
}
|
|
|
|
FLinearColor UK2Node_InputAction::GetNodeTitleColor() const
|
|
{
|
|
return GetDefault<UGraphEditorSettings>()->EventNodeTitleColor;
|
|
}
|
|
|
|
FText UK2Node_InputAction::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
|
{
|
|
FFormatNamedArguments Args;
|
|
Args.Add(TEXT("InputActionName"), FText::FromName(InputActionName));
|
|
return FText::Format(NSLOCTEXT("K2Node", "InputAction_Name", "InputAction {InputActionName}"), Args);
|
|
}
|
|
|
|
FString UK2Node_InputAction::GetNodeNativeTitle(ENodeTitleType::Type TitleType) const
|
|
{
|
|
// Do not setup this function for localization, intentionally left unlocalized!
|
|
return FString::Printf(TEXT("InputAction %s"), *InputActionName.ToString());
|
|
}
|
|
|
|
FString UK2Node_InputAction::GetTooltip() const
|
|
{
|
|
return FString::Printf(*NSLOCTEXT("K2Node", "InputAction_Tooltip", "Event for when the keys bound to input action %s are pressed or released.").ToString(), *InputActionName.ToString());
|
|
}
|
|
|
|
UEdGraphPin* UK2Node_InputAction::GetPressedPin() const
|
|
{
|
|
return FindPin(TEXT("Pressed"));
|
|
}
|
|
|
|
UEdGraphPin* UK2Node_InputAction::GetReleasedPin() const
|
|
{
|
|
return FindPin(TEXT("Released"));
|
|
}
|
|
|
|
void UK2Node_InputAction::ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const
|
|
{
|
|
Super::ValidateNodeDuringCompilation(MessageLog);
|
|
|
|
TArray<FName> ActionNames;
|
|
GetDefault<UInputSettings>()->GetActionNames(ActionNames);
|
|
if (!ActionNames.Contains(InputActionName))
|
|
{
|
|
MessageLog.Warning(*FString::Printf(*NSLOCTEXT("KismetCompiler", "MissingInputAction_Warning", "InputAction Event references unknown Action '%s' for @@").ToString(), *InputActionName.ToString()), this);
|
|
}
|
|
}
|
|
|
|
void UK2Node_InputAction::CreateInputActionEvent(FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph, UEdGraphPin* InputActionPin, const EInputEvent InputKeyEvent)
|
|
{
|
|
if (InputActionPin->LinkedTo.Num() > 0)
|
|
{
|
|
UK2Node_InputActionEvent* InputActionEvent = CompilerContext.SpawnIntermediateNode<UK2Node_InputActionEvent>(this, SourceGraph);
|
|
InputActionEvent->CustomFunctionName = FName( *FString::Printf(TEXT("InpActEvt_%s_%s"), *InputActionName.ToString(), *InputActionEvent->GetName()));
|
|
InputActionEvent->InputActionName = InputActionName;
|
|
InputActionEvent->bConsumeInput = bConsumeInput;
|
|
InputActionEvent->bExecuteWhenPaused = bExecuteWhenPaused;
|
|
InputActionEvent->bOverrideParentBinding = bOverrideParentBinding;
|
|
InputActionEvent->InputKeyEvent = InputKeyEvent;
|
|
InputActionEvent->EventSignatureName = TEXT("InputActionHandlerDynamicSignature__DelegateSignature");
|
|
InputActionEvent->EventSignatureClass = UInputComponent::StaticClass();
|
|
InputActionEvent->bInternalEvent = true;
|
|
InputActionEvent->AllocateDefaultPins();
|
|
|
|
// Move any exec links from the InputActionNode pin to the InputActionEvent node
|
|
UEdGraphPin* EventOutput = CompilerContext.GetSchema()->FindExecutionPin(*InputActionEvent, EGPD_Output);
|
|
|
|
if(EventOutput != NULL)
|
|
{
|
|
CompilerContext.MovePinLinksToIntermediate(*InputActionPin, *EventOutput);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void UK2Node_InputAction::ExpandNode(FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
|
|
{
|
|
Super::ExpandNode(CompilerContext, SourceGraph);
|
|
|
|
if (CompilerContext.bIsFullCompile)
|
|
{
|
|
CreateInputActionEvent(CompilerContext, SourceGraph, GetPressedPin(), IE_Pressed);
|
|
CreateInputActionEvent(CompilerContext, SourceGraph, GetReleasedPin(), IE_Released);
|
|
}
|
|
} |