Files
UnrealEngineUWP/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/BaseTools/SingleTargetWithSelectionTool.h
ryan schmidt 0e4ddc8e1a ModelingTools: add new modeling-mode Tool/Operator for extruding Mesh Selections
Add UE::ToolTarget::SupportsIncrementalMeshChanges() and ::ApplyIncrementalMeshEditChange(), these allow a Tool to directly edit a DynamicMeshComponent in the level (and emit corresponding MeshChange) so that a Tool can emit multiple undoable edits on a DynamicMesh
Add new USingleTargetWithSelectionTool base tool class, this is a USingleSelectionTool that can receive a FGeometrySelection. USingleTargetWithSelectionToolBuilder configures this type of Tool as necessary.
Add new LinearExtrusionOp dynamic mesh operator, provides linear-extrusion API to FOffsetMeshRegion using new Operator design (mesh shared via FSharedConstDynamicMesh3, CalculateResultInPlace() function to simplify direct usage in geometry script/etc)
Add new ExtrudeMeshSelectionTool, subclass of USingleTargetWithSelectionTool, exposes new LinearExtrusionOp, uses above ToolTarget functions to directly edit DynamicMeshComponent where possible
Enable new Tool in Modeling Mode

Add a few new functions to UMeshOpPreviewWithBackgroundCompute to simplify configuring InProgress and Secondary materials
Small additions to USingleSelectionTool

#preflight 639a3e250a671525500d8a7e
#rb none

[CL 23520421 by ryan schmidt in ue5-main branch]
2022-12-14 17:43:16 -05:00

66 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "SingleSelectionTool.h"
#include "InteractiveToolBuilder.h"
#include "Selections/GeometrySelection.h"
#include "SingleTargetWithSelectionTool.generated.h"
UCLASS(Transient, Abstract)
class MODELINGCOMPONENTS_API USingleTargetWithSelectionToolBuilder : public UInteractiveToolWithToolTargetsBuilder
{
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 USingleTargetWithSelectionTool* CreateNewTool(const FToolBuilderState& SceneState) const PURE_VIRTUAL(USingleTargetWithSelectionToolBuilder::CreateNewTool, return nullptr; );
/** Called by BuildTool to configure the Tool with the input MeshSource based on the SceneState */
virtual void InitializeNewTool(USingleTargetWithSelectionTool* Tool, const FToolBuilderState& SceneState) const;
/** @return true if this Tool requires an input selection */
virtual bool RequiresInputSelection() const { return false; }
protected:
virtual const FToolTargetTypeRequirements& GetTargetRequirements() const override;
};
UCLASS()
class MODELINGCOMPONENTS_API USingleTargetWithSelectionTool : public USingleSelectionTool
{
GENERATED_BODY()
public:
virtual void Shutdown(EToolShutdownType ShutdownType) override;
virtual void OnShutdown(EToolShutdownType ShutdownType);
virtual void SetTargetWorld(UWorld* World);
virtual UWorld* GetTargetWorld();
protected:
UPROPERTY()
TWeakObjectPtr<UWorld> TargetWorld = nullptr;
public:
virtual void SetGeometrySelection(const UE::Geometry::FGeometrySelection& SelectionIn);
virtual void SetGeometrySelection(UE::Geometry::FGeometrySelection&& SelectionIn);
/** @return true if a Selection is available */
virtual bool HasGeometrySelection() const;
/** @return the input Selection */
virtual const UE::Geometry::FGeometrySelection& GetGeometrySelection() const;
protected:
UE::Geometry::FGeometrySelection GeometrySelection;
bool bGeometrySelectionInitialized = false;
};