1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-05 18:19:43 +00:00

Don't add RotateController to an uncontrolled node

This commit is contained in:
scrawl 2016-02-29 20:23:19 +01:00
parent 8791063110
commit 87871d7d54

View file

@ -1353,12 +1353,27 @@ namespace MWRender
if (found != getNodeMap().end()) if (found != getNodeMap().end())
{ {
osg::MatrixTransform* node = found->second; osg::MatrixTransform* node = found->second;
bool foundKeyframeCtrl = false;
osg::Callback* cb = node->getUpdateCallback();
while (cb)
{
if (dynamic_cast<NifOsg::KeyframeController*>(cb))
{
foundKeyframeCtrl = true;
break;
}
}
if (foundKeyframeCtrl)
{
mHeadController = new RotateController(mObjectRoot.get()); mHeadController = new RotateController(mObjectRoot.get());
node->addUpdateCallback(mHeadController); node->addUpdateCallback(mHeadController);
mActiveControllers.insert(std::make_pair(node, mHeadController)); mActiveControllers.insert(std::make_pair(node, mHeadController));
} }
} }
} }
}
void Animation::setHeadPitch(float pitchRadians) void Animation::setHeadPitch(float pitchRadians)
{ {