@ -454,23 +454,33 @@ void loadResource(Ogre::Resource *resource)
bool createSkeleton ( const std : : string & name , const std : : string & group , const Nif : : Node * node )
bool createSkeleton ( const std : : string & name , const std : : string & group , const Nif : : Node * node )
{
{
/* If the root node is a NiTriShape, or is a parent to only NiTriShapes, do
/* We need to be a little aggressive here, since some NIFs have a crap-ton
* not create a skeleton . */
* of nodes and Ogre only supports 256 bones . We will skip a skeleton if :
if ( node - > recType = = Nif : : RC_NiTriShape )
* There are no bones used for skinning , there are no controllers on non -
return false ;
* NiTriShape nodes , there are no nodes named " AttachLight " , and the tree
* consists of NiNode , NiTriShape , and RootCollisionNode types only .
if ( node - > recType = = Nif : : RC_NiNode )
*/
if ( ! node - > boneTrafo )
{
{
bool alltrishapes = true ;
if ( node - > recType = = Nif : : RC_NiTriShape )
const Nif : : NiNode * ninode = static_cast < const Nif : : NiNode * > ( node ) ;
return false ;
const Nif : : NodeList & children = ninode - > children ;
if ( node - > controller . empty ( ) & & node - > name ! = " AttachLight " )
for ( size_t i = 0 ; i < children . length ( ) & & alltrishapes ; i + + )
{
{
if ( ! children [ i ] . empty ( ) & & children [ i ] - > recType ! = Nif : : RC_NiTriShape )
if ( node - > recType = = Nif : : RC_NiNode | | node - > recType = = Nif : : RC_RootCollisionNode )
alltrishapes = false ;
{
const Nif : : NiNode * ninode = static_cast < const Nif : : NiNode * > ( node ) ;
const Nif : : NodeList & children = ninode - > children ;
for ( size_t i = 0 ; i < children . length ( ) ; i + + )
{
if ( ! children [ i ] . empty ( ) )
{
if ( createSkeleton ( name , group , children [ i ] . getPtr ( ) ) )
return true ;
}
}
return false ;
}
}
}
if ( alltrishapes )
return false ;
}
}
Ogre : : SkeletonManager & skelMgr = Ogre : : SkeletonManager : : getSingleton ( ) ;
Ogre : : SkeletonManager & skelMgr = Ogre : : SkeletonManager : : getSingleton ( ) ;