Files
UnrealEngineUWP/Engine/Plugins/Experimental/MeshModelingToolsetExp/Source/MeshModelingToolsExp/Public/BakeTransformTool.h
Jimmy Andrews 525173d5ea Prevent BakeRS UI from allowing user to try baking only rotation w/ a rotation+non-uniform scale, as UE transforms don't support this
#jira UE-151507
#rb lonnie.li
#preflight 627af39d0a5817c9d918b1bd

[CL 20132493 by Jimmy Andrews in ue5-main branch]
2022-05-10 20:29:48 -04:00

102 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "BaseTools/MultiSelectionMeshEditingTool.h"
#include "InteractiveToolBuilder.h"
#include "MeshOpPreviewHelpers.h"
#include "DynamicMesh/DynamicMesh3.h"
#include "BaseTools/SingleClickTool.h"
#include "BakeTransformTool.generated.h"
// predeclarations
struct FMeshDescription;
class UDynamicMeshComponent;
/**
*
*/
UCLASS()
class MESHMODELINGTOOLSEXP_API UBakeTransformToolBuilder : public UMultiSelectionMeshEditingToolBuilder
{
GENERATED_BODY()
public:
virtual UMultiSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
};
UENUM()
enum class EBakeScaleMethod : uint8
{
// bake all scale information, so the component has scale of 1 on all axes
BakeFullScale,
// bake the non-uniform scale, so the component has a uniform scale
BakeNonuniformScale,
// do not bake any scaling
DoNotBakeScale
};
/**
* Standard properties
*/
UCLASS()
class MESHMODELINGTOOLSEXP_API UBakeTransformToolProperties : public UInteractiveToolPropertySet
{
GENERATED_BODY()
public:
UBakeTransformToolProperties();
/** Bake rotation */
UPROPERTY(EditAnywhere, Category = Options)
bool bBakeRotation = true;
/** Bake scale */
UPROPERTY(EditAnywhere, Category = Options)
EBakeScaleMethod BakeScale = EBakeScaleMethod::BakeFullScale;
/** Recenter pivot after baking transform */
UPROPERTY(EditAnywhere, Category = Options)
bool bRecenterPivot = false;
// This variable is used to enable/disable the "DoNotBakeScale" option in the BakeScale enum
// It is marked as visible only so that the FBakeTransformToolDetails can read it; it will be hidden by that DetailCustomization
UPROPERTY(VisibleAnywhere, Category = Options)
bool bAllowNoScale = true;
};
/**
* Simple tool to bake scene transform on meshes into the mesh assets
*/
UCLASS()
class MESHMODELINGTOOLSEXP_API UBakeTransformTool : public UMultiSelectionMeshEditingTool
{
GENERATED_BODY()
public:
UBakeTransformTool();
virtual void Setup() override;
virtual void OnShutdown(EToolShutdownType ShutdownType) override;
virtual bool HasCancel() const override { return true; }
virtual bool HasAccept() const override { return true; }
protected:
UPROPERTY()
TObjectPtr<UBakeTransformToolProperties> BasicProperties;
protected:
TArray<int> MapToFirstOccurrences;
void UpdateAssets();
};