Implemented Animation Clip asset and animation controller #410
|
@ -18,6 +18,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Editor/Editor.hxx"
|
||||
// STL Includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
// Project Headers
|
||||
#include "Components/Component.hxx"
|
||||
#include "Scripts/ScriptStore.hxx"
|
||||
|
@ -30,7 +31,9 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "RangeAttribute.hxx"
|
||||
#include "Math/Vector2.hxx"
|
||||
#include "Math/Vector3.hxx"
|
||||
#include <string>
|
||||
#include "Assets/AnimationClipAsset.hxx"
|
||||
#include "Assets/AnimationControllerAsset.hxx"
|
||||
#include "Assets/AnimationRigAsset.hxx"
|
||||
|
||||
// Using Directives
|
||||
using namespace System;
|
||||
|
@ -163,24 +166,27 @@ namespace SHADE
|
|||
bool isHovered = false;
|
||||
|
||||
const bool MODIFIED_PRIMITIVE =
|
||||
renderSpecificField<int , Int16 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , Int32 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , Int64 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , UInt16 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , UInt32 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , UInt64 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , Byte >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<bool , bool >(field, object, SHEditorUI::InputCheckbox, &isHovered) ||
|
||||
renderSpecificField<float , float >(field, object, SHEditorUI::InputFloat , &isHovered) ||
|
||||
renderSpecificField<double , double >(field, object, SHEditorUI::InputDouble , &isHovered) ||
|
||||
renderSpecificField<SHVec2 , Vector2 >(field, object, SHEditorUI::InputVec2 , &isHovered) ||
|
||||
renderSpecificField<SHVec3 , Vector3 >(field, object, SHEditorUI::InputVec3 , &isHovered) ||
|
||||
renderSpecificField<uint32_t , GameObject >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<std::string, System::String^>(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<int , System::Enum >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<AssetID , FontAsset >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<AssetID , MeshAsset >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<AssetID , MaterialAsset >(field, object, nullptr , &isHovered);
|
||||
renderSpecificField<int , Int16 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , Int32 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , Int64 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , UInt16 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , UInt32 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , UInt64 >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<int , Byte >(field, object, SHEditorUI::InputInt , &isHovered) ||
|
||||
renderSpecificField<bool , bool >(field, object, SHEditorUI::InputCheckbox, &isHovered) ||
|
||||
renderSpecificField<float , float >(field, object, SHEditorUI::InputFloat , &isHovered) ||
|
||||
renderSpecificField<double , double >(field, object, SHEditorUI::InputDouble , &isHovered) ||
|
||||
renderSpecificField<SHVec2 , Vector2 >(field, object, SHEditorUI::InputVec2 , &isHovered) ||
|
||||
renderSpecificField<SHVec3 , Vector3 >(field, object, SHEditorUI::InputVec3 , &isHovered) ||
|
||||
renderSpecificField<uint32_t , GameObject >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<std::string, System::String^ >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<int , System::Enum >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<AssetID , FontAsset >(field, object, nullptr , &isHovered) ||
|
||||
renderSpecificField<AssetID , MeshAsset >(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)
|
||||
{
|
||||
|
@ -324,24 +330,27 @@ namespace SHADE
|
|||
bool modified;
|
||||
|
||||
const bool RENDERED =
|
||||
renderFieldEditor<int , Int16 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , Int32 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , Int64 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , UInt16 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , UInt32 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , UInt64 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , Byte >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<bool , bool >(fieldName, object, SHEditorUI::InputCheckbox, nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<float , float >(fieldName, object, SHEditorUI::InputFloat , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<double , double >(fieldName, object, SHEditorUI::InputDouble , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<SHVec2 , Vector2 >(fieldName, object, SHEditorUI::InputVec2 , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<SHVec3 , Vector3 >(fieldName, object, SHEditorUI::InputVec3 , 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<int , System::Enum >(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 , MaterialAsset >(fieldName, object, nullptr , nullptr, rangeAttrib, modified);
|
||||
renderFieldEditor<int , Int16 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , Int32 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , Int64 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , UInt16 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , UInt32 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , UInt64 >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<int , Byte >(fieldName, object, SHEditorUI::InputInt , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<bool , bool >(fieldName, object, SHEditorUI::InputCheckbox, nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<float , float >(fieldName, object, SHEditorUI::InputFloat , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<double , double >(fieldName, object, SHEditorUI::InputDouble , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<SHVec2 , Vector2 >(fieldName, object, SHEditorUI::InputVec2 , nullptr, rangeAttrib, modified) ||
|
||||
renderFieldEditor<SHVec3 , Vector3 >(fieldName, object, SHEditorUI::InputVec3 , 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<int , System::Enum >(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 , 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;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Assets/FontAsset.hxx"
|
||||
#include "Assets/MeshAsset.hxx"
|
||||
#include "Assets/MaterialAsset.hxx"
|
||||
#include "Assets/AnimationClipAsset.hxx"
|
||||
#include "Assets/AnimationControllerAsset.hxx"
|
||||
#include "Assets/AnimationRigAsset.hxx"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -237,6 +240,42 @@ namespace SHADE
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue