Files
UnrealEngineUWP/Engine/Plugins/EnhancedInput/Source/InputEditor/Public/InputEditorModule.h
ben hoffman f180f2cf58 Add a name validator to player mappable setting names. This makes it easier to avoid mistakes and possibly stomping a key binding.
The "Name" here is the FName that will be used as a key to save each key mapping during serialization, so they should be unique for each key mapping that you want the player to be able to set.

#jira UE-177248
#preflight 63f4ef2290198dffba48f6ee
#rb benjamin.fox
#rb nate.strohmyer
#rnx

[CL 24344605 by ben hoffman in ue5-main branch]
2023-02-21 13:37:27 -05:00

106 lines
3.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Factories/Factory.h"
#include "IAssetTools.h"
#include "IAssetTypeActions.h"
#include "TickableEditorObject.h"
#include "InputEditorModule.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogEnhancedInputEditor, Log, All);
////////////////////////////////////////////////////////////////////
// FInputEditorModule
class UInputAction;
class SWindow;
class FInputEditorModule : public IModuleInterface, public FTickableEditorObject
{
public:
// IModuleInterface interface
virtual void StartupModule() override;
virtual void ShutdownModule() override;
// End IModuleInterface interface
// FTickableEditorObject interface
virtual void Tick(float DeltaTime) override;
virtual TStatId GetStatId() const override { RETURN_QUICK_DECLARE_CYCLE_STAT(FInputEditorModule, STATGROUP_Tickables); }
// End FTickableEditorObject interface
static EAssetTypeCategories::Type GetInputAssetsCategory() { return InputAssetsCategory; }
/** Returns true if the given name is in use by a player mappable key setting */
INPUTEDITOR_API static bool IsMappingNameInUse(const FName InName);
private:
void RegisterAssetTypeActions(IAssetTools& AssetTools, TSharedRef<IAssetTypeActions> Action)
{
AssetTools.RegisterAssetTypeActions(Action);
CreatedAssetTypeActions.Add(Action);
}
void OnMainFrameCreationFinished(TSharedPtr<SWindow> InRootWindow, bool bIsRunningStartupDialog);
/** Automatically upgrade the current project to use Enhanced Input if it is currently set to the legacy input classes. */
void AutoUpgradeDefaultInputClasses();
static EAssetTypeCategories::Type InputAssetsCategory;
TArray<TSharedPtr<IAssetTypeActions>> CreatedAssetTypeActions;
TSharedPtr<class FSlateStyleSet> StyleSet;
};
////////////////////////////////////////////////////////////////////
// Asset factories
UCLASS()
class INPUTEDITOR_API UInputMappingContext_Factory : public UFactory
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY(EditAnywhere, Category=InputMappingContext)
TSubclassOf<class UInputMappingContext> InputMappingContextClass;
virtual bool ConfigureProperties() override;
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
/** Set the array of initial actions that the resulting IMC should be populated with */
void SetInitialActions(TArray<TWeakObjectPtr<UInputAction>> InInitialActions);
protected:
/** An array of Input Actions that the mapping context should be populated with upon creation */
TArray<TWeakObjectPtr<UInputAction>> InitialActions;
};
UCLASS()
class INPUTEDITOR_API UInputAction_Factory : public UFactory
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY(EditAnywhere, Category=InputAction)
TSubclassOf<UInputAction> InputActionClass;
virtual bool ConfigureProperties() override;
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
};
UCLASS()
class INPUTEDITOR_API UPlayerMappableInputConfig_Factory : public UFactory
{
GENERATED_UCLASS_BODY()
public:
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
};
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
#include "CoreMinimal.h"
#include "IDetailsView.h"
#endif