- Started work on giving UComboActions their own automatically-recognised events in Blueprints, just like UInputAssets have in the EnhancedInput plugin.

- Also gave the data assets a factory class and organised them into the Input category to make them look like a proper Unreal asset.
This commit is contained in:
Jamie Greunbaum
2023-09-12 01:39:23 -04:00
parent 3e71bb31ae
commit 445895b77b
10 changed files with 789 additions and 88 deletions
@@ -3,68 +3,78 @@
#pragma once
#include "Modules/ModuleManager.h"
#include "EdGraphUtilities.h"
#include "IAssetTools.h"
// #include "Interfaces/IHttpRequest.h"
#include "IAssetTypeActions.h"
#include "Factories/Factory.h"
#include "ComboInputEditor.generated.h"
UCLASS()
class COMBOINPUTEDITOR_API UComboAction_Factory : public UFactory
{
GENERATED_BODY()
public:
UComboAction_Factory(const class FObjectInitializer &ObjectInitializer);
UPROPERTY(EditAnywhere, Category="Combo Input")
TSubclassOf<class UComboAction> ComboActionClass;
virtual UObject *FactoryCreateNew(UClass *Class, UObject *InParent, FName Name, EObjectFlags Flags, UObject *Context, FFeedbackContext *Warn) override;
};
UCLASS()
class COMBOINPUTEDITOR_API UComboSequenceNode_Factory : public UFactory
{
GENERATED_BODY()
public:
UComboSequenceNode_Factory(const class FObjectInitializer &ObjectInitializer);
UPROPERTY(EditAnywhere, Category="Combo Input")
TSubclassOf<class UComboSequenceNode> ComboSequenceNodeClass;
virtual UObject *FactoryCreateNew(UClass *Class, UObject *InParent, FName Name, EObjectFlags Flags, UObject *Context, FFeedbackContext *Warn) override;
};
UCLASS()
class COMBOINPUTEDITOR_API UComboInputAsset_Factory : public UFactory
{
GENERATED_BODY()
public:
UComboInputAsset_Factory(const class FObjectInitializer &ObjectInitializer);
UPROPERTY(EditAnywhere, Category="Combo Input")
TSubclassOf<class UComboInputAsset> ComboInputAssetClass;
virtual UObject *FactoryCreateNew(UClass *Class, UObject *InParent, FName Name, EObjectFlags Flags, UObject *Context, FFeedbackContext *Warn) override;
};
// class FHttpModule;
// class FSlateStyleSet;
class FComboInputEditorModule : public IModuleInterface
{
public:
public:
static FComboInputEditorModule &Get() { return FModuleManager::LoadModuleChecked<FComboInputEditorModule>("ComboInputEditor"); }
static bool IsAvailable() { return FModuleManager::Get().IsModuleLoaded("ComboInputEditor"); }
/**
* 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 FComboInputEditorModule &Get()
{
return FModuleManager::LoadModuleChecked<FComboInputEditorModule>( "ComboInputEditor" );
}
/**
* 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("ComboInputEditor");
}
/* Called when the module is loaded */
virtual void StartupModule() override;
/* Called when the module is unloaded */
virtual void ShutdownModule() override;
private:
// void RegisterAssetTypeAction(IAssetTools& AssetTools, TSharedRef<IAssetTypeActions> Action);
// void OnGetResponse(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
// UFUNCTION() void SendHTTPGet();
// void PluginButtonClicked();
// void RegisterMenus();
static EAssetTypeCategories::Type GetInputAssetsCategory() { return FComboInputEditorModule::ComboAssetsCategory; }
private:
// TSharedPtr<class FUICommandList> PluginCommands;
// TSharedPtr<FSlateStyleSet> DialogueTreeSet;
// TSharedPtr<class FMounteaDialogueGraphAssetAction> MounteaDialogueGraphAssetActions;
// TSharedPtr<class FMounteaDialogueAdditionalDataAssetAction> MounteaDialogueAdditionalDataAssetActions;
// TSharedPtr<class FMounteaDialogueDecoratorAssetAction> MounteaDialogueDecoratorAssetAction;
// TSharedPtr<struct FGraphPanelNodeFactory> GraphPanelNodeFactory_MounteaDialogueGraph;
// TArray< TSharedPtr<IAssetTypeActions> > CreatedAssetTypeActions;
void RegisterAssetTypeActions(IAssetTools &AssetTools, TSharedRef<IAssetTypeActions> Action)
{
AssetTools.RegisterAssetTypeActions(Action);
CreatedAssetTypeActions.Add(Action);
}
// EAssetTypeCategories::Type MounteaDialogueGraphAssetCategoryBit;
// FHttpModule* Http;
static EAssetTypeCategories::Type ComboAssetsCategory;
// TArray<FName> RegisteredCustomClassLayouts;
// TArray<FName> RegisteredCustomPropertyTypeLayout;
};
TArray<TSharedPtr<IAssetTypeActions>> CreatedAssetTypeActions;
};