You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Refactor recompute-UVs-for-groups/islands out of ParameterizeMeshOp/Tool into RecomputeUVsOp/Tool. RecomputeUVsTool supports selection of active PolygroupLayer when applicable. Add support for auto-repacking. - Clean up ParameterizeMeshOp/Tool, remove functionality related to recomputation that was moved to Recompute tool, add separate property sets for UVAtlas and XAtlas - Add FDynamicMeshUVEditor::QuickPack() function to compute UV layout - Add support for Polygroup Layer selection in SetCollisionGeometryTool, if only one source object is in use #rb none #rnx #jira none #preflight 60ced4b0be81e800012cc135 [CL 16724375 by Ryan Schmidt in ue5-main branch]
134 lines
3.7 KiB
C++
134 lines
3.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "BaseTools/SingleSelectionMeshEditingTool.h"
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
#include "MeshOpPreviewHelpers.h"
|
|
#include "Properties/MeshMaterialProperties.h"
|
|
#include "Properties/MeshUVChannelProperties.h"
|
|
|
|
#include "ParameterizeMeshTool.generated.h"
|
|
|
|
// predeclarations
|
|
class UDynamicMeshComponent;
|
|
class UMaterialInterface;
|
|
class UMaterialInstanceDynamic;
|
|
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API UParameterizeMeshToolBuilder : public USingleSelectionMeshEditingToolBuilder
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
virtual USingleSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
|
|
};
|
|
|
|
|
|
UENUM()
|
|
enum class EParameterizeMeshUVMethod
|
|
{
|
|
// keep values the same as UE::Geometry::EParamOpBackend!
|
|
/** Compute Automatic UVs using UVAtlas */
|
|
UVAtlas = 0,
|
|
/** Compute Automatic UVs using XAtlas */
|
|
XAtlas = 1
|
|
};
|
|
|
|
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API UParameterizeMeshToolProperties : public UInteractiveToolPropertySet
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
/** Automatic UV Generation technique to use */
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
EParameterizeMeshUVMethod Method = EParameterizeMeshUVMethod::UVAtlas;
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
* Settings for the UVAtlas Automatic UV Generation Method
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API UParameterizeMeshToolUVAtlasProperties : public UInteractiveToolPropertySet
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
/** Maximum amount of stretch, from none to any. If zero stretch is specified each triangle will likely be its own chart */
|
|
UPROPERTY(EditAnywhere, Category = UVAtlas, meta = (UIMin = "0", UIMax = "1", ClampMin = "0", ClampMax = "1"))
|
|
float ChartStretch = 0.11f;
|
|
|
|
/** Hint at number of Charts. 0 (Default) means UVAtlas will decide */
|
|
UPROPERTY(EditAnywhere, Category = UVAtlas, meta = (UIMin = "0", UIMax = "100", ClampMin = "0", ClampMax = "10000"))
|
|
int NumCharts = 0;
|
|
};
|
|
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API UParameterizeMeshToolXAtlasProperties : public UInteractiveToolPropertySet
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
/** Number of solve iterations. Higher values generally result in better charts. */
|
|
UPROPERTY(EditAnywhere, Category = XAtlas, meta = (UIMin = "1", UIMax = "10", ClampMin = "1", ClampMax = "1000"))
|
|
int MaxIterations = 1;
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
* UParameterizeMeshTool automatically decomposes the input mesh into charts, solves for UVs,
|
|
* and then packs the resulting charts
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API UParameterizeMeshTool : public USingleSelectionMeshEditingTool, public UE::Geometry::IDynamicMeshOperatorFactory
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual void Setup() override;
|
|
virtual void Shutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
virtual void OnTick(float DeltaTime) override;
|
|
|
|
virtual bool HasCancel() const override { return true; }
|
|
virtual bool HasAccept() const override { return true; }
|
|
virtual bool CanAccept() const override;
|
|
|
|
virtual void OnPropertyModified(UObject* PropertySet, FProperty* Property) override;
|
|
|
|
// IDynamicMeshOperatorFactory API
|
|
virtual TUniquePtr<UE::Geometry::FDynamicMeshOperator> MakeNewOperator() override;
|
|
|
|
protected:
|
|
UPROPERTY()
|
|
UMeshUVChannelProperties* UVChannelProperties = nullptr;
|
|
|
|
UPROPERTY()
|
|
UParameterizeMeshToolProperties* Settings = nullptr;
|
|
|
|
UPROPERTY()
|
|
UParameterizeMeshToolUVAtlasProperties* UVAtlasProperties = nullptr;
|
|
|
|
UPROPERTY()
|
|
UParameterizeMeshToolXAtlasProperties* XAtlasProperties = nullptr;
|
|
|
|
|
|
UPROPERTY()
|
|
UExistingMeshMaterialProperties* MaterialSettings = nullptr;
|
|
|
|
protected:
|
|
UPROPERTY()
|
|
UMeshOpPreviewWithBackgroundCompute* Preview = nullptr;
|
|
|
|
protected:
|
|
TSharedPtr<UE::Geometry::FDynamicMesh3, ESPMode::ThreadSafe> InputMesh;
|
|
|
|
void OnMethodTypeChanged();
|
|
|
|
};
|