Add SoftAssetReference type

This commit is contained in:
Wojtek Figat
2022-02-28 23:15:35 +01:00
parent 6738bc8dea
commit 4a9c746bed
5 changed files with 352 additions and 12 deletions

View File

@@ -13,6 +13,8 @@
struct Version;
struct VariantType;
template<typename T>
class SoftAssetReference;
// @formatter:off
@@ -513,6 +515,26 @@ namespace Serialization
v = id;
}
// Soft Asset Reference
template<typename T>
inline bool ShouldSerialize(const SoftAssetReference<T>& v, const void* otherObj)
{
return !otherObj || v.Get() != ((SoftAssetReference<T>*)otherObj)->Get();
}
template<typename T>
inline void Serialize(ISerializable::SerializeStream& stream, const SoftAssetReference<T>& v, const void* otherObj)
{
stream.Guid(v.GetID());
}
template<typename T>
inline void Deserialize(ISerializable::DeserializeStream& stream, SoftAssetReference<T>& v, ISerializeModifier* modifier)
{
Guid id;
Deserialize(stream, id, modifier);
v = id;
}
// Array
template<typename T, typename AllocationType = HeapAllocation>