You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #rnx #jira none #preflight 60c4451f5c10070001ae0537 [CL 16652187 by Ryan Schmidt in ue5-main branch]
111 lines
2.9 KiB
C++
111 lines
2.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Operations/SubdividePoly.h"
|
|
#include "CoreMinimal.h"
|
|
#include "InteractiveTool.h"
|
|
#include "InteractiveToolBuilder.h"
|
|
#include "ModelingOperators.h"
|
|
#include "SingleSelectionTool.h"
|
|
#include "Components/DynamicMeshComponent.h"
|
|
#include "MeshOpPreviewHelpers.h"
|
|
#include "BaseTools/SingleSelectionMeshEditingTool.h"
|
|
#include "SubdividePolyTool.generated.h"
|
|
|
|
class USubdividePolyTool;
|
|
class UPreviewGeometry;
|
|
|
|
/**
|
|
* Tool builder
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API USubdividePolyToolBuilder : public USingleSelectionMeshEditingToolBuilder
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
virtual USingleSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
|
|
};
|
|
|
|
/**
|
|
* Properties
|
|
*/
|
|
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API USubdividePolyToolProperties : public UInteractiveToolPropertySet
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
UPROPERTY(EditAnywhere, Category=Settings, meta = (UIMin = "1", ClampMin = "1"))
|
|
int SubdivisionLevel = 3;
|
|
|
|
// Controls whether the user can select Catmull-Clark or is forced to use Loop
|
|
UPROPERTY(meta = (TransientToolProperty))
|
|
bool bCatmullClarkOK = true;
|
|
|
|
UPROPERTY(EditAnywhere, Category = Settings, meta = (EditCondition = "bCatmullClarkOK", HideEditConditionToggle))
|
|
ESubdivisionScheme SubdivisionScheme = ESubdivisionScheme::CatmullClark;
|
|
|
|
UPROPERTY(EditAnywhere, Category=Settings)
|
|
ESubdivisionOutputNormals NormalComputationMethod = ESubdivisionOutputNormals::Generated;
|
|
|
|
UPROPERTY(EditAnywhere, Category=Settings)
|
|
ESubdivisionOutputUVs UVComputationMethod = ESubdivisionOutputUVs::Interpolated;
|
|
|
|
UPROPERTY(EditAnywhere, Category = Settings)
|
|
bool bRenderGroups = true;
|
|
|
|
UPROPERTY(EditAnywhere, Category = Settings)
|
|
bool bRenderCage = true;
|
|
|
|
};
|
|
|
|
|
|
/**
|
|
* Tool actual
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLSEDITORONLY_API USubdividePolyTool : public USingleSelectionMeshEditingTool
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
|
|
virtual void Setup() override;
|
|
virtual void Shutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
virtual bool HasCancel() const override { return true; }
|
|
virtual bool HasAccept() const override { return true; }
|
|
virtual bool CanAccept() const override;
|
|
|
|
void OnTick(float DeltaTime);
|
|
|
|
protected:
|
|
|
|
friend class USubdividePolyOperatorFactory;
|
|
|
|
UPROPERTY()
|
|
UPreviewMesh* PreviewMesh = nullptr;
|
|
|
|
UPROPERTY()
|
|
USubdividePolyToolProperties* Properties = nullptr;
|
|
|
|
// Input mesh
|
|
TSharedPtr<UE::Geometry::FDynamicMesh3, ESPMode::ThreadSafe> OriginalMesh;
|
|
|
|
UPROPERTY()
|
|
UPreviewGeometry* PreviewGeometry = nullptr;
|
|
|
|
bool bPreviewGeometryNeedsUpdate;
|
|
void CreateOrUpdatePreviewGeometry();
|
|
|
|
// Determine if the mesh group topology can be used for Catmull-Clark or Bilinear subdivision. If not, we can only
|
|
// Loop subdivision on the original triangle mesh.
|
|
bool CheckGroupTopology(FText& Message);
|
|
|
|
void CapSubdivisionLevel(ESubdivisionScheme Scheme, int DesiredLevel);
|
|
};
|
|
|