Add OBJ_TEXTURE_PATH and B3D_TEXTURE_PATH to SceneParameters to allow setting texture-paths for obj and b3d.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3005 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
58764ce8b9
commit
7eaece5d46
|
@ -1,5 +1,7 @@
|
|||
Changes in 1.7
|
||||
|
||||
- Add OBJ_TEXTURE_PATH and B3D_TEXTURE_PATH to SceneParameters to allow setting texture-paths for obj and b3d.
|
||||
|
||||
- Irrlicht keeps now filenames additionaly to the internally used names, thereby fixing some problems with uppercase-filenames on Linux.
|
||||
|
||||
- Bugfix: Mousewheel no longer sends EMIE_MOUSE_WHEEL messages twice on Linux.
|
||||
|
|
|
@ -111,6 +111,14 @@ namespace scene
|
|||
const c8* const DMF_FLIP_ALPHA_TEXTURES = "DMF_FlipAlpha";
|
||||
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in obj loader.
|
||||
/** Use it like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::OBJ_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
**/
|
||||
const c8* const OBJ_TEXTURE_PATH = "OBJ_TexturePath";
|
||||
|
||||
//! Flag to avoid loading group structures in .obj files
|
||||
/** Use it like this:
|
||||
\code
|
||||
|
@ -137,6 +145,13 @@ namespace scene
|
|||
**/
|
||||
const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";
|
||||
|
||||
//! Name of the parameter for changing the texture path of the built-in b3d loader.
|
||||
/** Use it like this:
|
||||
\code
|
||||
SceneManager->getParameters()->setAttribute(scene::B3D_TEXTURE_PATH, "path/to/your/textures");
|
||||
\endcode
|
||||
**/
|
||||
const c8* const B3D_TEXTURE_PATH = "B3D_TexturePath";
|
||||
|
||||
//! Flag set as parameter when the scene manager is used as editor
|
||||
/** In this way special animators like deletion animators can be stopped from
|
||||
|
|
|
@ -912,7 +912,15 @@ void CB3DMeshFileLoader::loadTextures(SB3dMaterial& material) const
|
|||
{
|
||||
video::ITexture* tex = 0;
|
||||
io::IFileSystem* fs = SceneManager->getFileSystem();
|
||||
if (fs->existFile(B3dTexture->TextureName))
|
||||
io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(B3D_TEXTURE_PATH) );
|
||||
if ( texnameWithUserPath.size() )
|
||||
{
|
||||
texnameWithUserPath += '/';
|
||||
texnameWithUserPath += B3dTexture->TextureName;
|
||||
}
|
||||
if (fs->existFile(texnameWithUserPath))
|
||||
tex = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath);
|
||||
else if (fs->existFile(B3dTexture->TextureName))
|
||||
tex = SceneManager->getVideoDriver()->getTexture(B3dTexture->TextureName);
|
||||
else if (fs->existFile(fs->getFileDir(B3DFile->getFileName()) +"/"+ fs->getFileBasename(B3dTexture->TextureName)))
|
||||
tex = SceneManager->getVideoDriver()->getTexture(fs->getFileDir(B3DFile->getFileName()) +"/"+ fs->getFileBasename(B3dTexture->TextureName));
|
||||
|
|
|
@ -426,7 +426,15 @@ const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const buf
|
|||
bool newTexture=false;
|
||||
if (texname.size())
|
||||
{
|
||||
if (FileSystem->existFile(texname))
|
||||
io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(OBJ_TEXTURE_PATH) );
|
||||
if ( texnameWithUserPath.size() )
|
||||
{
|
||||
texnameWithUserPath += '/';
|
||||
texnameWithUserPath += texname;
|
||||
}
|
||||
if (FileSystem->existFile(texnameWithUserPath))
|
||||
texture = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath);
|
||||
else if (FileSystem->existFile(texname))
|
||||
{
|
||||
newTexture = SceneManager->getVideoDriver()->findTexture(texname) == 0;
|
||||
texture = SceneManager->getVideoDriver()->getTexture(texname);
|
||||
|
|
Loading…
Reference in New Issue