diff --git a/Volt/Volt/src/Volt/Asset/Animation/Animation.h b/Volt/Volt/src/Volt/Asset/Animation/Animation.h index 47fed2528..f4d1adbda 100644 --- a/Volt/Volt/src/Volt/Asset/Animation/Animation.h +++ b/Volt/Volt/src/Volt/Asset/Animation/Animation.h @@ -53,6 +53,18 @@ namespace Volt { uint32_t frame; std::string name; + + static void Serialize(BinaryStreamWriter& streamWriter, const Event& data) + { + streamWriter.Write(data.frame); + streamWriter.Write(data.name); + } + + static void Deserialize(BinaryStreamReader& streamReader, Event& outData) + { + streamReader.Read(outData.frame); + streamReader.Read(outData.name); + } }; const std::vector Sample(float aStartTime, Ref aSkeleton, bool looping); diff --git a/Volt/Volt/src/Volt/Asset/ImportersNew/AnimationSerializer.cpp b/Volt/Volt/src/Volt/Asset/ImportersNew/AnimationSerializer.cpp index 2fd461ebc..3de591abe 100644 --- a/Volt/Volt/src/Volt/Asset/ImportersNew/AnimationSerializer.cpp +++ b/Volt/Volt/src/Volt/Asset/ImportersNew/AnimationSerializer.cpp @@ -11,12 +11,14 @@ namespace Volt float duration; uint32_t framesPerSecond; std::vector frames; + std::vector events; static void Serialize(BinaryStreamWriter& streamWriter, const AnimationSerializationData& data) { streamWriter.Write(data.duration); streamWriter.Write(data.framesPerSecond); streamWriter.Write(data.frames); + streamWriter.Write(data.events); } static void Deserialize(BinaryStreamReader& streamReader, AnimationSerializationData& outData) @@ -24,6 +26,7 @@ namespace Volt streamReader.Read(outData.duration); streamReader.Read(outData.framesPerSecond); streamReader.Read(outData.frames); + streamReader.Read(outData.events); } }; @@ -37,6 +40,7 @@ namespace Volt serializationData.duration = animation->m_duration; serializationData.framesPerSecond = animation->m_framesPerSecond; serializationData.frames = animation->m_frames; + serializationData.events = animation->m_events; const size_t compressedDataOffset = AssetSerializer::WriteMetadata(metadata, asset->GetVersion(), streamWriter); streamWriter.Write(serializationData); @@ -76,6 +80,7 @@ namespace Volt animation->m_duration = serializationData.duration; animation->m_framesPerSecond = serializationData.framesPerSecond; animation->m_frames = serializationData.frames; + animation->m_events = serializationData.events; return true; }