Commit 6c1777a8 authored by hybrid's avatar hybrid

Support relative filenames in serialization

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3713 dfc29bdd-3216-0410-991c-e03cc46cb475
parent d2aba0fc
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "IMeshCache.h" #include "IMeshCache.h"
#include "IAnimatedMesh.h" #include "IAnimatedMesh.h"
#include "IMaterialRenderer.h" #include "IMaterialRenderer.h"
#include "IFileSystem.h"
namespace irr namespace irr
{ {
...@@ -313,7 +314,15 @@ void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeRea ...@@ -313,7 +314,15 @@ void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeRea
{ {
IMeshSceneNode::serializeAttributes(out, options); IMeshSceneNode::serializeAttributes(out, options);
out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str()); if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)
{
const io::path path = SceneManager->getFileSystem()->getRelativeFilename(
SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),
options->Filename);
out->addString("Mesh", path.c_str());
}
else
out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials); out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
} }
......
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