summaryrefslogtreecommitdiff
path: root/Runtime/Animation/NewAnimationTrack.cpp
blob: 0489f59c75c995c1f3f068107e6dce26b15f020f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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<string> NewAnimationTrack::GetCurves ()
{
	vector<string> 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<class T> inline
float GetValue (Object& o, int offset)
{
	return *reinterpret_cast<T*> (reinterpret_cast<char*> (&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<float> (*src, value->m_ByteOffset);
		return true;
	}
	else if (value->m_Type == "bool")
	{
		if (src && f)
			*f = GetValue<bool> (*src, value->m_ByteOffset);
		return true;
	}
	else
		return false;
}
*/
template<class TransferFunction>
void NewAnimationTrack::Transfer (TransferFunction& transfer)
{
	Super::Transfer (transfer);
	TRANSFER (m_Curves);
	TRANSFER (m_ClassID);
}

template<class TransferFunction>
void NewAnimationTrack::Channel::Transfer (TransferFunction& transfer)
{
	TRANSFER (byteOffset);
	TRANSFER (curve);
	TRANSFER (attributeName);
}

IMPLEMENT_CLASS (NewAnimationTrack)
IMPLEMENT_OBJECT_SERIALIZE (NewAnimationTrack)
#endif