Renamed SHAnimationData to SHRawAnimation

This commit is contained in:
Kah Wei 2023-02-27 16:51:02 +08:00
parent ba22638520
commit 7839bd21f2
11 changed files with 33 additions and 33 deletions

View File

@ -181,7 +181,7 @@ namespace Sandbox
// Link up SHDebugDraw
SHDebugDraw::Init(SHSystemManager::GetSystem<SHDebugDrawSystem>());
auto clip = SHResourceManager::LoadOrGet<SHAnimationData>(77816045);
auto clip = SHResourceManager::LoadOrGet<SHRawAnimation>(77816045);
auto rig = SHResourceManager::LoadOrGet<SHRig>(77816045);
int i = 0;
}

View File

@ -17,7 +17,7 @@ of DigiPen Institute of Technology is prohibited.
// Project Includes
#include "SH_API.h"
#include "Resource/SHHandle.h"
#include "SHAnimationData.h"
#include "SHRawAnimation.h"
namespace SHADE
{
@ -100,7 +100,7 @@ namespace SHADE
/// </summary>
struct Node
{
Handle<SHAnimationData> Clip;
Handle<SHRawAnimation> Clip;
std::vector<Transition> Transitions;
};

View File

@ -19,7 +19,7 @@ of DigiPen Institute of Technology is prohibited.
// Project Includes
#include "SHRig.h"
#include "Math/SHMatrix.h"
#include "SHAnimationData.h"
#include "SHRawAnimation.h"
#include "Graphics/SHVkUtil.h"
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
#include "ECS_Base/Managers/SHSystemManager.h"
@ -37,14 +37,14 @@ namespace SHADE
playOnce = false;
}
void SHAnimatorComponent::Play(Handle<SHAnimationData> clip)
void SHAnimatorComponent::Play(Handle<SHRawAnimation> clip)
{
currClip = clip;
currPlaybackTime = 0.0f;
Play();
}
void SHAnimatorComponent::PlayOneShot(Handle<SHAnimationData> clip)
void SHAnimatorComponent::PlayOneShot(Handle<SHRawAnimation> clip)
{
Play(clip);
playOnce = true;
@ -86,7 +86,7 @@ namespace SHADE
}
}
void SHAnimatorComponent::SetClip(Handle<SHAnimationData> newClip)
void SHAnimatorComponent::SetClip(Handle<SHRawAnimation> newClip)
{
// No change
if (currClip == newClip)

View File

@ -22,7 +22,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Math/SHMatrix.h"
#include "Math/Vector/SHVec3.h"
#include "Math/SHQuaternion.h"
#include "SHAnimationData.h"
#include "SHRawAnimation.h"
namespace SHADE
{
@ -31,7 +31,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------------*/
class SHRig;
struct SHRigNode;
class SHAnimationData;
class SHRawAnimation;
class SHVkBuffer;
/*-----------------------------------------------------------------------------------*/
@ -55,12 +55,12 @@ namespace SHADE
/// Plays the specified animation clip from the start.
/// </summary>
/// <param name="clip">Animation clip to play.</param>
void Play(Handle<SHAnimationData> clip);
void Play(Handle<SHRawAnimation> clip);
/// <summary>
/// Plays the specified animation clip from the start one time only.
/// </summary>
/// <param name="clip">Animation clip to play.</param>
void PlayOneShot(Handle<SHAnimationData> clip);
void PlayOneShot(Handle<SHRawAnimation> clip);
/// <summary>
/// Plays the currently loaded animation clip from the start.
/// </summary>
@ -88,7 +88,7 @@ namespace SHADE
/// If the clip is the same as the current clip, nothing happens.
/// </summary>
/// <param name="newClip">Clip to use.</param>
void SetClip(Handle<SHAnimationData> newClip);
void SetClip(Handle<SHRawAnimation> newClip);
/*---------------------------------------------------------------------------------*/
/* Getter Functions */
@ -108,7 +108,7 @@ namespace SHADE
/// Retrieve the currently set animation clip.
/// </summary>
/// <returns>Handle to the currently set animation clip.</returns>
Handle<SHAnimationData> GetCurrentClip() const noexcept { return currClip; }
Handle<SHRawAnimation> GetCurrentClip() const noexcept { return currClip; }
/// <summary>
/// Checks if an animation is currently playing.
/// </summary>
@ -131,7 +131,7 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/
// Resources
Handle<SHRig> rig;
Handle<SHAnimationData> currClip;
Handle<SHRawAnimation> currClip;
// Playback Tracking
float currPlaybackTime = 0.0f;
bool isPlaying = true;
@ -141,7 +141,7 @@ namespace SHADE
// Buffer
std::vector<SHMatrix> boneMatrices;
// Caches
std::unordered_map<std::string, const SHAnimationData::Channel*> channelMap;
std::unordered_map<std::string, const SHRawAnimation::Channel*> channelMap;
/*---------------------------------------------------------------------------------*/
/* Helper Functions */

View File

@ -15,7 +15,7 @@ of DigiPen Institute of Technology is prohibited.
// Project Includes
#include "SHRig.h"
#include "Math/SHMatrix.h"
#include "SHAnimationData.h"
#include "SHRawAnimation.h"
#include "Graphics/SHVkUtil.h"
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
#include "ECS_Base/Managers/SHSystemManager.h"

View File

@ -12,14 +12,14 @@ of DigiPen Institute of Technology is prohibited.
// Pre-compiled Header
#include "SHpch.h"
// Primary Header
#include "SHAnimationData.h"
#include "SHRawAnimation.h"
namespace SHADE
{
/*-----------------------------------------------------------------------------------*/
/* Constructors */
/*-----------------------------------------------------------------------------------*/
SHAnimationData::SHAnimationData(const SHAnimAsset& asset)
SHRawAnimation::SHRawAnimation(const SHAnimAsset& asset)
: ticksPerSecond { static_cast<int>(asset.ticksPerSecond) }
, totalTime { static_cast<float>(asset.duration) / static_cast<int>(asset.ticksPerSecond) }
{

View File

@ -35,7 +35,7 @@ namespace SHADE
/// Represents a animation clip of a 3D animation that is made for a specific model
/// rig.
/// </summary>
class SH_API SHAnimationData
class SH_API SHRawAnimation
{
public:
/*---------------------------------------------------------------------------------*/
@ -60,7 +60,7 @@ namespace SHADE
/// Constructs an SHAnimation Clip from a specified SHAnimAsset.
/// </summary>
/// <param name="asset">Animation asset to load.</param>
explicit SHAnimationData(const SHAnimAsset& asset);
explicit SHRawAnimation(const SHAnimAsset& asset);
/*---------------------------------------------------------------------------------*/
/* Getter Functions */

View File

@ -644,13 +644,13 @@ namespace SHADE
SHEditorWindowManager::GetEditorWindow<SHAssetBrowser>()->SetScrollTo(assetID);
}
}
Handle<SHAnimationData> const& clip = component->GetCurrentClip();
const auto CLIP_NAME = clip ? SHResourceManager::GetAssetName<SHAnimationData>(clip).value_or("") : "";
Handle<SHRawAnimation> const& clip = component->GetCurrentClip();
const auto CLIP_NAME = clip ? SHResourceManager::GetAssetName<SHRawAnimation>(clip).value_or("") : "";
SHEditorWidgets::DragDropReadOnlyField<AssetID>("Clip", CLIP_NAME,
[component]()
{
Handle<SHAnimationData> const& clip = component->GetCurrentClip();
return SHResourceManager::GetAssetID<SHAnimationData>(clip).value_or(0);
Handle<SHRawAnimation> const& clip = component->GetCurrentClip();
return SHResourceManager::GetAssetID<SHRawAnimation>(clip).value_or(0);
},
[component](AssetID const& id)
{
@ -659,13 +659,13 @@ namespace SHADE
SHLOG_WARNING("Attempted to assign non mesh asset to Renderable Mesh property!")
return;
}
component->SetClip(SHResourceManager::LoadOrGet<SHAnimationData>(id));
component->SetClip(SHResourceManager::LoadOrGet<SHRawAnimation>(id));
}, SHDragDrop::DRAG_RESOURCE);
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
{
if (Handle<SHAnimationData> const& clip = component->GetCurrentClip())
if (Handle<SHRawAnimation> const& clip = component->GetCurrentClip())
{
AssetID assetID = SHResourceManager::GetAssetID<SHAnimationData>(clip).value_or(0);
AssetID assetID = SHResourceManager::GetAssetID<SHRawAnimation>(clip).value_or(0);
SHEditorWindowManager::GetEditorWindow<SHAssetBrowser>()->SetScrollTo(assetID);
}
}

View File

@ -28,7 +28,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
#include "Assets/Asset Types/SHMaterialAsset.h"
#include "Graphics/MiddleEnd/TextRendering/SHFont.h"
#include "Animation/SHAnimationData.h"
#include "Animation/SHRawAnimation.h"
#include "Animation/SHRig.h"
namespace SHADE
@ -53,7 +53,7 @@ namespace SHADE
template<> struct SHResourceLoader<SHMaterialSpec> { using AssetType = SHMaterialAsset; };
template<> struct SHResourceLoader<SHMaterial> { using AssetType = SHMaterialSpec; };
template<> struct SHResourceLoader<SHFont> { using AssetType = SHFontAsset; };
template<> struct SHResourceLoader<SHAnimationData> { using AssetType = SHModelAsset; };
template<> struct SHResourceLoader<SHRawAnimation> { using AssetType = SHModelAsset; };
template<> struct SHResourceLoader<SHRig> { using AssetType = SHModelAsset; };
/// <summary>

View File

@ -41,7 +41,7 @@ namespace SHADE
!std::is_same_v<ResourceType, SHMaterialSpec> &&
!std::is_same_v<ResourceType, SHFont> &&
!std::is_same_v<ResourceType, SHMaterial> &&
!std::is_same_v<ResourceType, SHAnimationData> &&
!std::is_same_v<ResourceType, SHRawAnimation> &&
!std::is_same_v<ResourceType, SHRig>
)
{
@ -355,7 +355,7 @@ namespace SHADE
loadedAssetData.emplace_back(assetId);
return resourceHub.Create<ResourceType>(assetData.rig, rigNodeStore);
}
else if constexpr (std::is_same_v<ResourceType, SHAnimationData>)
else if constexpr (std::is_same_v<ResourceType, SHRawAnimation>)
{
loadedAssetData.emplace_back(assetId);
return resourceHub.Create<ResourceType>(*assetData.anims[0]);

View File

@ -400,7 +400,7 @@ namespace YAML
{
YAML::Node node;
node[RIG_YAML_TAG.data()] = SHResourceManager::GetAssetID<SHRig>(rhs.GetRig()).value_or(0);
node[CLIP_YAML_TAG.data()] = SHResourceManager::GetAssetID<SHAnimationData>(rhs.GetCurrentClip()).value_or(0);
node[CLIP_YAML_TAG.data()] = SHResourceManager::GetAssetID<SHRawAnimation>(rhs.GetCurrentClip()).value_or(0);
return node;
}
static bool decode(YAML::Node const& node, SHAnimatorComponent& rhs)
@ -411,7 +411,7 @@ namespace YAML
}
if (node[CLIP_YAML_TAG.data()].IsDefined())
{
rhs.SetClip(SHResourceManager::LoadOrGet<SHAnimationData>(node[CLIP_YAML_TAG.data()].as<AssetID>()));
rhs.SetClip(SHResourceManager::LoadOrGet<SHRawAnimation>(node[CLIP_YAML_TAG.data()].as<AssetID>()));
}
return true;
}