You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
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]
90 lines
2.5 KiB
C++
90 lines
2.5 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;
|
|
}
|
|
};
|
|
|
|
|
|
UCLASS()
|
|
class MODELINGCOMPONENTS_API UGeometrySelectionEditCommandResult : public UInteractiveCommandResult
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
FGeometrySelectionHandle SourceHandle;
|
|
|
|
UE::Geometry::FGeometrySelection OutputSelection;
|
|
};
|
|
|
|
|
|
/**
|
|
* 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 IsModifySelectionCommand() const { return false; }
|
|
|
|
virtual bool CanExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* SelectionArgs)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual void ExecuteCommandForSelection(UGeometrySelectionEditCommandArguments* Arguments, UInteractiveCommandResult** Result = nullptr)
|
|
{
|
|
}
|
|
|
|
|
|
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, UInteractiveCommandResult** Result = nullptr) override
|
|
{
|
|
UGeometrySelectionEditCommandArguments* SelectionArgs = Cast<UGeometrySelectionEditCommandArguments>(Arguments);
|
|
if ( SelectionArgs && (SelectionArgs->IsSelectionEmpty() == false || AllowEmptySelection()) )
|
|
{
|
|
ExecuteCommandForSelection(SelectionArgs, Result);
|
|
}
|
|
}
|
|
|
|
|
|
};
|