Fixed SHAnimationClip not copying name of channels correctly and added extra check for SHRig if an invalid rig is being constructed
This commit is contained in:
parent
5c14a0829a
commit
c0de2d4705
|
@ -28,7 +28,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
// Create a channel
|
// Create a channel
|
||||||
Channel newChannel;
|
Channel newChannel;
|
||||||
newChannel.Name = channel.name;
|
newChannel.Name = std::string(channel.name);
|
||||||
newChannel.PositionKeyFrames.reserve(channel.positionKeys.size());
|
newChannel.PositionKeyFrames.reserve(channel.positionKeys.size());
|
||||||
newChannel.RotationKeyFrames.reserve(channel.rotationKeys.size());
|
newChannel.RotationKeyFrames.reserve(channel.rotationKeys.size());
|
||||||
newChannel.ScaleKeyFrames.reserve(channel.scaleKeys.size());
|
newChannel.ScaleKeyFrames.reserve(channel.scaleKeys.size());
|
||||||
|
|
|
@ -11,9 +11,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
*//*************************************************************************************/
|
*//*************************************************************************************/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// STL Includes
|
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
|
#include "SH_API.h"
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
#include "Assets/Asset Types/Models/SHAnimationAsset.h"
|
#include "Assets/Asset Types/Models/SHAnimationAsset.h"
|
||||||
|
|
||||||
|
@ -36,7 +35,7 @@ namespace SHADE
|
||||||
/// Represents a animation clip of a 3D animation that is made for a specific model
|
/// Represents a animation clip of a 3D animation that is made for a specific model
|
||||||
/// rig.
|
/// rig.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SHAnimationClip
|
class SH_API SHAnimationClip
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -27,7 +27,10 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
// Don't bother if empty
|
// Don't bother if empty
|
||||||
if (asset.root == nullptr)
|
if (asset.root == nullptr)
|
||||||
|
{
|
||||||
|
SHLOG_ERROR("[SHRig] Attempted to load an invalid rig with no root.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Do a recursive depth first traversal to populate the rig
|
// Do a recursive depth first traversal to populate the rig
|
||||||
nodeCount = 0;
|
nodeCount = 0;
|
||||||
|
|
|
@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
// Project Includes
|
// Project Includes
|
||||||
|
#include "SH_API.h"
|
||||||
#include "Math/SHMatrix.h"
|
#include "Math/SHMatrix.h"
|
||||||
#include "Resource/SHHandle.h"
|
#include "Resource/SHHandle.h"
|
||||||
#include "Resource/SHResourceLibrary.h"
|
#include "Resource/SHResourceLibrary.h"
|
||||||
|
@ -32,7 +33,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
class SHRig
|
class SH_API SHRig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -51,8 +51,8 @@ namespace SHADE
|
||||||
template<> struct SHResourceLoader<SHMaterialSpec> { using AssetType = SHMaterialAsset; };
|
template<> struct SHResourceLoader<SHMaterialSpec> { using AssetType = SHMaterialAsset; };
|
||||||
template<> struct SHResourceLoader<SHMaterial> { using AssetType = SHMaterialSpec; };
|
template<> struct SHResourceLoader<SHMaterial> { using AssetType = SHMaterialSpec; };
|
||||||
template<> struct SHResourceLoader<SHFont> { using AssetType = SHFontAsset; };
|
template<> struct SHResourceLoader<SHFont> { using AssetType = SHFontAsset; };
|
||||||
template<> struct SHResourceLoader<SHAnimationClip> { using AssetType = SHAnimAsset; };
|
template<> struct SHResourceLoader<SHAnimationClip> { using AssetType = SHModelAsset; };
|
||||||
template<> struct SHResourceLoader<SHRig> { using AssetType = SHRigAsset; };
|
template<> struct SHResourceLoader<SHRig> { using AssetType = SHModelAsset; };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Static class responsible for loading and caching runtime resources from their
|
/// Static class responsible for loading and caching runtime resources from their
|
||||||
|
|
|
@ -348,10 +348,15 @@ namespace SHADE
|
||||||
return gfxSystem->AddFont(assetData);
|
return gfxSystem->AddFont(assetData);
|
||||||
}
|
}
|
||||||
// Animation Clip and Rig
|
// Animation Clip and Rig
|
||||||
else
|
else if constexpr (std::is_same_v<ResourceType, SHRig>)
|
||||||
{
|
{
|
||||||
loadedAssetData.emplace_back(assetId);
|
loadedAssetData.emplace_back(assetId);
|
||||||
return resourceHub.Create<ResourceType>(assetData);
|
return resourceHub.Create<ResourceType>(assetData.rig);
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<ResourceType, SHAnimationClip>)
|
||||||
|
{
|
||||||
|
loadedAssetData.emplace_back(assetId);
|
||||||
|
return resourceHub.Create<ResourceType>(*assetData.anims[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue