2019-12-27 09:26:59 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
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
|
|
|
#include "BaseTools/SingleTargetWithSelectionTool.h"
|
2019-09-12 13:55:17 -04:00
|
|
|
#include "MeshOpPreviewHelpers.h"
|
2019-10-24 14:46:56 -04:00
|
|
|
#include "ToolDataVisualizer.h"
|
2019-09-12 13:55:17 -04:00
|
|
|
#include "ParameterizationOps/UVProjectionOp.h"
|
2019-09-19 15:47:11 -04:00
|
|
|
#include "Properties/MeshMaterialProperties.h"
|
2021-05-31 22:15:32 -04:00
|
|
|
#include "Properties/MeshUVChannelProperties.h"
|
|
|
|
|
#include "Drawing/PreviewGeometryActor.h"
|
|
|
|
|
#include "Selection/SelectClickedAction.h"
|
2021-06-02 15:58:00 -04:00
|
|
|
#include "OrientedBoxTypes.h"
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
#include "UVProjectionTool.generated.h"
|
|
|
|
|
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
// Forward declarations
|
2019-09-12 13:55:17 -04:00
|
|
|
struct FMeshDescription;
|
2021-06-12 14:30:22 -04:00
|
|
|
class UDynamicMeshComponent;
|
2021-09-29 23:20:44 -04:00
|
|
|
class UCombinedTransformGizmo;
|
2019-09-12 13:55:17 -04:00
|
|
|
class UTransformProxy;
|
2021-05-31 22:15:32 -04:00
|
|
|
class USingleClickInputBehavior;
|
2021-12-02 15:04:36 -05:00
|
|
|
class UUVProjectionTool;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
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
|
|
|
class MESHMODELINGTOOLS_API UUVProjectionToolBuilder : public USingleTargetWithSelectionToolBuilder
|
2019-09-12 13:55:17 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
public:
|
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
|
|
|
virtual USingleTargetWithSelectionTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
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
|
|
|
virtual bool RequiresInputSelection() const override { return false; }
|
2022-12-15 18:17:12 -05:00
|
|
|
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const override;
|
2019-09-12 13:55:17 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
UENUM()
|
|
|
|
|
enum class EUVProjectionToolActions
|
|
|
|
|
{
|
|
|
|
|
NoAction,
|
|
|
|
|
AutoFit,
|
|
|
|
|
AutoFitAlign,
|
|
|
|
|
Reset
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UCLASS()
|
2021-12-02 16:03:57 -05:00
|
|
|
class MESHMODELINGTOOLS_API UUVProjectionToolEditActions : public UInteractiveToolPropertySet
|
2021-05-31 22:15:32 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TWeakObjectPtr<UUVProjectionTool> ParentTool;
|
|
|
|
|
|
|
|
|
|
void Initialize(UUVProjectionTool* ParentToolIn) { ParentTool = ParentToolIn; }
|
|
|
|
|
void PostAction(EUVProjectionToolActions Action);
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Automatically fit the UV Projection Dimensions based on the current projection orientation */
|
2021-05-31 22:15:32 -04:00
|
|
|
UFUNCTION(CallInEditor, Category = Actions, meta = (DisplayName = "AutoFit", DisplayPriority = 1))
|
|
|
|
|
void AutoFit()
|
|
|
|
|
{
|
|
|
|
|
PostAction(EUVProjectionToolActions::AutoFit);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Automatically orient the projection and then automatically fit the UV Projection Dimensions */
|
2021-05-31 22:15:32 -04:00
|
|
|
UFUNCTION(CallInEditor, Category = Actions, meta = (DisplayName = "AutoFitAlign", DisplayPriority = 2))
|
|
|
|
|
void AutoFitAlign()
|
|
|
|
|
{
|
|
|
|
|
PostAction(EUVProjectionToolActions::AutoFitAlign);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Re-initialize the projection based on the UV Projection Initialization property */
|
2021-05-31 22:15:32 -04:00
|
|
|
UFUNCTION(CallInEditor, Category = Actions, meta = (DisplayName = "Reset", DisplayPriority = 3))
|
|
|
|
|
void Reset()
|
|
|
|
|
{
|
|
|
|
|
PostAction(EUVProjectionToolActions::Reset);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UENUM()
|
|
|
|
|
enum class EUVProjectionToolInitializationMode
|
|
|
|
|
{
|
|
|
|
|
/** Initialize projection to bounding box center */
|
|
|
|
|
Default,
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Initialize projection based on previous usage of the Project tool */
|
2021-05-31 22:15:32 -04:00
|
|
|
UsePrevious,
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Initialize projection using Auto Fitting for the initial projection type */
|
2021-05-31 22:15:32 -04:00
|
|
|
AutoFit,
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Initialize projection using Auto Fitting with Alignment for the initial projection type */
|
2021-05-31 22:15:32 -04:00
|
|
|
AutoFitAlign
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2019-09-12 13:55:17 -04:00
|
|
|
/**
|
|
|
|
|
* Standard properties
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
2021-12-02 16:03:57 -05:00
|
|
|
class MESHMODELINGTOOLS_API UUVProjectionToolProperties : public UInteractiveToolPropertySet
|
2019-09-12 13:55:17 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Shape and/or algorithm to use for UV projection */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Projection")
|
2021-05-31 22:15:32 -04:00
|
|
|
EUVProjectionMethod ProjectionType = EUVProjectionMethod::Plane;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Width, length, and height of the projection shape before rotation */
|
2022-12-16 11:11:57 -05:00
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Projection", meta = (Delta = 0.5, LinearDeltaSensitivity = 1))
|
2021-05-31 22:15:32 -04:00
|
|
|
FVector Dimensions = FVector(100.0f, 100.0f, 100.0f);
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2022-11-16 11:37:21 -05:00
|
|
|
/** If true, changes to Dimensions result in all components be changed proportionally */
|
2021-12-02 15:04:36 -05:00
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Projection")
|
2022-11-16 11:37:21 -05:00
|
|
|
bool bProportionalDimensions = false;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Determines how projection settings will be initialized; this only takes effect if the projection shape dimensions or position are unchanged */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Projection")
|
2021-05-31 22:15:32 -04:00
|
|
|
EUVProjectionToolInitializationMode Initialization = EUVProjectionToolInitializationMode::Default;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
//
|
|
|
|
|
// Cylinder projection options
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
/** Angle in degrees to determine whether faces should be assigned to the cylinder or the flat end caps */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = CylinderProjection, meta = (DisplayName = "Split Angle", UIMin = "0", UIMax = "90",
|
|
|
|
|
EditCondition = "ProjectionType == EUVProjectionMethod::Cylinder", EditConditionHides))
|
|
|
|
|
float CylinderSplitAngle = 45.0f;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// ExpMap projection options
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
/** Blend between surface normals and projection normal; ExpMap projection becomes Plane projection when this value is 1 */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "ExpMap Projection", meta = (DisplayName = "Normal Blending", UIMin = "0", UIMax = "1",
|
|
|
|
|
EditCondition = "ProjectionType == EUVProjectionMethod::ExpMap", EditConditionHides))
|
|
|
|
|
float ExpMapNormalBlending = 0.0f;
|
|
|
|
|
|
|
|
|
|
/** Number of smoothing steps to apply; this slightly increases distortion but produces more stable results. */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "ExpMap Projection", meta = (DisplayName = "Smoothing Steps", UIMin = "0", UIMax = "100",
|
|
|
|
|
EditCondition = "ProjectionType == EUVProjectionMethod::ExpMap", EditConditionHides))
|
|
|
|
|
int ExpMapSmoothingSteps = 0;
|
|
|
|
|
|
2022-01-07 00:14:44 -05:00
|
|
|
/** Smoothing parameter; larger values result in faster smoothing in each step. */
|
2021-12-02 15:04:36 -05:00
|
|
|
UPROPERTY(EditAnywhere, Category = "ExpMap Projection", meta = (DisplayName = "Smoothing Alpha", UIMin = "0", UIMax = "1",
|
|
|
|
|
EditCondition = "ProjectionType == EUVProjectionMethod::ExpMap", EditConditionHides))
|
|
|
|
|
float ExpMapSmoothingAlpha = 0.25f;
|
|
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
//
|
|
|
|
|
// UV-space transform options
|
|
|
|
|
//
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Rotation in degrees applied after computing projection */
|
2022-12-16 11:11:57 -05:00
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Transform", meta = (ClampMin = -360, ClampMax = 360))
|
2021-12-02 15:04:36 -05:00
|
|
|
float Rotation = 0.0;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Scaling applied after computing projection */
|
2022-12-16 11:11:57 -05:00
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Transform", meta = (Delta = 0.01, LinearDeltaSensitivity = 1))
|
2021-12-02 15:04:36 -05:00
|
|
|
FVector2D Scale = FVector2D::UnitVector;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
/** Translation applied after computing projection */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = "UV Transform")
|
|
|
|
|
FVector2D Translation = FVector2D::ZeroVector;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Saved State. These are used internally to support UsePrevious initialization mode
|
|
|
|
|
//
|
2021-12-02 15:04:36 -05:00
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
UPROPERTY()
|
|
|
|
|
FVector SavedDimensions = FVector::ZeroVector;
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
UPROPERTY()
|
2022-11-16 11:37:21 -05:00
|
|
|
bool bSavedProportionalDimensions = false;
|
2021-12-02 15:04:36 -05:00
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
UPROPERTY()
|
|
|
|
|
FTransform SavedTransform;
|
2019-09-12 13:55:17 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory with enough info to spawn the background-thread Operator to do a chunk of work for the tool
|
|
|
|
|
* stores a pointer to the tool and enough info to know which specific operator it should spawn
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
2021-12-02 16:03:57 -05:00
|
|
|
class MESHMODELINGTOOLS_API UUVProjectionOperatorFactory : public UObject, public UE::Geometry::IDynamicMeshOperatorFactory
|
2019-09-12 13:55:17 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
public:
|
|
|
|
|
// IDynamicMeshOperatorFactory API
|
2021-03-09 19:33:56 -04:00
|
|
|
virtual TUniquePtr<UE::Geometry::FDynamicMeshOperator> MakeNewOperator() override;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UUVProjectionTool> Tool;
|
2019-09-12 13:55:17 -04:00
|
|
|
};
|
|
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
|
2019-09-12 13:55:17 -04:00
|
|
|
/**
|
2021-12-02 15:04:36 -05:00
|
|
|
* UV projection tool
|
2019-09-12 13:55:17 -04:00
|
|
|
*/
|
|
|
|
|
UCLASS()
|
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
|
|
|
class MESHMODELINGTOOLS_API UUVProjectionTool : public USingleTargetWithSelectionTool
|
2019-09-12 13:55:17 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
friend UUVProjectionOperatorFactory;
|
|
|
|
|
|
|
|
|
|
virtual void Setup() override;
|
2022-01-28 18:40:54 -05:00
|
|
|
virtual void OnShutdown(EToolShutdownType ShutdownType) override;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2020-04-18 18:42:59 -04:00
|
|
|
virtual void OnTick(float DeltaTime) override;
|
2019-09-12 13:55:17 -04:00
|
|
|
virtual void Render(IToolsContextRenderAPI* RenderAPI) override;
|
|
|
|
|
|
2022-11-16 11:37:21 -05:00
|
|
|
virtual void OnPropertyModified(UObject* PropertySet, FProperty* Property) override;
|
|
|
|
|
|
2019-09-12 13:55:17 -04:00
|
|
|
virtual bool HasCancel() const override { return true; }
|
2020-11-24 18:42:39 -04:00
|
|
|
virtual bool HasAccept() const override { return true; }
|
2019-09-12 13:55:17 -04:00
|
|
|
virtual bool CanAccept() const override;
|
|
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
virtual void RequestAction(EUVProjectionToolActions ActionType);
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UMeshUVChannelProperties> UVChannelProperties = nullptr;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UUVProjectionToolProperties> BasicProperties = nullptr;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UUVProjectionToolEditActions> EditActions = nullptr;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2019-09-19 15:47:11 -04:00
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UExistingMeshMaterialProperties> MaterialSettings = nullptr;
|
2019-09-19 15:47:11 -04:00
|
|
|
|
2019-09-12 13:55:17 -04:00
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UMeshOpPreviewWithBackgroundCompute> Preview = nullptr;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UMaterialInstanceDynamic> CheckerMaterial = nullptr;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-09-29 23:20:44 -04:00
|
|
|
TObjectPtr<UCombinedTransformGizmo> TransformGizmo = nullptr;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UTransformProxy> TransformProxy = nullptr;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UUVProjectionOperatorFactory> OperatorFactory = nullptr;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UPreviewGeometry> EdgeRenderer = nullptr;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
TSharedPtr<UE::Geometry::FDynamicMesh3, ESPMode::ThreadSafe> InputMesh;
|
|
|
|
|
TSharedPtr<TArray<int32>, ESPMode::ThreadSafe> TriangleROI;
|
|
|
|
|
TSharedPtr<TArray<int32>, ESPMode::ThreadSafe> VertexROI;
|
|
|
|
|
TSharedPtr<UE::Geometry::FDynamicMeshAABBTree3, ESPMode::ThreadSafe> InputMeshROISpatial;
|
|
|
|
|
TSet<int32> TriangleROISet;
|
2019-09-12 13:55:17 -04:00
|
|
|
|
2022-01-29 14:37:53 -05:00
|
|
|
FTransform3d WorldTransform;
|
2021-05-31 22:15:32 -04:00
|
|
|
UE::Geometry::FAxisAlignedBox3d WorldBounds;
|
|
|
|
|
|
2022-11-16 11:37:21 -05:00
|
|
|
FVector CachedDimensions;
|
2021-05-31 22:15:32 -04:00
|
|
|
FVector InitialDimensions;
|
2022-11-16 11:37:21 -05:00
|
|
|
bool bInitialProportionalDimensions;
|
2021-05-31 22:15:32 -04:00
|
|
|
FTransform InitialTransform;
|
|
|
|
|
int32 DimensionsWatcher = -1;
|
2021-12-02 15:04:36 -05:00
|
|
|
int32 DimensionsModeWatcher = -1;
|
2021-05-31 22:15:32 -04:00
|
|
|
bool bTransformModified = false;
|
|
|
|
|
void OnInitializationModeChanged();
|
|
|
|
|
void ApplyInitializationMode();
|
2019-09-12 13:55:17 -04:00
|
|
|
|
|
|
|
|
FViewCameraState CameraState;
|
|
|
|
|
|
|
|
|
|
FToolDataVisualizer ProjectionShapeVisualizer;
|
|
|
|
|
|
2021-05-31 22:15:32 -04:00
|
|
|
void InitializeMesh();
|
2019-09-12 13:55:17 -04:00
|
|
|
void UpdateNumPreviews();
|
|
|
|
|
|
|
|
|
|
void TransformChanged(UTransformProxy* Proxy, FTransform Transform);
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
void OnMaterialSettingsChanged();
|
|
|
|
|
void OnMeshUpdated(UMeshOpPreviewWithBackgroundCompute* PreviewCompute);
|
|
|
|
|
|
2021-12-02 15:04:36 -05:00
|
|
|
UE::Geometry::FOrientedBox3d GetProjectionBox() const;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Support for ctrl+click to set plane from hit point
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
TUniquePtr<FSelectClickedAction> SetPlaneCtrlClickBehaviorTarget;
|
|
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<USingleClickInputBehavior> ClickToSetPlaneBehavior;
|
2021-05-31 22:15:32 -04:00
|
|
|
|
2022-01-07 00:14:44 -05:00
|
|
|
void UpdatePlaneFromClick(const FVector3d& Position, const FVector3d& Normal, bool bTransitionOnly);
|
2021-05-31 22:15:32 -04:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Support for Action Buttons
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
bool bHavePendingAction = false;
|
|
|
|
|
EUVProjectionToolActions PendingAction;
|
|
|
|
|
virtual void ApplyAction(EUVProjectionToolActions ActionType);
|
|
|
|
|
void ApplyAction_AutoFit(bool bAlign);
|
|
|
|
|
void ApplyAction_Reset();
|
|
|
|
|
|
2019-09-12 13:55:17 -04:00
|
|
|
};
|