mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Build bones for non-NiNode nodes (NiTriShapes, etc)
This commit is contained in:
parent
fefbf86531
commit
65c20f128f
@ -142,7 +142,7 @@ static void fail(const std::string &msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void buildBones(Ogre::Skeleton *skel, Nif::NiNode *node, Ogre::Bone *parent=NULL)
|
void buildBones(Ogre::Skeleton *skel, const Nif::Node *node, Ogre::Bone *parent=NULL)
|
||||||
{
|
{
|
||||||
Ogre::Bone *bone;
|
Ogre::Bone *bone;
|
||||||
if(!skel->hasBone(node->name))
|
if(!skel->hasBone(node->name))
|
||||||
@ -157,12 +157,15 @@ void buildBones(Ogre::Skeleton *skel, Nif::NiNode *node, Ogre::Bone *parent=NULL
|
|||||||
bone->setBindingPose();
|
bone->setBindingPose();
|
||||||
bone->setInitialState();
|
bone->setInitialState();
|
||||||
|
|
||||||
const Nif::NodeList &children = node->children;
|
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(node);
|
||||||
for(size_t i = 0;i < children.length();i++)
|
if(ninode)
|
||||||
{
|
{
|
||||||
Nif::NiNode *next;
|
const Nif::NodeList &children = ninode->children;
|
||||||
if(!children[i].empty() && (next=dynamic_cast<Nif::NiNode*>(children[i].getPtr())))
|
for(size_t i = 0;i < children.length();i++)
|
||||||
buildBones(skel, next, bone);
|
{
|
||||||
|
if(!children[i].empty())
|
||||||
|
buildBones(skel, children[i].getPtr(), bone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +175,7 @@ void loadResource(Ogre::Resource *resource)
|
|||||||
OgreAssert(skel, "Attempting to load a skeleton into a non-skeleton resource!");
|
OgreAssert(skel, "Attempting to load a skeleton into a non-skeleton resource!");
|
||||||
|
|
||||||
Nif::NIFFile nif(skel->getName());
|
Nif::NIFFile nif(skel->getName());
|
||||||
Nif::NiNode *node = dynamic_cast<Nif::NiNode*>(nif.getRecord(0));
|
const Nif::Node *node = dynamic_cast<const Nif::Node*>(nif.getRecord(0));
|
||||||
buildBones(skel, node);
|
buildBones(skel, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user