Files
UnrealEngineUWP/Engine/Source/Runtime/InteractiveToolsFramework/Public/InteractiveToolActionSet.h
Bryan sefcik b4a6e947d8 Ran IWYU on Public headers under Engine/Source/Runtime/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21065896 by bryan.sefcik
#preflight 62d4b1a5a6141b6adfb0c892
#jira

#ROBOMERGE-OWNER: Bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21150156 via CL 21151754 via CL 21154719
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)
#ROBOMERGE-CONFLICT from-shelf

[CL 21181076 by Bryan sefcik in ue5-main branch]
2022-07-20 11:31:36 -04:00

121 lines
3.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/Array.h"
#include "Containers/UnrealString.h"
#include "CoreMinimal.h"
#include "GenericPlatform/GenericApplication.h"
#include "HAL/Platform.h"
#include "InputCoreTypes.h"
#include "Internationalization/Text.h"
#include "Templates/Function.h"
class UClass;
class UInteractiveTool;
/**
* Standard Actions that can be shared across multiple Tools.
* The enum values are used as FInteractiveToolAction.ActionID.
* If you need to define your own values, start at BaseClientDefinedActionID
*/
enum class EStandardToolActions
{
IncreaseBrushSize = 100,
DecreaseBrushSize = 101,
ToggleWireframe = 102,
BaseClientDefinedActionID = 10000
};
/**
* FInteractiveToolAction is returned by a UInteractiveTool to represent
* an "Action" the Tool can execute.
*/
struct INTERACTIVETOOLSFRAMEWORK_API FInteractiveToolAction
{
/** Which type of UInteractiveTool this Action can be applied to*/
const UClass* ClassType;
/** Identifier for this Action */
int32 ActionID;
/** Internal name for this Action */
FString ActionName;
/** Short name for this Action */
FText ShortName;
/** Descriptive name for this Action */
FText Description;
/** Suggested modifier keys for this Action */
EModifierKey::Type DefaultModifiers;
/** Suggested keybinding for this Action. */
FKey DefaultKey;
/** Call this function to execute the Action */
TFunction<void()> OnAction;
FInteractiveToolAction()
{
ClassType = nullptr;
ActionID = 0;
}
FInteractiveToolAction(const UClass* ClassTypeIn, int32 ActionIDIn,
const FString& ActionNameIn, const FText& ShortNameIn, const FText& DescriptionIn,
EModifierKey::Type DefaultModifiersIn, const FKey& DefaultKeyIn )
{
ClassType = ClassTypeIn;
ActionID = ActionIDIn;
ActionName = ActionNameIn;
ShortName = ShortNameIn;
Description = DescriptionIn;
DefaultModifiers = DefaultModifiersIn;
DefaultKey = DefaultKeyIn;
}
};
/**
* FInteractiveToolActionSet maintains a list of FInteractiveToolAction.
* Each UInteractiveTool contains an instance of this class.
*/
class INTERACTIVETOOLSFRAMEWORK_API FInteractiveToolActionSet
{
public:
/**
* Register an Action with the ActionSet. This function is intended to be called by
* UInteractiveTool::RegisterActions() implementations
*/
void RegisterAction(UInteractiveTool* Tool, int32 ActionID,
const FString& ActionName, const FText& ShortUIName, const FText& DescriptionText,
EModifierKey::Type Modifiers, const FKey& ShortcutKey,
TFunction<void()> ActionFunction );
/**
* Find an existing Action by ID
* @return located Action, or nullptr if not found
*/
const FInteractiveToolAction* FindActionByID(int32 ActionID) const;
/**
* Return the internal list of registered Actions by adding to the OutActions array
*/
void CollectActions(TArray<FInteractiveToolAction>& OutActions) const;
/**
* Execute the action identified by ActionID
*/
void ExecuteAction(int32 ActionID) const;
protected:
TArray<FInteractiveToolAction> Actions;
};