Fix serialization issues related to sequence node/track (#214) (#247)

* Fix serialization issues related to sequence node/track
This commit is contained in:
chiyenteng
2021-04-22 17:42:06 -07:00
committed by GitHub
parent 9ca7408929
commit bac334a244
73 changed files with 801 additions and 442 deletions
+21 -3
View File
@@ -327,7 +327,16 @@ struct IMovieCallback
*/
struct IAnimTrack
{
AZ_RTTI(IAnimTrack, "{AA0D5170-FB28-426F-BA13-7EFF6BB3AC67}")
AZ_RTTI(IAnimTrack, "{AA0D5170-FB28-426F-BA13-7EFF6BB3AC67}");
AZ_CLASS_ALLOCATOR(IAnimTrack, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimTrack>();
}
}
//! Flags that can be set on animation track.
enum EAnimTrackFlags
@@ -594,7 +603,16 @@ struct IAnimNodeOwner
struct IAnimNode
{
public:
AZ_RTTI(IAnimNode, "{0A096354-7F26-4B18-B8C0-8F10A3E0440A}")
AZ_RTTI(IAnimNode, "{0A096354-7F26-4B18-B8C0-8F10A3E0440A}");
AZ_CLASS_ALLOCATOR(IAnimNode, AZ::SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimNode>();
}
}
//////////////////////////////////////////////////////////////////////////
// Supported params.
@@ -922,7 +940,7 @@ struct IAnimSequence
static void Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<IAnimSequence>();
}
@@ -88,11 +88,14 @@ void CAnimAzEntityNode::SetSkipInterpolatedCameraNode(const bool skipNodeCameraA
}
//////////////////////////////////////////////////////////////////////////
void CAnimAzEntityNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimAzEntityNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimAzEntityNode, CAnimNode>()
->Version(1)
->Field("Entity", &CAnimAzEntityNode::m_entityId);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimAzEntityNode, CAnimNode>()
->Version(1)
->Field("Entity", &CAnimAzEntityNode::m_entityId);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -74,7 +74,7 @@ public:
// will be animating these components during interpolation.
void SetSkipInterpolatedCameraNode(const bool skipNodeCameraAnimation) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
@@ -651,12 +651,15 @@ void CAnimComponentNode::AddPropertyToParamInfoMap(const CAnimParamType& paramTy
}
//////////////////////////////////////////////////////////////////////////
void CAnimComponentNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimComponentNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimComponentNode, CAnimNode>()
->Version(1)
->Field("ComponentID", &CAnimComponentNode::m_componentId)
->Field("ComponentTypeID", &CAnimComponentNode::m_componentTypeId);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimComponentNode, CAnimNode>()
->Version(1)
->Field("ComponentID", &CAnimComponentNode::m_componentId)
->Field("ComponentTypeID", &CAnimComponentNode::m_componentTypeId);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ public:
m_skipComponentAnimationUpdates = skipAnimationUpdates;
}
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
// functions involved in the process to parse and store component behavior context animated properties
@@ -67,10 +67,13 @@ void CAnimEnvironmentNode::Initialize()
}
}
//////////////////////////////////////////////////////////////////////////
void CAnimEnvironmentNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimEnvironmentNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimEnvironmentNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimEnvironmentNode, CAnimNode>()
->Version(1);
}
}
void CAnimEnvironmentNode::Animate(SAnimContext& ac)
@@ -40,7 +40,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -272,17 +272,32 @@ bool CAnimNode::RemoveTrack(IAnimTrack* pTrack)
}
//////////////////////////////////////////////////////////////////////////
void CAnimNode::Reflect(AZ::SerializeContext* serializeContext)
static bool AnimNodeVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<CAnimNode>()
->Version(2)
->Field("ID", &CAnimNode::m_id)
->Field("Name", &CAnimNode::m_name)
->Field("Flags", &CAnimNode::m_flags)
->Field("Tracks", &CAnimNode::m_tracks)
->Field("Parent", &CAnimNode::m_parentNodeId)
->Field("Type", &CAnimNode::m_nodeType)
->Field("Expanded", &CAnimNode::m_expanded);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimNode>());
}
return true;
}
void CAnimNode::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimNode, IAnimNode>()
->Version(3, &AnimNodeVersionConverter)
->Field("ID", &CAnimNode::m_id)
->Field("Name", &CAnimNode::m_name)
->Field("Flags", &CAnimNode::m_flags)
->Field("Tracks", &CAnimNode::m_tracks)
->Field("Parent", &CAnimNode::m_parentNodeId)
->Field("Type", &CAnimNode::m_nodeType)
->Field("Expanded", &CAnimNode::m_expanded);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -162,7 +162,7 @@ public:
void SetExpanded(bool expanded) override;
bool GetExpanded() const override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual void UpdateDynamicParamsInternal() {};
@@ -36,8 +36,11 @@ CAnimParamType CAnimNodeGroup::GetParamType([[maybe_unused]] unsigned int nIndex
}
//////////////////////////////////////////////////////////////////////////
void CAnimNodeGroup::Reflect(AZ::SerializeContext* serializeContext)
void CAnimNodeGroup::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimNodeGroup, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimNodeGroup, CAnimNode>()
->Version(1);
}
}
@@ -34,7 +34,7 @@ public:
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_ANIMNODEGROUP_H
#endif // CRYINCLUDE_CRYMOVIE_ANIMNODEGROUP_H
@@ -453,8 +453,11 @@ void CAnimPostFXNode::OnReset()
}
//////////////////////////////////////////////////////////////////////////
void CAnimPostFXNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimPostFXNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimPostFXNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimPostFXNode, CAnimNode>()
->Version(1);
}
}
@@ -63,7 +63,7 @@ public:
void InitPostLoad(IAnimSequence* sequence) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -291,10 +291,13 @@ void CAnimScreenFaderNode::Serialize
}
//////////////////////////////////////////////////////////////////////////
void CAnimScreenFaderNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimScreenFaderNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimScreenFaderNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimScreenFaderNode, CAnimNode>()
->Version(1);
}
}
//-----------------------------------------------------------------------------
@@ -56,7 +56,7 @@ public:
bool IsAnyTextureVisible() const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -837,9 +837,7 @@ static bool AnimSequenceVersionConverter(
void CAnimSequence::Reflect(AZ::ReflectContext* context)
{
IAnimSequence::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimSequence, IAnimSequence>()
->Version(IAnimSequence::kSequenceVersion, &AnimSequenceVersionConverter)
@@ -17,101 +17,104 @@
#include "AnimSerializer.h"
void AnimSerializer::ReflectAnimTypes(AZ::SerializeContext* context)
void AnimSerializer::ReflectAnimTypes(AZ::ReflectContext* context)
{
// Reflection for Maestro's AZ_TYPE_INFO'ed classes
context->Class<CAnimParamType>()
->Version(1)
->Field("Type", &CAnimParamType::m_type)
->Field("Name", &CAnimParamType::m_name);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context); serializeContext != nullptr)
{
// Reflection for Maestro's AZ_TYPE_INFO'ed classes
serializeContext->Class<CAnimParamType>()
->Version(1)
->Field("Type", &CAnimParamType::m_type)
->Field("Name", &CAnimParamType::m_name);
context->Class<Range>()
->Field("Start", &Range::start)
->Field("End", &Range::end);
serializeContext->Class<Range>()
->Field("Start", &Range::start)
->Field("End", &Range::end);
// Curve Key classes
context->Class<IKey>()
->Field("Time", &IKey::time)
->Field("Flags", &IKey::flags);
// Curve Key classes
serializeContext->Class<IKey>()
->Field("Time", &IKey::time)
->Field("Flags", &IKey::flags);
context->Class<AZ::IAssetBlendKey, ITimeRangeKey>()
->Field("AssetId", &AZ::IAssetBlendKey::m_assetId)
->Field("Description", &AZ::IAssetBlendKey::m_description)
->Field("BlendInTime", &AZ::IAssetBlendKey::m_blendInTime)
->Field("BlendOutTime", &AZ::IAssetBlendKey::m_blendOutTime);
serializeContext->Class<AZ::IAssetBlendKey, ITimeRangeKey>()
->Field("AssetId", &AZ::IAssetBlendKey::m_assetId)
->Field("Description", &AZ::IAssetBlendKey::m_description)
->Field("BlendInTime", &AZ::IAssetBlendKey::m_blendInTime)
->Field("BlendOutTime", &AZ::IAssetBlendKey::m_blendOutTime);
context->Class<IBoolKey, IKey>();
serializeContext->Class<IBoolKey, IKey>();
context->Class<ICaptureKey, IKey>()
->Field("Duration", &ICaptureKey::duration)
->Field("TimeStep", &ICaptureKey::timeStep)
->Field("Folder", &ICaptureKey::folder)
->Field("Once", &ICaptureKey::once)
->Field("FilePrefix", &ICaptureKey::prefix);
serializeContext->Class<ICaptureKey, IKey>()
->Field("Duration", &ICaptureKey::duration)
->Field("TimeStep", &ICaptureKey::timeStep)
->Field("Folder", &ICaptureKey::folder)
->Field("Once", &ICaptureKey::once)
->Field("FilePrefix", &ICaptureKey::prefix);
context->Class<ICharacterKey, ITimeRangeKey>()
->Field("Animation", &ICharacterKey::m_animation)
->Field("BlendGap", &ICharacterKey::m_bBlendGap)
->Field("PlayInPlace", &ICharacterKey::m_bInPlace);
serializeContext->Class<ICharacterKey, ITimeRangeKey>()
->Field("Animation", &ICharacterKey::m_animation)
->Field("BlendGap", &ICharacterKey::m_bBlendGap)
->Field("PlayInPlace", &ICharacterKey::m_bInPlace);
context->Class<ICommentKey, IKey>()
->Field("Comment", &ICommentKey::m_strComment)
->Field("Duration", &ICommentKey::m_duration)
->Field("Font", &ICommentKey::m_strFont)
->Field("Color", &ICommentKey::m_color)
->Field("Size", &ICommentKey::m_size)
->Field("Align", &ICommentKey::m_align);
serializeContext->Class<ICommentKey, IKey>()
->Field("Comment", &ICommentKey::m_strComment)
->Field("Duration", &ICommentKey::m_duration)
->Field("Font", &ICommentKey::m_strFont)
->Field("Color", &ICommentKey::m_color)
->Field("Size", &ICommentKey::m_size)
->Field("Align", &ICommentKey::m_align);
context->Class<IConsoleKey, IKey>()
->Field("Command", &IConsoleKey::command);
serializeContext->Class<IConsoleKey, IKey>()
->Field("Command", &IConsoleKey::command);
context->Class<IDiscreteFloatKey, IKey>()
->Field("Value", &IDiscreteFloatKey::m_fValue);
serializeContext->Class<IDiscreteFloatKey, IKey>()
->Field("Value", &IDiscreteFloatKey::m_fValue);
context->Class<IEventKey, IKey>()
->Field("Event", &IEventKey::event)
->Field("EventValue", &IEventKey::eventValue)
->Field("Anim", &IEventKey::animation)
->Field("Target", &IEventKey::target)
->Field("Length", &IEventKey::duration);
serializeContext->Class<IEventKey, IKey>()
->Field("Event", &IEventKey::event)
->Field("EventValue", &IEventKey::eventValue)
->Field("Anim", &IEventKey::animation)
->Field("Target", &IEventKey::target)
->Field("Length", &IEventKey::duration);
context->Class<ILookAtKey, IKey>()
->Field("LookAtNodeName", &ILookAtKey::szSelection)
->Field("LookPose", &ILookAtKey::lookPose)
->Field("Duration", &ILookAtKey::fDuration)
->Field("SmoothTime", &ILookAtKey::smoothTime);
serializeContext->Class<ILookAtKey, IKey>()
->Field("LookAtNodeName", &ILookAtKey::szSelection)
->Field("LookPose", &ILookAtKey::lookPose)
->Field("Duration", &ILookAtKey::fDuration)
->Field("SmoothTime", &ILookAtKey::smoothTime);
context->Class<IScreenFaderKey, IKey>()
->Field("FadeTime", &IScreenFaderKey::m_fadeTime)
->Field("FadeColor", &IScreenFaderKey::m_fadeColor)
->Field("FadeType", &IScreenFaderKey::m_fadeType)
->Field("FadeChangeType", &IScreenFaderKey::m_fadeChangeType)
->Field("Texture", &IScreenFaderKey::m_strTexture)
->Field("useCurColor", &IScreenFaderKey::m_bUseCurColor);
serializeContext->Class<IScreenFaderKey, IKey>()
->Field("FadeTime", &IScreenFaderKey::m_fadeTime)
->Field("FadeColor", &IScreenFaderKey::m_fadeColor)
->Field("FadeType", &IScreenFaderKey::m_fadeType)
->Field("FadeChangeType", &IScreenFaderKey::m_fadeChangeType)
->Field("Texture", &IScreenFaderKey::m_strTexture)
->Field("useCurColor", &IScreenFaderKey::m_bUseCurColor);
context->Class<ISelectKey, IKey>()
->Field("SelectedName", &ISelectKey::szSelection)
->Field("SelectedEntityId", &ISelectKey::cameraAzEntityId)
->Field("Duration", &ISelectKey::fDuration)
->Field("BlendTime", &ISelectKey::fBlendTime);
serializeContext->Class<ISelectKey, IKey>()
->Field("SelectedName", &ISelectKey::szSelection)
->Field("SelectedEntityId", &ISelectKey::cameraAzEntityId)
->Field("Duration", &ISelectKey::fDuration)
->Field("BlendTime", &ISelectKey::fBlendTime);
context->Class<ISequenceKey, IKey>()
->Field("Node", &ISequenceKey::szSelection)
->Field("SequenceEntityId", &ISequenceKey::sequenceEntityId)
->Field("OverrideTimes", &ISequenceKey::bOverrideTimes)
->Field("StartTime", &ISequenceKey::fStartTime)
->Field("EndTime", &ISequenceKey::fEndTime);
serializeContext->Class<ISequenceKey, IKey>()
->Field("Node", &ISequenceKey::szSelection)
->Field("SequenceEntityId", &ISequenceKey::sequenceEntityId)
->Field("OverrideTimes", &ISequenceKey::bOverrideTimes)
->Field("StartTime", &ISequenceKey::fStartTime)
->Field("EndTime", &ISequenceKey::fEndTime);
context->Class<ISoundKey, IKey>()
->Field("StartTrigger", &ISoundKey::sStartTrigger)
->Field("StopTrigger", &ISoundKey::sStopTrigger)
->Field("Duration", &ISoundKey::fDuration)
->Field("Color", &ISoundKey::customColor);
serializeContext->Class<ISoundKey, IKey>()
->Field("StartTrigger", &ISoundKey::sStartTrigger)
->Field("StopTrigger", &ISoundKey::sStopTrigger)
->Field("Duration", &ISoundKey::fDuration)
->Field("Color", &ISoundKey::customColor);
context->Class<ITimeRangeKey, IKey>()
->Field("Duration", &ITimeRangeKey::m_duration)
->Field("Start", &ITimeRangeKey::m_startTime)
->Field("End", &ITimeRangeKey::m_endTime)
->Field("Speed", &ITimeRangeKey::m_speed)
->Field("Loop", &ITimeRangeKey::m_bLoop);
serializeContext->Class<ITimeRangeKey, IKey>()
->Field("Duration", &ITimeRangeKey::m_duration)
->Field("Start", &ITimeRangeKey::m_startTime)
->Field("End", &ITimeRangeKey::m_endTime)
->Field("Speed", &ITimeRangeKey::m_speed)
->Field("Loop", &ITimeRangeKey::m_bLoop);
}
}
@@ -11,11 +11,11 @@
*/
#pragma once
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/RTTI/ReflectContext.h>
class AnimSerializer
{
public:
//! Reflection for Maestro's AZ_TYPE_INFO'ed classes
static void ReflectAnimTypes(AZ::SerializeContext* context);
static void ReflectAnimTypes(AZ::ReflectContext* context);
};
@@ -370,7 +370,7 @@ public:
m_id = id;
}
static void Reflect(AZ::SerializeContext* serializeContext) {}
static void Reflect([[maybe_unused]] AZ::ReflectContext* context) {}
protected:
@@ -404,34 +404,39 @@ inline bool TAnimSplineTrack<Vec2>::VersionConverter(AZ::SerializeContext& conte
AZ::SerializeContext::DataElementNode& classElement)
{
bool result = true;
if (classElement.GetVersion() == 1)
if (classElement.GetVersion() < 5)
{
bool converted = false;
classElement.AddElement(context, "BaseClass1", azrtti_typeid<IAnimTrack>());
int splineElementIdx = classElement.FindElement(AZ_CRC("Spline", 0x35f655e9));
if (splineElementIdx != -1)
if (classElement.GetVersion() == 1)
{
// Find & copy the raw pointer node
AZ::SerializeContext::DataElementNode& splinePtrNodeRef = classElement.GetSubElement(splineElementIdx);
AZ::SerializeContext::DataElementNode splinePtrNodeCopy = splinePtrNodeRef;
bool converted = false;
// Reset the node, then convert it to an intrusive pointer
splinePtrNodeRef = AZ::SerializeContext::DataElementNode();
if (splinePtrNodeRef.Convert<AZStd::intrusive_ptr<spline::TrackSplineInterpolator<Vec2>>>(context, "Spline"))
int splineElementIdx = classElement.FindElement(AZ_CRC("Spline", 0x35f655e9));
if (splineElementIdx != -1)
{
// Use the standard name used with the smart pointers serialization
// (smart pointers are serialized as containers with one element);
// Set the intrusive pointer to the raw pointer value
splinePtrNodeCopy.SetName(AZ::SerializeContext::IDataContainer::GetDefaultElementName());
splinePtrNodeRef.AddElement(splinePtrNodeCopy);
// Find & copy the raw pointer node
AZ::SerializeContext::DataElementNode& splinePtrNodeRef = classElement.GetSubElement(splineElementIdx);
AZ::SerializeContext::DataElementNode splinePtrNodeCopy = splinePtrNodeRef;
converted = true;
// Reset the node, then convert it to an intrusive pointer
splinePtrNodeRef = AZ::SerializeContext::DataElementNode();
if (splinePtrNodeRef.Convert<AZStd::intrusive_ptr<spline::TrackSplineInterpolator<Vec2>>>(context, "Spline"))
{
// Use the standard name used with the smart pointers serialization
// (smart pointers are serialized as containers with one element);
// Set the intrusive pointer to the raw pointer value
splinePtrNodeCopy.SetName(AZ::SerializeContext::IDataContainer::GetDefaultElementName());
splinePtrNodeRef.AddElement(splinePtrNodeCopy);
converted = true;
}
}
}
// Did not convert. Discard unknown versions if failed to convert, and hope for the best
AZ_Assert(converted, "Failed to convert TUiAnimSplineTrack<Vec2> version %d to the current version", classElement.GetVersion());
result = converted;
// Did not convert. Discard unknown versions if failed to convert, and hope for the best
AZ_Assert(converted, "Failed to convert TUiAnimSplineTrack<Vec2> version %d to the current version", classElement.GetVersion());
result = converted;
}
}
return result;
@@ -439,31 +444,34 @@ inline bool TAnimSplineTrack<Vec2>::VersionConverter(AZ::SerializeContext& conte
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimSplineTrack<Vec2>::Reflect(AZ::SerializeContext* serializeContext)
inline void TAnimSplineTrack<Vec2>::Reflect(AZ::ReflectContext* context)
{
spline::SplineKey<Vec2>::Reflect(serializeContext);
spline::SplineKeyEx<Vec2>::Reflect(serializeContext);
spline::TrackSplineInterpolator<Vec2>::Reflect(serializeContext);
BezierSplineVec2::Reflect(serializeContext);
serializeContext->Class<TAnimSplineTrack<Vec2> >()
->Version(4, &TAnimSplineTrack<Vec2>::VersionConverter)
->Field("Flags", &TAnimSplineTrack<Vec2>::m_flags)
->Field("DefaultValue", &TAnimSplineTrack<Vec2>::m_defaultValue)
->Field("ParamType", &TAnimSplineTrack<Vec2>::m_nParamType)
->Field("Spline", &TAnimSplineTrack<Vec2>::m_spline)
->Field("Id", &TAnimSplineTrack<Vec2>::m_id);
AZ::EditContext* ec = serializeContext->GetEditContext();
// Preventing the default value from being pushed to slice to keep it from dirtying the slice when updated internally
if (ec)
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
ec->Class<TAnimSplineTrack<Vec2>>("TAnimSplineTrack Vec2", "Specialization track for Vec2 AnimSpline")->
DataElement(AZ::Edit::UIHandlers::Vector2, &TAnimSplineTrack<Vec2>::m_defaultValue, "DefaultValue", "")->
spline::SplineKey<Vec2>::Reflect(serializeContext);
spline::SplineKeyEx<Vec2>::Reflect(serializeContext);
spline::TrackSplineInterpolator<Vec2>::Reflect(serializeContext);
BezierSplineVec2::Reflect(serializeContext);
serializeContext->Class<TAnimSplineTrack<Vec2>, IAnimTrack>()
->Version(5, &TAnimSplineTrack<Vec2>::VersionConverter)
->Field("Flags", &TAnimSplineTrack<Vec2>::m_flags)
->Field("DefaultValue", &TAnimSplineTrack<Vec2>::m_defaultValue)
->Field("ParamType", &TAnimSplineTrack<Vec2>::m_nParamType)
->Field("Spline", &TAnimSplineTrack<Vec2>::m_spline)
->Field("Id", &TAnimSplineTrack<Vec2>::m_id);
AZ::EditContext* ec = serializeContext->GetEditContext();
// Preventing the default value from being pushed to slice to keep it from dirtying the slice when updated internally
if (ec)
{
ec->Class<TAnimSplineTrack<Vec2>>("TAnimSplineTrack Vec2", "Specialization track for Vec2 AnimSpline")->
DataElement(AZ::Edit::UIHandlers::Vector2, &TAnimSplineTrack<Vec2>::m_defaultValue, "DefaultValue", "")->
Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide)->
Attribute(AZ::Edit::Attributes::SliceFlags, AZ::Edit::SliceFlags::NotPushable);
}
}
}
#endif // CRYINCLUDE_CRYMOVIE_ANIMSPLINETRACK_VEC2SPECIALIZATION_H
@@ -249,7 +249,7 @@ public:
m_id = id;
}
static void Reflect([[maybe_unused]] AZ::SerializeContext* serializeContext) {}
static void Reflect([[maybe_unused]] AZ::ReflectContext* context) {}
protected:
void CheckValid()
@@ -163,16 +163,31 @@ float CAssetBlendTrack::GetKeyDuration(int key) const
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<AZ::IAssetBlendKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool AssetBlendTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<AZ::IAssetBlendKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<AZ::IAssetBlendKey>::m_flags)
->Field("Range", &TAnimTrack<AZ::IAssetBlendKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<AZ::IAssetBlendKey>::m_nParamType)
->Field("Keys", &TAnimTrack<AZ::IAssetBlendKey>::m_keys)
->Field("Id", &TAnimTrack<AZ::IAssetBlendKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<AZ::IAssetBlendKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<AZ::IAssetBlendKey>, IAnimTrack>()
->Version(3, &AssetBlendTrackVersionConverter)
->Field("Flags", &TAnimTrack<AZ::IAssetBlendKey>::m_flags)
->Field("Range", &TAnimTrack<AZ::IAssetBlendKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<AZ::IAssetBlendKey>::m_nParamType)
->Field("Keys", &TAnimTrack<AZ::IAssetBlendKey>::m_keys)
->Field("Id", &TAnimTrack<AZ::IAssetBlendKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -277,10 +292,13 @@ float CAssetBlendTrack::GetEndTime() const
}
//////////////////////////////////////////////////////////////////////////
void CAssetBlendTrack::Reflect(AZ::SerializeContext* serializeContext)
void CAssetBlendTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<AZ::IAssetBlendKey>::Reflect(serializeContext);
TAnimTrack<AZ::IAssetBlendKey>::Reflect(context);
serializeContext->Class<CAssetBlendTrack, TAnimTrack<AZ::IAssetBlendKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAssetBlendTrack, TAnimTrack<AZ::IAssetBlendKey>>()
->Version(1);
}
}
@@ -47,7 +47,7 @@ public:
float GetEndTime() const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
@@ -98,24 +98,42 @@ bool CBoolTrack::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTr
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IBoolKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool BoolTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IBoolKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IBoolKey>::m_flags)
->Field("Range", &TAnimTrack<IBoolKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IBoolKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IBoolKey>::m_keys)
->Field("Id", &TAnimTrack<IBoolKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IBoolKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IBoolKey>, IAnimTrack>()
->Version(3, &BoolTrackVersionConverter)
->Field("Flags", &TAnimTrack<IBoolKey>::m_flags)
->Field("Range", &TAnimTrack<IBoolKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IBoolKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IBoolKey>::m_keys)
->Field("Id", &TAnimTrack<IBoolKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::Reflect(AZ::SerializeContext* serializeContext)
void CBoolTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IBoolKey>::Reflect(serializeContext);
TAnimTrack<IBoolKey>::Reflect(context);
serializeContext->Class<CBoolTrack, TAnimTrack<IBoolKey> >()
->Version(1)
->Field("DefaultValue", &CBoolTrack::m_bDefaultValue);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CBoolTrack, TAnimTrack<IBoolKey>>()
->Version(1)
->Field("DefaultValue", &CBoolTrack::m_bDefaultValue);
}
}
@@ -45,7 +45,7 @@ public:
bool Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTracks = true) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
bool m_bDefaultValue;
@@ -151,8 +151,11 @@ void CAnimCVarNode::Animate(SAnimContext& ec)
}
//////////////////////////////////////////////////////////////////////////
void CAnimCVarNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimCVarNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimCVarNode,CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimCVarNode, CAnimNode>()
->Version(1);
}
}
@@ -41,7 +41,7 @@ public:
int GetDefaultKeyTangentFlags() const override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -71,23 +71,41 @@ void CCaptureTrack::GetKeyInfo(int key, const char*& description, float& duratio
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ICaptureKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool CaptureTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ICaptureKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ICaptureKey>::m_flags)
->Field("Range", &TAnimTrack<ICaptureKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICaptureKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICaptureKey>::m_keys)
->Field("Id", &TAnimTrack<ICaptureKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ICaptureKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ICaptureKey>, IAnimTrack>()
->Version(3, &CaptureTrackVersionConverter)
->Field("Flags", &TAnimTrack<ICaptureKey>::m_flags)
->Field("Range", &TAnimTrack<ICaptureKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICaptureKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICaptureKey>::m_keys)
->Field("Id", &TAnimTrack<ICaptureKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CCaptureTrack::Reflect(AZ::SerializeContext* serializeContext)
void CCaptureTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ICaptureKey>::Reflect(serializeContext);
TAnimTrack<ICaptureKey>::Reflect(context);
serializeContext->Class<CCaptureTrack, TAnimTrack<ICaptureKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCaptureTrack, TAnimTrack<ICaptureKey>>()
->Version(1);
}
}
@@ -33,7 +33,7 @@ public:
void SerializeKey(ICaptureKey& key, XmlNodeRef& keyNode, bool bLoading);
void GetKeyInfo(int key, const char*& description, float& duration);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_CAPTURETRACK_H
@@ -150,16 +150,31 @@ float CCharacterTrack::GetKeyDuration(int key) const
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ICharacterKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool CharacterTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ICharacterKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ICharacterKey>::m_flags)
->Field("Range", &TAnimTrack<ICharacterKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICharacterKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICharacterKey>::m_keys)
->Field("Id", &TAnimTrack<ICharacterKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ICharacterKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ICharacterKey>, IAnimTrack>()
->Version(3, &CharacterTrackVersionConverter)
->Field("Flags", &TAnimTrack<ICharacterKey>::m_flags)
->Field("Range", &TAnimTrack<ICharacterKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICharacterKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICharacterKey>::m_keys)
->Field("Id", &TAnimTrack<ICharacterKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
@@ -169,11 +184,14 @@ AnimValueType CCharacterTrack::GetValueType()
}
//////////////////////////////////////////////////////////////////////////
void CCharacterTrack::Reflect(AZ::SerializeContext* serializeContext)
void CCharacterTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ICharacterKey>::Reflect(serializeContext);
TAnimTrack<ICharacterKey>::Reflect(context);
serializeContext->Class<CCharacterTrack, TAnimTrack<ICharacterKey> >()
->Version(1)
->Field("AnimationLayer", &CCharacterTrack::m_iAnimationLayer);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCharacterTrack, TAnimTrack<ICharacterKey>>()
->Version(1)
->Field("AnimationLayer", &CCharacterTrack::m_iAnimationLayer);
}
}
@@ -51,7 +51,7 @@ public:
float GetEndTime() const { return m_timeRange.end; }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
int m_iAnimationLayer;
@@ -107,10 +107,13 @@ void CCommentNode::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmpty
}
//////////////////////////////////////////////////////////////////////////
void CCommentNode::Reflect(AZ::SerializeContext* serializeContext)
void CCommentNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CCommentNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCommentNode, CAnimNode>()
->Version(1);
}
}
//-----------------------------------------------------------------------------
@@ -49,7 +49,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -78,23 +78,41 @@ void CCommentTrack::SerializeKey(ICommentKey& key, XmlNodeRef& keyNode, bool bLo
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ICommentKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool CommentTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ICommentKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ICommentKey>::m_flags)
->Field("Range", &TAnimTrack<ICommentKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICommentKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICommentKey>::m_keys)
->Field("Id", &TAnimTrack<ICommentKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ICommentKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ICommentKey>, IAnimTrack>()
->Version(3, &CommentTrackVersionConverter)
->Field("Flags", &TAnimTrack<ICommentKey>::m_flags)
->Field("Range", &TAnimTrack<ICommentKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ICommentKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ICommentKey>::m_keys)
->Field("Id", &TAnimTrack<ICommentKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CCommentTrack::Reflect(AZ::SerializeContext* serializeContext)
void CCommentTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ICommentKey>::Reflect(serializeContext);
TAnimTrack<ICommentKey>::Reflect(context);
serializeContext->Class<CCommentTrack, TAnimTrack<ICommentKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCommentTrack, TAnimTrack<ICommentKey>>()
->Version(1);
}
}
@@ -40,7 +40,7 @@ public:
//!
void ValidateKeyOrder() { CheckValid(); }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_COMMENTTRACK_H
@@ -604,16 +604,31 @@ void CCompoundSplineTrack::SetId(unsigned int id)
}
//////////////////////////////////////////////////////////////////////////
void CCompoundSplineTrack::Reflect(AZ::SerializeContext* serializeContext)
static bool CompoundSplineTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<CCompoundSplineTrack>()
->Version(3)
->Field("Flags", &CCompoundSplineTrack::m_flags)
->Field("ParamType", &CCompoundSplineTrack::m_nParamType)
->Field("NumSubTracks", &CCompoundSplineTrack::m_nDimensions)
->Field("SubTracks", &CCompoundSplineTrack::m_subTracks)
->Field("SubTrackNames", &CCompoundSplineTrack::m_subTrackNames)
->Field("ValueType", &CCompoundSplineTrack::m_valueType)
->Field("Expanded", &CCompoundSplineTrack::m_expanded)
->Field("Id", &CCompoundSplineTrack::m_id);
if (rootElement.GetVersion() < 4)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
void CCompoundSplineTrack::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CCompoundSplineTrack, IAnimTrack>()
->Version(4, &CompoundSplineTrackVersionConverter)
->Field("Flags", &CCompoundSplineTrack::m_flags)
->Field("ParamType", &CCompoundSplineTrack::m_nParamType)
->Field("NumSubTracks", &CCompoundSplineTrack::m_nDimensions)
->Field("SubTracks", &CCompoundSplineTrack::m_subTracks)
->Field("SubTrackNames", &CCompoundSplineTrack::m_subTrackNames)
->Field("ValueType", &CCompoundSplineTrack::m_valueType)
->Field("Expanded", &CCompoundSplineTrack::m_expanded)
->Field("Id", &CCompoundSplineTrack::m_id);
}
}
@@ -157,7 +157,7 @@ public:
unsigned int GetId() const override;
void SetId(unsigned int id) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
int m_refCount;
@@ -47,23 +47,41 @@ void CConsoleTrack::GetKeyInfo(int key, const char*& description, float& duratio
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IConsoleKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool ConsoleTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IConsoleKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IConsoleKey>::m_flags)
->Field("Range", &TAnimTrack<IConsoleKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IConsoleKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IConsoleKey>::m_keys)
->Field("Id", &TAnimTrack<IConsoleKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IConsoleKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IConsoleKey>, IAnimTrack>()
->Version(3, &ConsoleTrackVersionConverter)
->Field("Flags", &TAnimTrack<IConsoleKey>::m_flags)
->Field("Range", &TAnimTrack<IConsoleKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IConsoleKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IConsoleKey>::m_keys)
->Field("Id", &TAnimTrack<IConsoleKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CConsoleTrack::Reflect(AZ::SerializeContext* serializeContext)
void CConsoleTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IConsoleKey>::Reflect(serializeContext);
TAnimTrack<IConsoleKey>::Reflect(context);
serializeContext->Class<CConsoleTrack, TAnimTrack<IConsoleKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CConsoleTrack, TAnimTrack<IConsoleKey> >()
->Version(1);
}
}
@@ -35,7 +35,7 @@ public:
void GetKeyInfo(int key, const char*& description, float& duration);
void SerializeKey(IConsoleKey& key, XmlNodeRef& keyNode, bool bLoading);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_CONSOLETRACK_H
@@ -112,8 +112,11 @@ void CAnimEventNode::OnReset()
}
//////////////////////////////////////////////////////////////////////////
void CAnimEventNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimEventNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimEventNode, CAnimNode>()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimEventNode, CAnimNode>()
->Version(1);
}
}
@@ -42,7 +42,7 @@ public:
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
//! Last animated key in track.
@@ -103,10 +103,13 @@ void CEventTrack::InitPostLoad(IAnimSequence* sequence)
}
//////////////////////////////////////////////////////////////////////////
void CEventTrack::Reflect(AZ::SerializeContext* serializeContext)
void CEventTrack::Reflect(AZ::ReflectContext* context)
{
// Note the template base class TAnimTrack<IEventKey>::Reflect() is reflected by CTrackEventTrack::Reflect()
serializeContext->Class<CEventTrack, TAnimTrack<IEventKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CEventTrack, TAnimTrack<IEventKey>>()
->Version(1);
}
}
@@ -42,7 +42,7 @@ public:
void SetKey(int index, IKey* key);
void InitPostLoad(IAnimSequence* sequence) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
AZStd::intrusive_ptr<IAnimStringTable> m_pStrings;
@@ -156,23 +156,41 @@ void CGotoTrack::SetKeyAtTime(float time, IKey* key)
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IDiscreteFloatKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool GotoTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IDiscreteFloatKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IDiscreteFloatKey>::m_flags)
->Field("Range", &TAnimTrack<IDiscreteFloatKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IDiscreteFloatKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IDiscreteFloatKey>::m_keys)
->Field("Id", &TAnimTrack<IDiscreteFloatKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IDiscreteFloatKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IDiscreteFloatKey>, IAnimTrack>()
->Version(3, &GotoTrackVersionConverter)
->Field("Flags", &TAnimTrack<IDiscreteFloatKey>::m_flags)
->Field("Range", &TAnimTrack<IDiscreteFloatKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IDiscreteFloatKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IDiscreteFloatKey>::m_keys)
->Field("Id", &TAnimTrack<IDiscreteFloatKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CGotoTrack::Reflect(AZ::SerializeContext* serializeContext)
void CGotoTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IDiscreteFloatKey>::Reflect(serializeContext);
TAnimTrack<IDiscreteFloatKey>::Reflect(context);
serializeContext->Class<CGotoTrack, TAnimTrack<IDiscreteFloatKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CGotoTrack, TAnimTrack<IDiscreteFloatKey>>()
->Version(1);
}
}
@@ -40,7 +40,7 @@ public:
void SerializeKey(IDiscreteFloatKey& key, XmlNodeRef& keyNode, bool bLoading);
void GetKeyInfo(int key, const char*& description, float& duration);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
void SetKeyAtTime(float time, IKey* key);
@@ -172,8 +172,11 @@ bool CLayerNode::GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo&
}
//////////////////////////////////////////////////////////////////////////
void CLayerNode::Reflect(AZ::SerializeContext* serializeContext)
void CLayerNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CLayerNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CLayerNode, CAnimNode>()
->Version(1);
}
}
@@ -52,7 +52,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -79,24 +79,42 @@ void CLookAtTrack::GetKeyInfo(int key, const char*& description, float& duration
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ILookAtKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool LookAtTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ILookAtKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ILookAtKey>::m_flags)
->Field("Range", &TAnimTrack<ILookAtKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ILookAtKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ILookAtKey>::m_keys)
->Field("Id", &TAnimTrack<ILookAtKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ILookAtKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ILookAtKey>, IAnimTrack>()
->Version(3, &LookAtTrackVersionConverter)
->Field("Flags", &TAnimTrack<ILookAtKey>::m_flags)
->Field("Range", &TAnimTrack<ILookAtKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ILookAtKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ILookAtKey>::m_keys)
->Field("Id", &TAnimTrack<ILookAtKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CLookAtTrack::Reflect(AZ::SerializeContext* serializeContext)
void CLookAtTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ILookAtKey>::Reflect(serializeContext);
TAnimTrack<ILookAtKey>::Reflect(context);
serializeContext->Class<CLookAtTrack, TAnimTrack<ILookAtKey> >()
->Version(1)
->Field("AnimationLayer", &CLookAtTrack::m_iAnimationLayer);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CLookAtTrack, TAnimTrack<ILookAtKey>>()
->Version(1)
->Field("AnimationLayer", &CLookAtTrack::m_iAnimationLayer);
}
}
@@ -41,7 +41,7 @@ public:
int GetAnimationLayerIndex() const { return m_iAnimationLayer; }
void SetAnimationLayerIndex(int index) { m_iAnimationLayer = index; }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
int m_iAnimationLayer;
};
@@ -432,10 +432,13 @@ void CAnimMaterialNode::AddTrack(IAnimTrack* track)
}
//////////////////////////////////////////////////////////////////////////
void CAnimMaterialNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimMaterialNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimMaterialNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimMaterialNode, CAnimNode>()
->Version(1);
}
}
#undef s_nodeParamsInitialized
@@ -49,7 +49,7 @@ public:
virtual void InitializeTrack(IAnimTrack* pTrack, const CAnimParamType& paramType);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -1196,13 +1196,16 @@ void CMovieSystem::Callback(IMovieCallback::ECallbackReason reason, IAnimNode* p
}
//////////////////////////////////////////////////////////////////////////
/*static*/ void CMovieSystem::Reflect(AZ::SerializeContext* serializeContext)
void CMovieSystem::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CMovieSystem>()
->Version(1)
->Field("Sequences", &CMovieSystem::m_sequences);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CMovieSystem>()
->Version(1)
->Field("Sequences", &CMovieSystem::m_sequences);
}
AnimSerializer::ReflectAnimTypes(serializeContext);
AnimSerializer::ReflectAnimTypes(context);
}
//////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -204,7 +204,7 @@ public:
void OnSequenceActivated(IAnimSequence* sequence) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
@@ -1026,10 +1026,13 @@ void CAnimSceneNode::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmp
SetFlags(GetFlags() | eAnimNodeFlags_CanChangeName);
}
void CAnimSceneNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimSceneNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimSceneNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimSceneNode, CAnimNode>()
->Version(1);
}
}
void CAnimSceneNode::PrecacheStatic(float startTime)
@@ -90,7 +90,7 @@ public:
virtual void PrecacheStatic(float startTime) override;
virtual void PrecacheDynamic(float time) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
// Utility function to find the sequence associated with an ISequenceKey
static IAnimSequence* GetSequenceFromSequenceKey(const ISequenceKey& sequenceKey);
@@ -179,23 +179,41 @@ bool CScreenFaderTrack::SetActiveTexture(int index)
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IScreenFaderKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool ScreenFaderTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IScreenFaderKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IScreenFaderKey>::m_flags)
->Field("Range", &TAnimTrack<IScreenFaderKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IScreenFaderKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IScreenFaderKey>::m_keys)
->Field("Id", &TAnimTrack<IScreenFaderKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IScreenFaderKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IScreenFaderKey>, IAnimTrack>()
->Version(3, &ScreenFaderTrackVersionConverter)
->Field("Flags", &TAnimTrack<IScreenFaderKey>::m_flags)
->Field("Range", &TAnimTrack<IScreenFaderKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IScreenFaderKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IScreenFaderKey>::m_keys)
->Field("Id", &TAnimTrack<IScreenFaderKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CScreenFaderTrack::Reflect(AZ::SerializeContext* serializeContext)
void CScreenFaderTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IScreenFaderKey>::Reflect(serializeContext);
TAnimTrack<IScreenFaderKey>::Reflect(context);
serializeContext->Class<CScreenFaderTrack, TAnimTrack<IScreenFaderKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CScreenFaderTrack, TAnimTrack<IScreenFaderKey>>()
->Version(1);
}
}
@@ -50,7 +50,7 @@ public:
void SetLastTextureID(int nTextureID){ m_lastTextureID = nTextureID; };
bool SetActiveTexture(int index);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
void ReleasePreloadedTextures();
@@ -107,8 +107,11 @@ void CAnimScriptVarNode::Animate(SAnimContext& ec)
}
}
void CAnimScriptVarNode::Reflect(AZ::SerializeContext* serializeContext)
void CAnimScriptVarNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CAnimScriptVarNode, CAnimNode>()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CAnimScriptVarNode, CAnimNode>()
->Version(1);
}
}
@@ -40,7 +40,7 @@ public:
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
float m_value;
@@ -63,23 +63,41 @@ void CSelectTrack::GetKeyInfo(int key, const char*& description, float& duration
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ISelectKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool SelectTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ISelectKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ISelectKey>::m_flags)
->Field("Range", &TAnimTrack<ISelectKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ISelectKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ISelectKey>::m_keys)
->Field("Id", &TAnimTrack<ISelectKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ISelectKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ISelectKey>, IAnimTrack>()
->Version(3, &SelectTrackVersionConverter)
->Field("Flags", &TAnimTrack<ISelectKey>::m_flags)
->Field("Range", &TAnimTrack<ISelectKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ISelectKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ISelectKey>::m_keys)
->Field("Id", &TAnimTrack<ISelectKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CSelectTrack::Reflect(AZ::SerializeContext* serializeContext)
void CSelectTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ISelectKey>::Reflect(serializeContext);
TAnimTrack<ISelectKey>::Reflect(context);
serializeContext->Class<CSelectTrack, TAnimTrack<ISelectKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CSelectTrack, TAnimTrack<ISelectKey>>()
->Version(1);
}
}
@@ -35,7 +35,7 @@ public:
void GetKeyInfo(int key, const char*& description, float& duration);
void SerializeKey(ISelectKey& key, XmlNodeRef& keyNode, bool bLoading);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_SELECTTRACK_H
@@ -83,23 +83,41 @@ void CSequenceTrack::GetKeyInfo(int key, const char*& description, float& durati
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ISequenceKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool SequencTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ISequenceKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ISequenceKey>::m_flags)
->Field("Range", &TAnimTrack<ISequenceKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ISequenceKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ISequenceKey>::m_keys)
->Field("Id", &TAnimTrack<ISequenceKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ISequenceKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ISequenceKey>, IAnimTrack>()
->Version(3, &SequencTrackVersionConverter)
->Field("Flags", &TAnimTrack<ISequenceKey>::m_flags)
->Field("Range", &TAnimTrack<ISequenceKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ISequenceKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ISequenceKey>::m_keys)
->Field("Id", &TAnimTrack<ISequenceKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CSequenceTrack::Reflect(AZ::SerializeContext* serializeContext)
void CSequenceTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ISequenceKey>::Reflect(serializeContext);
TAnimTrack<ISequenceKey>::Reflect(context);
serializeContext->Class<CSequenceTrack, TAnimTrack<ISequenceKey> >()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CSequenceTrack, TAnimTrack<ISequenceKey> >()
->Version(1);
}
}
@@ -29,7 +29,7 @@ public:
void GetKeyInfo(int key, const char*& description, float& duration);
void SerializeKey(ISequenceKey& key, XmlNodeRef& keyNode, bool bLoading);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_SEQUENCETRACK_H
@@ -117,8 +117,11 @@ bool CShadowsSetupNode::GetParamInfoFromType(const CAnimParamType& paramId, SPar
}
//////////////////////////////////////////////////////////////////////////
void CShadowsSetupNode::Reflect(AZ::SerializeContext* serializeContext)
void CShadowsSetupNode::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<CShadowsSetupNode, CAnimNode>()
->Version(1);
}
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CShadowsSetupNode, CAnimNode>()
->Version(1);
}
}
@@ -45,7 +45,7 @@ public:
virtual unsigned int GetParamCount() const;
virtual CAnimParamType GetParamType(unsigned int nIndex) const;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
protected:
virtual bool GetParamInfoFromType(const CAnimParamType& paramId, SParamInfo& info) const;
@@ -60,23 +60,41 @@ void CSoundTrack::GetKeyInfo(int key, const char*& description, float& duration)
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ISoundKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool SoundTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ISoundKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ISoundKey>::m_flags)
->Field("Range", &TAnimTrack<ISoundKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ISoundKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ISoundKey>::m_keys)
->Field("Id", &TAnimTrack<ISoundKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ISoundKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ISoundKey>, IAnimTrack>()
->Version(3, &SoundTrackVersionConverter)
->Field("Flags", &TAnimTrack<ISoundKey>::m_flags)
->Field("Range", &TAnimTrack<ISoundKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ISoundKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ISoundKey>::m_keys)
->Field("Id", &TAnimTrack<ISoundKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CSoundTrack::Reflect(AZ::SerializeContext* serializeContext)
void CSoundTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<ISoundKey>::Reflect(serializeContext);
TAnimTrack<ISoundKey>::Reflect(context);
serializeContext->Class<CSoundTrack, TAnimTrack<ISoundKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CSoundTrack, TAnimTrack<ISoundKey>>()
->Version(1);
}
}
@@ -55,7 +55,7 @@ public:
bool UsesMute() const override { return true; }
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_SOUNDTRACK_H
@@ -100,23 +100,41 @@ int CTimeRangesTrack::GetActiveKeyIndexForTime(const float time)
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<ITimeRangeKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool TimeRangesTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<ITimeRangeKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<ITimeRangeKey>::m_flags)
->Field("Range", &TAnimTrack<ITimeRangeKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ITimeRangeKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ITimeRangeKey>::m_keys)
->Field("Id", &TAnimTrack<ITimeRangeKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<ITimeRangeKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<ITimeRangeKey>, IAnimTrack>()
->Version(3, &TimeRangesTrackVersionConverter)
->Field("Flags", &TAnimTrack<ITimeRangeKey>::m_flags)
->Field("Range", &TAnimTrack<ITimeRangeKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<ITimeRangeKey>::m_nParamType)
->Field("Keys", &TAnimTrack<ITimeRangeKey>::m_keys)
->Field("Id", &TAnimTrack<ITimeRangeKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CTimeRangesTrack::Reflect(AZ::SerializeContext* serializeContext)
void CTimeRangesTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IBoolKey>::Reflect(serializeContext);
TAnimTrack<ITimeRangeKey>::Reflect(context);
serializeContext->Class<CTimeRangesTrack, TAnimTrack<ITimeRangeKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CTimeRangesTrack, TAnimTrack<ITimeRangeKey>>()
->Version(1);
}
}
@@ -39,8 +39,7 @@ public:
int GetActiveKeyIndexForTime(const float time);
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
};
#endif // CRYINCLUDE_CRYMOVIE_TIMERANGESTRACK_H
@@ -159,23 +159,41 @@ void CTrackEventTrack::GetKeyInfo(int key, const char*& description, float& dura
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IEventKey>::Reflect(AZ::SerializeContext* serializeContext)
static bool EventTrackVersionConverter(
AZ::SerializeContext& serializeContext,
AZ::SerializeContext::DataElementNode& rootElement)
{
serializeContext->Class<TAnimTrack<IEventKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IEventKey>::m_flags)
->Field("Range", &TAnimTrack<IEventKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IEventKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IEventKey>::m_keys)
->Field("Id", &TAnimTrack<IEventKey>::m_id);
if (rootElement.GetVersion() < 3)
{
rootElement.AddElement(serializeContext, "BaseClass1", azrtti_typeid<IAnimTrack>());
}
return true;
}
template<>
inline void TAnimTrack<IEventKey>::Reflect(AZ::ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<TAnimTrack<IEventKey>, IAnimTrack>()
->Version(3, &EventTrackVersionConverter)
->Field("Flags", &TAnimTrack<IEventKey>::m_flags)
->Field("Range", &TAnimTrack<IEventKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IEventKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IEventKey>::m_keys)
->Field("Id", &TAnimTrack<IEventKey>::m_id);
}
}
//////////////////////////////////////////////////////////////////////////
void CTrackEventTrack::Reflect(AZ::SerializeContext* serializeContext)
void CTrackEventTrack::Reflect(AZ::ReflectContext* context)
{
TAnimTrack<IEventKey>::Reflect(serializeContext);
TAnimTrack<IEventKey>::Reflect(context);
serializeContext->Class<CTrackEventTrack, TAnimTrack<IEventKey> >()
->Version(1);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<CTrackEventTrack, TAnimTrack<IEventKey>>()
->Version(1);
}
}
@@ -78,7 +78,7 @@ public:
void SetKey(int index, IKey* key);
void InitPostLoad(IAnimSequence* sequence) override;
static void Reflect(AZ::SerializeContext* serializeContext);
static void Reflect(AZ::ReflectContext* context);
private:
AZStd::intrusive_ptr< IAnimStringTable> m_pStrings;
@@ -34,6 +34,7 @@
#include <Cinematics/SelectTrack.h>
#include <Cinematics/SequenceTrack.h>
#include <Cinematics/SoundTrack.h>
#include <Cinematics/TimeRangesTrack.h>
#include <Cinematics/TrackEventTrack.h>
#include <Cinematics/AnimSequence.h>
@@ -105,18 +106,16 @@ namespace Maestro
{
}
/*static*/ void SequenceComponent::Reflect(AZ::ReflectContext* context)
void SequenceComponent::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
if (serializeContext)
// Reflect the Cinematics library
ReflectCinematicsLib(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<SequenceComponent, AZ::Component>()
->Version(2)
->Field("Sequence", &SequenceComponent::m_sequence);
// Reflect the Cinematics library
ReflectCinematicsLib(serializeContext);
}
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
@@ -141,12 +140,13 @@ namespace Maestro
}
}
/*static*/ void SequenceComponent::ReflectCinematicsLib(AZ::SerializeContext* context)
void SequenceComponent::ReflectCinematicsLib(AZ::ReflectContext* context)
{
// The Movie System itself
CMovieSystem::Reflect(context);
// Tracks
IAnimTrack::Reflect(context);
TAnimSplineTrack<Vec2>::Reflect(context);
CBoolTrack::Reflect(context);
CCaptureTrack::Reflect(context);
@@ -163,10 +163,13 @@ namespace Maestro
CSoundTrack::Reflect(context);
CTrackEventTrack::Reflect(context);
CAssetBlendTrack::Reflect(context);
CTimeRangesTrack::Reflect(context);
// Nodes
IAnimSequence::Reflect(context);
CAnimSequence::Reflect(context);
CAnimSceneNode::Reflect(context);
IAnimNode::Reflect(context);
CAnimNode::Reflect(context);
CAnimAzEntityNode::Reflect(context);
CAnimComponentNode::Reflect(context);
@@ -104,7 +104,7 @@ namespace Maestro
AZStd::intrusive_ptr<IAnimSequence> m_sequence;
// Reflects the entire CryMovie library
static void ReflectCinematicsLib(AZ::SerializeContext* context);
static void ReflectCinematicsLib(AZ::ReflectContext* context);
};
} // namespace Maestro