Added enough code for event nodes to be created for each UComboAction class. Now to figure out how to make them actually fire.

This commit is contained in:
Jamie Greunbaum
2023-09-15 12:56:26 -04:00
parent 445895b77b
commit 5326c81528
21 changed files with 338 additions and 191 deletions
+1
View File
@@ -50,6 +50,7 @@ public class ComboInput : ModuleRules
"BlueprintGraph",
"GraphEditor",
"KismetCompiler",
}
);
@@ -70,6 +70,11 @@ void UComboManagerComponent::ActivateComboInput(const UComboInputAsset *Input)
{
this->BeginNodeTransition(ActionData.NextNode);
for (const FComboActionHandlerDynamicSignature &Binding : this->ComboActionEventBindings)
{
Binding.Execute(/*EComboActionTriggerEvent::Activated*/);
}
UE_LOG(LogComboManagerComponent, Verbose, TEXT("%s activated"), *ActionData.ComboAction->ActionName.ToString());
}
}
@@ -2,6 +2,10 @@
#include "Events/ComboActionDelegateBinding.h"
#include "EnhancedInputComponent.h"
#include "Components/ComboManagerComponent.h"
#include "GameFramework/PlayerController.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ComboActionDelegateBinding)
@@ -10,7 +14,23 @@ UComboActionDelegateBinding::UComboActionDelegateBinding(const FObjectInitialize
{
}
void UComboActionDelegateBinding::BindToComboManagerComponent(UComboManagerComponent *ComboManager, UObject *ObjectToBindTo) const
void UComboActionDelegateBinding::BindDynamicDelegates(UObject *InInstance) const
{
APlayerController *PlayerController = Cast<APlayerController>(InInstance);
if (!PlayerController)
{
return;
}
if (UComboManagerComponent *ComboManager = PlayerController->GetComponentByClass<UComboManagerComponent>())
{
for (const FBlueprintComboActionBinding &Binding : this->ComboActionDelegateBindings)
{
// Get the function we want to bind
if (UFunction *FunctionToBind = InInstance->GetClass()->FindFunctionByName(Binding.FunctionNameToBind))
{
ComboManager->BindAction(InInstance, Binding.FunctionNameToBind);
}
}
}
}
@@ -7,6 +7,7 @@
#include "BlueprintEditorSettings.h"
#include "BlueprintNodeSpawner.h"
#include "ComboInputAssets.h"
#include "ComboInputTriggers.h"
#include "EdGraphSchema_K2_Actions.h"
#include "Editor.h"
#include "EditorCategoryUtils.h"
@@ -21,9 +22,6 @@
#include "Modules/ModuleManager.h"
#include "Styling/AppStyle.h"
#define ACTIVATED_PIN_NAME TEXT("Activated")
#define COMBO_ACTION_PIN_NAME TEXT("Combo Action")
#include UE_INLINE_GENERATED_CPP_BY_NAME(K2Node_ComboAction)
#define LOCTEXT_NAMESPACE "K2Node_ComboAction"
@@ -44,14 +42,14 @@ UK2Node_ComboAction::UK2Node_ComboAction(const FObjectInitializer &ObjectInitial
{
}
void ForEachEventPinName(TFunctionRef<void(ETriggerEvent Event, FName PinName)> PinLambda)
void ForEachEventPinName(TFunctionRef<void(EComboActionTriggerEvent Event, FName PinName)> PinLambda)
{
UEnum* EventEnum = StaticEnum<ETriggerEvent>();
UEnum *EventEnum = StaticEnum<EComboActionTriggerEvent>();
for (int32 i = 0; i < EventEnum->NumEnums() - 1; ++i)
{
if (!EventEnum->HasMetaData(TEXT("Hidden"), i))
{
PinLambda(ETriggerEvent(EventEnum->GetValueByIndex(i)), *EventEnum->GetNameStringByIndex(i));
PinLambda(EComboActionTriggerEvent(EventEnum->GetValueByIndex(i)), *EventEnum->GetNameStringByIndex(i));
}
}
}
@@ -60,66 +58,19 @@ void UK2Node_ComboAction::AllocateDefaultPins()
{
this->PreloadObject((UObject*)this->ComboAction);
UEdGraphPin *TriggeredPin = this->CreatePin(EGPD_Output, UEdGraphSchema_K2::PC_Exec, TEXT("Triggered"));
TriggeredPin->PinToolTip = TEXT("Executed when this combo action is first activated.");
// Add a special tooltip and display name for pins that are unsupported
if (UE::Input::bComboActionShouldWarnOnUnsupportedInputPin)
ForEachEventPinName([this](EComboActionTriggerEvent Event, FName PinName)
{
static const FText UnsuportedTooltip = LOCTEXT("UnsupportedTooltip", "\n\nThis trigger event is not supported by the action! Add a supported trigger to enable this pin.");
TriggeredPin->PinToolTip += UnsuportedTooltip.ToString();
TriggeredPin->PinFriendlyName = FText::Format(LOCTEXT("UnsupportedPinFriendlyName", "(Unsupported) {0}"), FText::FromName(TriggeredPin->GetFName()));
}
HideEventPins(nullptr);
const UEdGraphSchema_K2 *Schema = GetDefault<UEdGraphSchema_K2>();
this->AdvancedPinDisplay = ENodeAdvancedPins::Hidden;
UEdGraphPin *ActivatedValuePin = this->CreatePin(EGPD_Output, UEdGraphSchema_K2::PC_Boolean, UEdGraphSchema_K2::PC_Boolean, ACTIVATED_PIN_NAME);
ActivatedValuePin->bAdvancedView = true;
Schema->SetPinAutogeneratedDefaultValue(ActivatedValuePin, TEXT("true"));
static const UEnum *EventEnum = StaticEnum<EComboActionTriggerEvent>();
if(this->ComboAction)
{
UEdGraphPin *ActionPin = CreatePin(EGPD_Output, UEdGraphSchema_K2::PC_Object, this->ComboAction->GetClass(), COMBO_ACTION_PIN_NAME);
ActionPin->DefaultObject = const_cast<UObject*>(Cast<UObject>(ComboAction));
ActionPin->DefaultValue = ComboAction->GetName();
Schema->ConstructBasicPinTooltip(*ActionPin, LOCTEXT("InputActionPinDescription", "The input action that caused this event to fire"), ActionPin->PinToolTip);
}
UEdGraphPin *NewPin = CreatePin(EEdGraphPinDirection::EGPD_Output, UEdGraphSchema_K2::PC_Exec, PinName);
NewPin->PinToolTip = EventEnum->GetToolTipTextByIndex(EventEnum->GetIndexByValue(static_cast<uint8>(Event))).ToString();
});
this->AdvancedPinDisplay = ENodeAdvancedPins::NoPins;
Super::AllocateDefaultPins();
}
void UK2Node_ComboAction::HideEventPins(UEdGraphPin *RetainPin)
{
//// Gather pins
//const ETriggerEventsSupported SupportedTriggerEvents = GetDefault<UBlueprintEditorSettings>()->bEnableInputTriggerSupportWarnings && InputAction ? InputAction->GetSupportedTriggerEvents() : ETriggerEventsSupported::All;
//// Hide any event pins that are not supported by this Action's triggers in the advanced view
//ForEachEventPinName([this, SupportedTriggerEvents](ETriggerEvent Event, FName PinName)
//{
// if (UEdGraphPin* Pin = FindPin(PinName))
// {
// const bool bIsSupported = UInputTrigger::IsSupportedTriggerEvent(SupportedTriggerEvents, Event);
//
// Pin->bAdvancedView = !bIsSupported;
// }
//});
}
void UK2Node_ComboAction::PostReconstructNode()
{
Super::PostReconstructNode();
HideEventPins(nullptr);
}
void UK2Node_ComboAction::PinConnectionListChanged(UEdGraphPin* Pin)
{
Super::PinConnectionListChanged(Pin);
HideEventPins(Pin);
}
FLinearColor UK2Node_ComboAction::GetNodeTitleColor() const
{
return GetDefault<UGraphEditorSettings>()->EventNodeTitleColor;
@@ -127,7 +78,7 @@ FLinearColor UK2Node_ComboAction::GetNodeTitleColor() const
FName UK2Node_ComboAction::GetActionName() const
{
return this->ComboAction ? this->ComboAction->GetFName() : FName();
return this->ComboAction ? this->ComboAction->ActionName : FName();
}
FText UK2Node_ComboAction::GetNodeTitle(ENodeTitleType::Type TitleType) const
@@ -210,135 +161,69 @@ void UK2Node_ComboAction::ValidateNodeDuringCompilation(class FCompilerResultsLo
}
}
void UK2Node_ComboAction::ExpandNode(FKismetCompilerContext& CompilerContext, UEdGraph* SourceGraph)
void UK2Node_ComboAction::ExpandNode(FKismetCompilerContext &CompilerContext, UEdGraph *SourceGraph)
{
Super::ExpandNode(CompilerContext, SourceGraph);
if(!this->ComboAction)
{
static const FText InvalidActionWarning = LOCTEXT("InvalidInputActionDuringExpansion", "@@ does not have a valid Input Action asset!!");
static const FText InvalidActionWarning = LOCTEXT("InvalidComboActionDuringExpansion", "@@ does not have a valid Combo Action asset!!");
CompilerContext.MessageLog.Warning(*InvalidActionWarning.ToString(), this);
return;
}
//// Establish active pins
//struct ActivePinData
//{
// ActivePinData(UEdGraphPin* InPin, ETriggerEvent InTriggerEvent) : Pin(InPin), TriggerEvent(InTriggerEvent) {}
// UEdGraphPin* Pin;
// ETriggerEvent TriggerEvent;
//};
// Establish active pins
struct ActivePinData
{
ActivePinData(UEdGraphPin* InPin, EComboActionTriggerEvent InTriggerEvent) : Pin(InPin), TriggerEvent(InTriggerEvent) {}
UEdGraphPin* Pin;
EComboActionTriggerEvent TriggerEvent;
};
//const ETriggerEventsSupported SupportedTriggerEvents = GetDefault<UBlueprintEditorSettings>()->bEnableInputTriggerSupportWarnings ? this->ComboAction->GetSupportedTriggerEvents() : ETriggerEventsSupported::All;
//
//TArray<ActivePinData> ActivePins;
//ForEachEventPinName([this, &ActivePins, &SupportedTriggerEvents, &CompilerContext](ETriggerEvent Event, FName PinName)
//{
// UEdGraphPin* ComboActionPin = FindPin(PinName, EEdGraphPinDirection::EGPD_Output);
// if (ComboActionPin && ComboActionPin->LinkedTo.Num() > 0)
// {
// ActivePins.Add(ActivePinData(ComboActionPin, Event));
// // Check if this exec pin is supported!
// if (UE::Input::bShouldWarnOnUnsupportedInputPin && !UInputTrigger::IsSupportedTriggerEvent(SupportedTriggerEvents, Event))
// {
// CompilerContext.MessageLog.Warning(*FText::Format(LOCTEXT("UnsuportedEventTypeOnAction", "'{0}'on @@ may not be executed because it is not a supported trigger on this action!"), ComboActionPin->GetDisplayName()).ToString(), this);
// }
// }
//});
TArray<ActivePinData> ActivePins;
ForEachEventPinName([this, &ActivePins, &CompilerContext](EComboActionTriggerEvent Event, FName PinName)
{
UEdGraphPin *ComboActionPin = FindPin(PinName, EEdGraphPinDirection::EGPD_Output);
if (ComboActionPin && ComboActionPin->LinkedTo.Num() > 0)
{
ActivePins.Add(ActivePinData(ComboActionPin, Event));
}
});
//if (ActivePins.Num() == 0)
//{
// return;
//}
if (ActivePins.Num() == 0)
{
return;
}
//// Bind all active pins to their action delegate
//const UEdGraphSchema_K2* Schema = CompilerContext.GetSchema();
// Bind all active pins to their action delegate
const UEdGraphSchema_K2 *Schema = CompilerContext.GetSchema();
//auto CreateComboActionEvent = [this, &CompilerContext, &SourceGraph](UEdGraphPin* Pin, ETriggerEvent TriggerEvent) -> UK2Node_ComboActionEvent*
//{
// if (!this->ComboAction)
// {
// return nullptr;
// }
auto CreateComboActionEvent = [this, &CompilerContext, &SourceGraph](UEdGraphPin *Pin, EComboActionTriggerEvent TriggerEvent) -> UK2Node_ComboActionEvent *
{
if (!this->ComboAction)
{
return nullptr;
}
// UK2Node_ComboActionEvent* InputActionEvent = CompilerContext.SpawnIntermediateEventNode<UK2Node_ComboActionEvent>(this, Pin, SourceGraph);
// InputActionEvent->CustomFunctionName = FName(*FString::Printf(TEXT("InpActEvt_%s_%s"), *GetActionName().ToString(), *InputActionEvent->GetName()));
// InputActionEvent->ComboAction = this->ComboAction;
// InputActionEvent->TriggerEvent = TriggerEvent;
// InputActionEvent->EventReference.SetExternalDelegateMember(FName(TEXT("ComboActionHandlerDynamicSignature__DelegateSignature")));
// InputActionEvent->AllocateDefaultPins();
// return InputActionEvent;
//};
UK2Node_ComboActionEvent *ComboActionEvent = CompilerContext.SpawnIntermediateEventNode<UK2Node_ComboActionEvent>(this, Pin, SourceGraph);
ComboActionEvent->CustomFunctionName = FName(*FString::Printf(TEXT("ComboActionEvent_%s_%s"), *this->ComboAction->GetName(), *ComboActionEvent->GetName()));
ComboActionEvent->ComboAction = this->ComboAction;
ComboActionEvent->TriggerEvent = TriggerEvent;
ComboActionEvent->EventReference.SetExternalDelegateMember(FName(TEXT("ComboActionHandlerDynamicSignature__DelegateSignature")));
ComboActionEvent->AllocateDefaultPins();
return ComboActionEvent;
};
//// Create temporary variables to copy ActionValue and ElapsedSeconds into
//UK2Node_TemporaryVariable* ActionValueVar = CompilerContext.SpawnIntermediateNode<UK2Node_TemporaryVariable>(this, SourceGraph);
//ActionValueVar->VariableType.PinCategory = UK2Node_GetInputActionValue::GetValueCategory(this->ComboAction);
//ActionValueVar->VariableType.PinSubCategory = UK2Node_GetInputActionValue::GetValueSubCategory(this->ComboAction);
//ActionValueVar->VariableType.PinSubCategoryObject = UK2Node_GetInputActionValue::GetValueSubCategoryObject(this->ComboAction);
//ActionValueVar->AllocateDefaultPins();
for (ActivePinData &PinData : ActivePins)
{
UEdGraphPin *EachPin = PinData.Pin;
UK2Node_ComboActionEvent *ComboActionEvent = CreateComboActionEvent(EachPin, PinData.TriggerEvent);
//UK2Node_TemporaryVariable* ElapsedSecondsVar = CompilerContext.SpawnIntermediateNode<UK2Node_TemporaryVariable>(this, SourceGraph);
//ElapsedSecondsVar->VariableType.PinCategory = UEdGraphSchema_K2::PC_Real;
//ElapsedSecondsVar->VariableType.PinSubCategory = UEdGraphSchema_K2::PC_Double;
//ElapsedSecondsVar->AllocateDefaultPins();
//UK2Node_TemporaryVariable* TriggeredSecondsVar = CompilerContext.SpawnIntermediateNode<UK2Node_TemporaryVariable>(this, SourceGraph);
//TriggeredSecondsVar->VariableType.PinCategory = UEdGraphSchema_K2::PC_Real;
//TriggeredSecondsVar->VariableType.PinSubCategory = UEdGraphSchema_K2::PC_Double;
//TriggeredSecondsVar->AllocateDefaultPins();
//UK2Node_TemporaryVariable* InputActionVar = CompilerContext.SpawnIntermediateNode<UK2Node_TemporaryVariable>(this, SourceGraph);
//InputActionVar->VariableType.PinCategory = UEdGraphSchema_K2::PC_Object;
//InputActionVar->VariableType.PinSubCategoryObject = this->ComboAction->GetClass();
//InputActionVar->AllocateDefaultPins();
//for (ActivePinData& PinData : ActivePins)
//{
// UEdGraphPin* EachPin = PinData.Pin;
// UK2Node_ComboActionEvent *ComboActionEvent = CreateComboActionEvent(EachPin, PinData.TriggerEvent);
// if (!ComboActionEvent)
// {
// continue;
// }
// // Create assignment nodes to assign the action value
// UK2Node_AssignmentStatement* ActionValueInitialize = CompilerContext.SpawnIntermediateNode<UK2Node_AssignmentStatement>(this, SourceGraph);
// ActionValueInitialize->AllocateDefaultPins();
// Schema->TryCreateConnection(ActionValueVar->GetVariablePin(), ActionValueInitialize->GetVariablePin());
// Schema->TryCreateConnection(ActionValueInitialize->GetValuePin(), ComboActionEvent->FindPinChecked(ActionValuePinName));
// // Connect the events to the assign location nodes
// Schema->TryCreateConnection(Schema->FindExecutionPin(*ComboActionEvent, EGPD_Output), ActionValueInitialize->GetExecPin());
// // Create assignment nodes to assign the elapsed timers and input action
// UK2Node_AssignmentStatement* ElapsedSecondsInitialize = CompilerContext.SpawnIntermediateNode<UK2Node_AssignmentStatement>(this, SourceGraph);
// ElapsedSecondsInitialize->AllocateDefaultPins();
// Schema->TryCreateConnection(ElapsedSecondsVar->GetVariablePin(), ElapsedSecondsInitialize->GetVariablePin());
// Schema->TryCreateConnection(ElapsedSecondsInitialize->GetValuePin(), ComboActionEvent->FindPinChecked(TEXT("ElapsedTime")));
// UK2Node_AssignmentStatement* TriggeredSecondsInitialize = CompilerContext.SpawnIntermediateNode<UK2Node_AssignmentStatement>(this, SourceGraph);
// TriggeredSecondsInitialize->AllocateDefaultPins();
// Schema->TryCreateConnection(TriggeredSecondsVar->GetVariablePin(), TriggeredSecondsInitialize->GetVariablePin());
// Schema->TryCreateConnection(TriggeredSecondsInitialize->GetValuePin(), ComboActionEvent->FindPinChecked(TEXT("TriggeredTime")));
// UK2Node_AssignmentStatement* InputActionInitialize = CompilerContext.SpawnIntermediateNode<UK2Node_AssignmentStatement>(this, SourceGraph);
// InputActionInitialize->AllocateDefaultPins();
// Schema->TryCreateConnection(InputActionVar->GetVariablePin(), InputActionInitialize->GetVariablePin());
// Schema->TryCreateConnection(InputActionInitialize->GetValuePin(), ComboActionEvent->FindPinChecked(TEXT("SourceAction")));
//
// // Connect the assign location to the assign elapsed time nodes
// Schema->TryCreateConnection(ActionValueInitialize->GetThenPin(), ElapsedSecondsInitialize->GetExecPin());
// Schema->TryCreateConnection(ElapsedSecondsInitialize->GetThenPin(), TriggeredSecondsInitialize->GetExecPin());
// Schema->TryCreateConnection(TriggeredSecondsInitialize->GetThenPin(), InputActionInitialize->GetExecPin());
//
// // Move the original event connections to the then pin of the Input Action assign
// CompilerContext.MovePinLinksToIntermediate(*EachPin, *InputActionInitialize->GetThenPin());
// // Move the original event variable connections to the intermediate nodes
// CompilerContext.MovePinLinksToIntermediate(*FindPin(ActionValuePinName), *ActionValueVar->GetVariablePin());
// CompilerContext.MovePinLinksToIntermediate(*FindPin(ElapsedSecondsPinName), *ElapsedSecondsVar->GetVariablePin());
// CompilerContext.MovePinLinksToIntermediate(*FindPin(TriggeredSecondsPinName), *TriggeredSecondsVar->GetVariablePin());
// CompilerContext.MovePinLinksToIntermediate(*FindPin(InputActionPinName), *InputActionVar->GetVariablePin());
//}
if (!ComboActionEvent)
{
continue;
}
}
}
void UK2Node_ComboAction::GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const
@@ -2,6 +2,7 @@
#include "Events/K2Node_ComboActionEvent.h"
#include "ComboInputTriggers.h"
#include "Events/ComboActionDelegateBinding.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(K2Node_ComboActionEvent)
@@ -11,7 +12,7 @@ UK2Node_ComboActionEvent::UK2Node_ComboActionEvent(const FObjectInitializer &Obj
: Super(ObjectInitializer)
{
bInternalEvent = true;
//TriggerEvent = ETriggerEvent::None;
TriggerEvent = EComboActionTriggerEvent::None;
}
UClass *UK2Node_ComboActionEvent::GetDynamicBindingClass() const
@@ -24,9 +25,8 @@ void UK2Node_ComboActionEvent::RegisterDynamicBinding(UDynamicBlueprintBinding *
UComboActionDelegateBinding *ComboActionBindingObject = CastChecked<UComboActionDelegateBinding>(BindingObject);
FBlueprintComboActionBinding Binding;
Binding.InputAction = this->ComboAction;
//Binding.TriggerEvent = this->TriggerEvent;
Binding.FunctionNameToBind = this->CustomFunctionName;
Binding.TriggerEvent = this->TriggerEvent;
ComboActionBindingObject->ComboActionDelegateBindings.Add(Binding);
}
@@ -22,8 +22,8 @@ public:
UPROPERTY()
TObjectPtr<const class UComboAction> ComboAction;
//UPROPERTY()
// ETriggerEvent TriggerEvent;
UPROPERTY()
EComboActionTriggerEvent TriggerEvent;
//~ Begin UK2Node Interface
virtual UClass *GetDynamicBindingClass() const override;
@@ -0,0 +1,16 @@
// ©2022 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ComboInputTriggers.generated.h"
UENUM(BlueprintType, meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))
enum class EComboActionTriggerEvent : uint8
{
None = (0x0) UMETA(Hidden),
Activated = (1 << 0),
Released = (1 << 1),
};
ENUM_CLASS_FLAGS(EComboActionTriggerEvent)
@@ -5,12 +5,15 @@
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/DataAsset.h"
#include "ComboInputAssets.h"
#include "Events/ComboActionDelegateBinding.h"
#include "ComboManagerComponent.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogComboManagerComponent, Log, All);
DECLARE_DYNAMIC_DELEGATE/*_OneParam*/(FComboActionHandlerDynamicSignature/*, EComboActionTriggerEvent, TriggerEvent*/);
UCLASS(BlueprintType, ClassGroup=(Input), meta=(BlueprintSpawnableComponent))
class COMBOINPUT_API UComboManagerComponent : public UActorComponent
@@ -24,6 +27,13 @@ public:
UFUNCTION(BlueprintCallable)
void ActivateComboInput(const class UComboInputAsset *Input);
void BindAction(UObject *ObjectToBindTo, FName FunctionName)
{
FComboActionHandlerDynamicSignature Delegate;
Delegate.BindUFunction(ObjectToBindTo, FunctionName);
this->ComboActionEventBindings.Add(MoveTemp(Delegate));
}
protected:
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly)
TObjectPtr<const class UComboSequenceNode> DefaultStartNode;
@@ -47,6 +57,8 @@ private:
const class UComboSequenceNode *ActiveNode = nullptr;
const class UComboSequenceNode *PreviousNode = nullptr;
TArray<FComboActionHandlerDynamicSignature> ComboActionEventBindings;
TObjectPtr<class UInputBufferComponent> AttachedInputBuffer;
FTimerHandle FinishTransitionTimer;
@@ -2,8 +2,8 @@
#pragma once
#include "Engine/DynamicBlueprintBinding.h"
#include "InputTriggers.h"
#include "Engine/InputDelegateBinding.h"
#include "ComboInputTriggers.h"
#include "ComboActionDelegateBinding.generated.h"
@@ -14,9 +14,8 @@ struct COMBOINPUT_API FBlueprintComboActionBinding
GENERATED_BODY()
public:
UPROPERTY() TObjectPtr<const class UComboAction> InputAction = nullptr;
//UPROPERTY() ETriggerEvent TriggerEvent = ETriggerEvent::None;
UPROPERTY() FName FunctionNameToBind = NAME_None;
UPROPERTY() EComboActionTriggerEvent TriggerEvent = EComboActionTriggerEvent::None;
};
UCLASS()
@@ -26,7 +25,10 @@ class COMBOINPUT_API UComboActionDelegateBinding : public UDynamicBlueprintBindi
public:
UComboActionDelegateBinding(const FObjectInitializer &ObjectInitializer);
void BindToComboManagerComponent(class UComboManagerComponent *ComboManager, class UObject *ObjectToBindTo) const;
//~ Begin UDynamicBlueprintBinding Interface
virtual void BindDynamicDelegates(UObject *InInstance) const override;
//~ End UDynamicBlueprintBinding Interface
UPROPERTY() TArray<FBlueprintComboActionBinding> ComboActionDelegateBindings;
};
@@ -47,8 +47,6 @@ public:
virtual FText GetMenuCategory() const override;
virtual bool CanUserEditPinAdvancedViewFlag() const override { return true; }
virtual FBlueprintNodeSignature GetSignature() const override;
virtual void PostReconstructNode();
virtual void PinConnectionListChanged(UEdGraphPin *Pin);
//~ End UK2Node Interface
//~ Begin IK2Node_EventNodeInterface Interface.
@@ -57,7 +55,6 @@ public:
private:
FName GetActionName() const;
void HideEventPins(UEdGraphPin *RetainPin);
/** Constructing FText strings can be costly, so we cache the node's title/tooltip */
FNodeTextCache CachedTooltip;
@@ -26,6 +26,7 @@ public class ComboInputEditor : ModuleRules
"Core",
"CoreUObject",
"AssetTools",
"SlateCore"
}
);
@@ -4,8 +4,12 @@
#include "ComboInputAssets.h"
#include "ToolMenuSection.h"
#include "AssetTypeActions/AssetTypeActions_DataAsset.h"
#include "Interfaces/IPluginManager.h"
#include "Styling/SlateStyle.h"
#include "Styling/SlateStyleMacros.h"
#include "Styling/SlateStyleRegistry.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(ComboInputEditor)
@@ -113,15 +117,49 @@ UObject *UComboInputAsset_Factory::FactoryCreateNew(UClass *Class, UObject *InPa
class FComboInputSlateStyle final : public FSlateStyleSet
{
public:
FComboInputSlateStyle() : FSlateStyleSet("ComboInputEditor")
{
SetParentStyleName(FAppStyle::GetAppStyleSetName());
// The icons are located in /Engine/Plugins/ComboInput/Content/Editor/Slate/Icons
SetContentRoot(FPaths::EnginePluginsDir() / TEXT("ComboInput/Content/Editor/Slate"));
SetCoreContentRoot(FPaths::EngineContentDir() / TEXT("Slate"));
// Combo Input Editor icons
static const FVector2D Icon16 = FVector2D(16.0f, 16.0f);
static const FVector2D Icon64 = FVector2D(64.0f, 64.0f);
Set("ComboInputIcon_Small", new IMAGE_BRUSH_SVG("Icons/ComboInput_16", Icon16));
Set("ComboInputIcon_Large", new IMAGE_BRUSH_SVG("Icons/ComboInput_64", Icon64));
Set("ClassIcon.ComboAction", new IMAGE_BRUSH_SVG("Icons/ComboAction_16", Icon16));
Set("ClassThumbnail.ComboAction", new IMAGE_BRUSH_SVG("Icons/ComboAction_64", Icon64));
Set("ClassIcon.ComboSequenceNode", new IMAGE_BRUSH_SVG("Icons/ComboSequenceNode_16", Icon16));
Set("ClassThumbnail.ComboSequenceNode", new IMAGE_BRUSH_SVG("Icons/ComboSequenceNode_64", Icon64));
Set("ClassIcon.ComboInputAsset", new IMAGE_BRUSH_SVG("Icons/ComboInputAsset_16", Icon16));
Set("ClassThumbnail.ComboInputAsset", new IMAGE_BRUSH_SVG("Icons/ComboInputAsset_64", Icon64));
}
};
void FComboInputEditorModule::StartupModule()
{
// Register combo action asset
IAssetTools &AssetTools = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools").Get();
FComboInputEditorModule::ComboAssetsCategory = AssetTools.RegisterAdvancedAssetCategory(FName(TEXT("Input")), LOCTEXT("InputAssetsCategory", "Input"));
this->RegisterAssetTypeActions(AssetTools, MakeShareable(new FAssetTypeActions_ComboAction));
this->RegisterAssetTypeActions(AssetTools, MakeShareable(new FAssetTypeActions_ComboSequenceNode));
this->RegisterAssetTypeActions(AssetTools, MakeShareable(new FAssetTypeActions_ComboInputAsset));
// Make a new style set for Combo Input, which will register any custom icons for the types in this plugin
StyleSet = MakeShared<FComboInputSlateStyle>();
FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get());
}
void FComboInputEditorModule::ShutdownModule()
@@ -77,4 +77,6 @@ private:
static EAssetTypeCategories::Type ComboAssetsCategory;
TArray<TSharedPtr<IAssetTypeActions>> CreatedAssetTypeActions;
TSharedPtr<class FSlateStyleSet> StyleSet;
};