Commit 941b333a authored by Rogerborg's avatar Rogerborg

Bug 2123736; In getMeshFilename(const IMesh*), test the possibility that the...

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
parent d0ac6a9c
...@@ -133,6 +133,9 @@ const c8* CMeshCache::getMeshFilename(u32 number) const ...@@ -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. //! 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 const c8* CMeshCache::getMeshFilename(const IAnimatedMesh* const mesh) const
{ {
if(!mesh)
return 0;
for (u32 i=0; i<Meshes.size(); ++i) for (u32 i=0; i<Meshes.size(); ++i)
{ {
if (Meshes[i].Mesh == mesh) if (Meshes[i].Mesh == mesh)
...@@ -146,10 +149,15 @@ const c8* CMeshCache::getMeshFilename(const IAnimatedMesh* const mesh) const ...@@ -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. //! 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 const c8* CMeshCache::getMeshFilename(const IMesh* const mesh) const
{ {
if(!mesh)
return 0;
for (u32 i=0; i<Meshes.size(); ++i) for (u32 i=0; i<Meshes.size(); ++i)
{ {
if (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh) // IMesh may actually be an IAnimatedMesh, so do a direct comparison
return Meshes[i].Name.c_str(); // 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; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment