From d32563063b3b0f0ddf387a29e69a1fb250084970 Mon Sep 17 00:00:00 2001 From: Nicolay Korslund Date: Thu, 2 Sep 2010 14:12:48 +0200 Subject: [PATCH] Alternative fix to mesh crash bug --- components/nifogre/ogre_nif_loader.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 5053fbd7d5..4c0277f898 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -767,14 +767,20 @@ void NIFLoader::handleNode(Nif::Node *node, int flags, if (!skel.isNull()) //if there is a skeleton { - bone = skel->createBone(node->name.toString()); + std::string name = node->name.toString(); + // Quick-n-dirty workaround for the fact that several + // bones may have the same name. + if(!skel->hasBone(name)) + { + bone = skel->createBone(name); - if (parentBone) - parentBone->addChild(bone); + if (parentBone) + parentBone->addChild(bone); - bone->setInheritOrientation(true); - bone->setPosition(convertVector3(node->trafo->pos)); - bone->setOrientation(convertRotation(node->trafo->rotation)); + bone->setInheritOrientation(true); + bone->setPosition(convertVector3(node->trafo->pos)); + bone->setOrientation(convertRotation(node->trafo->rotation)); + } } }