You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
101 lines
2.8 KiB
C++
101 lines
2.8 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 "Properties/RecomputeUVsProperties.h"
|
|
#include "PropertySets/PolygroupLayersProperties.h"
|
|
#include "Polygroups/PolygroupSet.h"
|
|
#include "Drawing/UVLayoutPreview.h"
|
|
|
|
#include "RecomputeUVsTool.generated.h"
|
|
|
|
|
|
// Forward declarations
|
|
class UDynamicMeshComponent;
|
|
class UMaterialInterface;
|
|
class UMaterialInstanceDynamic;
|
|
class RecomputeUVsOp;
|
|
class URecomputeUVsOpFactory;
|
|
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API URecomputeUVsToolBuilder : public USingleSelectionMeshEditingToolBuilder
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual USingleSelectionMeshEditingTool* CreateNewTool(const FToolBuilderState& SceneState) const override;
|
|
virtual bool CanBuildTool(const FToolBuilderState& SceneState) const override;
|
|
};
|
|
|
|
|
|
/**
|
|
* URecomputeUVsTool Recomputes UVs based on existing segmentations of the mesh
|
|
*/
|
|
UCLASS()
|
|
class MESHMODELINGTOOLS_API URecomputeUVsTool : public USingleSelectionMeshEditingTool, public IInteractiveToolManageGeometrySelectionAPI
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
virtual void Setup() override;
|
|
virtual void OnShutdown(EToolShutdownType ShutdownType) override;
|
|
|
|
virtual void Render(IToolsContextRenderAPI* RenderAPI) 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;
|
|
|
|
// IInteractiveToolManageGeometrySelectionAPI -- this tool won't update external geometry selection or change selection-relevant mesh IDs
|
|
virtual bool IsInputSelectionValidOnOutput() override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
protected:
|
|
UPROPERTY()
|
|
TObjectPtr<UMeshUVChannelProperties> UVChannelProperties = nullptr;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<URecomputeUVsToolProperties> Settings = nullptr;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<UPolygroupLayersProperties> PolygroupLayerProperties = nullptr;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<UExistingMeshMaterialProperties> MaterialSettings = nullptr;
|
|
|
|
UPROPERTY()
|
|
bool bCreateUVLayoutViewOnSetup = true;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<UUVLayoutPreview> UVLayoutView = nullptr;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<URecomputeUVsOpFactory> RecomputeUVsOpFactory;
|
|
|
|
UPROPERTY()
|
|
TObjectPtr<UMeshOpPreviewWithBackgroundCompute> Preview = nullptr;
|
|
|
|
TSharedPtr<UE::Geometry::FDynamicMesh3, ESPMode::ThreadSafe> InputMesh;
|
|
|
|
TSharedPtr<UE::Geometry::FPolygroupSet, ESPMode::ThreadSafe> ActiveGroupSet;
|
|
void OnSelectedGroupLayerChanged();
|
|
void UpdateActiveGroupLayer();
|
|
int32 GetSelectedUVChannel() const;
|
|
void OnPreviewMeshUpdated();
|
|
};
|