move first mesh bones calculation under check for its presense

This commit is contained in:
d.isakov 2025-04-16 08:04:58 +02:00
parent b4f1ff9a00
commit 42a40b3920

View file

@ -2286,6 +2286,8 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
}
}
if (firstMeshWithBones != -1)
{
// Update all bones and boneMatrices of first mesh with bones.
for (int boneId = 0; boneId < anim.boneCount; boneId++)
{
@ -2306,8 +2308,6 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
// Update remaining meshes with bones
// NOTE: Using deep copy because shallow copy results in double free with 'UnloadModel()'
if (firstMeshWithBones != -1)
{
for (int i = firstMeshWithBones + 1; i < model.meshCount; i++)
{
if (model.meshes[i].boneMatrices)