Files
alexei lebedev 2815323fbc [mutable] Moved the Mutable plugin out of Experimental status into Beta.
#jira UE-223488
#rb jordi.rovira
#tests Editor
#rnx

#virtualized

[CL 36035608 by alexei lebedev in ue5-main branch]
2024-09-05 07:16:19 -04:00

96 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MuT/NodeMeshConstant.h"
#include "Misc/AssertionMacros.h"
#include "MuT/NodeLayout.h"
#include "MuT/NodeMeshConstantPrivate.h"
#include "MuT/NodePrivate.h"
#include "MuR/Mesh.h"
namespace mu
{
FNodeType NodeMeshConstant::Private::s_type = FNodeType(Node::EType::MeshConstant, NodeMesh::GetStaticType() );
MUTABLE_IMPLEMENT_NODE( NodeMeshConstant );
Ptr<Mesh> NodeMeshConstant::GetValue() const
{
return m_pD->Value;
}
void NodeMeshConstant::SetValue( Ptr<Mesh> pValue )
{
m_pD->Value = pValue;
if (m_pD->Value)
{
// Ensure mesh is well formed
m_pD->Value->EnsureSurfaceData();
}
}
void NodeMeshConstant::AddMorph(const FString& Name, Ptr<Mesh> Morphed)
{
m_pD->Morphs.Add({Name,Morphed});
}
Ptr<Mesh> NodeMeshConstant::FindMorph(const FString& Name) const
{
for (Private::FMorph& Morph : m_pD->Morphs )
{
if (Morph.Name == Name)
{
return Morph.MorphedMesh;
}
}
return nullptr;
}
int32 NodeMeshConstant::GetLayoutCount() const
{
return m_pD->Layouts.Num();
}
void NodeMeshConstant::SetLayoutCount( int32 num )
{
check( num >=0 );
m_pD->Layouts.SetNum( num );
}
Ptr<NodeLayout> NodeMeshConstant::GetLayout( int32 index ) const
{
check( index >=0 && index < m_pD->Layouts.Num() );
Ptr<NodeLayout> pResult;
if (index >= 0 && index < m_pD->Layouts.Num())
{
pResult = m_pD->Layouts[index];
}
return pResult;
}
void NodeMeshConstant::SetLayout( int32 index, Ptr<NodeLayout> pLayout )
{
check( index >=0 && index < m_pD->Layouts.Num() );
m_pD->Layouts[ index ] = pLayout;
}
}