2022-07-15 13:49:13 -04:00
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
ModelingMode: Selection system improvements. Add Disconnect command and various new Selection-Edit Commands
Add UInteractiveCommandResult, UInteractiveCommand::ExecuteCommand() now optionally can return a result subclass
Add UGeometrySelectionEditCommandResult, UGeometrySelectionEditCommand now can optionally return an "output" selection via this type
UGeometrySelectionManager::ExecuteSelectionCommand optionally can restore a selection after a command, via UGeometrySelectionEditCommandResult
Add UDisconnectGeometrySelectionCommand, implements disconnection of selected triangles (ie separates but not into a new mesh)
Add UModifyGeometrySelectionCommand, implements various selection edits (select all, expand to connected, invert, invert connected, expand, contract)
Add IGeometrySelector::InitializeSelectionFromPredicate() and ::UpdateSelectionFromSelection(), implement in UDynamicMeshSelector, used to implement selection edit commands
Add UI to enable new commands in Modeling Mode
#rb none
#preflight 63c047f4305002c64170f6a2
[CL 23667880 by ryan schmidt in ue5-main branch]
2023-01-12 14:52:52 -05:00
|
|
|
UCLASS()
|
|
|
|
|
class MODELINGCOMPONENTS_API UGeometrySelectionEditCommandResult : public UInteractiveCommandResult
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
public:
|
|
|
|
|
FGeometrySelectionHandle SourceHandle;
|
|
|
|
|
|
|
|
|
|
UE::Geometry::FGeometrySelection OutputSelection;
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-15 13:49:13 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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; }
|
ModelingMode: Selection system improvements. Add Disconnect command and various new Selection-Edit Commands
Add UInteractiveCommandResult, UInteractiveCommand::ExecuteCommand() now optionally can return a result subclass
Add UGeometrySelectionEditCommandResult, UGeometrySelectionEditCommand now can optionally return an "output" selection via this type
UGeometrySelectionManager::ExecuteSelectionCommand optionally can restore a selection after a command, via UGeometrySelectionEditCommandResult
Add UDisconnectGeometrySelectionCommand, implements disconnection of selected triangles (ie separates but not into a new mesh)
Add UModifyGeometrySelectionCommand, implements various selection edits (select all, expand to connected, invert, invert connected, expand, contract)
Add IGeometrySelector::InitializeSelectionFromPredicate() and ::UpdateSelectionFromSelection(), implement in UDynamicMeshSelector, used to implement selection edit commands
Add UI to enable new commands in Modeling Mode
#rb none
#preflight 63c047f4305002c64170f6a2
[CL 23667880 by ryan schmidt in ue5-main branch]
2023-01-12 14:52:52 -05:00
|
|
|
virtual bool IsModifySelectionCommand() const { return false; }
|
2022-07-15 13:49:13 -04:00
|
|
|
|
|
|
|
|
virtual bool CanExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* SelectionArgs)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
ModelingMode: Selection system improvements. Add Disconnect command and various new Selection-Edit Commands
Add UInteractiveCommandResult, UInteractiveCommand::ExecuteCommand() now optionally can return a result subclass
Add UGeometrySelectionEditCommandResult, UGeometrySelectionEditCommand now can optionally return an "output" selection via this type
UGeometrySelectionManager::ExecuteSelectionCommand optionally can restore a selection after a command, via UGeometrySelectionEditCommandResult
Add UDisconnectGeometrySelectionCommand, implements disconnection of selected triangles (ie separates but not into a new mesh)
Add UModifyGeometrySelectionCommand, implements various selection edits (select all, expand to connected, invert, invert connected, expand, contract)
Add IGeometrySelector::InitializeSelectionFromPredicate() and ::UpdateSelectionFromSelection(), implement in UDynamicMeshSelector, used to implement selection edit commands
Add UI to enable new commands in Modeling Mode
#rb none
#preflight 63c047f4305002c64170f6a2
[CL 23667880 by ryan schmidt in ue5-main branch]
2023-01-12 14:52:52 -05:00
|
|
|
virtual void ExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* Arguments, UInteractiveCommandResult** Result = nullptr)
|
2022-07-15 13:49:13 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
ModelingMode: Selection system improvements. Add Disconnect command and various new Selection-Edit Commands
Add UInteractiveCommandResult, UInteractiveCommand::ExecuteCommand() now optionally can return a result subclass
Add UGeometrySelectionEditCommandResult, UGeometrySelectionEditCommand now can optionally return an "output" selection via this type
UGeometrySelectionManager::ExecuteSelectionCommand optionally can restore a selection after a command, via UGeometrySelectionEditCommandResult
Add UDisconnectGeometrySelectionCommand, implements disconnection of selected triangles (ie separates but not into a new mesh)
Add UModifyGeometrySelectionCommand, implements various selection edits (select all, expand to connected, invert, invert connected, expand, contract)
Add IGeometrySelector::InitializeSelectionFromPredicate() and ::UpdateSelectionFromSelection(), implement in UDynamicMeshSelector, used to implement selection edit commands
Add UI to enable new commands in Modeling Mode
#rb none
#preflight 63c047f4305002c64170f6a2
[CL 23667880 by ryan schmidt in ue5-main branch]
2023-01-12 14:52:52 -05:00
|
|
|
virtual void ExecuteCommand(UInteractiveCommandArguments* Arguments, UInteractiveCommandResult** Result = nullptr) override
|
2022-07-15 13:49:13 -04:00
|
|
|
{
|
|
|
|
|
UGeometrySelectionEditCommandArguments* SelectionArgs = Cast<UGeometrySelectionEditCommandArguments>(Arguments);
|
|
|
|
|
if ( SelectionArgs && (SelectionArgs->IsSelectionEmpty() == false || AllowEmptySelection()) )
|
|
|
|
|
{
|
ModelingMode: Selection system improvements. Add Disconnect command and various new Selection-Edit Commands
Add UInteractiveCommandResult, UInteractiveCommand::ExecuteCommand() now optionally can return a result subclass
Add UGeometrySelectionEditCommandResult, UGeometrySelectionEditCommand now can optionally return an "output" selection via this type
UGeometrySelectionManager::ExecuteSelectionCommand optionally can restore a selection after a command, via UGeometrySelectionEditCommandResult
Add UDisconnectGeometrySelectionCommand, implements disconnection of selected triangles (ie separates but not into a new mesh)
Add UModifyGeometrySelectionCommand, implements various selection edits (select all, expand to connected, invert, invert connected, expand, contract)
Add IGeometrySelector::InitializeSelectionFromPredicate() and ::UpdateSelectionFromSelection(), implement in UDynamicMeshSelector, used to implement selection edit commands
Add UI to enable new commands in Modeling Mode
#rb none
#preflight 63c047f4305002c64170f6a2
[CL 23667880 by ryan schmidt in ue5-main branch]
2023-01-12 14:52:52 -05:00
|
|
|
ExecuteCommandForSelection(SelectionArgs, Result);
|
2022-07-15 13:49:13 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|