2022-09-26 15:12:13 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
2022-10-01 02:04:57 -04:00
|
|
|
#include "MuT/NodeObjectNew.h"
|
2022-09-26 15:12:13 -04:00
|
|
|
|
2022-10-02 10:56:02 -04:00
|
|
|
#include "HAL/PlatformString.h"
|
|
|
|
|
#include "Misc/AssertionMacros.h"
|
|
|
|
|
#include "MuT/CompilerPrivate.h"
|
|
|
|
|
#include "MuT/NodeComponent.h"
|
2022-10-01 02:04:57 -04:00
|
|
|
#include "MuT/NodeComponentNew.h"
|
2022-10-02 10:56:02 -04:00
|
|
|
#include "MuT/NodeLOD.h"
|
|
|
|
|
#include "MuT/NodeMesh.h"
|
|
|
|
|
#include "MuT/NodeMeshConstant.h"
|
|
|
|
|
#include "MuT/NodeMeshPrivate.h"
|
|
|
|
|
#include "MuT/NodePrivate.h"
|
|
|
|
|
#include "MuT/NodeSurface.h"
|
2022-10-01 02:04:57 -04:00
|
|
|
#include "MuT/NodeSurfaceNew.h"
|
2022-09-26 15:12:13 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace mu
|
|
|
|
|
{
|
|
|
|
|
//---------------------------------------------------------------------------------------------
|
2024-06-10 04:10:54 -04:00
|
|
|
FNodeType NodeObjectNew::StaticType = FNodeType(Node::EType::ObjectNew, NodeObject::GetStaticType() );
|
2022-09-26 15:12:13 -04:00
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
const FString& NodeObjectNew::GetName() const
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
return Name;
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-06-10 04:10:54 -04:00
|
|
|
void NodeObjectNew::SetName( const FString& InName )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
Name = InName;
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
const FString& NodeObjectNew::GetUid() const
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
return Uid;
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-06-10 04:10:54 -04:00
|
|
|
void NodeObjectNew::SetUid( const FString& InUid )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
Uid = InUid;
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
int32 NodeObjectNew::GetStateCount() const
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
return States.Num();
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
void NodeObjectNew::SetStateCount( int32 c )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
States.SetNum( c );
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
void NodeObjectNew::SetStateName( int32 s, const FString& n )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
|
|
|
|
check( s>=0 && s<GetStateCount() );
|
2024-06-10 04:10:54 -04:00
|
|
|
States[s].Name = n;
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
bool NodeObjectNew::HasStateParam( int32 s, const FString& param ) const
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
|
|
|
|
check( s>=0 && s<GetStateCount() );
|
2024-06-10 04:10:54 -04:00
|
|
|
return States[s].RuntimeParams.Contains( param );
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
void NodeObjectNew::AddStateParam( int32 s, const FString& param )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
|
|
|
|
check( s>=0 && s<GetStateCount() );
|
|
|
|
|
|
|
|
|
|
if (!HasStateParam(s,param))
|
|
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
States[s].RuntimeParams.Add( param );
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 04:43:37 -04:00
|
|
|
void NodeObjectNew::RemoveStateParam( int32 s, const FString& param )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
|
|
|
|
check( s>=0 && s<GetStateCount() );
|
|
|
|
|
|
2024-06-10 04:10:54 -04:00
|
|
|
int32 it = States[s].RuntimeParams.Find( param );
|
2022-10-11 05:14:05 -04:00
|
|
|
if ( it != INDEX_NONE )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
States[s].RuntimeParams.RemoveAt( it );
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-03-08 04:37:54 -05:00
|
|
|
void NodeObjectNew::SetStateProperties( int32 StateIndex,
|
|
|
|
|
ETextureCompressionStrategy TextureCompressionStrategy,
|
|
|
|
|
bool bOnlyFirstLOD,
|
|
|
|
|
uint8 FirstLOD,
|
|
|
|
|
uint8 NumExtraLODsToBuildAfterFirstLOD )
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
2023-03-08 04:37:54 -05:00
|
|
|
check(StateIndex >=0 && StateIndex<GetStateCount() );
|
2022-09-26 15:12:13 -04:00
|
|
|
|
2024-06-10 04:10:54 -04:00
|
|
|
FStateOptimizationOptions& Data = States[StateIndex].Optimisation;
|
2023-03-08 04:37:54 -05:00
|
|
|
Data.TextureCompressionStrategy = TextureCompressionStrategy;
|
|
|
|
|
Data.bOnlyFirstLOD = bOnlyFirstLOD;
|
|
|
|
|
Data.FirstLOD = FirstLOD;
|
|
|
|
|
Data.NumExtraLODsToBuildAfterFirstLOD = NumExtraLODsToBuildAfterFirstLOD;
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
2024-06-10 04:10:54 -04:00
|
|
|
void NodeObjectNew::AddExtensionDataNode(Ptr<NodeExtensionData> Node, const FString& InName)
|
2023-04-05 11:20:44 -04:00
|
|
|
{
|
2024-06-10 04:10:54 -04:00
|
|
|
NodeObjectNew::FNamedExtensionDataNode& Entry = ExtensionDataNodes.AddDefaulted_GetRef();
|
2023-04-05 11:20:44 -04:00
|
|
|
Entry.Node = Node;
|
2024-06-10 04:10:54 -04:00
|
|
|
Entry.Name = InName;
|
2023-04-05 11:20:44 -04:00
|
|
|
}
|
2022-09-26 15:12:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|