Files
UnrealEngineUWP/Engine/Source/Runtime/InteractiveToolsFramework/Public/InteractiveCommand.h
Ryan Schmidt 6032c02f0e ModelingMode: add Delete command for current Mesh Selection
ToolsFramework:
add UInteractiveCommand and UInteractiveCommandArguments types, base classes for 'interactive commands' which are intended to be used for atomic actions, ie stateless, no user interaction, etc
ModelingComponents:
add UGeometrySelectionEditCommand/Arguments, this is a UInteractiveCommand that uses a FGeometrySelection as an argument
add UGeometrySelectionManager::CanExecuteSelectionCommand() and ExecuteSelectionCommand()

MeshModelingTools:
add UDeleteGeometrySelectionCommand, deletes selected mesh geometry by converting input selection to list of triangles

ModelingToolsEditorMode:
add Delete command to ModelingMode and UI. ModelingToolsEditorMode currently is keeping active command set alive via new UModelingToolsEditorMode::ModelingModeCommands member.

#rb none
#preflight 62d195b9a66919b6701d89a8

[CL 21113757 by Ryan Schmidt in ue5-main branch]
2022-07-15 13:49:13 -04:00

68 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ToolContextInterfaces.h"
#include "InteractiveCommand.generated.h"
class IToolsContextTransactionsAPI;
/**
* UInteractiveCommandArguments are arguments passed to a UInteractiveCommand.
* Subclasses of UInteractiveCommand will generally be paired with subclasses of UInteractiveCommandArguments.
*
* The base UInteractiveCommandArguments provides support for transactions via
* a IToolsContextTransactionsAPI
*/
UCLASS()
class INTERACTIVETOOLSFRAMEWORK_API UInteractiveCommandArguments : public UObject
{
GENERATED_BODY()
public:
virtual void SetTransactionsAPI(IToolsContextTransactionsAPI* TransactionsAPIIn) { TransactionsAPI = TransactionsAPIIn; }
virtual bool HasTransactionsAPI() const { return TransactionsAPI != nullptr; }
virtual IToolsContextTransactionsAPI* GetTransactionsAPI() const { return TransactionsAPI; }
protected:
IToolsContextTransactionsAPI* TransactionsAPI = nullptr;
};
/**
* A UInteractiveCommand is an atomic action that can be executed via some user interaction.
* For example clicking a button that deletes an active selection can be considered an Interactive Command.
* This differs from an Interactive Tool in that there is no ongoing user interaction once the
* command has been initiated.
*/
UCLASS(Abstract)
class INTERACTIVETOOLSFRAMEWORK_API UInteractiveCommand : public UObject
{
GENERATED_BODY()
public:
/**
* @return a short text string that can be used for the command in (eg) Editor transaction/undo toasts
*/
virtual FText GetCommandShortString() const
{
return FText();
}
/**
* @return true if it is safe to call ExecuteCommand() with the given Arguments
*/
virtual bool CanExecuteCommand(UInteractiveCommandArguments* Arguments)
{
return false;
}
/**
* Execute the command with the given Arguments
*/
virtual void ExecuteCommand(UInteractiveCommandArguments* Arguments)
{
}
};