Files
ryan schmidt 70ac55822d ModelingMode: improve interop with new Selection System and existing Tools
Add support for Tools to provide an "output" selection. Add UGeometrySelectionManager::SetSelectionForComponent() which can set an explicit externally-provided selection. FBaseDynamicMeshSelector::UpdateSelectionFromSelection() now supports selection conversion when available and requested (is used to implement SetSelectionForComponent). New GeometrySelectionUtil functions InitializeSelectionFromTriangles() and ConvertSelection() are used to implement this (note: only Triangles->other conversion is currently supported). Add HaveAvailableGeometrySelection() and SetToolOutputGeometrySelectionForTarget() in StoredMeshSelectionUtil.h, this is the top-level function that Tools can use to set an Output selection.

ExtrudeMeshSelectionTool now emits output selection.

Update EditMeshPolygonsTool to use new Selection system and allow individual operations to be utilized as standalone Tools. Convert EditMeshPolygonsTool to be a USingleTargetWithSelectionTool, use FGeometrySelection to initialize selection. Add bTerminateOnPendingActionComplete flag, which is set when Tool is directly initialized to a specific operation, and forces tool to shut down when operation completes. This allows it to be used to more cleanly implement multiple action buttons in Modeling UI. When in this mode, selection panels are not shown. On Shutdown, now emits an "output" selection which GeometrySelectionManager can use to provide new selection to user. Update UPolygonSelectionMechanic Set/Get selection APIs to use FGeometrySelection instead of UPersistentMeshSelection.

port UVProjectionTool to derive from USingleTargetWithSelectionTool, use FGeometrySelection to initialize target ROI

deprecate UPersistentMeshSelection and related functions in StoredMeshSelectionUtil.h. Deprecate Tool Input Selection APIs in USingleSelectionMeshEditingTool and Builder.

Repurpose old ModelingMode-level PolyModel tab operations for new Selection Tools UI, now support Inset, Outset, Cut Faces, Insert Edge Loop, PushPull, and Bevel.

#rb none
#preflight 63c84fa2b065224750b9831f

[CL 23766643 by ryan schmidt in ue5-main branch]
2023-01-18 17:59:31 -05:00

98 lines
2.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Selection/SelectionEditInteractiveCommand.h"
#include "ModifyGeometrySelectionCommand.generated.h"
/**
* UModifyGeometrySelectionCommand updates/edits the current selection in various ways.
* Default operation is to Select All.
* Subclasses below can be used in situations where specific per-modification types are needed.
*/
UCLASS()
class MESHMODELINGTOOLS_API UModifyGeometrySelectionCommand : public UGeometrySelectionEditCommand
{
GENERATED_BODY()
public:
enum class EModificationType
{
SelectAll = 0,
ExpandToConnected = 1,
Invert = 10,
InvertConnected = 11,
Expand = 20,
Contract = 21
};
virtual EModificationType GetModificationType() const { return EModificationType::SelectAll; }
virtual bool AllowEmptySelection() const override { return GetModificationType() == EModificationType::SelectAll || GetModificationType() == EModificationType::Invert; }
virtual bool IsModifySelectionCommand() const override { return true; }
virtual FText GetCommandShortString() const override;
virtual bool CanExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* Arguments) override;
virtual void ExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* Arguments, UInteractiveCommandResult** Result) override;
};
/**
* Command to Invert the current Selection
*/
UCLASS()
class MESHMODELINGTOOLS_API UModifyGeometrySelectionCommand_Invert : public UModifyGeometrySelectionCommand
{
GENERATED_BODY()
public:
virtual EModificationType GetModificationType() const override { return EModificationType::Invert; }
};
/**
* Command to Expand the current Selection to all connected geometry
*/
UCLASS()
class MESHMODELINGTOOLS_API UModifyGeometrySelectionCommand_ExpandToConnected : public UModifyGeometrySelectionCommand
{
GENERATED_BODY()
public:
virtual EModificationType GetModificationType() const override { return EModificationType::ExpandToConnected; }
};
/**
* Command to Invert the current Selection, only considering connected geometry
*/
UCLASS()
class MESHMODELINGTOOLS_API UModifyGeometrySelectionCommand_InvertConnected : public UModifyGeometrySelectionCommand
{
GENERATED_BODY()
public:
virtual EModificationType GetModificationType() const override { return EModificationType::InvertConnected; }
};
/**
* Command to Expand the current Selection by a one-ring
*/
UCLASS()
class MESHMODELINGTOOLS_API UModifyGeometrySelectionCommand_Expand : public UModifyGeometrySelectionCommand
{
GENERATED_BODY()
public:
virtual EModificationType GetModificationType() const override { return EModificationType::Expand; }
};
/**
* Command to Contract the current Selection by a one-ring
*/
UCLASS()
class MESHMODELINGTOOLS_API UModifyGeometrySelectionCommand_Contract : public UModifyGeometrySelectionCommand
{
GENERATED_BODY()
public:
virtual EModificationType GetModificationType() const override { return EModificationType::Contract; }
};