You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
78 lines
2.9 KiB
C++
78 lines
2.9 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BlueprintGraphPrivatePCH.h"
|
|
#include "K2Node_InputVectorAxisEvent.h"
|
|
#include "CompilerResultsLog.h"
|
|
#include "BlueprintNodeSpawner.h"
|
|
#include "Engine/InputVectorAxisDelegateBinding.h"
|
|
|
|
UK2Node_InputVectorAxisEvent::UK2Node_InputVectorAxisEvent(const class FPostConstructInitializeProperties& PCIP)
|
|
: Super(PCIP)
|
|
{
|
|
EventSignatureName = TEXT("InputVectorAxisHandlerDynamicSignature__DelegateSignature");
|
|
}
|
|
|
|
void UK2Node_InputVectorAxisEvent::ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const
|
|
{
|
|
// Skip AxisKeyEvent validation
|
|
UK2Node_Event::ValidateNodeDuringCompilation(MessageLog);
|
|
|
|
if (!AxisKey.IsValid())
|
|
{
|
|
MessageLog.Warning(*FText::Format(NSLOCTEXT("KismetCompiler", "Invalid_InputVectorAxis_Warning", "InputVectorAxis Event specifies invalid FKey'{0}' for @@"), FText::FromString(AxisKey.ToString())).ToString(), this);
|
|
}
|
|
else if (!AxisKey.IsVectorAxis())
|
|
{
|
|
MessageLog.Warning(*FText::Format(NSLOCTEXT("KismetCompiler", "NotAxis_InputVectorAxis_Warning", "InputVectorAxis Event specifies FKey'{0}' which is not a vector axis for @@"), FText::FromString(AxisKey.ToString())).ToString(), this);
|
|
}
|
|
else if (!AxisKey.IsBindableInBlueprints())
|
|
{
|
|
MessageLog.Warning(*FText::Format(NSLOCTEXT("KismetCompiler", "NotBindable_InputVectorAxis_Warning", "InputVectorAxis Event specifies FKey'{0}' that is not blueprint bindable for @@"), FText::FromString(AxisKey.ToString())).ToString(), this);
|
|
}
|
|
}
|
|
|
|
UClass* UK2Node_InputVectorAxisEvent::GetDynamicBindingClass() const
|
|
{
|
|
return UInputVectorAxisDelegateBinding::StaticClass();
|
|
}
|
|
|
|
void UK2Node_InputVectorAxisEvent::RegisterDynamicBinding(UDynamicBlueprintBinding* BindingObject) const
|
|
{
|
|
UInputVectorAxisDelegateBinding* InputVectorAxisBindingObject = CastChecked<UInputVectorAxisDelegateBinding>(BindingObject);
|
|
|
|
FBlueprintInputAxisKeyDelegateBinding Binding;
|
|
Binding.AxisKey = AxisKey;
|
|
Binding.bConsumeInput = bConsumeInput;
|
|
Binding.bExecuteWhenPaused = bExecuteWhenPaused;
|
|
Binding.bOverrideParentBinding = bOverrideParentBinding;
|
|
Binding.FunctionNameToBind = CustomFunctionName;
|
|
|
|
InputVectorAxisBindingObject->InputAxisKeyDelegateBindings.Add(Binding);
|
|
}
|
|
|
|
void UK2Node_InputVectorAxisEvent::GetMenuActions(TArray<UBlueprintNodeSpawner*>& ActionListOut) const
|
|
{
|
|
TArray<FKey> AllKeys;
|
|
EKeys::GetAllKeys(AllKeys);
|
|
|
|
for (FKey const Key : AllKeys)
|
|
{
|
|
if (!Key.IsBindableInBlueprints() || !Key.IsVectorAxis())
|
|
{
|
|
continue;
|
|
}
|
|
|
|
UBlueprintNodeSpawner* NodeSpawner = UBlueprintNodeSpawner::Create(GetClass());
|
|
check(NodeSpawner != nullptr);
|
|
|
|
auto CustomizeInputNodeLambda = [](UEdGraphNode* NewNode, bool bIsTemplateNode, FKey Key)
|
|
{
|
|
UK2Node_InputAxisKeyEvent* InputNode = CastChecked<UK2Node_InputAxisKeyEvent>(NewNode);
|
|
InputNode->Initialize(Key);
|
|
};
|
|
|
|
NodeSpawner->CustomizeNodeDelegate = UBlueprintNodeSpawner::FCustomizeNodeDelegate::CreateStatic(CustomizeInputNodeLambda, Key);
|
|
ActionListOut.Add(NodeSpawner);
|
|
}
|
|
}
|