1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 09:36:43 +00:00

Don't create entities and particles when only the skeleton base is needed

This commit is contained in:
Chris Robinson 2013-04-13 13:13:09 -07:00
parent 4a42f89e08
commit 07c24e0382

View file

@ -468,7 +468,7 @@ class NIFObjectLoader
static void createObjects(const std::string &name, const std::string &group, static void createObjects(const std::string &name, const std::string &group,
Ogre::SceneManager *sceneMgr, const Nif::Node *node, Ogre::SceneManager *sceneMgr, const Nif::Node *node,
ObjectList &objectlist, int flags=0) ObjectList &objectlist, int flags)
{ {
// Do not create objects for the collision shape (includes all children) // Do not create objects for the collision shape (includes all children)
if(node->recType == Nif::RC_RootCollisionNode) if(node->recType == Nif::RC_RootCollisionNode)
@ -585,8 +585,8 @@ class NIFObjectLoader
} }
} }
if(node->recType == Nif::RC_NiAutoNormalParticles || if((node->recType == Nif::RC_NiAutoNormalParticles ||
node->recType == Nif::RC_NiRotatingParticles) node->recType == Nif::RC_NiRotatingParticles) && !(flags&0x40000000))
{ {
Ogre::ParticleSystem *partsys = createParticleSystem(name, group, sceneMgr, objectlist.mSkelBase, node); Ogre::ParticleSystem *partsys = createParticleSystem(name, group, sceneMgr, objectlist.mSkelBase, node);
if(partsys != NULL) if(partsys != NULL)
@ -614,8 +614,7 @@ class NIFObjectLoader
{ {
/* This creates an empty mesh to which a skeleton gets attached. This /* This creates an empty mesh to which a skeleton gets attached. This
* is to ensure we have an entity with a skeleton instance, even if all * is to ensure we have an entity with a skeleton instance, even if all
* other meshes are hidden or entities attached to a specific node * other entities are attached to bones and not skinned. */
* instead of skinned. */
Ogre::MeshManager &meshMgr = Ogre::MeshManager::getSingleton(); Ogre::MeshManager &meshMgr = Ogre::MeshManager::getSingleton();
if(meshMgr.getByName(name).isNull()) if(meshMgr.getByName(name).isNull())
NIFMeshLoader::createMesh(name, name, group, ~(size_t)0); NIFMeshLoader::createMesh(name, name, group, ~(size_t)0);
@ -625,7 +624,7 @@ class NIFObjectLoader
} }
public: public:
static void load(Ogre::SceneManager *sceneMgr, ObjectList &objectlist, const std::string &name, const std::string &group) static void load(Ogre::SceneManager *sceneMgr, ObjectList &objectlist, const std::string &name, const std::string &group, int flags=0)
{ {
Nif::NIFFile::ptr nif = Nif::NIFFile::create(name); Nif::NIFFile::ptr nif = Nif::NIFFile::create(name);
if(nif->numRoots() < 1) if(nif->numRoots() < 1)
@ -651,7 +650,7 @@ public:
// Create a base skeleton entity if this NIF needs one // Create a base skeleton entity if this NIF needs one
createSkelBase(name, group, sceneMgr, node, objectlist); createSkelBase(name, group, sceneMgr, node, objectlist);
} }
createObjects(name, group, sceneMgr, node, objectlist); createObjects(name, group, sceneMgr, node, objectlist, flags);
} }
}; };
@ -739,7 +738,7 @@ ObjectList Loader::createObjectBase(Ogre::SceneManager *sceneMgr, std::string na
ObjectList objectlist; ObjectList objectlist;
Misc::StringUtils::toLower(name); Misc::StringUtils::toLower(name);
NIFObjectLoader::load(sceneMgr, objectlist, name, group); NIFObjectLoader::load(sceneMgr, objectlist, name, group, 0xC0000000);
return objectlist; return objectlist;
} }