XFileExporter.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. @author: Richard Steffen, 2014
  32. ----------------------------------------------------------------------
  33. */
  34. #ifndef ASSIMP_BUILD_NO_EXPORT
  35. #ifndef ASSIMP_BUILD_NO_XFILE_EXPORTER
  36. #include "XFileExporter.h"
  37. #include "ConvertToLHProcess.h"
  38. #include "Bitmap.h"
  39. #include "BaseImporter.h"
  40. #include "fast_atof.h"
  41. #include "SceneCombiner.h"
  42. #include <ctime>
  43. #include <set>
  44. #include <boost/scoped_ptr.hpp>
  45. #include "Exceptional.h"
  46. #include "../include/assimp/IOSystem.hpp"
  47. #include "../include/assimp/scene.h"
  48. #include "../include/assimp/light.h"
  49. using namespace Assimp;
  50. namespace Assimp
  51. {
  52. // ------------------------------------------------------------------------------------------------
  53. // Worker function for exporting a scene to Collada. Prototyped and registered in Exporter.cpp
  54. void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* pProperties)
  55. {
  56. std::string path = "";
  57. std::string file = pFile;
  58. // We need to test both types of folder separators because pIOSystem->getOsSeparator() is not reliable.
  59. // Moreover, the path given by some applications is not even consistent with the OS specific type of separator.
  60. const char* end_path = std::max(strrchr(pFile, '\\'), strrchr(pFile, '/'));
  61. if(end_path != NULL) {
  62. path = std::string(pFile, end_path + 1 - pFile);
  63. file = file.substr(end_path + 1 - pFile, file.npos);
  64. std::size_t pos = file.find_last_of('.');
  65. if(pos != file.npos) {
  66. file = file.substr(0, pos);
  67. }
  68. }
  69. // create/copy Properties
  70. ExportProperties props(*pProperties);
  71. // set standard properties if not set
  72. if (!props.HasPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT)) props.SetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT, false);
  73. // invoke the exporter
  74. XFileExporter iDoTheExportThing( pScene, pIOSystem, path, file, &props);
  75. // we're still here - export successfully completed. Write result to the given IOSYstem
  76. boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt"));
  77. if(outfile == NULL) {
  78. throw DeadlyExportError("could not open output .x file: " + std::string(pFile));
  79. }
  80. // XXX maybe use a small wrapper around IOStream that behaves like std::stringstream in order to avoid the extra copy.
  81. outfile->Write( iDoTheExportThing.mOutput.str().c_str(), static_cast<size_t>(iDoTheExportThing.mOutput.tellp()),1);
  82. }
  83. } // end of namespace Assimp
  84. // ------------------------------------------------------------------------------------------------
  85. // Constructor for a specific scene to export
  86. XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties)
  87. {
  88. // make sure that all formatting happens using the standard, C locale and not the user's current locale
  89. mOutput.imbue( std::locale("C") );
  90. mScene = pScene;
  91. mSceneOwned = false;
  92. // set up strings
  93. endstr = "\n";
  94. // start writing
  95. WriteFile();
  96. }
  97. // ------------------------------------------------------------------------------------------------
  98. // Destructor
  99. XFileExporter::~XFileExporter()
  100. {
  101. if(mSceneOwned) {
  102. delete mScene;
  103. }
  104. }
  105. // ------------------------------------------------------------------------------------------------
  106. // Starts writing the contents
  107. void XFileExporter::WriteFile()
  108. {
  109. // note, that all realnumber values must be comma separated in x files
  110. mOutput.setf(std::ios::fixed);
  111. mOutput.precision(16); // precission for double
  112. // entry of writing the file
  113. WriteHeader();
  114. mOutput << startstr << "Frame DXCC_ROOT {" << endstr;
  115. PushTag();
  116. aiMatrix4x4 I; // identity
  117. WriteFrameTransform(I);
  118. WriteNode(mScene->mRootNode);
  119. PopTag();
  120. mOutput << startstr << "}" << endstr;
  121. }
  122. // ------------------------------------------------------------------------------------------------
  123. // Writes the asset header
  124. void XFileExporter::WriteHeader()
  125. {
  126. if (mProperties->GetPropertyBool(AI_CONFIG_EXPORT_XFILE_64BIT) == true)
  127. mOutput << startstr << "xof 0303txt 0064" << endstr;
  128. else
  129. mOutput << startstr << "xof 0303txt 0032" << endstr;
  130. mOutput << endstr;
  131. mOutput << startstr << "template Frame {" << endstr;
  132. PushTag();
  133. mOutput << startstr << "<3d82ab46-62da-11cf-ab39-0020af71e433>" << endstr;
  134. mOutput << startstr << "[...]" << endstr;
  135. PopTag();
  136. mOutput << startstr << "}" << endstr;
  137. mOutput << endstr;
  138. mOutput << startstr << "template Matrix4x4 {" << endstr;
  139. PushTag();
  140. mOutput << startstr << "<f6f23f45-7686-11cf-8f52-0040333594a3>" << endstr;
  141. mOutput << startstr << "array FLOAT matrix[16];" << endstr;
  142. PopTag();
  143. mOutput << startstr << "}" << endstr;
  144. mOutput << endstr;
  145. mOutput << startstr << "template FrameTransformMatrix {" << endstr;
  146. PushTag();
  147. mOutput << startstr << "<f6f23f41-7686-11cf-8f52-0040333594a3>" << endstr;
  148. mOutput << startstr << "Matrix4x4 frameMatrix;" << endstr;
  149. PopTag();
  150. mOutput << startstr << "}" << endstr;
  151. mOutput << endstr;
  152. mOutput << startstr << "template Vector {" << endstr;
  153. PushTag();
  154. mOutput << startstr << "<3d82ab5e-62da-11cf-ab39-0020af71e433>" << endstr;
  155. mOutput << startstr << "FLOAT x;" << endstr;
  156. mOutput << startstr << "FLOAT y;" << endstr;
  157. mOutput << startstr << "FLOAT z;" << endstr;
  158. PopTag();
  159. mOutput << startstr << "}" << endstr;
  160. mOutput << endstr;
  161. mOutput << startstr << "template MeshFace {" << endstr;
  162. PushTag();
  163. mOutput << startstr << "<3d82ab5f-62da-11cf-ab39-0020af71e433>" << endstr;
  164. mOutput << startstr << "DWORD nFaceVertexIndices;" << endstr;
  165. mOutput << startstr << "array DWORD faceVertexIndices[nFaceVertexIndices];" << endstr;
  166. PopTag();
  167. mOutput << startstr << "}" << endstr;
  168. mOutput << endstr;
  169. mOutput << startstr << "template Mesh {" << endstr;
  170. PushTag();
  171. mOutput << startstr << "<3d82ab44-62da-11cf-ab39-0020af71e433>" << endstr;
  172. mOutput << startstr << "DWORD nVertices;" << endstr;
  173. mOutput << startstr << "array Vector vertices[nVertices];" << endstr;
  174. mOutput << startstr << "DWORD nFaces;" << endstr;
  175. mOutput << startstr << "array MeshFace faces[nFaces];" << endstr;
  176. mOutput << startstr << "[...]" << endstr;
  177. PopTag();
  178. mOutput << startstr << "}" << endstr;
  179. mOutput << endstr;
  180. mOutput << startstr << "template MeshNormals {" << endstr;
  181. PushTag();
  182. mOutput << startstr << "<f6f23f43-7686-11cf-8f52-0040333594a3>" << endstr;
  183. mOutput << startstr << "DWORD nNormals;" << endstr;
  184. mOutput << startstr << "array Vector normals[nNormals];" << endstr;
  185. mOutput << startstr << "DWORD nFaceNormals;" << endstr;
  186. mOutput << startstr << "array MeshFace faceNormals[nFaceNormals];" << endstr;
  187. PopTag();
  188. mOutput << startstr << "}" << endstr;
  189. mOutput << endstr;
  190. mOutput << startstr << "template Coords2d {" << endstr;
  191. PushTag();
  192. mOutput << startstr << "<f6f23f44-7686-11cf-8f52-0040333594a3>" << endstr;
  193. mOutput << startstr << "FLOAT u;" << endstr;
  194. mOutput << startstr << "FLOAT v;" << endstr;
  195. PopTag();
  196. mOutput << startstr << "}" << endstr;
  197. mOutput << endstr;
  198. mOutput << startstr << "template MeshTextureCoords {" << endstr;
  199. PushTag();
  200. mOutput << startstr << "<f6f23f40-7686-11cf-8f52-0040333594a3>" << endstr;
  201. mOutput << startstr << "DWORD nTextureCoords;" << endstr;
  202. mOutput << startstr << "array Coords2d textureCoords[nTextureCoords];" << endstr;
  203. PopTag();
  204. mOutput << startstr << "}" << endstr;
  205. mOutput << endstr;
  206. mOutput << startstr << "template ColorRGBA {" << endstr;
  207. PushTag();
  208. mOutput << startstr << "<35ff44e0-6c7c-11cf-8f52-0040333594a3>" << endstr;
  209. mOutput << startstr << "FLOAT red;" << endstr;
  210. mOutput << startstr << "FLOAT green;" << endstr;
  211. mOutput << startstr << "FLOAT blue;" << endstr;
  212. mOutput << startstr << "FLOAT alpha;" << endstr;
  213. PopTag();
  214. mOutput << startstr << "}" << endstr;
  215. mOutput << endstr;
  216. mOutput << startstr << "template IndexedColor {" << endstr;
  217. PushTag();
  218. mOutput << startstr << "<1630b820-7842-11cf-8f52-0040333594a3>" << endstr;
  219. mOutput << startstr << "DWORD index;" << endstr;
  220. mOutput << startstr << "ColorRGBA indexColor;" << endstr;
  221. PopTag();
  222. mOutput << startstr << "}" << endstr;
  223. mOutput << endstr;
  224. mOutput << startstr << "template MeshVertexColors {" << endstr;
  225. PushTag();
  226. mOutput << startstr << "<1630b821-7842-11cf-8f52-0040333594a3>" << endstr;
  227. mOutput << startstr << "DWORD nVertexColors;" << endstr;
  228. mOutput << startstr << "array IndexedColor vertexColors[nVertexColors];" << endstr;
  229. PopTag();
  230. mOutput << startstr << "}" << endstr;
  231. mOutput << endstr;
  232. mOutput << startstr << "template VertexElement {" << endstr;
  233. PushTag();
  234. mOutput << startstr << "<f752461c-1e23-48f6-b9f8-8350850f336f>" << endstr;
  235. mOutput << startstr << "DWORD Type;" << endstr;
  236. mOutput << startstr << "DWORD Method;" << endstr;
  237. mOutput << startstr << "DWORD Usage;" << endstr;
  238. mOutput << startstr << "DWORD UsageIndex;" << endstr;
  239. PopTag();
  240. mOutput << startstr << "}" << endstr;
  241. mOutput << endstr;
  242. mOutput << startstr << "template DeclData {" << endstr;
  243. PushTag();
  244. mOutput << startstr << "<bf22e553-292c-4781-9fea-62bd554bdd93>" << endstr;
  245. mOutput << startstr << "DWORD nElements;" << endstr;
  246. mOutput << startstr << "array VertexElement Elements[nElements];" << endstr;
  247. mOutput << startstr << "DWORD nDWords;" << endstr;
  248. mOutput << startstr << "array DWORD data[nDWords];" << endstr;
  249. PopTag();
  250. mOutput << startstr << "}" << endstr;
  251. mOutput << endstr;
  252. }
  253. // Writes the material setup
  254. void XFileExporter::WriteFrameTransform(aiMatrix4x4& m)
  255. {
  256. mOutput << startstr << "FrameTransformMatrix {" << endstr << " ";
  257. PushTag();
  258. mOutput << startstr << m.a1 << ", " << m.b1 << ", " << m.c1 << ", " << m.d1 << "," << endstr;
  259. mOutput << startstr << m.a2 << ", " << m.b2 << ", " << m.c2 << ", " << m.d2 << "," << endstr;
  260. mOutput << startstr << m.a3 << ", " << m.b3 << ", " << m.c3 << ", " << m.d3 << "," << endstr;
  261. mOutput << startstr << m.a4 << ", " << m.b4 << ", " << m.c4 << ", " << m.d4 << ";;" << endstr;
  262. PopTag();
  263. mOutput << startstr << "}" << endstr << endstr;
  264. }
  265. // ------------------------------------------------------------------------------------------------
  266. // Recursively writes the given node
  267. void XFileExporter::WriteNode( aiNode* pNode)
  268. {
  269. if (pNode->mName.length==0)
  270. {
  271. std::stringstream ss;
  272. ss << "Node_" << pNode;
  273. pNode->mName.Set(ss.str());
  274. }
  275. mOutput << startstr << "Frame " << toXFileString(pNode->mName) << " {" << endstr;
  276. PushTag();
  277. aiMatrix4x4 m = pNode->mTransformation;
  278. WriteFrameTransform(m);
  279. for (size_t i = 0; i < pNode->mNumMeshes; i++)
  280. WriteMesh(mScene->mMeshes[pNode->mMeshes[i]]);
  281. // recursive call the Nodes
  282. for (size_t a = 0; a < pNode->mNumChildren; a++)
  283. WriteNode( mScene->mRootNode->mChildren[a]);
  284. PopTag();
  285. mOutput << startstr << "}" << endstr << endstr;
  286. }
  287. void XFileExporter::WriteMesh(aiMesh* mesh)
  288. {
  289. mOutput << startstr << "Mesh " << toXFileString(mesh->mName) << "_mShape" << " {" << endstr;
  290. PushTag();
  291. // write all the vertices
  292. mOutput << startstr << mesh->mNumVertices << ";" << endstr;
  293. for (size_t a = 0; a < mesh->mNumVertices; a++)
  294. {
  295. aiVector3D &v = mesh->mVertices[a];
  296. mOutput << startstr << v[0] << ";"<< v[1] << ";" << v[2] << ";";
  297. if (a < mesh->mNumVertices - 1)
  298. mOutput << "," << endstr;
  299. else
  300. mOutput << ";" << endstr;
  301. }
  302. // write all the faces
  303. mOutput << startstr << mesh->mNumFaces << ";" << endstr;
  304. for( size_t a = 0; a < mesh->mNumFaces; ++a )
  305. {
  306. const aiFace& face = mesh->mFaces[a];
  307. mOutput << startstr << face.mNumIndices << ";";
  308. // must be counter clockwise triangle
  309. //for(int b = face.mNumIndices - 1; b >= 0 ; --b)
  310. for(size_t b = 0; b < face.mNumIndices ; ++b)
  311. {
  312. mOutput << face.mIndices[b];
  313. //if (b > 0)
  314. if (b<face.mNumIndices-1)
  315. mOutput << ",";
  316. else
  317. mOutput << ";";
  318. }
  319. if (a < mesh->mNumFaces - 1)
  320. mOutput << "," << endstr;
  321. else
  322. mOutput << ";" << endstr;
  323. }
  324. mOutput << endstr;
  325. if (mesh->HasTextureCoords(0))
  326. {
  327. const aiMaterial* mat = mScene->mMaterials[mesh->mMaterialIndex];
  328. aiString relpath;
  329. mat->Get(_AI_MATKEY_TEXTURE_BASE, aiTextureType_DIFFUSE, 0, relpath);
  330. mOutput << startstr << "MeshMaterialList {" << endstr;
  331. PushTag();
  332. mOutput << startstr << "1;" << endstr; // number of materials
  333. mOutput << startstr << mesh->mNumFaces << ";" << endstr; // number of faces
  334. mOutput << startstr;
  335. for( size_t a = 0; a < mesh->mNumFaces; ++a )
  336. {
  337. mOutput << "0"; // the material index
  338. if (a < mesh->mNumFaces - 1)
  339. mOutput << ", ";
  340. else
  341. mOutput << ";" << endstr;
  342. }
  343. mOutput << startstr << "Material {" << endstr;
  344. PushTag();
  345. mOutput << startstr << "1.0; 1.0; 1.0; 1.000000;;" << endstr;
  346. mOutput << startstr << "1.000000;" << endstr; // power
  347. mOutput << startstr << "0.000000; 0.000000; 0.000000;;" << endstr; // specularity
  348. mOutput << startstr << "0.000000; 0.000000; 0.000000;;" << endstr; // emission
  349. mOutput << startstr << "TextureFilename { \"";
  350. writePath(relpath);
  351. mOutput << "\"; }" << endstr;
  352. PopTag();
  353. mOutput << startstr << "}" << endstr;
  354. PopTag();
  355. mOutput << startstr << "}" << endstr;
  356. }
  357. // write normals (every vertex has one)
  358. if (mesh->HasNormals())
  359. {
  360. mOutput << endstr << startstr << "MeshNormals {" << endstr;
  361. mOutput << startstr << mesh->mNumVertices << ";" << endstr;
  362. for (size_t a = 0; a < mesh->mNumVertices; a++)
  363. {
  364. aiVector3D &v = mesh->mNormals[a];
  365. // because we have a LHS and also changed wth winding, we need to invert the normals again
  366. mOutput << startstr << -v[0] << ";"<< -v[1] << ";" << -v[2] << ";";
  367. if (a < mesh->mNumVertices - 1)
  368. mOutput << "," << endstr;
  369. else
  370. mOutput << ";" << endstr;
  371. }
  372. mOutput << startstr << mesh->mNumFaces << ";" << endstr;
  373. for (size_t a = 0; a < mesh->mNumFaces; a++)
  374. {
  375. const aiFace& face = mesh->mFaces[a];
  376. mOutput << startstr << face.mNumIndices << ";";
  377. //for(int b = face.mNumIndices-1; b >= 0 ; --b)
  378. for(size_t b = 0; b < face.mNumIndices ; ++b)
  379. {
  380. mOutput << face.mIndices[b];
  381. //if (b > 0)
  382. if (b<face.mNumIndices-1)
  383. mOutput << ",";
  384. else
  385. mOutput << ";";
  386. }
  387. if (a < mesh->mNumFaces-1)
  388. mOutput << "," << endstr;
  389. else
  390. mOutput << ";" << endstr;
  391. }
  392. mOutput << startstr << "}" << endstr;
  393. }
  394. // write texture UVs if available
  395. if (mesh->HasTextureCoords(0))
  396. {
  397. mOutput << endstr << startstr << "MeshTextureCoords {" << endstr;
  398. mOutput << startstr << mesh->mNumVertices << ";" << endstr;
  399. for (size_t a = 0; a < mesh->mNumVertices; a++)
  400. //for (int a = (int)mesh->mNumVertices-1; a >=0 ; a--)
  401. {
  402. aiVector3D& uv = mesh->mTextureCoords[0][a]; // uv of first uv layer for the vertex
  403. mOutput << startstr << uv.x << ";" << uv.y;
  404. if (a < mesh->mNumVertices-1)
  405. //if (a >0 )
  406. mOutput << ";," << endstr;
  407. else
  408. mOutput << ";;" << endstr;
  409. }
  410. mOutput << startstr << "}" << endstr;
  411. }
  412. // write color channel if available
  413. if (mesh->HasVertexColors(0))
  414. {
  415. mOutput << endstr << startstr << "MeshVertexColors {" << endstr;
  416. mOutput << startstr << mesh->mNumVertices << ";" << endstr;
  417. for (size_t a = 0; a < mesh->mNumVertices; a++)
  418. {
  419. aiColor4D& mColors = mesh->mColors[0][a]; // color of first vertex color set for the vertex
  420. mOutput << startstr << a << ";" << mColors.r << ";" << mColors.g << ";" << mColors.b << ";" << mColors.a << ";;";
  421. if (a < mesh->mNumVertices-1)
  422. mOutput << "," << endstr;
  423. else
  424. mOutput << ";" << endstr;
  425. }
  426. mOutput << startstr << "}" << endstr;
  427. }
  428. /*
  429. else
  430. {
  431. mOutput << endstr << startstr << "MeshVertexColors {" << endstr;
  432. mOutput << startstr << mesh->mNumVertices << ";" << endstr;
  433. for (size_t a = 0; a < mesh->mNumVertices; a++)
  434. {
  435. aiColor4D* mColors = mesh->mColors[a];
  436. mOutput << startstr << a << ";0.500000;0.000000;0.000000;0.500000;;";
  437. if (a < mesh->mNumVertices-1)
  438. mOutput << "," << endstr;
  439. else
  440. mOutput << ";" << endstr;
  441. }
  442. mOutput << startstr << "}" << endstr;
  443. }
  444. */
  445. PopTag();
  446. mOutput << startstr << "}" << endstr << endstr;
  447. }
  448. std::string XFileExporter::toXFileString(aiString &name)
  449. {
  450. std::string str = std::string(name.C_Str());
  451. std::replace(str.begin(), str.end(), '<', '_');
  452. std::replace(str.begin(), str.end(), '>', '_');
  453. std::replace(str.begin(), str.end(), '{', '_');
  454. std::replace(str.begin(), str.end(), '}', '_');
  455. std::replace(str.begin(), str.end(), '$', '_');
  456. return str;
  457. }
  458. void XFileExporter::writePath(aiString path)
  459. {
  460. std::string str = std::string(path.C_Str());
  461. BaseImporter::ConvertUTF8toISO8859_1(str);
  462. while( str.find( "\\\\") != std::string::npos)
  463. str.replace( str.find( "\\\\"), 2, "\\");
  464. while( str.find( "\\") != std::string::npos)
  465. str.replace( str.find( "\\"), 1, "/");
  466. mOutput << str;
  467. }
  468. #endif
  469. #endif