forked from teamnwah/openmw-tes3coop
Put check for nif file name into separate function
This commit is contained in:
parent
2599aba196
commit
3f21c49479
1 changed files with 8 additions and 4 deletions
|
@ -34,6 +34,13 @@ btVector3 getbtVector(const osg::Vec3f &v)
|
||||||
return btVector3(v.x(), v.y(), v.z());
|
return btVector3(v.x(), v.y(), v.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pathFileNameStartsWithX(const std::string& path)
|
||||||
|
{
|
||||||
|
const std::size_t slashpos = path.find_last_of("/\\");
|
||||||
|
const std::size_t letterPos = slashpos == std::string::npos ? 0 : slashpos + 1;
|
||||||
|
return letterPos < path.size() && (path[letterPos] == 'x' || path[letterPos] == 'X');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NifBullet
|
namespace NifBullet
|
||||||
|
@ -91,10 +98,7 @@ osg::ref_ptr<Resource::BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr&
|
||||||
|
|
||||||
// files with the name convention xmodel.nif usually have keyframes stored in a separate file xmodel.kf (see Animation::addAnimSource).
|
// files with the name convention xmodel.nif usually have keyframes stored in a separate file xmodel.kf (see Animation::addAnimSource).
|
||||||
// assume all nodes in the file will be animated
|
// assume all nodes in the file will be animated
|
||||||
std::string filename = nif->getFilename();
|
const bool isAnimated = pathFileNameStartsWithX(nif->getFilename());
|
||||||
const std::size_t slashpos = filename.find_last_of("/\\");
|
|
||||||
const std::size_t letterPos = slashpos == std::string::npos ? 0 : slashpos + 1;
|
|
||||||
const bool isAnimated = letterPos < filename.size() && (filename[letterPos] == 'x' || filename[letterPos] == 'X');
|
|
||||||
|
|
||||||
handleNode(node, 0, autogenerated, isAnimated, autogenerated);
|
handleNode(node, 0, autogenerated, isAnimated, autogenerated);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue