Bug 2123736; In getMeshFilename(const IMesh*), test the possibility that the IMesh is an IAnimatedMesh. This is a stopgap.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1674 dfc29bdd-3216-0410-991c-e03cc46cb475
master
Rogerborg 2008-11-03 22:13:37 +00:00
parent d0ac6a9cb4
commit 941b333aad
1 changed files with 10 additions and 2 deletions

View File

@ -133,6 +133,9 @@ const c8* CMeshCache::getMeshFilename(u32 number) const
//! Returns the filename of a loaded mesh, if there is any. Returns 0 if there is none.
const c8* CMeshCache::getMeshFilename(const IAnimatedMesh* const mesh) const
{
if(!mesh)
return 0;
for (u32 i=0; i<Meshes.size(); ++i)
{
if (Meshes[i].Mesh == mesh)
@ -146,10 +149,15 @@ const c8* CMeshCache::getMeshFilename(const IAnimatedMesh* const mesh) const
//! Returns the filename of a loaded mesh, if there is any. Returns 0 if there is none.
const c8* CMeshCache::getMeshFilename(const IMesh* const mesh) const
{
if(!mesh)
return 0;
for (u32 i=0; i<Meshes.size(); ++i)
{
if (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh)
return Meshes[i].Name.c_str();
// IMesh may actually be an IAnimatedMesh, so do a direct comparison
// as well as getting an IMesh from our stored IAnimatedMeshes
if (Meshes[i].Mesh && (Meshes[i].Mesh == mesh || Meshes[i].Mesh->getMesh(0) == mesh))
return Meshes[i].Name.c_str();
}
return 0;