Files
UnrealEngine/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsEditorOnlyExp/Public/MergeMeshesTool.h
2025-05-18 13:04:45 +08:00

86 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "BaseTools/BaseVoxelTool.h"
#include "CompositionOps/VoxelMergeMeshesOp.h"
#include "MergeMeshesTool.generated.h"
/**
* Standard properties of the Merge Meshes operation
*/
UCLASS()
class MESHMODELINGTOOLSEDITORONLYEXP_API UMergeMeshesToolProperties : public UInteractiveToolPropertySet
{
GENERATED_BODY()
public:
/** The size of the geometry bounding box major axis measured in voxels.*/
UPROPERTY(EditAnywhere, Category = VoxelSettings, meta = (UIMin = "8", UIMax = "1024", ClampMin = "8", ClampMax = "1024"))
int32 VoxelCount = 128;
/** Remeshing adaptivity, prior to optional simplification */
UPROPERTY(EditAnywhere, Category = VoxelSettings, meta = (UIMin = "0", UIMax = "1", ClampMin = "0", ClampMax = "1"))
float MeshAdaptivity = 0.001f;
/** Offset when remeshing, note large offsets with high voxels counts will be slow. Hidden because this duplicates functionality of the voxel offset tool */
UPROPERTY()
float OffsetDistance = 0;
/** Automatically simplify the result of voxel-based merge.*/
UPROPERTY(EditAnywhere, Category = VoxelSettings)
bool bAutoSimplify = false;
};
UCLASS()
class MESHMODELINGTOOLSEDITORONLYEXP_API UMergeMeshesTool : public UBaseVoxelTool
{
GENERATED_BODY()
public:
UMergeMeshesTool() {}
protected:
virtual void SetupProperties() override;
virtual void SaveProperties() override;
virtual FString GetCreatedAssetName() const override;
virtual FText GetActionName() const override;
virtual void ConvertInputsAndSetPreviewMaterials(bool bSetPreviewMesh) override;
// IDynamicMeshOperatorFactory API
virtual TUniquePtr<UE::Geometry::FDynamicMeshOperator> MakeNewOperator() override;
UPROPERTY()
TObjectPtr<UMergeMeshesToolProperties> MergeProps;
};
UCLASS()
class MESHMODELINGTOOLSEDITORONLYEXP_API UMergeMeshesToolBuilder : public UBaseCreateFromSelectedToolBuilder
{
GENERATED_BODY()
public:
virtual UMultiSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override
{
return NewObject<UMergeMeshesTool>(SceneState.ToolManager);
}
virtual int32 MinComponentsSupported() const override { return 1; }
};