Hello, sorry if this is a dumb thread to make, but I finished the tutorial on learnopengl for adding skeleton animations and in their code to load an animation they pass the animation path and model:
Animation danceAnimation("Assets/Animations/Ymca Dance.dae", myModel);
This seems to be necessary for this readMissingBones
method not entirely sure what it's purpose is, but here is the code for it:
void Animation::readMissingBones(const aiAnimation* animation, Model& model) {
int size = animation->mNumChannels;
auto& boneInfoMap = model.m_BoneInfoMap;
int& boneCount = model.m_BoneCounter;
//reading channels(bones engaged in an animation and their keyframes)
for (int i = 0; i < size; i++)
{
auto channel = animation->mChannels[i];
std::string boneName = channel->mNodeName.data;
if (boneInfoMap.find(boneName) == boneInfoMap.end())
{
boneInfoMap[boneName].id = boneCount;
boneCount++;
}
m_Bones.push_back(Bone(channel->mNodeName.data, boneInfoMap[channel->mNodeName.data].id, channel));
}
m_BoneInfoMap = boneInfoMap;
}
My problem with the way they've done this is it doesn't make sense that you would need to provide a model to load an animation ideally I'd want to just load my animation and play it
Animation myAnimation = loadAnimation("path/to/animation");
myAnimatedModel->m_animator->playAnimation(myAnimation); // or something like playAnimation(myModel, myAnimation)
To achieve I'm pretty sure I'll need to decouple the model from the animation class so that readMissingBones() doesn't need it, but not sure how so just wanted to get some suggestions from others.