2021-03-18 18:26:33 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "SingleSelectionTool.h"
|
2021-11-23 16:50:40 -05:00
|
|
|
#include "InteractiveToolBuilder.h"
|
2021-03-18 18:26:33 -04:00
|
|
|
#include "SingleSelectionMeshEditingTool.generated.h"
|
|
|
|
|
|
|
|
|
|
class USingleSelectionMeshEditingTool;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* USingleSelectionMeshEditingToolBuilder is a base tool builder for single
|
|
|
|
|
* selection tools that define a common set of ToolTarget interfaces required
|
|
|
|
|
* for editing meshes.
|
|
|
|
|
*/
|
|
|
|
|
UCLASS(Transient, Abstract)
|
2021-11-23 11:49:25 -05:00
|
|
|
class MODELINGCOMPONENTS_API USingleSelectionMeshEditingToolBuilder : public UInteractiveToolWithToolTargetsBuilder
|
2021-03-18 18:26:33 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/** @return true if a single mesh source can be found in the active selection */
|
|
|
|
|
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const override;
|
|
|
|
|
|
|
|
|
|
/** @return new Tool instance initialized with selected mesh source */
|
|
|
|
|
virtual UInteractiveTool* BuildTool(const FToolBuilderState& SceneState) const override;
|
|
|
|
|
|
|
|
|
|
/** @return new Tool instance. Override this in subclasses to build a different Tool class type */
|
|
|
|
|
virtual USingleSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const PURE_VIRTUAL(USingleSelectionMeshEditingToolBuilder::CreateNewTool, return nullptr; );
|
|
|
|
|
|
|
|
|
|
/** Called by BuildTool to configure the Tool with the input MeshSource based on the SceneState */
|
|
|
|
|
virtual void InitializeNewTool(USingleSelectionMeshEditingTool* Tool, const FToolBuilderState& SceneState) const;
|
|
|
|
|
|
|
|
|
|
protected:
|
2021-11-23 11:49:25 -05:00
|
|
|
virtual const FToolTargetTypeRequirements& GetTargetRequirements() const override;
|
2021-03-18 18:26:33 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Single Selection Mesh Editing tool base class.
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
2021-03-24 11:11:02 -04:00
|
|
|
class MODELINGCOMPONENTS_API USingleSelectionMeshEditingTool : public USingleSelectionTool
|
2021-03-18 18:26:33 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
public:
|
2022-01-28 18:40:54 -05:00
|
|
|
virtual void Shutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
|
virtual void OnShutdown(EToolShutdownType ShutdownType);
|
|
|
|
|
|
2022-01-28 12:44:22 -05:00
|
|
|
virtual void SetWorld(UWorld* World);
|
|
|
|
|
virtual UWorld* GetTargetWorld();
|
ModelingTools: replace StorableSelection mechanism with new UPersistentMeshSelection and UPersistentMeshSelectionManager context object.
- UPersistentMeshSelection is largely a port of UGroupTopologyStorableSelection, with the actual selection data moved to FGenericMeshSelection
- UPersistentMeshSelectionManager is meant to be used as a ContextObject in a ToolsContext, also contains utility functions to register/unregister/find context object
- Selection is no longer passed as part of FToolBuilderState. Instead Tools access the selection via ContextObject
- UPersistentMeshSelectionManager currently supports a single active selection. Selection changes are transacted via an FChange.
- When not inside a Tool, Selection is visualized with a pink border outline. Currently vertex selection is not visualized.
- Usage model is that on Tool Accept/Complete, prior to Tool Shutdown, any existing selection is cleared, and Tool may set a new Output selection which becomes the active selection
- StoredMeshSelectionUtil.h has utility functions to get current selection, set output selection, and clear it
- SingleSelectionMeshEditingTool already made input selection available to subclasses, port that capability to new architecture
- convert EditMeshPolygonsTool to be a SingleSelectionMeshEditingTool, use provided Input selection and set Output selection as appropriate
- ModelingToolsEditorMode clears active selection where appropriate, eg if selected object changes. However the behavior here will need further improvement, currently relies on questionable event handling from the TypedElement system
#rb semion.piskarev
#rnx
#jira none
#preflight 6136cbbfd9c85a0001fc3b56
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 17441056 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)
[CL 17441061 by ryan schmidt in ue5-release-engine-test branch]
2021-09-06 23:05:07 -04:00
|
|
|
|
2021-03-18 18:26:33 -04:00
|
|
|
protected:
|
2021-11-18 17:15:29 -05:00
|
|
|
UPROPERTY()
|
2022-01-28 10:18:10 -05:00
|
|
|
TWeakObjectPtr<UWorld> TargetWorld = nullptr;
|
2021-03-18 18:26:33 -04:00
|
|
|
};
|