From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Animation/NewAnimationTrack.cpp | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Runtime/Animation/NewAnimationTrack.cpp (limited to 'Runtime/Animation/NewAnimationTrack.cpp') diff --git a/Runtime/Animation/NewAnimationTrack.cpp b/Runtime/Animation/NewAnimationTrack.cpp new file mode 100644 index 0000000..0489f59 --- /dev/null +++ b/Runtime/Animation/NewAnimationTrack.cpp @@ -0,0 +1,80 @@ +#include "UnityPrefix.h" +#if UNITY_EDITOR +#include "NewAnimationTrack.h" +#include "Runtime/Math/AnimationCurve.h" +#include "Runtime/Graphics/Transform.h" +#include "Runtime/Serialize/TransferFunctions/SerializeTransfer.h" +#include "Runtime/Serialize/TransferUtility.h" +#include "Runtime/Graphics/Transform.h" + +using namespace std; + +enum { kModifiesRotation = 1 << 0, kModifiesScale = 1 << 1 }; + +vector NewAnimationTrack::GetCurves () +{ + vector curves; + curves.reserve (m_Curves.size ()); + for (Curves::iterator i=m_Curves.begin ();i!=m_Curves.end ();i++) + curves.push_back (i->attributeName); + return curves; +} + +NewAnimationTrack::NewAnimationTrack (MemLabelId label, ObjectCreationMode mode) +: Super(label, mode) +{ + m_ClassID = 0; +} + +NewAnimationTrack::~NewAnimationTrack () +{} + +/* +template inline +float GetValue (Object& o, int offset) +{ + return *reinterpret_cast (reinterpret_cast (&o) + offset); +} + +bool NewAnimationTrack::ExtractFloatValue (Object* src, const TypeTree* value, float* f) +{ + if (value == NULL) + return false; + if (value->m_ByteOffset == -1) + return false; + + if (value->m_Type == "float") + { + if (src && f) + *f = GetValue (*src, value->m_ByteOffset); + return true; + } + else if (value->m_Type == "bool") + { + if (src && f) + *f = GetValue (*src, value->m_ByteOffset); + return true; + } + else + return false; +} +*/ +template +void NewAnimationTrack::Transfer (TransferFunction& transfer) +{ + Super::Transfer (transfer); + TRANSFER (m_Curves); + TRANSFER (m_ClassID); +} + +template +void NewAnimationTrack::Channel::Transfer (TransferFunction& transfer) +{ + TRANSFER (byteOffset); + TRANSFER (curve); + TRANSFER (attributeName); +} + +IMPLEMENT_CLASS (NewAnimationTrack) +IMPLEMENT_OBJECT_SERIALIZE (NewAnimationTrack) +#endif -- cgit v1.1-26-g67d0