From 626dcd54dc1da12647be1316a6010fe30e689da3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 18 Jul 2012 17:26:51 -0700 Subject: [PATCH] Store the skeleton name with the mesh resource loader instead of a flag --- components/nifogre/ogre_nif_loader.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 9fd3d44f1..c4e1398f9 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -509,7 +509,7 @@ class NIFMeshLoader : Ogre::ManualResourceLoader std::string mGroup; std::string mShapeName; std::string mMaterialName; - bool mHasSkel; + std::string mSkelName; void warn(const std::string &msg) { @@ -535,7 +535,7 @@ class NIFMeshLoader : Ogre::ManualResourceLoader { // Only set a skeleton when skinning. Unskinned meshes with a skeleton will be // explicitly attached later. - mesh->setSkeletonName(mName); + mesh->setSkeletonName(mSkelName); // Get the skeleton resource, so vertices can be transformed into the bones' initial state. Ogre::SkeletonManager *skelMgr = Ogre::SkeletonManager::getSingletonPtr(); @@ -579,7 +579,7 @@ class NIFMeshLoader : Ogre::ManualResourceLoader srcVerts = newVerts; srcNorms = newNorms; } - else if(!mHasSkel) + else if(mSkelName.length() == 0) { // No skinning and no skeleton, so just transform the vertices and // normals into position. @@ -752,10 +752,9 @@ class NIFMeshLoader : Ogre::ManualResourceLoader public: NIFMeshLoader() - : mHasSkel(false) { } - NIFMeshLoader(const std::string &name, const std::string &group, bool hasSkel) - : mName(name), mGroup(group), mHasSkel(hasSkel) + NIFMeshLoader(const std::string &name, const std::string &group, const std::string skelName) + : mName(name), mGroup(group), mSkelName(skelName) { } virtual void loadResource(Ogre::Resource *resource) @@ -765,8 +764,8 @@ public: if(!mShapeName.length()) { - if(mHasSkel) - mesh->setSkeletonName(mName); + if(mSkelName.length() > 0) + mesh->setSkeletonName(mSkelName); return; } @@ -874,7 +873,7 @@ MeshPairList NIFLoader::load(std::string name, const std::string &group) bool hasSkel = NIFSkeletonLoader::createSkeleton(name, group, node); - NIFMeshLoader meshldr(name, group, hasSkel); + NIFMeshLoader meshldr(name, group, (hasSkel ? name : std::string())); meshldr.createMeshes(node, meshes); return meshes;