Share the space with the parent entity only when there's real skinned meshes

The existence of a base skeleton doesn't mean it shares the same bone
structure. If there isn't an actual skinned entity besides the base, simply
attach it to the bone like unskinned meshes should be.
This commit is contained in:
Chris Robinson 2013-02-27 13:16:27 -08:00
parent bfe80bb8dc
commit 3ed0bf97a8

View file

@ -1204,14 +1204,20 @@ EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonen
if(meshes.size() == 0) if(meshes.size() == 0)
return entitylist; return entitylist;
bool isskinned = false;
Ogre::SceneManager *sceneMgr = parentNode->getCreator(); Ogre::SceneManager *sceneMgr = parentNode->getCreator();
std::string filter = "@shape=tri "+bonename; std::string filter = "@shape=tri "+bonename;
Misc::StringUtils::toLower(filter); Misc::StringUtils::toLower(filter);
for(size_t i = 0;i < meshes.size();i++) for(size_t i = 0;i < meshes.size();i++)
{ {
Ogre::Entity *ent = sceneMgr->createEntity(meshes[i].mMeshName); Ogre::Entity *ent = sceneMgr->createEntity(meshes[i].mMeshName);
if(!entitylist.mSkelBase && ent->hasSkeleton()) if(!entitylist.mSkelBase)
entitylist.mSkelBase = ent; {
if(ent->hasSkeleton())
entitylist.mSkelBase = ent;
}
else if(!isskinned && ent->hasSkeleton())
isskinned = true;
entitylist.mEntities.push_back(ent); entitylist.mEntities.push_back(ent);
} }
@ -1219,7 +1225,7 @@ EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonen
if(bonename.find("Left") != std::string::npos) if(bonename.find("Left") != std::string::npos)
scale.x *= -1.0f; scale.x *= -1.0f;
if(entitylist.mSkelBase) if(isskinned)
{ {
for(size_t i = 0;i < entitylist.mEntities.size();i++) for(size_t i = 0;i < entitylist.mEntities.size();i++)
{ {