Kismet nodes now have their own module to themselves, so Unreal Engine can compile a shipping build correctly.
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class ComboInputNodes : ModuleRules
|
||||
{
|
||||
public ComboInputNodes(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
bLegacyPublicIncludePaths = false;
|
||||
ShadowVariableWarningLevel = WarningLevel.Error;
|
||||
|
||||
PublicIncludePaths.AddRange
|
||||
(
|
||||
new string[]
|
||||
{
|
||||
// ... add public include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateIncludePaths.AddRange
|
||||
(
|
||||
new string[]
|
||||
{
|
||||
"ComboInputNodes/Private"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PublicDependencyModuleNames.AddRange
|
||||
(
|
||||
new string[]
|
||||
{
|
||||
"ComboInput",
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateDependencyModuleNames.AddRange
|
||||
(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"DeveloperSettings",
|
||||
|
||||
"UnrealEd",
|
||||
"BlueprintGraph",
|
||||
"GraphEditor",
|
||||
"KismetCompiler",
|
||||
}
|
||||
);
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange
|
||||
(
|
||||
new string[]
|
||||
{
|
||||
// ... add any modules that your module loads dynamically here ...
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#include "ComboInputNodes.h"
|
||||
|
||||
#include "GameplayTagsManager.h"
|
||||
#include "Interfaces/IPluginManager.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FComboInputNodesModule"
|
||||
|
||||
|
||||
void FComboInputNodesModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
}
|
||||
|
||||
void FComboInputNodesModule::ShutdownModule()
|
||||
{
|
||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
||||
// we call this function before unloading the module.
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FComboInputNodesModule, ComboInputNodes)
|
||||
@@ -0,0 +1,302 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#include "K2Node_ComboAction.h"
|
||||
|
||||
#include "AssetRegistry/AssetRegistryModule.h"
|
||||
#include "BlueprintActionDatabaseRegistrar.h"
|
||||
#include "BlueprintEditorSettings.h"
|
||||
#include "BlueprintNodeSpawner.h"
|
||||
#include "ComboInputAssets.h"
|
||||
#include "ComboInputTriggers.h"
|
||||
#include "EdGraphSchema_K2_Actions.h"
|
||||
#include "Editor.h"
|
||||
#include "EditorCategoryUtils.h"
|
||||
#include "GraphEditorSettings.h"
|
||||
#include "K2Node_AssignmentStatement.h"
|
||||
#include "K2Node_ComboActionEvent.h"
|
||||
#include "K2Node_TemporaryVariable.h"
|
||||
#include "Kismet2/BlueprintEditorUtils.h"
|
||||
#include "KismetCompiler.h"
|
||||
#include "Misc/PackageName.h"
|
||||
#include "Subsystems/AssetEditorSubsystem.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "Styling/AppStyle.h"
|
||||
|
||||
#include UE_INLINE_GENERATED_CPP_BY_NAME(K2Node_ComboAction)
|
||||
|
||||
#define LOCTEXT_NAMESPACE "K2Node_ComboAction"
|
||||
|
||||
#define COMBO_ACTION_OBJECT_PIN_NAME TEXT("ComboAction")
|
||||
|
||||
|
||||
void ForEachEventPinName(TFunctionRef<void(EComboActionTriggerEvent Event, FName PinName)> PinLambda)
|
||||
{
|
||||
UEnum *EventEnum = StaticEnum<EComboActionTriggerEvent>();
|
||||
for (int32 i = 0; i < EventEnum->NumEnums() - 1; ++i)
|
||||
{
|
||||
if (!EventEnum->HasMetaData(TEXT("Hidden"), i))
|
||||
{
|
||||
PinLambda(EComboActionTriggerEvent(EventEnum->GetValueByIndex(i)), *EventEnum->GetNameStringByIndex(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UK2Node_ComboAction::AllocateDefaultPins()
|
||||
{
|
||||
const UEdGraphSchema_K2 *Schema = GetDefault<UEdGraphSchema_K2>();
|
||||
|
||||
this->AdvancedPinDisplay = ENodeAdvancedPins::Hidden;
|
||||
|
||||
ForEachEventPinName([this](EComboActionTriggerEvent Event, FName PinName)
|
||||
{
|
||||
static const UEnum *EventEnum = StaticEnum<EComboActionTriggerEvent>();
|
||||
|
||||
UEdGraphPin *NewPin = this->CreatePin(EGPD_Output, UEdGraphSchema_K2::PC_Exec, PinName);
|
||||
NewPin->PinToolTip = EventEnum->GetToolTipTextByIndex(EventEnum->GetIndexByValue(static_cast<uint8>(Event))).ToString();
|
||||
NewPin->bAdvancedView = (Event > EComboActionTriggerEvent::Activated);
|
||||
});
|
||||
|
||||
UEdGraphPin *ComboActionPin = this->CreatePin(EGPD_Output, UEdGraphSchema_K2::PC_Object, UComboAction::StaticClass(), COMBO_ACTION_OBJECT_PIN_NAME);
|
||||
ComboActionPin->bAdvancedView = true;
|
||||
|
||||
Schema->SetPinAutogeneratedDefaultValueBasedOnType(ComboActionPin);
|
||||
|
||||
if (this->ComboAction)
|
||||
{
|
||||
ComboActionPin->DefaultObject = const_cast<UObject *>(Cast<UObject>(this->ComboAction));
|
||||
ComboActionPin->DefaultValue = this->ComboAction->GetName();
|
||||
Schema->ConstructBasicPinTooltip(*ComboActionPin, LOCTEXT("ComboActionPinDescription", "The combo action that caused this event to fire"), ComboActionPin->PinToolTip);
|
||||
}
|
||||
|
||||
Super::AllocateDefaultPins();
|
||||
}
|
||||
|
||||
FLinearColor UK2Node_ComboAction::GetNodeTitleColor() const
|
||||
{
|
||||
return GetDefault<UGraphEditorSettings>()->EventNodeTitleColor;
|
||||
}
|
||||
|
||||
FName UK2Node_ComboAction::GetActionName() const
|
||||
{
|
||||
return this->ComboAction ? this->ComboAction->ActionName : FName();
|
||||
}
|
||||
|
||||
FText UK2Node_ComboAction::GetNodeTitle(ENodeTitleType::Type TitleType) const
|
||||
{
|
||||
if (TitleType == ENodeTitleType::MenuTitle)
|
||||
{
|
||||
return FText::FromName(this->GetActionName());
|
||||
}
|
||||
else if (this->CachedNodeTitle.IsOutOfDate(this))
|
||||
{
|
||||
FFormatNamedArguments Args;
|
||||
Args.Add(TEXT("ComboActionName"), FText::FromName(this->GetActionName()));
|
||||
|
||||
FText LocFormat = LOCTEXT("ComboAction_Name", "ComboAction {ComboActionName}");
|
||||
// FText::Format() is slow, so we cache this to save on performance
|
||||
this->CachedNodeTitle.SetCachedText(FText::Format(LocFormat, Args), this);
|
||||
}
|
||||
|
||||
return this->CachedNodeTitle;
|
||||
}
|
||||
|
||||
FText UK2Node_ComboAction::GetTooltipText() const
|
||||
{
|
||||
if (CachedTooltip.IsOutOfDate(this))
|
||||
{
|
||||
// FText::Format() is slow, so we cache this to save on performance
|
||||
CachedTooltip.SetCachedText(FText::Format(NSLOCTEXT("K2Node", "ComboAction_Tooltip", "Event for when the combo action {0} is activated or released.\nBoth execution pins might fire on the same frame if an action\nwas buffered during a release action, but \"Activated\" will\nalways happen before \"Released\"."), FText::FromName(this->ComboAction->GetFName())), this);
|
||||
}
|
||||
return CachedTooltip;
|
||||
}
|
||||
|
||||
FSlateIcon UK2Node_ComboAction::GetIconAndTint(FLinearColor &OutColor) const
|
||||
{
|
||||
static FSlateIcon Icon(FAppStyle::GetAppStyleSetName(), "GraphEditor.Event_16x");
|
||||
return Icon;
|
||||
}
|
||||
|
||||
bool UK2Node_ComboAction::IsCompatibleWithGraph(UEdGraph const *Graph) const
|
||||
{
|
||||
// This node expands into event nodes and must be placed in a Ubergraph
|
||||
EGraphType const GraphType = Graph->GetSchema()->GetGraphType(Graph);
|
||||
bool bIsCompatible = (GraphType == EGraphType::GT_Ubergraph);
|
||||
|
||||
if (bIsCompatible)
|
||||
{
|
||||
UBlueprint *Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(Graph);
|
||||
|
||||
UEdGraphSchema_K2 const *K2Schema = Cast<UEdGraphSchema_K2>(Graph->GetSchema());
|
||||
bool const bIsConstructionScript = (K2Schema != nullptr) ? UEdGraphSchema_K2::IsConstructionScript(Graph) : false;
|
||||
|
||||
bIsCompatible = (Blueprint != nullptr) && Blueprint->SupportsInputEvents() && !bIsConstructionScript && Super::IsCompatibleWithGraph(Graph);
|
||||
}
|
||||
return bIsCompatible;
|
||||
}
|
||||
|
||||
UObject *UK2Node_ComboAction::GetJumpTargetForDoubleClick() const
|
||||
{
|
||||
return const_cast<UObject *>(Cast<UObject>(this->ComboAction));
|
||||
}
|
||||
|
||||
void UK2Node_ComboAction::JumpToDefinition() const
|
||||
{
|
||||
GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(this->GetJumpTargetForDoubleClick());
|
||||
}
|
||||
|
||||
void UK2Node_ComboAction::ValidateNodeDuringCompilation(class FCompilerResultsLog &MessageLog) const
|
||||
{
|
||||
Super::ValidateNodeDuringCompilation(MessageLog);
|
||||
|
||||
if (!this->ComboAction)
|
||||
{
|
||||
MessageLog.Error(*LOCTEXT("ComboAction_ErrorFmt", "ComboActionEvent references invalid 'null' action for @@").ToString(), this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void UK2Node_ComboAction::ExpandNode(FKismetCompilerContext &CompilerContext, UEdGraph *SourceGraph)
|
||||
{
|
||||
Super::ExpandNode(CompilerContext, SourceGraph);
|
||||
|
||||
const UEdGraphSchema_K2 *Schema = CompilerContext.GetSchema();
|
||||
|
||||
// Create a temporary variable to copy Key in to
|
||||
UK2Node_TemporaryVariable *ComboActionObjectVar = CompilerContext.SpawnIntermediateNode<UK2Node_TemporaryVariable>(this, SourceGraph);
|
||||
ComboActionObjectVar->VariableType.PinCategory = UEdGraphSchema_K2::PC_Object;
|
||||
ComboActionObjectVar->VariableType.PinSubCategoryObject = UComboAction::StaticClass();
|
||||
ComboActionObjectVar->AllocateDefaultPins();
|
||||
|
||||
// Establish active pins
|
||||
struct ActivePinData
|
||||
{
|
||||
ActivePinData(UEdGraphPin *InPin, EComboActionTriggerEvent InTriggerEvent) : Pin(InPin), TriggerEvent(InTriggerEvent){}
|
||||
UEdGraphPin *Pin;
|
||||
EComboActionTriggerEvent TriggerEvent;
|
||||
};
|
||||
|
||||
TArray<ActivePinData> ActivePins;
|
||||
ForEachEventPinName([this, &ActivePins, &CompilerContext](EComboActionTriggerEvent Event, FName PinName)
|
||||
{
|
||||
UEdGraphPin *InputActionPin = this->FindPin(PinName, EEdGraphPinDirection::EGPD_Output);
|
||||
if (InputActionPin && InputActionPin->LinkedTo.Num() > 0)
|
||||
{
|
||||
ActivePins.Add(ActivePinData(InputActionPin, Event));
|
||||
}
|
||||
});
|
||||
|
||||
for(const ActivePinData &PinData : ActivePins)
|
||||
{
|
||||
UEdGraphPin *ComboActionPin = PinData.Pin;
|
||||
|
||||
if (ComboActionPin->LinkedTo.Num() > 0)
|
||||
{
|
||||
// Create the combo action event
|
||||
UK2Node_ComboActionEvent *ComboActionEvent = CompilerContext.SpawnIntermediateEventNode<UK2Node_ComboActionEvent>(this, ComboActionPin, SourceGraph);
|
||||
ComboActionEvent->CustomFunctionName = FName(*FString::Printf(TEXT("ComboActionEvent_%s_%s"), *this->GetActionName().ToString(), *ComboActionEvent->GetName()));
|
||||
ComboActionEvent->ComboAction = this->ComboAction;
|
||||
ComboActionEvent->TriggerEvent = PinData.TriggerEvent;
|
||||
ComboActionEvent->EventReference.SetExternalDelegateMember(FName(TEXT("ComboActionHandlerDynamicSignature__DelegateSignature")));
|
||||
ComboActionEvent->bInternalEvent = true;
|
||||
ComboActionEvent->AllocateDefaultPins();
|
||||
|
||||
// Create assignment nodes to assign the key
|
||||
UK2Node_AssignmentStatement *ComboActionObjectInitialize = CompilerContext.SpawnIntermediateNode<UK2Node_AssignmentStatement>(this, SourceGraph);
|
||||
ComboActionObjectInitialize->AllocateDefaultPins();
|
||||
Schema->TryCreateConnection(ComboActionObjectVar->GetVariablePin(), ComboActionObjectInitialize->GetVariablePin());
|
||||
Schema->TryCreateConnection(ComboActionObjectInitialize->GetValuePin(), ComboActionEvent->FindPinChecked(COMBO_ACTION_OBJECT_PIN_NAME));
|
||||
|
||||
// Connect the events to the assign key nodes
|
||||
Schema->TryCreateConnection(Schema->FindExecutionPin(*ComboActionEvent, EGPD_Output), ComboActionObjectInitialize->GetExecPin());
|
||||
|
||||
// Move the original event connections to the then pin of the key assign
|
||||
CompilerContext.MovePinLinksToIntermediate(*ComboActionPin, *ComboActionObjectInitialize->GetThenPin());
|
||||
|
||||
// Move the original event variable connections to the intermediate nodes
|
||||
CompilerContext.MovePinLinksToIntermediate(*this->FindPin(COMBO_ACTION_OBJECT_PIN_NAME), *ComboActionObjectVar->GetVariablePin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UK2Node_ComboAction::GetMenuActions(FBlueprintActionDatabaseRegistrar &ActionRegistrar) const
|
||||
{
|
||||
auto CustomizeComboActionNodeLambda = [](UEdGraphNode *NewNode, bool bIsTemplateNode, TWeakObjectPtr<const UComboAction> Action)
|
||||
{
|
||||
UK2Node_ComboAction *ComboActionNode = CastChecked<UK2Node_ComboAction>(NewNode);
|
||||
ComboActionNode->ComboAction = Action.Get();
|
||||
};
|
||||
|
||||
// Do a first time registration using the node's class to pull in all existing actions
|
||||
if (ActionRegistrar.IsOpenForRegistration(GetClass()))
|
||||
{
|
||||
IAssetRegistry &AssetRegistry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")).Get();
|
||||
|
||||
static bool bRegisterOnce = true;
|
||||
if (bRegisterOnce)
|
||||
{
|
||||
bRegisterOnce = false;
|
||||
if (AssetRegistry.IsLoadingAssets())
|
||||
{
|
||||
AssetRegistry.OnFilesLoaded().AddLambda([]()
|
||||
{
|
||||
FBlueprintActionDatabase::Get().RefreshClassActions(StaticClass());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TArray<FAssetData> ActionAssets;
|
||||
AssetRegistry.GetAssetsByClass(UComboAction::StaticClass()->GetClassPathName(), ActionAssets, true);
|
||||
for (const FAssetData &ActionAsset : ActionAssets)
|
||||
{
|
||||
UBlueprintNodeSpawner *NodeSpawner = UBlueprintNodeSpawner::Create(GetClass());
|
||||
check(NodeSpawner != nullptr);
|
||||
|
||||
if (FPackageName::GetPackageMountPoint(ActionAsset.PackageName.ToString()) != NAME_None)
|
||||
{
|
||||
if (const UComboAction *Action = Cast<const UComboAction>(ActionAsset.GetAsset()))
|
||||
{
|
||||
NodeSpawner->CustomizeNodeDelegate = UBlueprintNodeSpawner::FCustomizeNodeDelegate::CreateStatic(CustomizeComboActionNodeLambda, TWeakObjectPtr<const UComboAction>(Action));
|
||||
ActionRegistrar.AddBlueprintAction(Action, NodeSpawner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (const UComboAction *Action = Cast<const UComboAction>(ActionRegistrar.GetActionKeyFilter()))
|
||||
{
|
||||
// If this is a specific UComboAction asset update it.
|
||||
UBlueprintNodeSpawner *NodeSpawner = UBlueprintNodeSpawner::Create(GetClass());
|
||||
check(NodeSpawner != nullptr);
|
||||
|
||||
NodeSpawner->CustomizeNodeDelegate = UBlueprintNodeSpawner::FCustomizeNodeDelegate::CreateStatic(CustomizeComboActionNodeLambda, TWeakObjectPtr<const UComboAction>(Action));
|
||||
ActionRegistrar.AddBlueprintAction(Action, NodeSpawner);
|
||||
}
|
||||
}
|
||||
|
||||
FText UK2Node_ComboAction::GetMenuCategory() const
|
||||
{
|
||||
static FNodeTextCache CachedCategory;
|
||||
if (CachedCategory.IsOutOfDate(this))
|
||||
{
|
||||
// FText::Format() is slow, so we cache this to save on performance
|
||||
CachedCategory.SetCachedText(FEditorCategoryUtils::BuildCategoryString(FCommonEditorCategory::Input, LOCTEXT("ActionMenuCategory", "Combo Action Events")), this); // TODO: Rename Action Events once old action system is removed
|
||||
}
|
||||
return CachedCategory;
|
||||
}
|
||||
|
||||
FBlueprintNodeSignature UK2Node_ComboAction::GetSignature() const
|
||||
{
|
||||
FBlueprintNodeSignature NodeSignature = Super::GetSignature();
|
||||
NodeSignature.AddKeyValue(GetActionName().ToString());
|
||||
|
||||
return NodeSignature;
|
||||
}
|
||||
|
||||
TSharedPtr<FEdGraphSchemaAction> UK2Node_ComboAction::GetEventNodeAction(const FText &ActionCategory)
|
||||
{
|
||||
// TODO: Custom EdGraphSchemaAction required?
|
||||
TSharedPtr<FEdGraphSchemaAction_K2InputAction> EventNodeAction = MakeShareable(new FEdGraphSchemaAction_K2InputAction(ActionCategory, GetNodeTitle(ENodeTitleType::EditableTitle), GetTooltipText(), 0));
|
||||
EventNodeAction->NodeTemplate = this;
|
||||
return EventNodeAction;
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@@ -0,0 +1,34 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#include "K2Node_ComboActionEvent.h"
|
||||
|
||||
#include "ComboInputTriggers.h"
|
||||
#include "Events/ComboActionDelegateBinding.h"
|
||||
|
||||
#include UE_INLINE_GENERATED_CPP_BY_NAME(K2Node_ComboActionEvent)
|
||||
|
||||
|
||||
UK2Node_ComboActionEvent::UK2Node_ComboActionEvent(const FObjectInitializer &ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
bInternalEvent = true;
|
||||
TriggerEvent = EComboActionTriggerEvent::None;
|
||||
}
|
||||
|
||||
UClass *UK2Node_ComboActionEvent::GetDynamicBindingClass() const
|
||||
{
|
||||
return UComboActionDelegateBinding::StaticClass();
|
||||
}
|
||||
|
||||
void UK2Node_ComboActionEvent::RegisterDynamicBinding(UDynamicBlueprintBinding *BindingObject) const
|
||||
{
|
||||
UComboActionDelegateBinding *ComboActionBindingObject = CastChecked<UComboActionDelegateBinding>(BindingObject);
|
||||
|
||||
FBlueprintComboActionBinding Binding;
|
||||
Binding.FunctionNameToBind = this->CustomFunctionName;
|
||||
Binding.ComboAction = this->ComboAction;
|
||||
Binding.TriggerEvent = this->TriggerEvent;
|
||||
|
||||
ComboActionBindingObject->ComboActionDelegateBindings.Add(Binding);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include "ComboInputTriggers.h"
|
||||
#include "K2Node_Event.h"
|
||||
|
||||
#include "K2Node_ComboActionEvent.generated.h"
|
||||
|
||||
|
||||
/**
|
||||
* Blueprint event node created for each UComboAction data asset, which is called
|
||||
* when the ComboManagerComponent activates the associated action.
|
||||
*/
|
||||
UCLASS()
|
||||
class COMBOINPUTNODES_API UK2Node_ComboActionEvent : public UK2Node_Event
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UK2Node_ComboActionEvent(const FObjectInitializer &ObjectInitializer);
|
||||
|
||||
UPROPERTY()
|
||||
TObjectPtr<const class UComboAction> ComboAction;
|
||||
|
||||
UPROPERTY()
|
||||
EComboActionTriggerEvent TriggerEvent;
|
||||
|
||||
//~ Begin UK2Node Interface
|
||||
virtual UClass *GetDynamicBindingClass() const override;
|
||||
virtual void RegisterDynamicBinding(UDynamicBlueprintBinding *BindingObject) const override;
|
||||
//~ End UK2Node Interface
|
||||
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Modules/ModuleInterface.h"
|
||||
|
||||
|
||||
class FComboInputNodesModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Singleton-like access to this module's interface. This is just for convenience!
|
||||
* Beware of calling this during the shutdown phase, though. Your module might have been unloaded already.
|
||||
*
|
||||
* @return Returns singleton instance, loading the module on demand if needed
|
||||
*/
|
||||
static FComboInputNodesModule &Get()
|
||||
{
|
||||
return FModuleManager::LoadModuleChecked<FComboInputNodesModule>("ComboInputNodes");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if this module is loaded and ready. It is only valid to call Get() if IsAvailable() returns true.
|
||||
*
|
||||
* @return True if the module is loaded and ready to use
|
||||
*/
|
||||
static bool IsAvailable()
|
||||
{
|
||||
return FModuleManager::Get().IsModuleLoaded("ComboInputNodes");
|
||||
}
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "K2Node.h"
|
||||
#include "K2Node_EventNodeInterface.h"
|
||||
#include "EdGraph/EdGraphNodeUtils.h"
|
||||
|
||||
#include "K2Node_ComboAction.generated.h"
|
||||
|
||||
|
||||
class UInputAction;
|
||||
enum class ETriggerEvent : uint8;
|
||||
namespace ENodeTitleType { enum Type : int; }
|
||||
struct FBlueprintNodeSignature;
|
||||
|
||||
class FBlueprintActionDatabaseRegistrar;
|
||||
class FKismetCompilerContext;
|
||||
|
||||
|
||||
UCLASS()
|
||||
class COMBOINPUTNODES_API UK2Node_ComboAction : public UK2Node, public IK2Node_EventNodeInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UK2Node_ComboAction(const FObjectInitializer &ObjectInitializer) : Super(ObjectInitializer){}
|
||||
|
||||
UPROPERTY() TObjectPtr<const class UComboAction> ComboAction;
|
||||
|
||||
//~ Begin UEdGraphNode Interface.
|
||||
virtual void AllocateDefaultPins() override;
|
||||
virtual FLinearColor GetNodeTitleColor() const override;
|
||||
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
||||
virtual FText GetTooltipText() const override;
|
||||
virtual FSlateIcon GetIconAndTint(FLinearColor &OutColor) const override;
|
||||
virtual bool IsCompatibleWithGraph(UEdGraph const *Graph) const override;
|
||||
virtual UObject* GetJumpTargetForDoubleClick() const override;
|
||||
virtual void JumpToDefinition() const override;
|
||||
//~ End UEdGraphNode Interface.
|
||||
|
||||
//~ Begin UK2Node Interface
|
||||
virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog &MessageLog) const override;
|
||||
virtual bool ShouldShowNodeProperties() const override { return true; }
|
||||
virtual void ExpandNode(FKismetCompilerContext &CompilerContext, UEdGraph *SourceGraph) override;
|
||||
virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar &ActionRegistrar) const override;
|
||||
virtual FText GetMenuCategory() const override;
|
||||
virtual bool CanUserEditPinAdvancedViewFlag() const override { return true; }
|
||||
virtual FBlueprintNodeSignature GetSignature() const override;
|
||||
//~ End UK2Node Interface
|
||||
|
||||
//~ Begin IK2Node_EventNodeInterface Interface.
|
||||
virtual TSharedPtr<FEdGraphSchemaAction> GetEventNodeAction(const FText &ActionCategory) override;
|
||||
//~ End IK2Node_EventNodeInterface Interface.
|
||||
|
||||
private:
|
||||
FName GetActionName() const;
|
||||
|
||||
/** Constructing FText strings can be costly, so we cache the node's title/tooltip */
|
||||
FNodeTextCache CachedTooltip;
|
||||
FNodeTextCache CachedNodeTitle;
|
||||
};
|
||||
Reference in New Issue
Block a user