Files
UnrealEngineUWP/Engine/Source/Runtime/Datasmith/DirectLink/Public/DirectLinkElementSnapshot.h
Marc Audy 9753392e2b Merge UE5/RES CL# 15462083 to UE5/Main
This represents UE4/Main @ 15414221

[CL 15463811 by Marc Audy in ue5-main branch]
2021-02-18 18:13:28 -04:00

73 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "DirectLinkCommon.h"
#include "DirectLinkParameterStore.h"
namespace DirectLink
{
enum class ESerializationStatus
{
Ok,
StreamError,
VersionMinNotRespected,
VersionMaxNotRespected,
};
struct DIRECTLINK_API FReferenceSnapshot
{
void Serialize(FArchive& Ar);
FElementHash Hash() const;
struct FReferenceGroup
{
FName Name;
TArray<FSceneGraphId> ReferencedIds;
};
TArray<FReferenceGroup> Groups;
};
class DIRECTLINK_API FElementSnapshot
{
public:
FElementSnapshot() = default;
FElementSnapshot(const ISceneGraphNode& Node);
friend FArchive& operator<<(FArchive& Ar, FElementSnapshot& This);
ESerializationStatus Serialize(FArchive& Ar);
FElementHash GetHash() const;
FElementHash GetDataHash() const; // #ue_directlink_sync: serialize hashs
FElementHash GetRefHash() const;
void UpdateNodeReferences(IReferenceResolutionProvider& Resolver, ISceneGraphNode& Node) const;
void UpdateNodeData(ISceneGraphNode& Node) const;
FSceneGraphId GetNodeId() const { return NodeId; }
template<typename T>
bool GetValueAs(FName Name, T& Out) const
{
return DataSnapshot.GetValueAs(Name, Out);
}
private:
FSceneGraphId NodeId;
mutable FElementHash DataHash = InvalidHash;
mutable FElementHash RefHash = InvalidHash;
FParameterStoreSnapshot DataSnapshot;
FReferenceSnapshot RefSnapshot;
};
} // namespace DirectLink