Implemented Animation Clip asset and animation controller #410
|
@ -23,6 +23,9 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Assets/MeshAsset.hxx"
|
||||
#include "Scripts/Script.hxx"
|
||||
#include "Scripts/ScriptStore.hxx"
|
||||
#include "Assets/AnimationClipAsset.hxx"
|
||||
#include "Assets/AnimationControllerAsset.hxx"
|
||||
#include "Assets/AnimationRigAsset.hxx"
|
||||
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
/* File-Level Constants */
|
||||
|
@ -164,24 +167,27 @@ namespace SHADE
|
|||
YAML::Node fieldNode;
|
||||
|
||||
// Retrieve string for the YAML
|
||||
const bool PRIMITIVE_SERIALIZED = fieldInsertYaml<System::Int16 >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Int32 >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Int64 >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::UInt16>(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::UInt32>(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::UInt64>(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Byte >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<bool >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<float >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<double >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Enum >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::String>(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<Vector2 >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<Vector3 >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<GameObject >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<FontAsset >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<MaterialAsset >(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<MeshAsset >(fieldInfo, object, fieldNode);
|
||||
const bool PRIMITIVE_SERIALIZED = fieldInsertYaml<System::Int16 > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Int32 > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Int64 > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::UInt16> (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::UInt32> (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::UInt64> (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Byte > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<bool > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<float > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<double > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::Enum > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<System::String> (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<Vector2 > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<Vector3 > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<GameObject > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<FontAsset > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<MaterialAsset > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<MeshAsset > (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<AnimationClipAsset> (fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<AnimationControllerAsset>(fieldInfo, object, fieldNode) ||
|
||||
fieldInsertYaml<AnimationRigAsset> (fieldInfo, object, fieldNode);
|
||||
|
||||
// Serialization of more complex types
|
||||
if (!PRIMITIVE_SERIALIZED)
|
||||
|
@ -228,24 +234,27 @@ namespace SHADE
|
|||
bool SerialisationUtilities::varInsertYaml(System::Object^ object, YAML::Node& fieldNode)
|
||||
{
|
||||
const bool INSERTED =
|
||||
varInsertYamlInternal<System::Int16 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Int32 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Int64 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::UInt16>(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::UInt32>(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::UInt64>(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Byte >(object, fieldNode) ||
|
||||
varInsertYamlInternal<bool >(object, fieldNode) ||
|
||||
varInsertYamlInternal<float >(object, fieldNode) ||
|
||||
varInsertYamlInternal<double >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Enum >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::String>(object, fieldNode) ||
|
||||
varInsertYamlInternal<Vector2 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<Vector3 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<GameObject >(object, fieldNode) ||
|
||||
varInsertYamlInternal<FontAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<MaterialAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<MeshAsset >(object, fieldNode);
|
||||
varInsertYamlInternal<System::Int16 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Int32 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Int64 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::UInt16 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::UInt32 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::UInt64 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Byte >(object, fieldNode) ||
|
||||
varInsertYamlInternal<bool >(object, fieldNode) ||
|
||||
varInsertYamlInternal<float >(object, fieldNode) ||
|
||||
varInsertYamlInternal<double >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::Enum >(object, fieldNode) ||
|
||||
varInsertYamlInternal<System::String >(object, fieldNode) ||
|
||||
varInsertYamlInternal<Vector2 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<Vector3 >(object, fieldNode) ||
|
||||
varInsertYamlInternal<GameObject >(object, fieldNode) ||
|
||||
varInsertYamlInternal<FontAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<MaterialAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<MeshAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<AnimationClipAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<AnimationRigAsset >(object, fieldNode) ||
|
||||
varInsertYamlInternal<AnimationControllerAsset>(object, fieldNode);
|
||||
return INSERTED;
|
||||
}
|
||||
|
||||
|
@ -255,24 +264,27 @@ namespace SHADE
|
|||
bool SerialisationUtilities::writeYamlIntoField(System::Reflection::FieldInfo^ fieldInfo, Object^ object, YAML::Node& node)
|
||||
{
|
||||
const bool ASSIGNED =
|
||||
fieldAssignYaml<System::Int16> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Int32> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Int64> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::UInt16>(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::UInt32>(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::UInt64>(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Byte> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<bool> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<float> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<double> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Enum> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::String>(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<Vector2> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<Vector3> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<GameObject> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<FontAsset> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<MaterialAsset> (fieldInfo, object, node) ||
|
||||
fieldAssignYaml<MeshAsset> (fieldInfo, object, node);
|
||||
fieldAssignYaml<System::Int16 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Int32 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Int64 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::UInt16 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::UInt32 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::UInt64 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Byte >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<bool >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<float >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<double >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::Enum >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<System::String >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<Vector2 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<Vector3 >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<GameObject >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<FontAsset >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<MaterialAsset >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<MeshAsset >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<AnimationClipAsset >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<AnimationRigAsset >(fieldInfo, object, node) ||
|
||||
fieldAssignYaml<AnimationControllerAsset>(fieldInfo, object, node);
|
||||
if (!ASSIGNED)
|
||||
{
|
||||
if (ReflectionUtilities::FieldIsList(fieldInfo))
|
||||
|
@ -329,24 +341,27 @@ namespace SHADE
|
|||
bool SerialisationUtilities::varAssignYaml(System::Object^% object, YAML::Node& node)
|
||||
{
|
||||
const bool DESERIALISED =
|
||||
varAssignYamlInternal<System::Int16> (object, node) ||
|
||||
varAssignYamlInternal<System::Int32> (object, node) ||
|
||||
varAssignYamlInternal<System::Int64> (object, node) ||
|
||||
varAssignYamlInternal<System::UInt16>(object, node) ||
|
||||
varAssignYamlInternal<System::UInt32>(object, node) ||
|
||||
varAssignYamlInternal<System::UInt64>(object, node) ||
|
||||
varAssignYamlInternal<System::Byte> (object, node) ||
|
||||
varAssignYamlInternal<bool> (object, node) ||
|
||||
varAssignYamlInternal<float> (object, node) ||
|
||||
varAssignYamlInternal<double> (object, node) ||
|
||||
varAssignYamlInternal<System::Enum> (object, node) ||
|
||||
varAssignYamlInternal<System::String>(object, node) ||
|
||||
varAssignYamlInternal<Vector2> (object, node) ||
|
||||
varAssignYamlInternal<Vector3> (object, node) ||
|
||||
varAssignYamlInternal<GameObject> (object, node) ||
|
||||
varAssignYamlInternal<FontAsset> (object, node) ||
|
||||
varAssignYamlInternal<MaterialAsset> (object, node) ||
|
||||
varAssignYamlInternal<MeshAsset> (object, node);
|
||||
varAssignYamlInternal<System::Int16 >(object, node) ||
|
||||
varAssignYamlInternal<System::Int32 >(object, node) ||
|
||||
varAssignYamlInternal<System::Int64 >(object, node) ||
|
||||
varAssignYamlInternal<System::UInt16 >(object, node) ||
|
||||
varAssignYamlInternal<System::UInt32 >(object, node) ||
|
||||
varAssignYamlInternal<System::UInt64 >(object, node) ||
|
||||
varAssignYamlInternal<System::Byte >(object, node) ||
|
||||
varAssignYamlInternal<bool >(object, node) ||
|
||||
varAssignYamlInternal<float >(object, node) ||
|
||||
varAssignYamlInternal<double >(object, node) ||
|
||||
varAssignYamlInternal<System::Enum >(object, node) ||
|
||||
varAssignYamlInternal<System::String >(object, node) ||
|
||||
varAssignYamlInternal<Vector2 >(object, node) ||
|
||||
varAssignYamlInternal<Vector3 >(object, node) ||
|
||||
varAssignYamlInternal<GameObject >(object, node) ||
|
||||
varAssignYamlInternal<FontAsset >(object, node) ||
|
||||
varAssignYamlInternal<MaterialAsset >(object, node) ||
|
||||
varAssignYamlInternal<MeshAsset >(object, node) ||
|
||||
varAssignYamlInternal<AnimationClipAsset >(object, node) ||
|
||||
varAssignYamlInternal<AnimationRigAsset >(object, node) ||
|
||||
varAssignYamlInternal<AnimationControllerAsset>(object, node);
|
||||
return DESERIALISED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,12 @@ namespace SHADE
|
|||
{
|
||||
fieldNode = MAX_EID;
|
||||
}
|
||||
else if constexpr (std::is_same_v<FieldType, FontAsset> ||
|
||||
std::is_same_v<FieldType, MaterialAsset> ||
|
||||
std::is_same_v<FieldType, MeshAsset>)
|
||||
else if constexpr (std::is_same_v<FieldType, FontAsset> ||
|
||||
std::is_same_v<FieldType, MaterialAsset> ||
|
||||
std::is_same_v<FieldType, MeshAsset> ||
|
||||
std::is_same_v<FieldType, AnimationClipAsset> ||
|
||||
std::is_same_v<FieldType, AnimationControllerAsset> ||
|
||||
std::is_same_v<FieldType, AnimationRigAsset>)
|
||||
{
|
||||
fieldNode = INVALID_ASSET_ID;
|
||||
}
|
||||
|
@ -128,9 +131,12 @@ namespace SHADE
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_same_v<FieldType, FontAsset> ||
|
||||
std::is_same_v<FieldType, MaterialAsset> ||
|
||||
std::is_same_v<FieldType, MeshAsset>)
|
||||
else if constexpr (std::is_same_v<FieldType, FontAsset> ||
|
||||
std::is_same_v<FieldType, MaterialAsset> ||
|
||||
std::is_same_v<FieldType, MeshAsset> ||
|
||||
std::is_same_v<FieldType, AnimationClipAsset> ||
|
||||
std::is_same_v<FieldType, AnimationControllerAsset> ||
|
||||
std::is_same_v<FieldType, AnimationRigAsset>)
|
||||
{
|
||||
if (object->GetType() == FieldType::typeid)
|
||||
{
|
||||
|
@ -254,9 +260,12 @@ namespace SHADE
|
|||
const uint32_t EID = node.as<uint32_t>();
|
||||
object = (EID == MAX_EID ? GameObject() : GameObject(EID));
|
||||
}
|
||||
else if constexpr (std::is_same_v<FieldType, FontAsset> ||
|
||||
std::is_same_v<FieldType, MaterialAsset> ||
|
||||
std::is_same_v<FieldType, MeshAsset>)
|
||||
else if constexpr (std::is_same_v<FieldType, FontAsset> ||
|
||||
std::is_same_v<FieldType, MaterialAsset> ||
|
||||
std::is_same_v<FieldType, MeshAsset> ||
|
||||
std::is_same_v<FieldType, AnimationClipAsset> ||
|
||||
std::is_same_v<FieldType, AnimationControllerAsset> ||
|
||||
std::is_same_v<FieldType, AnimationRigAsset>)
|
||||
{
|
||||
if (object->GetType() == FieldType::typeid)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue