You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#ROBOMERGE-AUTHOR: michael.balzer #ROBOMERGE-SOURCE: CL 18227685 in //UE5/Release-5.0/... via CL 18229350 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) #ROBOMERGE[STARSHIP]: UE5-Main [CL 18231457 by michael balzer in ue5-release-engine-test branch]
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "VoxelMorphologyMeshesTool.h"
|
|
|
|
#include "InteractiveToolManager.h"
|
|
#include "ToolBuilderUtil.h"
|
|
|
|
#include "ToolSetupUtil.h"
|
|
|
|
#include "Selection/ToolSelectionUtil.h"
|
|
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
#include "DynamicMesh/MeshTransforms.h"
|
|
|
|
#include "MeshDescriptionToDynamicMesh.h"
|
|
#include "DynamicMeshToMeshDescription.h"
|
|
|
|
#include "InteractiveGizmoManager.h"
|
|
|
|
#include "BaseGizmos/GizmoComponents.h"
|
|
#include "BaseGizmos/CombinedTransformGizmo.h"
|
|
|
|
#include "CompositionOps/VoxelMorphologyMeshesOp.h"
|
|
|
|
using namespace UE::Geometry;
|
|
|
|
#define LOCTEXT_NAMESPACE "UVoxelMorphologyMeshesTool"
|
|
|
|
|
|
void UVoxelMorphologyMeshesTool::SetupProperties()
|
|
{
|
|
Super::SetupProperties();
|
|
|
|
MorphologyProperties = NewObject<UVoxelMorphologyMeshesToolProperties>(this);
|
|
MorphologyProperties->RestoreProperties(this);
|
|
AddToolPropertySource(MorphologyProperties);
|
|
|
|
SetToolDisplayName(LOCTEXT("VoxelMorphologyMeshesToolName", "Voxel Morphology"));
|
|
GetToolManager()->DisplayMessage(
|
|
LOCTEXT("OnStartTool", "Apply Morphological operations to the input meshes to create a new Mesh, using voxelization techniques. UVs, sharp edges, and small/thin features will be lost. Increase Voxel Count to enhance accuracy."),
|
|
EToolMessageLevel::UserNotification);
|
|
|
|
}
|
|
|
|
|
|
void UVoxelMorphologyMeshesTool::SaveProperties()
|
|
{
|
|
Super::SaveProperties();
|
|
|
|
VoxProperties->SaveProperties(this);
|
|
}
|
|
|
|
|
|
TUniquePtr<FDynamicMeshOperator> UVoxelMorphologyMeshesTool::MakeNewOperator()
|
|
{
|
|
TUniquePtr<FVoxelMorphologyMeshesOp> Op = MakeUnique<FVoxelMorphologyMeshesOp>();
|
|
|
|
Op->Transforms.SetNum(Targets.Num());
|
|
Op->Meshes.SetNum(Targets.Num());
|
|
for (int Idx = 0; Idx < Targets.Num(); Idx++)
|
|
{
|
|
Op->Meshes[Idx] = OriginalDynamicMeshes[Idx];
|
|
Op->Transforms[Idx] = TransformProxies[Idx]->GetTransform();
|
|
}
|
|
|
|
VoxProperties->SetPropertiesOnOp(*Op);
|
|
|
|
Op->bVoxWrapInput = MorphologyProperties->bVoxWrap;
|
|
Op->ThickenShells = MorphologyProperties->ThickenShells;
|
|
Op->bRemoveInternalsAfterVoxWrap = MorphologyProperties->bRemoveInternalsAfterVoxWrap;
|
|
Op->Distance = MorphologyProperties->Distance;
|
|
Op->Operation = MorphologyProperties->Operation;
|
|
|
|
return Op;
|
|
}
|
|
|
|
|
|
FString UVoxelMorphologyMeshesTool::GetCreatedAssetName() const
|
|
{
|
|
return TEXT("Morphology");
|
|
}
|
|
|
|
FText UVoxelMorphologyMeshesTool::GetActionName() const
|
|
{
|
|
return LOCTEXT("VoxelMorphologyMeshes", "Voxel Morphology");
|
|
}
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|