Implemented Animation Clip asset and animation controller #410

Merged
XiaoQiDigipen merged 66 commits from SP3-22-AnimationController into main 2023-03-09 16:19:40 +08:00
2 changed files with 85 additions and 37 deletions
Showing only changes of commit 7ab1ee6fec - Show all commits

View File

@ -18,6 +18,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Editor/Editor.hxx" #include "Editor/Editor.hxx"
// STL Includes // STL Includes
#include <memory> #include <memory>
#include <string>
// Project Headers // Project Headers
#include "Components/Component.hxx" #include "Components/Component.hxx"
#include "Scripts/ScriptStore.hxx" #include "Scripts/ScriptStore.hxx"
@ -30,7 +31,9 @@ of DigiPen Institute of Technology is prohibited.
#include "RangeAttribute.hxx" #include "RangeAttribute.hxx"
#include "Math/Vector2.hxx" #include "Math/Vector2.hxx"
#include "Math/Vector3.hxx" #include "Math/Vector3.hxx"
#include <string> #include "Assets/AnimationClipAsset.hxx"
#include "Assets/AnimationControllerAsset.hxx"
#include "Assets/AnimationRigAsset.hxx"
// Using Directives // Using Directives
using namespace System; using namespace System;
@ -176,11 +179,14 @@ namespace SHADE
renderSpecificField<SHVec2 , Vector2 >(field, object, SHEditorUI::InputVec2 , &isHovered) || renderSpecificField<SHVec2 , Vector2 >(field, object, SHEditorUI::InputVec2 , &isHovered) ||
renderSpecificField<SHVec3 , Vector3 >(field, object, SHEditorUI::InputVec3 , &isHovered) || renderSpecificField<SHVec3 , Vector3 >(field, object, SHEditorUI::InputVec3 , &isHovered) ||
renderSpecificField<uint32_t , GameObject >(field, object, nullptr , &isHovered) || renderSpecificField<uint32_t , GameObject >(field, object, nullptr , &isHovered) ||
renderSpecificField<std::string, System::String^>(field, object, nullptr , &isHovered) || renderSpecificField<std::string, System::String^ >(field, object, nullptr , &isHovered) ||
renderSpecificField<int , System::Enum >(field, object, nullptr , &isHovered) || renderSpecificField<int , System::Enum >(field, object, nullptr , &isHovered) ||
renderSpecificField<AssetID , FontAsset >(field, object, nullptr , &isHovered) || renderSpecificField<AssetID , FontAsset >(field, object, nullptr , &isHovered) ||
renderSpecificField<AssetID , MeshAsset >(field, object, nullptr , &isHovered) || renderSpecificField<AssetID , MeshAsset >(field, object, nullptr , &isHovered) ||
renderSpecificField<AssetID , MaterialAsset >(field, object, nullptr , &isHovered); renderSpecificField<AssetID , MaterialAsset >(field, object, nullptr , &isHovered) ||
renderSpecificField<AssetID , AnimationClipAsset >(field, object, nullptr , &isHovered) ||
renderSpecificField<AssetID , AnimationControllerAsset>(field, object, nullptr , &isHovered) ||
renderSpecificField<AssetID , AnimationRigAsset >(field, object, nullptr , &isHovered);
if (!MODIFIED_PRIMITIVE) if (!MODIFIED_PRIMITIVE)
{ {
@ -337,11 +343,14 @@ namespace SHADE
renderFieldEditor<SHVec2 , Vector2 >(fieldName, object, SHEditorUI::InputVec2 , nullptr, rangeAttrib, modified) || renderFieldEditor<SHVec2 , Vector2 >(fieldName, object, SHEditorUI::InputVec2 , nullptr, rangeAttrib, modified) ||
renderFieldEditor<SHVec3 , Vector3 >(fieldName, object, SHEditorUI::InputVec3 , nullptr, rangeAttrib, modified) || renderFieldEditor<SHVec3 , Vector3 >(fieldName, object, SHEditorUI::InputVec3 , nullptr, rangeAttrib, modified) ||
renderFieldEditor<uint32_t , GameObject >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) || renderFieldEditor<uint32_t , GameObject >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<std::string, System::String^>(fieldName, object, nullptr , nullptr, rangeAttrib, modified) || renderFieldEditor<std::string, System::String^ >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<int , System::Enum >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) || renderFieldEditor<int , System::Enum >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<AssetID , FontAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) || renderFieldEditor<AssetID , FontAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<AssetID , MeshAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) || renderFieldEditor<AssetID , MeshAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<AssetID , MaterialAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified); renderFieldEditor<AssetID , MaterialAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<AssetID , AnimationClipAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<AssetID , AnimationControllerAsset>(fieldName, object, nullptr , nullptr, rangeAttrib, modified) ||
renderFieldEditor<AssetID , AnimationRigAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified);
return modified; return modified;
} }

View File

@ -23,6 +23,9 @@ of DigiPen Institute of Technology is prohibited.
#include "Assets/FontAsset.hxx" #include "Assets/FontAsset.hxx"
#include "Assets/MeshAsset.hxx" #include "Assets/MeshAsset.hxx"
#include "Assets/MaterialAsset.hxx" #include "Assets/MaterialAsset.hxx"
#include "Assets/AnimationClipAsset.hxx"
#include "Assets/AnimationControllerAsset.hxx"
#include "Assets/AnimationRigAsset.hxx"
namespace SHADE namespace SHADE
{ {
@ -237,6 +240,42 @@ namespace SHADE
return true; return true;
} }
return false;
}
template<>
bool Editor::renderFieldEditorInternal<AssetID, AnimationClipAsset>(const std::string& fieldName, interior_ptr<AnimationClipAsset> managedValPtr, EditorFieldFunc<uint32_t>, bool* isHovered, RangeAttribute^)
{
uint32_t assetId = managedValPtr->NativeAssetID;
if (SHEditorUI::InputAssetField(fieldName, assetId, AssetType::FONT, isHovered))
{
*managedValPtr = AnimationClipAsset(assetId);
return true;
}
return false;
}
template<>
bool Editor::renderFieldEditorInternal<AssetID, AnimationControllerAsset>(const std::string& fieldName, interior_ptr<AnimationControllerAsset> managedValPtr, EditorFieldFunc<uint32_t>, bool* isHovered, RangeAttribute^)
{
uint32_t assetId = managedValPtr->NativeAssetID;
if (SHEditorUI::InputAssetField(fieldName, assetId, AssetType::MESH, isHovered))
{
*managedValPtr = AnimationControllerAsset(assetId);
return true;
}
return false;
}
template<>
bool Editor::renderFieldEditorInternal<AssetID, AnimationRigAsset>(const std::string& fieldName, interior_ptr<AnimationRigAsset> managedValPtr, EditorFieldFunc<uint32_t>, bool* isHovered, RangeAttribute^)
{
uint32_t assetId = managedValPtr->NativeAssetID;
if (SHEditorUI::InputAssetField(fieldName, assetId, AssetType::MATERIAL, isHovered))
{
*managedValPtr = AnimationRigAsset(assetId);
return true;
}
return false; return false;
} }
} }