Commit c167d7c7 authored by hybrid's avatar hybrid

Added a FileSystem check to avoid several error messages.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1219 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5bc1bdc1
...@@ -207,7 +207,7 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, ...@@ -207,7 +207,7 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
MeshLoaderList.push_back(new C3DSMeshFileLoader(MeshManipulator,FileSystem, Driver)); MeshLoaderList.push_back(new C3DSMeshFileLoader(MeshManipulator,FileSystem, Driver));
#endif #endif
#ifdef _IRR_COMPILE_WITH_X_LOADER_ #ifdef _IRR_COMPILE_WITH_X_LOADER_
MeshLoaderList.push_back(new CXMeshFileLoader(this)); MeshLoaderList.push_back(new CXMeshFileLoader(this, FileSystem));
#endif #endif
#ifdef _IRR_COMPILE_WITH_OCT_LOADER_ #ifdef _IRR_COMPILE_WITH_OCT_LOADER_
MeshLoaderList.push_back(new COCTLoader(Driver)); MeshLoaderList.push_back(new COCTLoader(Driver));
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "fast_atof.h" #include "fast_atof.h"
#include "coreutil.h" #include "coreutil.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "IFileSystem.h"
#include "IReadFile.h" #include "IReadFile.h"
#ifdef _DEBUG #ifdef _DEBUG
...@@ -25,10 +26,10 @@ namespace scene ...@@ -25,10 +26,10 @@ namespace scene
{ {
//! Constructor //! Constructor
CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr) CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs)
: SceneManager(smgr), AnimatedMesh(0), MajorVersion(0), MinorVersion(0), : SceneManager(smgr), FileSystem(fs), AnimatedMesh(0), MajorVersion(0),
BinaryFormat(false), BinaryNumCount(0), Buffer(0), P(0), End(0), MinorVersion(0), BinaryFormat(false), BinaryNumCount(0), Buffer(0),
FloatSize(0), CurFrame(0) P(0), End(0), FloatSize(0), CurFrame(0)
{ {
} }
...@@ -1256,17 +1257,19 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material) ...@@ -1256,17 +1257,19 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material)
return false; return false;
// original name // original name
if (FileSystem->existFile(TextureFileName.c_str()))
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() )); material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
// mesh path // mesh path
if (!material.getTexture(0)) else
{ {
TextureFileName=FilePath + stripPathFromString(TextureFileName,false); TextureFileName=FilePath + stripPathFromString(TextureFileName,false);
if (FileSystem->existFile(TextureFileName.c_str()))
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() )); material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
}
// working directory // working directory
if (!material.getTexture(0)) else
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() )); material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() ));
} }
}
else else
{ {
os::Printer::log("Unknown data object in material in .x file", objectName.c_str(), ELL_WARNING); os::Printer::log("Unknown data object in material in .x file", objectName.c_str(), ELL_WARNING);
......
...@@ -14,6 +14,7 @@ namespace irr ...@@ -14,6 +14,7 @@ namespace irr
{ {
namespace io namespace io
{ {
class IFileSystem;
class IReadFile; class IReadFile;
} // end namespace io } // end namespace io
namespace scene namespace scene
...@@ -26,7 +27,7 @@ class CXMeshFileLoader : public IMeshLoader ...@@ -26,7 +27,7 @@ class CXMeshFileLoader : public IMeshLoader
public: public:
//! Constructor //! Constructor
CXMeshFileLoader(scene::ISceneManager* smgr); CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs);
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".cob") //! based on the file extension (e.g. ".cob")
...@@ -166,6 +167,7 @@ private: ...@@ -166,6 +167,7 @@ private:
bool readRGBA(video::SColor& color); bool readRGBA(video::SColor& color);
ISceneManager* SceneManager; ISceneManager* SceneManager;
io::IFileSystem* FileSystem;
core::array<CSkinnedMesh::SJoint*> *AllJoints; core::array<CSkinnedMesh::SJoint*> *AllJoints;
......
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