Files
UnrealEngineUWP/Engine/Plugins/Experimental/MeshModelingToolset/Source/MeshModelingTools/Public/ProjectToTargetTool.h
Ryan Schmidt 7b214c4a33 MeshModeling: add ModelingObjectsCreationAPI, replaces existing usage of IToolsContextAssetAPI in Modeling Tools/Mode
- add new UModelingObjectsCreationAPI and associated data structures, provides abstract API for creating mesh and texture objects from Tools that is not specifically tied to StaticMesh Actors/Assets
- new helper functions in UE::Modeling:: namespace to simplify usage of an implementation of this API registered in a ContextObjectStore
- add new UEditorModelingObjectsCreationAPI implementation of above, supports hooks for higher level to provide custom paths
- add ModelingModeAssetUtils.h, provides several functions in UE::Modeling:: namespace to be used to implement those hooks (various existing path-determination code is moved here)
- ModelingToolsEditorMode now registers an instance of UEditorModelingObjectsCreationAPI in ContextObjectStore and connects up callbacks to these path functions
- AssetGenerationUtil functions and ModelingModeAssetAPI deleted
- All Tools that previously used IToolsContextAssetAPI updated to use this new system

#rb jimmy.andrews
#rnx
#jira none
#preflight 60b7c2ddae46a1000162729b

[CL 16538450 by Ryan Schmidt in ue5-main branch]
2021-06-02 15:58:00 -04:00

94 lines
3.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "RemeshMeshTool.h"
#include "ToolBuilderUtil.h"
#include "ProjectToTargetTool.generated.h"
/**
* Determine if/how we can build UProjectToTargetTool. It requires two selected mesh components.
*/
UCLASS()
class MESHMODELINGTOOLS_API UProjectToTargetToolBuilder : public UInteractiveToolBuilder
{
GENERATED_BODY()
public:
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const override;
virtual UInteractiveTool* BuildTool(const FToolBuilderState& SceneState) const override;
protected:
virtual const FToolTargetTypeRequirements& GetTargetRequirements() const override;
};
/**
* Subclass URemeshMeshToolProperties just so we can set default values for some properties. Setting these values in the
* Setup function of UProjectToTargetTool turns out to be tricky to achieve with the property cache.
*/
UCLASS()
class MESHMODELINGTOOLS_API UProjectToTargetToolProperties : public URemeshMeshToolProperties
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Category = ProjectionSpace)
bool bWorldSpace = true;
UPROPERTY(EditAnywhere, Category = Remeshing)
bool bParallel = true;
UPROPERTY(EditAnywhere, Category = NormalFlow, meta = (EditCondition = "RemeshType == ERemeshType::NormalFlow", UIMin = "0", UIMax = "100", ClampMin = "0", ClampMax = "100"))
int FaceProjectionPassesPerRemeshIteration = 1;
UPROPERTY(EditAnywhere, Category = NormalFlow, meta = (EditCondition = "RemeshType == ERemeshType::NormalFlow", UIMin = "0", UIMax = "1.0", ClampMin = "0", ClampMax = "10.0"))
float SurfaceProjectionSpeed = 0.2f;
UPROPERTY(EditAnywhere, Category = NormalFlow, meta = (EditCondition = "RemeshType == ERemeshType::NormalFlow", UIMin = "0", UIMax = "1.0", ClampMin = "0", ClampMax = "10.0"))
float NormalAlignmentSpeed = 0.2f;
UPROPERTY(EditAnywhere, Category = NormalFlow, meta = (EditCondition = "RemeshType == ERemeshType::NormalFlow"))
bool bSmoothInFillAreas = true;
UPROPERTY(EditAnywhere, Category = NormalFlow, meta = (EditCondition = "RemeshType == ERemeshType::NormalFlow", UIMin = "0", UIMax = "1.0", ClampMin = "0", ClampMax = "10.0"))
float FillAreaDistanceMultiplier = 0.25f;
UPROPERTY(EditAnywhere, Category = NormalFlow, meta = (EditCondition = "RemeshType == ERemeshType::NormalFlow", UIMin = "0", UIMax = "1.0", ClampMin = "0", ClampMax = "10.0"))
float FillAreaSmoothMultiplier = 0.25f;
UProjectToTargetToolProperties()
: URemeshMeshToolProperties()
{
bPreserveSharpEdges = false;
RemeshType = ERemeshType::NormalFlow;
}
};
/**
* Project one mesh surface onto another, while undergoing remeshing. Subclass of URemeshMeshTool to avoid duplication.
*/
UCLASS()
class MESHMODELINGTOOLS_API UProjectToTargetTool : public URemeshMeshTool
{
GENERATED_BODY()
public:
UProjectToTargetTool(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UProjectToTargetToolProperties>(TEXT("RemeshProperties")))
{}
virtual void Setup() override;
virtual TUniquePtr<UE::Geometry::FDynamicMeshOperator> MakeNewOperator() override;
private:
TUniquePtr<UE::Geometry::FDynamicMesh3> ProjectionTarget;
TUniquePtr<UE::Geometry::FDynamicMeshAABBTree3> ProjectionTargetSpatial;
};