mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-21 22:21:02 +00:00
Add hack required for unnamed animated collision shapes (in_dagoth_bridge00.nif)
This commit is contained in:
parent
10ef0a34d9
commit
4949aa1fbb
@ -58,13 +58,16 @@ void animateCollisionShapes (std::map<OEngine::Physic::RigidBody*, OEngine::Phys
|
|||||||
for (std::map<std::string, int>::iterator shapeIt = shapes.begin();
|
for (std::map<std::string, int>::iterator shapeIt = shapes.begin();
|
||||||
shapeIt != shapes.end(); ++shapeIt)
|
shapeIt != shapes.end(); ++shapeIt)
|
||||||
{
|
{
|
||||||
Ogre::Node* bone = animation->getNode(shapeIt->first);
|
|
||||||
|
|
||||||
// FIXME: this will happen for nodes with empty names. Ogre's SkeletonInstance::cloneBoneAndChildren
|
Ogre::Node* bone;
|
||||||
// will assign an auto-generated name if the bone name was empty. We could use the bone handle instead of
|
if (shapeIt->first.empty())
|
||||||
// the bone name, but that is a bit tricky to retrieve.
|
// HACK: see NifSkeletonLoader::buildBones
|
||||||
|
bone = animation->getNode(" ");
|
||||||
|
else
|
||||||
|
bone = animation->getNode(shapeIt->first);
|
||||||
|
|
||||||
if (bone == NULL)
|
if (bone == NULL)
|
||||||
continue;
|
throw std::runtime_error("can't find bone");
|
||||||
|
|
||||||
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
||||||
|
|
||||||
|
@ -14,10 +14,24 @@ namespace NifOgre
|
|||||||
void NIFSkeletonLoader::buildBones(Ogre::Skeleton *skel, const Nif::Node *node, Ogre::Bone *parent)
|
void NIFSkeletonLoader::buildBones(Ogre::Skeleton *skel, const Nif::Node *node, Ogre::Bone *parent)
|
||||||
{
|
{
|
||||||
Ogre::Bone *bone;
|
Ogre::Bone *bone;
|
||||||
if(!skel->hasBone(node->name))
|
if (node->name.empty())
|
||||||
bone = skel->createBone(node->name);
|
{
|
||||||
|
// HACK: use " " instead of empty name, otherwise Ogre will replace it with an auto-generated
|
||||||
|
// name in SkeletonInstance::cloneBoneAndChildren.
|
||||||
|
static const char* emptyname = " ";
|
||||||
|
if (!skel->hasBone(emptyname))
|
||||||
|
bone = skel->createBone(emptyname);
|
||||||
|
else
|
||||||
|
bone = skel->createBone();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
bone = skel->createBone();
|
{
|
||||||
|
if(!skel->hasBone(node->name))
|
||||||
|
bone = skel->createBone(node->name);
|
||||||
|
else
|
||||||
|
bone = skel->createBone();
|
||||||
|
}
|
||||||
|
|
||||||
if(parent) parent->addChild(bone);
|
if(parent) parent->addChild(bone);
|
||||||
mNifToOgreHandleMap[node->recIndex] = bone->getHandle();
|
mNifToOgreHandleMap[node->recIndex] = bone->getHandle();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user