Index: ps/trunk/source/graphics/Model.cpp =================================================================== --- ps/trunk/source/graphics/Model.cpp +++ ps/trunk/source/graphics/Model.cpp @@ -450,7 +450,7 @@ // return false on error, else true bool CModel::SetAnimation(CSkeletonAnim* anim, bool once) { - m_Anim = NULL; // in case something fails + m_Anim = nullptr; // in case something fails if (anim) { @@ -459,22 +459,12 @@ if (once) m_Flags |= MODELFLAG_NOLOOPANIMATION; - if (!m_BoneMatrices && anim->m_AnimDef) - { - // not boned, can't animate - return false; - } - - if (m_BoneMatrices && !anim->m_AnimDef) - { - // boned, but animation isn't valid - // (e.g. the default (static) idle animation on an animated unit) + // Not rigged or animation is not valid. + if (!m_BoneMatrices || !anim->m_AnimDef) return false; - } - if (anim->m_AnimDef && anim->m_AnimDef->GetNumKeys() != m_pModelDef->GetNumBones()) + if (anim->m_AnimDef->GetNumKeys() != m_pModelDef->GetNumBones()) { - // mismatch between model's skeleton and animation's skeleton LOGERROR("Mismatch between model's skeleton and animation's skeleton (%s.dae has %lu model bones while the animation %s has %lu animation keys.)", m_pModelDef->GetName().string8().c_str() , static_cast(m_pModelDef->GetNumBones()), @@ -483,11 +473,11 @@ return false; } - // reset the cached bounds when the animation is changed + // Reset the cached bounds when the animation is changed. m_ObjectBounds.SetEmpty(); InvalidateBounds(); - // start anim from beginning + // Start anim from beginning. m_AnimTime = 0; }