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,
MeshLoaderList.push_back(new C3DSMeshFileLoader(MeshManipulator,FileSystem, Driver));
#endif
#ifdef _IRR_COMPILE_WITH_X_LOADER_
MeshLoaderList.push_back(new CXMeshFileLoader(this));
MeshLoaderList.push_back(new CXMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_OCT_LOADER_
MeshLoaderList.push_back(new COCTLoader(Driver));
......
......@@ -12,6 +12,7 @@
#include "fast_atof.h"
#include "coreutil.h"
#include "IVideoDriver.h"
#include "IFileSystem.h"
#include "IReadFile.h"
#ifdef _DEBUG
......@@ -25,10 +26,10 @@ namespace scene
{
//! Constructor
CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr)
: SceneManager(smgr), AnimatedMesh(0), MajorVersion(0), MinorVersion(0),
BinaryFormat(false), BinaryNumCount(0), Buffer(0), P(0), End(0),
FloatSize(0), CurFrame(0)
CXMeshFileLoader::CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs)
: SceneManager(smgr), FileSystem(fs), AnimatedMesh(0), MajorVersion(0),
MinorVersion(0), BinaryFormat(false), BinaryNumCount(0), Buffer(0),
P(0), End(0), FloatSize(0), CurFrame(0)
{
}
......@@ -1256,16 +1257,18 @@ bool CXMeshFileLoader::parseDataObjectMaterial(video::SMaterial& material)
return false;
// original name
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
if (FileSystem->existFile(TextureFileName.c_str()))
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
// mesh path
if (!material.getTexture(0))
else
{
TextureFileName=FilePath + stripPathFromString(TextureFileName,false);
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
if (FileSystem->existFile(TextureFileName.c_str()))
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( TextureFileName.c_str() ));
// working directory
else
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() ));
}
// working directory
if (!material.getTexture(0))
material.setTexture(0, SceneManager->getVideoDriver()->getTexture ( stripPathFromString(TextureFileName,false).c_str() ));
}
else
{
......
......@@ -14,6 +14,7 @@ namespace irr
{
namespace io
{
class IFileSystem;
class IReadFile;
} // end namespace io
namespace scene
......@@ -26,7 +27,7 @@ class CXMeshFileLoader : public IMeshLoader
public:
//! 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
//! based on the file extension (e.g. ".cob")
......@@ -166,6 +167,7 @@ private:
bool readRGBA(video::SColor& color);
ISceneManager* SceneManager;
io::IFileSystem* FileSystem;
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