You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
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]
79 lines
2.1 KiB
C++
79 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "InteractiveCommand.h"
|
|
#include "Selection/GeometrySelector.h" // for FGeometrySelectionHandle
|
|
#include "SelectionEditInteractiveCommand.generated.h"
|
|
|
|
/**
|
|
* Arguments for a UGeometrySelectionEditCommand
|
|
*/
|
|
UCLASS()
|
|
class MODELINGCOMPONENTS_API UGeometrySelectionEditCommandArguments : public UInteractiveCommandArguments
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
FGeometrySelectionHandle SelectionHandle;
|
|
|
|
bool IsSelectionEmpty() const
|
|
{
|
|
return SelectionHandle.Selection == nullptr || SelectionHandle.Selection->IsEmpty();
|
|
}
|
|
|
|
bool IsMatchingType(FGeometryIdentifier::ETargetType TargetType, FGeometryIdentifier::EObjectType EngineType) const
|
|
{
|
|
return SelectionHandle.Identifier.TargetType == TargetType
|
|
|| SelectionHandle.Identifier.ObjectType == EngineType;
|
|
}
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
* UGeometrySelectionEditCommand is a command that edits geometry based on a selection.
|
|
* Requires a UGeometrySelectionEditCommandArguments
|
|
*/
|
|
UCLASS(Abstract)
|
|
class MODELINGCOMPONENTS_API UGeometrySelectionEditCommand : public UInteractiveCommand
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
virtual bool AllowEmptySelection() const { return false; }
|
|
|
|
virtual bool CanExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* SelectionArgs)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual void ExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* Arguments)
|
|
{
|
|
}
|
|
|
|
|
|
public:
|
|
|
|
// UInteractiveCommand API
|
|
|
|
virtual bool CanExecuteCommand(UInteractiveCommandArguments* Arguments) override
|
|
{
|
|
UGeometrySelectionEditCommandArguments* SelectionArgs = Cast<UGeometrySelectionEditCommandArguments>(Arguments);
|
|
if (SelectionArgs && (SelectionArgs->IsSelectionEmpty() == false || AllowEmptySelection()) )
|
|
{
|
|
return CanExecuteCommandForSelection(SelectionArgs);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
virtual void ExecuteCommand(UInteractiveCommandArguments* Arguments) override
|
|
{
|
|
UGeometrySelectionEditCommandArguments* SelectionArgs = Cast<UGeometrySelectionEditCommandArguments>(Arguments);
|
|
if ( SelectionArgs && (SelectionArgs->IsSelectionEmpty() == false || AllowEmptySelection()) )
|
|
{
|
|
ExecuteCommandForSelection(SelectionArgs);
|
|
}
|
|
}
|
|
|
|
|
|
};
|