mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-14 06:40:40 +00:00
Make the getHeadNode method more general
This commit is contained in:
parent
c6c67a1bb4
commit
08d43fe217
@ -180,6 +180,18 @@ void Animation::createObjectList(Ogre::SceneNode *node, const std::string &model
|
||||
}
|
||||
|
||||
|
||||
Ogre::Node *Animation::getNode(const std::string &name)
|
||||
{
|
||||
if(mObjectList.mSkelBase)
|
||||
{
|
||||
Ogre::SkeletonInstance *skel = mObjectList.mSkelBase->getSkeleton();
|
||||
if(skel->hasBone(name))
|
||||
return skel->getBone(name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool Animation::hasAnimation(const std::string &anim)
|
||||
{
|
||||
for(std::vector<NifOgre::ObjectList>::const_iterator iter(mAnimationSources.begin());iter != mAnimationSources.end();iter++)
|
||||
|
@ -113,6 +113,8 @@ public:
|
||||
|
||||
void play(const std::string &groupname, const std::string &start, const std::string &stop, bool loop);
|
||||
virtual Ogre::Vector3 runAnimation(float timepassed);
|
||||
|
||||
Ogre::Node *getNode(const std::string &name);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ namespace MWRender
|
||||
void RaceSelectionPreview::updateCamera()
|
||||
{
|
||||
Ogre::Vector3 scale = mNode->getScale();
|
||||
Ogre::Vector3 headOffset = mAnimation->getHeadNode()->_getDerivedPosition();
|
||||
Ogre::Vector3 headOffset = mAnimation->getNode("Bip01 Head")->_getDerivedPosition();
|
||||
headOffset = mNode->convertLocalToWorldPosition(headOffset);
|
||||
|
||||
mCamera->setPosition(headOffset + mPosition * scale);
|
||||
|
@ -451,9 +451,4 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::
|
||||
}
|
||||
}
|
||||
|
||||
Ogre::Node* NpcAnimation::getHeadNode()
|
||||
{
|
||||
return mObjectList.mSkelBase->getSkeleton()->getBone("Bip01 Head");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,8 +78,6 @@ public:
|
||||
|
||||
virtual Ogre::Vector3 runAnimation(float timepassed);
|
||||
|
||||
Ogre::Node* getHeadNode();
|
||||
|
||||
void forceUpdate()
|
||||
{ updateParts(true); }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user