1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

Offset animation times to start at 0

This commit is contained in:
Chris Robinson 2013-01-09 04:10:02 -08:00
parent 1e38e381a4
commit 465fd9c8af

View file

@ -164,7 +164,7 @@ static void fail(const std::string &msg)
static void buildAnimation(Ogre::Skeleton *skel, const std::string &name, const std::vector<Nif::NiKeyframeController*> &ctrls, const std::vector<std::string> &targets, float startTime, float stopTime)
{
Ogre::Animation *anim = skel->createAnimation(name, stopTime);
Ogre::Animation *anim = skel->createAnimation(name, stopTime-startTime);
for(size_t i = 0;i < ctrls.size();i++)
{
@ -246,7 +246,7 @@ static void buildAnimation(Ogre::Skeleton *skel, const std::string &name, const
}
Ogre::TransformKeyFrame *kframe;
kframe = nodetrack->createNodeKeyFrame(curtime);
kframe = nodetrack->createNodeKeyFrame(curtime-startTime);
if(quatiter == quatkeys.mKeys.end() || quatiter == quatkeys.mKeys.begin())
kframe->setRotation(curquat);
else
@ -450,8 +450,12 @@ void loadResource(Ogre::Resource *resource)
buildAnimation(skel, currentgroup, ctrls, targets, keyiter->first, lastkeyiter->first);
TextKeyMap::const_iterator insiter = keyiter;
TextKeyMap groupkeys;
groupkeys.insert(keyiter, ++lastkeyiter);
do {
groupkeys.insert(std::make_pair(insiter->first - keyiter->first, insiter->second));
} while(insiter++ != lastkeyiter);
Ogre::UserObjectBindings &bindings = boneiter.peekNext()->getUserObjectBindings();
bindings.setUserAny(std::string(sTextKeyExtraDataID)+"@"+currentgroup, Ogre::Any(groupkeys));
}