2019-12-27 09:26:59 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "UObject/NoExportTypes.h"
|
|
|
|
|
#include "SingleSelectionTool.h"
|
|
|
|
|
#include "InteractiveToolBuilder.h"
|
2020-04-18 18:42:59 -04:00
|
|
|
#include "Drawing/LineSetComponent.h"
|
2021-06-13 00:36:02 -04:00
|
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
|
|
|
#include "DynamicMesh/DynamicMeshAABBTree3.h"
|
2019-10-01 20:41:42 -04:00
|
|
|
#include "Properties/MeshMaterialProperties.h"
|
2019-12-19 18:07:47 -05:00
|
|
|
#include "PreviewMesh.h"
|
2021-03-24 11:11:02 -04:00
|
|
|
#include "BaseTools/SingleSelectionMeshEditingTool.h"
|
2019-10-01 20:41:42 -04:00
|
|
|
#include "MeshInspectorTool.generated.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// predeclarations
|
|
|
|
|
struct FMeshDescription;
|
|
|
|
|
class UMaterialInstanceDynamic;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
2021-07-29 20:08:48 -04:00
|
|
|
class MESHMODELINGTOOLSEXP_API UMeshInspectorToolBuilder : public USingleSelectionMeshEditingToolBuilder
|
2019-10-01 20:41:42 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
2021-03-24 11:11:02 -04:00
|
|
|
virtual USingleSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
|
2019-10-01 20:41:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UCLASS()
|
2021-07-29 20:08:48 -04:00
|
|
|
class MESHMODELINGTOOLSEXP_API UMeshInspectorProperties : public UInteractiveToolPropertySet
|
2019-10-01 20:41:42 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/** Toggle visibility of all mesh edges */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bWireframe = true;
|
|
|
|
|
|
|
|
|
|
/** Toggle visibility of open boundary edges */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bBoundaryEdges = true;
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
/** Toggle visibility of bowtie vertices */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bBowtieVertices = true;
|
|
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
/** Toggle visibility of polygon borders */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bPolygonBorders = false;
|
|
|
|
|
|
|
|
|
|
/** Toggle visibility of UV seam edges */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bUVSeams = false;
|
|
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
/** Toggle visibility of UV bowtie vertices */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bUVBowties = false;
|
|
|
|
|
|
2021-11-18 14:37:34 -05:00
|
|
|
/** Toggle visibility of triangles with missing UVs */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bMissingUVs = false;
|
|
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
/** Toggle visibility of Normal seam edges */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bNormalSeams = false;
|
|
|
|
|
|
|
|
|
|
/** Toggle visibility of normal vectors */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bNormalVectors = false;
|
|
|
|
|
|
|
|
|
|
/** Toggle visibility of tangent vectors */
|
|
|
|
|
UPROPERTY(EditAnywhere, Category = Options)
|
|
|
|
|
bool bTangentVectors = false;
|
|
|
|
|
|
|
|
|
|
/** Length of line segments representing normal vectors */
|
2020-09-24 00:43:27 -04:00
|
|
|
UPROPERTY(EditAnywhere, Category = Options, meta = (EditCondition = "bNormalVectors",
|
|
|
|
|
UIMin="0", UIMax="400", ClampMin = "0", ClampMax = "1000000000.0"))
|
2019-10-01 20:41:42 -04:00
|
|
|
float NormalLength = 5.0f;
|
|
|
|
|
|
|
|
|
|
/** Length of line segments representing tangent vectors */
|
2020-09-24 00:43:27 -04:00
|
|
|
UPROPERTY(EditAnywhere, Category = Options, meta = (EditCondition = "bTangentVectors",
|
|
|
|
|
UIMin = "0", UIMax = "400", ClampMin = "0", ClampMax = "1000000000.0"))
|
2019-10-01 20:41:42 -04:00
|
|
|
float TangentLength = 5.0f;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Mesh Inspector Tool for visualizing mesh information
|
|
|
|
|
*/
|
|
|
|
|
UCLASS()
|
2021-07-29 20:08:48 -04:00
|
|
|
class MESHMODELINGTOOLSEXP_API UMeshInspectorTool : public USingleSelectionMeshEditingTool
|
2019-10-01 20:41:42 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
UMeshInspectorTool();
|
|
|
|
|
|
|
|
|
|
virtual void RegisterActions(FInteractiveToolActionSet& ActionSet) override;
|
|
|
|
|
|
|
|
|
|
virtual void Setup() override;
|
2022-01-28 18:40:54 -05:00
|
|
|
virtual void OnShutdown(EToolShutdownType ShutdownType) override;
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
virtual void Render(IToolsContextRenderAPI* RenderAPI) override;
|
|
|
|
|
|
|
|
|
|
virtual bool HasCancel() const override { return false; }
|
|
|
|
|
virtual bool HasAccept() const override;
|
|
|
|
|
virtual bool CanAccept() const override;
|
|
|
|
|
|
2020-01-07 15:54:23 -05:00
|
|
|
virtual void OnPropertyModified(UObject* PropertySet, FProperty* Property) override;
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void IncreaseLineWidthAction();
|
|
|
|
|
virtual void DecreaseLineWidthAction();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UMeshInspectorProperties> Settings = nullptr;
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UExistingMeshMaterialProperties> MaterialSettings = nullptr;
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
float LineWidthMultiplier = 1.0f;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UPreviewMesh> PreviewMesh;
|
2019-10-01 20:41:42 -04:00
|
|
|
|
2020-04-18 18:42:59 -04:00
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<ULineSetComponent> DrawnLineSet;
|
2020-04-18 18:42:59 -04:00
|
|
|
|
2019-10-01 20:41:42 -04:00
|
|
|
UPROPERTY()
|
2021-07-20 00:24:38 -04:00
|
|
|
TObjectPtr<UMaterialInterface> DefaultMaterial = nullptr;
|
2019-10-01 20:41:42 -04:00
|
|
|
|
|
|
|
|
TArray<int> BoundaryEdges;
|
2020-06-23 18:40:00 -04:00
|
|
|
TArray<int> BoundaryBowties;
|
2019-10-01 20:41:42 -04:00
|
|
|
TArray<int> UVSeamEdges;
|
2020-06-23 18:40:00 -04:00
|
|
|
TArray<int> UVBowties;
|
2019-10-01 20:41:42 -04:00
|
|
|
TArray<int> NormalSeamEdges;
|
|
|
|
|
TArray<int> GroupBoundaryEdges;
|
2021-11-18 14:37:34 -05:00
|
|
|
TArray<int> MissingUVTriangleEdges;
|
2020-03-05 14:27:21 -05:00
|
|
|
|
|
|
|
|
void UpdateVisualization();
|
2019-10-01 20:41:42 -04:00
|
|
|
void Precompute();
|
|
|
|
|
};
|