You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
GeometryFlow: Added FCompactMeshNode, FComputeMeshPerVertexOverlayNormalsNode (convenient), and FTransferMeshMaterialIDsNode that applies FMeshAttributeTransfer based on two input meshes. Graph InferConnection() now is more clever and can infer connections in cases where a potentially-ambiguous connection is resolved based on what is already connected (ie if two mesh inputs, and one is assigned, infer that second one is intended) LODToolset: LODGraph now transfers materials and computes per-vertex normals before Simplify node, and Compacts afterwards (required for other downstream processes). LODProcess now handles multiple materials, and can re-use input materials if they do not require a baked texture or normal map. In repeat applications, previously-auto-generated StaticMesh Materials are detected and removed from the material set. Normals and Tangents are explicitly computed for stored HiRes source and LOD0, and build settings updated appropriately. #rb none #rnx #jira none [FYI] tyson.brochu #ROBOMERGE-SOURCE: CL 15470041 in //UE5/Release-5.0-EarlyAccess/... #ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668) [CL 15470044 by ryan schmidt in ue5-main branch]
80 lines
2.1 KiB
C++
80 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "MeshProcessingNodes/MeshProcessingBaseNodes.h"
|
|
#include "MeshProcessingNodes/MeshProcessingDataTypes.h"
|
|
#include "Operations/MeshAttributeTransfer.h"
|
|
|
|
namespace UE
|
|
{
|
|
namespace GeometryFlow
|
|
{
|
|
|
|
/**
|
|
* FTransferMeshMaterialIDsNode transfers Material IDs from a SourceMesh to the Input mesh and returns in the Output mesh (can be applied in-place)
|
|
*/
|
|
class FTransferMeshMaterialIDsNode : public FProcessMeshBaseNode
|
|
{
|
|
public:
|
|
static const FString InParamMaterialSourceMesh() { return TEXT("MaterialSourceMesh"); }
|
|
|
|
public:
|
|
FTransferMeshMaterialIDsNode()
|
|
{
|
|
AddInput(InParamMaterialSourceMesh(), MakeUnique<FDynamicMeshInput>());
|
|
|
|
// we can mutate input mesh
|
|
ConfigureInputFlags(InParamMesh(), FNodeInputFlags::Transformable());
|
|
}
|
|
|
|
virtual void CheckAdditionalInputs(const FNamedDataMap& DatasIn, bool& bRecomputeRequired, bool& bAllInputsValid) override
|
|
{
|
|
FindAndUpdateInputForEvaluate(InParamMaterialSourceMesh(), DatasIn, bRecomputeRequired, bAllInputsValid);
|
|
}
|
|
|
|
|
|
virtual void ProcessMesh(
|
|
const FNamedDataMap& DatasIn,
|
|
const FDynamicMesh3& MeshIn,
|
|
FDynamicMesh3& MeshOut) override
|
|
{
|
|
MeshOut = MeshIn;
|
|
TransferMaterialIDs(DatasIn, &MeshOut);
|
|
}
|
|
|
|
virtual void ProcessMeshInPlace(
|
|
const FNamedDataMap& DatasIn,
|
|
FDynamicMesh3& MeshInOut) override
|
|
{
|
|
TransferMaterialIDs(DatasIn, &MeshInOut);
|
|
}
|
|
|
|
|
|
virtual void TransferMaterialIDs(const FNamedDataMap& DatasIn, FDynamicMesh3* TargetMesh)
|
|
{
|
|
TSafeSharedPtr<IData> MaterialSourceMeshArg = DatasIn.FindData(InParamMaterialSourceMesh());
|
|
const FDynamicMesh3& MaterialSourceMesh = MaterialSourceMeshArg->GetDataConstRef<FDynamicMesh3>((int)EMeshProcessingDataTypes::DynamicMesh);
|
|
|
|
if (TargetMesh->HasAttributes() == false)
|
|
{
|
|
TargetMesh->EnableAttributes();
|
|
}
|
|
if (TargetMesh->Attributes()->HasMaterialID() == false)
|
|
{
|
|
TargetMesh->Attributes()->EnableMaterialID();
|
|
}
|
|
|
|
FMeshAttributeTransfer Transfer(&MaterialSourceMesh, TargetMesh);
|
|
Transfer.TransferType = EMeshAttributeTransferType::MaterialID;
|
|
Transfer.Apply();
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace GeometryFlow
|
|
} //
|