|
|
|
@ -31,6 +31,8 @@
|
|
|
|
|
#include <components/sceneutil/skeleton.hpp>
|
|
|
|
|
#include <components/sceneutil/positionattitudetransform.hpp>
|
|
|
|
|
|
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
|
|
|
|
|
|
#include <components/fallback/fallback.hpp>
|
|
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
@ -466,6 +468,8 @@ namespace MWRender
|
|
|
|
|
mAnimationTimePtr[i].reset(new AnimationTime);
|
|
|
|
|
|
|
|
|
|
mLightListCallback = new SceneUtil::LightListCallback;
|
|
|
|
|
|
|
|
|
|
mUseAdditionalSources = Settings::Manager::getBool ("use additional anim sources", "Game");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Animation::~Animation()
|
|
|
|
@ -536,6 +540,35 @@ namespace MWRender
|
|
|
|
|
return mKeyframes->mTextKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Animation::loadAllAnimationsInFolder(const std::string &model, const std::string &baseModel)
|
|
|
|
|
{
|
|
|
|
|
const std::map<std::string, VFS::File*>& index = mResourceSystem->getVFS()->getIndex();
|
|
|
|
|
|
|
|
|
|
std::string animationPath = model;
|
|
|
|
|
if (animationPath.find("meshes") == 0)
|
|
|
|
|
{
|
|
|
|
|
animationPath.replace(0, 6, "animations");
|
|
|
|
|
}
|
|
|
|
|
animationPath.replace(animationPath.size()-3, 3, "/");
|
|
|
|
|
|
|
|
|
|
mResourceSystem->getVFS()->normalizeFilename(animationPath);
|
|
|
|
|
|
|
|
|
|
std::map<std::string, VFS::File*>::const_iterator found = index.lower_bound(animationPath);
|
|
|
|
|
while (found != index.end())
|
|
|
|
|
{
|
|
|
|
|
const std::string& name = found->first;
|
|
|
|
|
if (name.size() >= animationPath.size() && name.substr(0, animationPath.size()) == animationPath)
|
|
|
|
|
{
|
|
|
|
|
size_t pos = name.find_last_of('.');
|
|
|
|
|
if (pos != std::string::npos && name.compare(pos, name.size()-pos, ".kf") == 0)
|
|
|
|
|
addSingleAnimSource(name, baseModel);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
++found;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Animation::addAnimSource(const std::string &model, const std::string& baseModel)
|
|
|
|
|
{
|
|
|
|
|
std::string kfname = model;
|
|
|
|
@ -546,6 +579,14 @@ namespace MWRender
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
addSingleAnimSource(kfname, baseModel);
|
|
|
|
|
|
|
|
|
|
if (mUseAdditionalSources)
|
|
|
|
|
loadAllAnimationsInFolder(kfname, baseModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Animation::addSingleAnimSource(const std::string &kfname, const std::string& baseModel)
|
|
|
|
|
{
|
|
|
|
|
if(!mResourceSystem->getVFS()->exists(kfname))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|