2020-11-24 01:17:27 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-04-12 12:37:05 -04:00
|
|
|
#include "GeometryFlowMeshProcessingModule.h"
|
2020-11-24 01:17:27 -04:00
|
|
|
#include "GeometryFlowCoreNodes.h"
|
|
|
|
|
#include "GeometryFlowNodeUtil.h"
|
|
|
|
|
#include "DataTypes/DynamicMeshData.h"
|
2022-01-28 19:49:26 -05:00
|
|
|
#include "Util/ProgressCancel.h"
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
namespace UE
|
|
|
|
|
{
|
|
|
|
|
namespace GeometryFlow
|
|
|
|
|
{
|
|
|
|
|
|
2021-03-09 19:33:56 -04:00
|
|
|
using namespace UE::Geometry;
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class FProcessMeshBaseNode : public FNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static const FString InParamMesh() { return TEXT("Mesh"); }
|
|
|
|
|
static const FString OutParamResultMesh() { return TEXT("ResultMesh"); }
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
FProcessMeshBaseNode()
|
|
|
|
|
{
|
|
|
|
|
AddInput(InParamMesh(), MakeUnique<FDynamicMeshInput>());
|
|
|
|
|
|
|
|
|
|
AddOutput(OutParamResultMesh(), MakeUnique<FDynamicMeshOutput>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// FProcessMeshBaseNode API that subclasses must/can implement
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
virtual void ProcessMesh(
|
|
|
|
|
const FNamedDataMap& DatasIn,
|
|
|
|
|
const FDynamicMesh3& MeshIn,
|
2021-09-23 14:24:45 -04:00
|
|
|
FDynamicMesh3& MeshOut,
|
|
|
|
|
TUniquePtr<FEvaluationInfo>& EvaluationInfo)
|
2020-11-24 01:17:27 -04:00
|
|
|
{
|
|
|
|
|
check(false); // subclass must implement ProcessMesh()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void ProcessMeshInPlace(
|
|
|
|
|
const FNamedDataMap& DatasIn,
|
2021-09-23 14:24:45 -04:00
|
|
|
FDynamicMesh3& MeshInOut,
|
|
|
|
|
TUniquePtr<FEvaluationInfo>& EvaluationInfo)
|
2020-11-24 01:17:27 -04:00
|
|
|
{
|
|
|
|
|
ensureMsgf(false, TEXT("TProcessMeshBaseNode::ProcessMeshInPlace called but not defined!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual void CheckAdditionalInputs(const FNamedDataMap& DatasIn, bool& bRecomputeRequired, bool& bAllInputsValid)
|
|
|
|
|
{
|
|
|
|
|
// none
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void Evaluate(
|
|
|
|
|
const FNamedDataMap& DatasIn,
|
|
|
|
|
FNamedDataMap& DatasOut,
|
|
|
|
|
TUniquePtr<FEvaluationInfo>& EvaluationInfo) override
|
|
|
|
|
{
|
|
|
|
|
if (ensure(DatasOut.Contains(OutParamResultMesh())))
|
|
|
|
|
{
|
|
|
|
|
bool bAllInputsValid = true;
|
|
|
|
|
bool bRecomputeRequired = ( IsOutputAvailable(OutParamResultMesh()) == false );
|
|
|
|
|
TSafeSharedPtr<IData> MeshArg = FindAndUpdateInputForEvaluate(InParamMesh(), DatasIn, bRecomputeRequired, bAllInputsValid);
|
|
|
|
|
CheckAdditionalInputs(DatasIn, bRecomputeRequired, bAllInputsValid);
|
|
|
|
|
if (bAllInputsValid)
|
|
|
|
|
{
|
|
|
|
|
if (bRecomputeRequired)
|
|
|
|
|
{
|
2022-01-28 19:49:26 -05:00
|
|
|
// if execution is interrupted by ProgressCancel, make sure this node is recomputed next time through
|
|
|
|
|
ClearAllOutputs();
|
|
|
|
|
|
2020-11-24 01:17:27 -04:00
|
|
|
bool bIsMeshMutable = DatasIn.GetDataFlags(InParamMesh()).bIsMutableData;
|
|
|
|
|
if (bIsMeshMutable)
|
|
|
|
|
{
|
2021-04-12 12:37:05 -04:00
|
|
|
UE_LOG(LogGeometryFlowMeshProcessing, Display, TEXT("[%s] RECOMPUTING MeshOp In Place!"), *GetIdentifier());
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
FDynamicMesh3 EditableMesh;
|
|
|
|
|
MeshArg->GiveTo<FDynamicMesh3>(EditableMesh, (int)EMeshProcessingDataTypes::DynamicMesh);
|
2021-09-23 14:24:45 -04:00
|
|
|
ProcessMeshInPlace(DatasIn, EditableMesh, EvaluationInfo);
|
2020-11-24 01:17:27 -04:00
|
|
|
|
2022-01-28 19:49:26 -05:00
|
|
|
if (EvaluationInfo && EvaluationInfo->Progress && EvaluationInfo->Progress->Cancelled())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-24 01:17:27 -04:00
|
|
|
// store new result
|
|
|
|
|
TSafeSharedPtr<FDataDynamicMesh> Result = MakeSafeShared<FDataDynamicMesh>();
|
|
|
|
|
Result->MoveData(MoveTemp(EditableMesh));
|
|
|
|
|
SetOutput(OutParamResultMesh(), Result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-04-12 12:37:05 -04:00
|
|
|
UE_LOG(LogGeometryFlowMeshProcessing, Display, TEXT("[%s] RECOMPUTING MeshOp"), *GetIdentifier());
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
// do we ever want to support using a copy of the source mesh?
|
|
|
|
|
const FDynamicMesh3& SourceMesh = MeshArg->GetDataConstRef<FDynamicMesh3>((int)EMeshProcessingDataTypes::DynamicMesh);
|
|
|
|
|
|
|
|
|
|
// run mesh processing
|
|
|
|
|
FDynamicMesh3 ResultMesh;
|
2021-09-23 14:24:45 -04:00
|
|
|
ProcessMesh(DatasIn, SourceMesh, ResultMesh, EvaluationInfo);
|
2020-11-24 01:17:27 -04:00
|
|
|
|
2022-01-28 19:49:26 -05:00
|
|
|
if (EvaluationInfo && EvaluationInfo->Progress && EvaluationInfo->Progress->Cancelled())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-24 01:17:27 -04:00
|
|
|
// store new result
|
|
|
|
|
TSafeSharedPtr<FDataDynamicMesh> Result = MakeSafeShared<FDataDynamicMesh>();
|
|
|
|
|
Result->MoveData(MoveTemp(ResultMesh));
|
|
|
|
|
SetOutput(OutParamResultMesh(), Result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EvaluationInfo->CountCompute(this);
|
|
|
|
|
}
|
|
|
|
|
DatasOut.SetData(OutParamResultMesh(), GetOutput(OutParamResultMesh()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AutoLOD: make mesh computation type configurable using new GeometryFlow Switch node, and expose Normals calculation settings in Graph/Process/Tool
GeometryFlow:
Add TSwitchNode node, uses internal integer to select one of N inputs (N is currently defined in template type, so number of inputs is fixed). Add custom util function UpdateSwitchNodeInputIndex() to simplify changing switch integer.
Add FMeshMakeCleanGeometryNode/Settings, strips out undesired attribute sets and fills small holes, to create better input mesh for simplification
Add FSimpleInPlaceProcessMeshBaseNode, just runs some basic geometry operation, makes it easier to make new nodes. Converted FComputeMeshPerVertexOverlayNormalsNode to this base class and added FComputeMeshPerVertexNormalsNode.
Fixed attribute set handling issue in FSimplifyMeshNode
MeshLODToolset:
Added ECoreMeshGeneratorMode enum to FGenerateMeshLODGraph. This setting drives a Switch node that picks between Vox, Vox+Closure, and Simplify-only mesh generation paths.
Added SourceMeshHint to BuildGraph, allows for variable graph construction. Use to skip MaterialID transfer in single-material case.
Change default collision type to aligned boxes (fast and low visual complexity)
Exposed top-level Mesh Generation type, Normals settings in Graph/Process/Tool, minor UI and default changes
#rb tyson.brochu
#rnx
#jira none
#preflight 61391fa89c40ec00012ddec0
[CL 17466797 by Ryan Schmidt in ue5-main branch]
2021-09-08 21:44:50 -04:00
|
|
|
/**
|
|
|
|
|
* FSimpleInPlaceProcessMeshBaseNode provides a standard pattern for a simple "In-Place" mesh
|
|
|
|
|
* processing operation, eg something like recomputing normals where it would not make
|
|
|
|
|
* sense to cache the output and there are no configuration settings. The subclass only
|
|
|
|
|
* has to implement the ApplyNodeToMesh() function.
|
|
|
|
|
*/
|
|
|
|
|
class FSimpleInPlaceProcessMeshBaseNode : public FProcessMeshBaseNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FSimpleInPlaceProcessMeshBaseNode()
|
|
|
|
|
{
|
|
|
|
|
// we can mutate input mesh
|
|
|
|
|
ConfigureInputFlags(InParamMesh(), FNodeInputFlags::Transformable());
|
|
|
|
|
}
|
2020-11-24 01:17:27 -04:00
|
|
|
|
2021-09-23 14:24:45 -04:00
|
|
|
virtual void ProcessMesh( const FNamedDataMap& DatasIn, const FDynamicMesh3& MeshIn, FDynamicMesh3& MeshOut, TUniquePtr<FEvaluationInfo>& EvaluationInfo) override
|
AutoLOD: make mesh computation type configurable using new GeometryFlow Switch node, and expose Normals calculation settings in Graph/Process/Tool
GeometryFlow:
Add TSwitchNode node, uses internal integer to select one of N inputs (N is currently defined in template type, so number of inputs is fixed). Add custom util function UpdateSwitchNodeInputIndex() to simplify changing switch integer.
Add FMeshMakeCleanGeometryNode/Settings, strips out undesired attribute sets and fills small holes, to create better input mesh for simplification
Add FSimpleInPlaceProcessMeshBaseNode, just runs some basic geometry operation, makes it easier to make new nodes. Converted FComputeMeshPerVertexOverlayNormalsNode to this base class and added FComputeMeshPerVertexNormalsNode.
Fixed attribute set handling issue in FSimplifyMeshNode
MeshLODToolset:
Added ECoreMeshGeneratorMode enum to FGenerateMeshLODGraph. This setting drives a Switch node that picks between Vox, Vox+Closure, and Simplify-only mesh generation paths.
Added SourceMeshHint to BuildGraph, allows for variable graph construction. Use to skip MaterialID transfer in single-material case.
Change default collision type to aligned boxes (fast and low visual complexity)
Exposed top-level Mesh Generation type, Normals settings in Graph/Process/Tool, minor UI and default changes
#rb tyson.brochu
#rnx
#jira none
#preflight 61391fa89c40ec00012ddec0
[CL 17466797 by Ryan Schmidt in ue5-main branch]
2021-09-08 21:44:50 -04:00
|
|
|
{
|
|
|
|
|
MeshOut = MeshIn;
|
2021-09-23 14:24:45 -04:00
|
|
|
ApplyNodeToMesh(MeshOut, EvaluationInfo);
|
AutoLOD: make mesh computation type configurable using new GeometryFlow Switch node, and expose Normals calculation settings in Graph/Process/Tool
GeometryFlow:
Add TSwitchNode node, uses internal integer to select one of N inputs (N is currently defined in template type, so number of inputs is fixed). Add custom util function UpdateSwitchNodeInputIndex() to simplify changing switch integer.
Add FMeshMakeCleanGeometryNode/Settings, strips out undesired attribute sets and fills small holes, to create better input mesh for simplification
Add FSimpleInPlaceProcessMeshBaseNode, just runs some basic geometry operation, makes it easier to make new nodes. Converted FComputeMeshPerVertexOverlayNormalsNode to this base class and added FComputeMeshPerVertexNormalsNode.
Fixed attribute set handling issue in FSimplifyMeshNode
MeshLODToolset:
Added ECoreMeshGeneratorMode enum to FGenerateMeshLODGraph. This setting drives a Switch node that picks between Vox, Vox+Closure, and Simplify-only mesh generation paths.
Added SourceMeshHint to BuildGraph, allows for variable graph construction. Use to skip MaterialID transfer in single-material case.
Change default collision type to aligned boxes (fast and low visual complexity)
Exposed top-level Mesh Generation type, Normals settings in Graph/Process/Tool, minor UI and default changes
#rb tyson.brochu
#rnx
#jira none
#preflight 61391fa89c40ec00012ddec0
[CL 17466797 by Ryan Schmidt in ue5-main branch]
2021-09-08 21:44:50 -04:00
|
|
|
}
|
|
|
|
|
|
2021-09-23 14:24:45 -04:00
|
|
|
virtual void ProcessMeshInPlace( const FNamedDataMap& DatasIn, FDynamicMesh3& MeshInOut, TUniquePtr<FEvaluationInfo>& EvaluationInfo) override
|
AutoLOD: make mesh computation type configurable using new GeometryFlow Switch node, and expose Normals calculation settings in Graph/Process/Tool
GeometryFlow:
Add TSwitchNode node, uses internal integer to select one of N inputs (N is currently defined in template type, so number of inputs is fixed). Add custom util function UpdateSwitchNodeInputIndex() to simplify changing switch integer.
Add FMeshMakeCleanGeometryNode/Settings, strips out undesired attribute sets and fills small holes, to create better input mesh for simplification
Add FSimpleInPlaceProcessMeshBaseNode, just runs some basic geometry operation, makes it easier to make new nodes. Converted FComputeMeshPerVertexOverlayNormalsNode to this base class and added FComputeMeshPerVertexNormalsNode.
Fixed attribute set handling issue in FSimplifyMeshNode
MeshLODToolset:
Added ECoreMeshGeneratorMode enum to FGenerateMeshLODGraph. This setting drives a Switch node that picks between Vox, Vox+Closure, and Simplify-only mesh generation paths.
Added SourceMeshHint to BuildGraph, allows for variable graph construction. Use to skip MaterialID transfer in single-material case.
Change default collision type to aligned boxes (fast and low visual complexity)
Exposed top-level Mesh Generation type, Normals settings in Graph/Process/Tool, minor UI and default changes
#rb tyson.brochu
#rnx
#jira none
#preflight 61391fa89c40ec00012ddec0
[CL 17466797 by Ryan Schmidt in ue5-main branch]
2021-09-08 21:44:50 -04:00
|
|
|
{
|
2021-09-23 14:24:45 -04:00
|
|
|
ApplyNodeToMesh(MeshInOut, EvaluationInfo);
|
AutoLOD: make mesh computation type configurable using new GeometryFlow Switch node, and expose Normals calculation settings in Graph/Process/Tool
GeometryFlow:
Add TSwitchNode node, uses internal integer to select one of N inputs (N is currently defined in template type, so number of inputs is fixed). Add custom util function UpdateSwitchNodeInputIndex() to simplify changing switch integer.
Add FMeshMakeCleanGeometryNode/Settings, strips out undesired attribute sets and fills small holes, to create better input mesh for simplification
Add FSimpleInPlaceProcessMeshBaseNode, just runs some basic geometry operation, makes it easier to make new nodes. Converted FComputeMeshPerVertexOverlayNormalsNode to this base class and added FComputeMeshPerVertexNormalsNode.
Fixed attribute set handling issue in FSimplifyMeshNode
MeshLODToolset:
Added ECoreMeshGeneratorMode enum to FGenerateMeshLODGraph. This setting drives a Switch node that picks between Vox, Vox+Closure, and Simplify-only mesh generation paths.
Added SourceMeshHint to BuildGraph, allows for variable graph construction. Use to skip MaterialID transfer in single-material case.
Change default collision type to aligned boxes (fast and low visual complexity)
Exposed top-level Mesh Generation type, Normals settings in Graph/Process/Tool, minor UI and default changes
#rb tyson.brochu
#rnx
#jira none
#preflight 61391fa89c40ec00012ddec0
[CL 17466797 by Ryan Schmidt in ue5-main branch]
2021-09-08 21:44:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// subclasses only have to implement this
|
2021-09-23 14:24:45 -04:00
|
|
|
virtual void ApplyNodeToMesh(FDynamicMesh3& MeshInOut, TUniquePtr<FEvaluationInfo>& EvaluationInfo) = 0;
|
AutoLOD: make mesh computation type configurable using new GeometryFlow Switch node, and expose Normals calculation settings in Graph/Process/Tool
GeometryFlow:
Add TSwitchNode node, uses internal integer to select one of N inputs (N is currently defined in template type, so number of inputs is fixed). Add custom util function UpdateSwitchNodeInputIndex() to simplify changing switch integer.
Add FMeshMakeCleanGeometryNode/Settings, strips out undesired attribute sets and fills small holes, to create better input mesh for simplification
Add FSimpleInPlaceProcessMeshBaseNode, just runs some basic geometry operation, makes it easier to make new nodes. Converted FComputeMeshPerVertexOverlayNormalsNode to this base class and added FComputeMeshPerVertexNormalsNode.
Fixed attribute set handling issue in FSimplifyMeshNode
MeshLODToolset:
Added ECoreMeshGeneratorMode enum to FGenerateMeshLODGraph. This setting drives a Switch node that picks between Vox, Vox+Closure, and Simplify-only mesh generation paths.
Added SourceMeshHint to BuildGraph, allows for variable graph construction. Use to skip MaterialID transfer in single-material case.
Change default collision type to aligned boxes (fast and low visual complexity)
Exposed top-level Mesh Generation type, Normals settings in Graph/Process/Tool, minor UI and default changes
#rb tyson.brochu
#rnx
#jira none
#preflight 61391fa89c40ec00012ddec0
[CL 17466797 by Ryan Schmidt in ue5-main branch]
2021-09-08 21:44:50 -04:00
|
|
|
|
|
|
|
|
};
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename SettingsType>
|
|
|
|
|
class TProcessMeshWithSettingsBaseNode : public FNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
using SettingsDataType = TMovableData<SettingsType, SettingsType::DataTypeIdentifier>;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static const FString InParamMesh() { return TEXT("Mesh"); }
|
|
|
|
|
static const FString InParamSettings() { return TEXT("Settings"); }
|
|
|
|
|
static const FString OutParamResultMesh() { return TEXT("ResultMesh"); }
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
TProcessMeshWithSettingsBaseNode()
|
|
|
|
|
{
|
|
|
|
|
AddInput(InParamMesh(), MakeUnique<FDynamicMeshInput>());
|
|
|
|
|
AddInput(InParamSettings(), MakeUnique<TBasicNodeInput<SettingsType, SettingsType::DataTypeIdentifier>>());
|
|
|
|
|
|
|
|
|
|
AddOutput(OutParamResultMesh(), MakeUnique<FDynamicMeshOutput>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual void ProcessMesh(
|
|
|
|
|
const FNamedDataMap& DatasIn,
|
|
|
|
|
const SettingsType& SettingsIn,
|
|
|
|
|
const FDynamicMesh3& MeshIn,
|
2021-09-23 14:24:45 -04:00
|
|
|
FDynamicMesh3& MeshOut,
|
|
|
|
|
TUniquePtr<FEvaluationInfo>& EvaluationInfo)
|
2020-11-24 01:17:27 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void ProcessMeshInPlace(
|
|
|
|
|
const FNamedDataMap& DatasIn,
|
|
|
|
|
const SettingsType& SettingsIn,
|
2021-09-23 14:24:45 -04:00
|
|
|
FDynamicMesh3& MeshInOut,
|
|
|
|
|
TUniquePtr<FEvaluationInfo>& EvaluationInfo)
|
2020-11-24 01:17:27 -04:00
|
|
|
{
|
|
|
|
|
ensureMsgf(false, TEXT("TProcessMeshWithSettingsBaseNode::ProcessMeshInPlace called but not defined!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual void CheckAdditionalInputs(const FNamedDataMap& DatasIn, bool& bRecomputeRequired, bool& bAllInputsValid)
|
|
|
|
|
{
|
|
|
|
|
// none
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void Evaluate(
|
|
|
|
|
const FNamedDataMap& DatasIn,
|
|
|
|
|
FNamedDataMap& DatasOut,
|
|
|
|
|
TUniquePtr<FEvaluationInfo>& EvaluationInfo) override
|
|
|
|
|
{
|
|
|
|
|
if (ensure(DatasOut.Contains(OutParamResultMesh())))
|
|
|
|
|
{
|
|
|
|
|
bool bAllInputsValid = true;
|
|
|
|
|
bool bRecomputeRequired = ( IsOutputAvailable(OutParamResultMesh()) == false );
|
|
|
|
|
TSafeSharedPtr<IData> MeshArg = FindAndUpdateInputForEvaluate(InParamMesh(), DatasIn, bRecomputeRequired, bAllInputsValid);
|
|
|
|
|
TSafeSharedPtr<IData> SettingsArg = FindAndUpdateInputForEvaluate(InParamSettings(), DatasIn, bRecomputeRequired, bAllInputsValid);
|
|
|
|
|
CheckAdditionalInputs(DatasIn, bRecomputeRequired, bAllInputsValid);
|
|
|
|
|
if (bAllInputsValid)
|
|
|
|
|
{
|
|
|
|
|
if (bRecomputeRequired)
|
|
|
|
|
{
|
2022-01-28 19:49:26 -05:00
|
|
|
// if execution is interrupted by ProgressCancel, make sure this node is recomputed next time through
|
|
|
|
|
ClearAllOutputs();
|
|
|
|
|
|
2020-11-24 01:17:27 -04:00
|
|
|
// always make a copy of settings
|
|
|
|
|
SettingsType Settings;
|
|
|
|
|
SettingsArg->GetDataCopy(Settings, SettingsType::DataTypeIdentifier);
|
|
|
|
|
|
|
|
|
|
bool bIsMeshMutable = DatasIn.GetDataFlags(InParamMesh()).bIsMutableData;
|
|
|
|
|
if (bIsMeshMutable)
|
|
|
|
|
{
|
2021-04-12 12:37:05 -04:00
|
|
|
UE_LOG(LogGeometryFlowMeshProcessing, Display, TEXT("[%s] RECOMPUTING MeshOp In Place!"), *GetIdentifier());
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
FDynamicMesh3 EditableMesh;
|
|
|
|
|
MeshArg->GiveTo<FDynamicMesh3>(EditableMesh, (int)EMeshProcessingDataTypes::DynamicMesh);
|
2021-09-23 14:24:45 -04:00
|
|
|
ProcessMeshInPlace(DatasIn, Settings, EditableMesh, EvaluationInfo);
|
2020-11-24 01:17:27 -04:00
|
|
|
|
2022-01-28 19:49:26 -05:00
|
|
|
if (EvaluationInfo && EvaluationInfo->Progress && EvaluationInfo->Progress->Cancelled())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-24 01:17:27 -04:00
|
|
|
// store new result
|
|
|
|
|
TSafeSharedPtr<FDataDynamicMesh> Result = MakeSafeShared<FDataDynamicMesh>();
|
|
|
|
|
Result->MoveData(MoveTemp(EditableMesh));
|
|
|
|
|
SetOutput(OutParamResultMesh(), Result);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-04-12 12:37:05 -04:00
|
|
|
UE_LOG(LogGeometryFlowMeshProcessing, Display, TEXT("[%s] RECOMPUTING MeshOp"), *GetIdentifier());
|
2020-11-24 01:17:27 -04:00
|
|
|
|
|
|
|
|
// do we ever want to support using a copy of the source mesh?
|
|
|
|
|
const FDynamicMesh3& SourceMesh = MeshArg->GetDataConstRef<FDynamicMesh3>((int)EMeshProcessingDataTypes::DynamicMesh);
|
|
|
|
|
|
|
|
|
|
// run mesh processing
|
|
|
|
|
FDynamicMesh3 ResultMesh;
|
2021-09-23 14:24:45 -04:00
|
|
|
ProcessMesh(DatasIn, Settings, SourceMesh, ResultMesh, EvaluationInfo);
|
2020-11-24 01:17:27 -04:00
|
|
|
|
2022-01-28 19:49:26 -05:00
|
|
|
if (EvaluationInfo && EvaluationInfo->Progress && EvaluationInfo->Progress->Cancelled())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-24 01:17:27 -04:00
|
|
|
// store new result
|
|
|
|
|
TSafeSharedPtr<FDataDynamicMesh> Result = MakeSafeShared<FDataDynamicMesh>();
|
|
|
|
|
Result->MoveData(MoveTemp(ResultMesh));
|
|
|
|
|
SetOutput(OutParamResultMesh(), Result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EvaluationInfo->CountCompute(this);
|
|
|
|
|
}
|
|
|
|
|
DatasOut.SetData(OutParamResultMesh(), GetOutput(OutParamResultMesh()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace GeometryFlow
|
|
|
|
|
} // end namespace UE
|
|
|
|
|
|
|
|
|
|
|