Add const version of World::getAnimation

openmw-38
scrawl 9 years ago
parent 51c77c5045
commit 29d0f448b4

@ -430,6 +430,7 @@ namespace MWBase
/// \todo Probably shouldn't be here /// \todo Probably shouldn't be here
virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr) = 0; virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr) = 0;
virtual const MWRender::Animation* getAnimation(const MWWorld::ConstPtr &ptr) const = 0;
virtual void reattachPlayerCamera() = 0; virtual void reattachPlayerCamera() = 0;
/// \todo this does not belong here /// \todo this does not belong here

@ -2114,7 +2114,7 @@ void CharacterController::setActive(bool active)
mAnimation->setActive(active); mAnimation->setActive(active);
} }
void CharacterController::setHeadTrackTarget(const MWWorld::Ptr &target) void CharacterController::setHeadTrackTarget(const MWWorld::ConstPtr &target)
{ {
mHeadTrackTarget = target; mHeadTrackTarget = target;
} }
@ -2137,7 +2137,7 @@ void CharacterController::updateHeadTracking(float duration)
osg::Vec3f headPos = mat.getTrans(); osg::Vec3f headPos = mat.getTrans();
osg::Vec3f direction; osg::Vec3f direction;
if (MWRender::Animation* anim = MWBase::Environment::get().getWorld()->getAnimation(mHeadTrackTarget)) if (const MWRender::Animation* anim = MWBase::Environment::get().getWorld()->getAnimation(mHeadTrackTarget))
{ {
const osg::Node* node = anim->getNode("Head"); const osg::Node* node = anim->getNode("Head");
if (node == NULL) if (node == NULL)

@ -180,7 +180,7 @@ class CharacterController : public MWRender::Animation::TextKeyListener
float mSecondsOfSwimming; float mSecondsOfSwimming;
float mSecondsOfRunning; float mSecondsOfRunning;
MWWorld::Ptr mHeadTrackTarget; MWWorld::ConstPtr mHeadTrackTarget;
float mTurnAnimationThreshold; // how long to continue playing turning animation after actor stopped turning float mTurnAnimationThreshold; // how long to continue playing turning animation after actor stopped turning
@ -255,7 +255,7 @@ public:
void setActive(bool active); void setActive(bool active);
/// Make this character turn its head towards \a target. To turn off head tracking, pass an empty Ptr. /// Make this character turn its head towards \a target. To turn off head tracking, pass an empty Ptr.
void setHeadTrackTarget(const MWWorld::Ptr& target); void setHeadTrackTarget(const MWWorld::ConstPtr& target);
}; };
MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::InventoryStore &inv, WeaponType *weaptype); MWWorld::ContainerStoreIterator getActiveWeapon(CreatureStats &stats, MWWorld::InventoryStore &inv, WeaponType *weaptype);

@ -2112,6 +2112,11 @@ namespace MWWorld
return mRendering->getAnimation(ptr); return mRendering->getAnimation(ptr);
} }
const MWRender::Animation* World::getAnimation(const MWWorld::ConstPtr &ptr) const
{
return mRendering->getAnimation(ptr);
}
void World::screenshot(osg::Image* image, int w, int h) void World::screenshot(osg::Image* image, int w, int h)
{ {
mRendering->screenshot(image, w, h); mRendering->screenshot(image, w, h);

@ -534,6 +534,7 @@ namespace MWWorld
/// \todo Probably shouldn't be here /// \todo Probably shouldn't be here
virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr); virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr);
virtual const MWRender::Animation* getAnimation(const MWWorld::ConstPtr &ptr) const;
virtual void reattachPlayerCamera(); virtual void reattachPlayerCamera();
/// \todo this does not belong here /// \todo this does not belong here

Loading…
Cancel
Save