|
|
|
@ -66,11 +66,6 @@ BulletNifLoader::~BulletNifLoader()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BulletNifLoader::setAnimatedNodes(const std::set<std::string> &animatedNodes)
|
|
|
|
|
{
|
|
|
|
|
mAnimatedNodes = animatedNodes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr nif)
|
|
|
|
|
{
|
|
|
|
|
mShape = new BulletShape;
|
|
|
|
@ -110,7 +105,20 @@ osg::ref_ptr<BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr nif)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool autogenerated = hasAutoGeneratedCollision(node);
|
|
|
|
|
handleNode(node, 0, autogenerated, false, autogenerated);
|
|
|
|
|
bool isAnimated = false;
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
std::string filename = nif->getFilename();
|
|
|
|
|
size_t slashpos = filename.find_last_of("/\\");
|
|
|
|
|
if (slashpos == std::string::npos)
|
|
|
|
|
slashpos = 0;
|
|
|
|
|
if (slashpos+1 < filename.size() && (filename[slashpos+1] == 'x' || filename[slashpos+1] == 'X'))
|
|
|
|
|
{
|
|
|
|
|
isAnimated = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleNode(node, 0, autogenerated, isAnimated, autogenerated);
|
|
|
|
|
|
|
|
|
|
if (mCompoundShape)
|
|
|
|
|
{
|
|
|
|
@ -192,9 +200,6 @@ void BulletNifLoader::handleNode(const Nif::Node *node, int flags,
|
|
|
|
|
&& (node->controller->flags & Nif::NiNode::ControllerFlag_Active))
|
|
|
|
|
isAnimated = true;
|
|
|
|
|
|
|
|
|
|
if (mAnimatedNodes.find(node->name) != mAnimatedNodes.end())
|
|
|
|
|
isAnimated = true;
|
|
|
|
|
|
|
|
|
|
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
|
|
|
|
|
|
|
|
|
|
// Don't collide with AvoidNode shapes
|
|
|
|
|