Adds functionality for checking if the animation group passed is currently playing on the actor passed. This is needed for AIWander.

actorid
Torben Carrington 12 years ago
parent b1a8dc35e0
commit c8c1ddd927

@ -112,6 +112,8 @@ namespace MWBase
virtual void skipAnimation(const MWWorld::Ptr& ptr) = 0;
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
/// references that are currently not in the scene should be ignored.
virtual bool checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string& groupName) = 0;
};
}

@ -309,4 +309,12 @@ namespace MWMechanics
if(iter != mActors.end())
iter->second.skipAnim();
}
bool Actors::checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string& groupName)
{
PtrControllerMap::iterator iter = mActors.find(ptr);
if(iter != mActors.end())
return iter->second.isAnimPlaying(groupName);
return false;
}
}

@ -82,6 +82,7 @@ namespace MWMechanics
void playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number);
void skipAnimation(const MWWorld::Ptr& ptr);
bool checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string& groupName);
};
}

@ -509,6 +509,14 @@ void CharacterController::skipAnim()
mSkipAnim = true;
}
bool CharacterController::isAnimPlaying(const std::string &groupName)
{
if(mAnimation == NULL)
return false;
else
return mAnimation->isPlaying(groupName);
}
void CharacterController::clearAnimQueue()
{

@ -125,6 +125,7 @@ public:
void playGroup(const std::string &groupname, int mode, int count);
void skipAnim();
bool isAnimPlaying(const std::string &groupName);
void setState(CharacterState state);
CharacterState getState() const

@ -668,5 +668,12 @@ namespace MWMechanics
else
mObjects.skipAnimation(ptr);
}
bool MechanicsManager::checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string &groupName)
{
if(MWWorld::Class::get(ptr).isActor())
return mActors.checkAnimationPlaying(ptr, groupName);
else
return false;
}
}

@ -100,6 +100,7 @@ namespace MWMechanics
virtual void playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number);
virtual void skipAnimation(const MWWorld::Ptr& ptr);
virtual bool checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string &groupName);
};
}

Loading…
Cancel
Save