Exporter.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2016, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file Exporter.cpp
  35. Assimp export interface. While it's public interface bears many similarities
  36. to the import interface (in fact, it is largely symmetric), the internal
  37. implementations differs a lot. Exporters are considered stateless and are
  38. simple callbacks which we maintain in a global list along with their
  39. description strings.
  40. Here we implement only the C++ interface (Assimp::Exporter).
  41. */
  42. #ifndef ASSIMP_BUILD_NO_EXPORT
  43. #include "DefaultIOSystem.h"
  44. #include "BlobIOSystem.h"
  45. #include "SceneCombiner.h"
  46. #include "BaseProcess.h"
  47. #include "Importer.h" // need this for GetPostProcessingStepInstanceList()
  48. #include "JoinVerticesProcess.h"
  49. #include "MakeVerboseFormat.h"
  50. #include "ConvertToLHProcess.h"
  51. #include "Exceptional.h"
  52. #include "ScenePrivate.h"
  53. #include <boost/shared_ptr.hpp>
  54. #include "../include/assimp/Exporter.hpp"
  55. #include "../include/assimp/mesh.h"
  56. #include "../include/assimp/postprocess.h"
  57. #include "../include/assimp/scene.h"
  58. #include <memory>
  59. namespace Assimp {
  60. // PostStepRegistry.cpp
  61. void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out);
  62. // ------------------------------------------------------------------------------------------------
  63. // Exporter worker function prototypes. Should not be necessary to #ifndef them, it's just a prototype
  64. // do not use const, because some exporter need to convert the scene temporary
  65. void ExportSceneCollada(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  66. void ExportSceneXFile(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  67. void ExportSceneStep(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  68. void ExportSceneObj(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  69. void ExportSceneSTL(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  70. void ExportSceneSTLBinary(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  71. void ExportScenePly(const char*,IOSystem*, const aiScene*, const ExportProperties*);
  72. void ExportScenePlyBinary(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  73. void ExportScene3DS(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  74. void ExportSceneGLTF(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  75. void ExportSceneGLB(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  76. void ExportSceneAssbin(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  77. void ExportSceneAssxml(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  78. // ------------------------------------------------------------------------------------------------
  79. // global array of all export formats which Assimp supports in its current build
  80. Exporter::ExportFormatEntry gExporters[] =
  81. {
  82. #ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
  83. Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada),
  84. #endif
  85. #ifndef ASSIMP_BUILD_NO_XFILE_EXPORTER
  86. Exporter::ExportFormatEntry( "x", "X Files", "x", &ExportSceneXFile,
  87. aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs),
  88. #endif
  89. #ifndef ASSIMP_BUILD_NO_STEP_EXPORTER
  90. Exporter::ExportFormatEntry( "stp", "Step Files", "stp", &ExportSceneStep, 0),
  91. #endif
  92. #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
  93. Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
  94. aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */),
  95. #endif
  96. #ifndef ASSIMP_BUILD_NO_STL_EXPORTER
  97. Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL,
  98. aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
  99. ),
  100. Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary,
  101. aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
  102. ),
  103. #endif
  104. #ifndef ASSIMP_BUILD_NO_PLY_EXPORTER
  105. Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly,
  106. aiProcess_PreTransformVertices
  107. ),
  108. Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
  109. aiProcess_PreTransformVertices
  110. ),
  111. #endif
  112. #ifndef ASSIMP_BUILD_NO_3DS_EXPORTER
  113. Exporter::ExportFormatEntry( "3ds", "Autodesk 3DS (legacy)", "3ds" , &ExportScene3DS,
  114. aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices),
  115. #endif
  116. #ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
  117. Exporter::ExportFormatEntry( "gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
  118. aiProcess_JoinIdenticalVertices /*| aiProcess_SortByPType*/),
  119. Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
  120. aiProcess_JoinIdenticalVertices /*| aiProcess_SortByPType*/),
  121. #endif
  122. #ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
  123. Exporter::ExportFormatEntry( "assbin", "Assimp Binary", "assbin" , &ExportSceneAssbin, 0),
  124. #endif
  125. #ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER
  126. Exporter::ExportFormatEntry( "assxml", "Assxml Document", "assxml" , &ExportSceneAssxml, 0),
  127. #endif
  128. };
  129. #define ASSIMP_NUM_EXPORTERS (sizeof(gExporters)/sizeof(gExporters[0]))
  130. class ExporterPimpl {
  131. public:
  132. ExporterPimpl()
  133. : blob()
  134. , mIOSystem(new Assimp::DefaultIOSystem())
  135. , mIsDefaultIOHandler(true)
  136. {
  137. GetPostProcessingStepInstanceList(mPostProcessingSteps);
  138. // grab all builtin exporters
  139. mExporters.resize(ASSIMP_NUM_EXPORTERS);
  140. std::copy(gExporters,gExporters+ASSIMP_NUM_EXPORTERS,mExporters.begin());
  141. }
  142. ~ExporterPimpl()
  143. {
  144. delete blob;
  145. // Delete all post-processing plug-ins
  146. for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++) {
  147. delete mPostProcessingSteps[a];
  148. }
  149. }
  150. public:
  151. aiExportDataBlob* blob;
  152. boost::shared_ptr< Assimp::IOSystem > mIOSystem;
  153. bool mIsDefaultIOHandler;
  154. /** Post processing steps we can apply at the imported data. */
  155. std::vector< BaseProcess* > mPostProcessingSteps;
  156. /** Last fatal export error */
  157. std::string mError;
  158. /** Exporters, this includes those registered using #Assimp::Exporter::RegisterExporter */
  159. std::vector<Exporter::ExportFormatEntry> mExporters;
  160. };
  161. } // end of namespace Assimp
  162. using namespace Assimp;
  163. // ------------------------------------------------------------------------------------------------
  164. Exporter :: Exporter()
  165. : pimpl(new ExporterPimpl())
  166. {
  167. }
  168. // ------------------------------------------------------------------------------------------------
  169. Exporter :: ~Exporter()
  170. {
  171. FreeBlob();
  172. delete pimpl;
  173. }
  174. // ------------------------------------------------------------------------------------------------
  175. void Exporter :: SetIOHandler( IOSystem* pIOHandler)
  176. {
  177. pimpl->mIsDefaultIOHandler = !pIOHandler;
  178. pimpl->mIOSystem.reset(pIOHandler);
  179. }
  180. // ------------------------------------------------------------------------------------------------
  181. IOSystem* Exporter :: GetIOHandler() const
  182. {
  183. return pimpl->mIOSystem.get();
  184. }
  185. // ------------------------------------------------------------------------------------------------
  186. bool Exporter :: IsDefaultIOHandler() const
  187. {
  188. return pimpl->mIsDefaultIOHandler;
  189. }
  190. // ------------------------------------------------------------------------------------------------
  191. const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int, const ExportProperties* pProperties)
  192. {
  193. if (pimpl->blob) {
  194. delete pimpl->blob;
  195. pimpl->blob = NULL;
  196. }
  197. boost::shared_ptr<IOSystem> old = pimpl->mIOSystem;
  198. BlobIOSystem* blobio = new BlobIOSystem();
  199. pimpl->mIOSystem = boost::shared_ptr<IOSystem>( blobio );
  200. if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName())) {
  201. pimpl->mIOSystem = old;
  202. return NULL;
  203. }
  204. pimpl->blob = blobio->GetBlobChain();
  205. pimpl->mIOSystem = old;
  206. return pimpl->blob;
  207. }
  208. // ------------------------------------------------------------------------------------------------
  209. bool IsVerboseFormat(const aiMesh* mesh)
  210. {
  211. // avoid slow vector<bool> specialization
  212. std::vector<unsigned int> seen(mesh->mNumVertices,0);
  213. for(unsigned int i = 0; i < mesh->mNumFaces; ++i) {
  214. const aiFace& f = mesh->mFaces[i];
  215. for(unsigned int j = 0; j < f.mNumIndices; ++j) {
  216. if(++seen[f.mIndices[j]] == 2) {
  217. // found a duplicate index
  218. return false;
  219. }
  220. }
  221. }
  222. return true;
  223. }
  224. // ------------------------------------------------------------------------------------------------
  225. bool IsVerboseFormat(const aiScene* pScene)
  226. {
  227. for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
  228. if(!IsVerboseFormat(pScene->mMeshes[i])) {
  229. return false;
  230. }
  231. }
  232. return true;
  233. }
  234. // ------------------------------------------------------------------------------------------------
  235. aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing, const ExportProperties* pProperties)
  236. {
  237. ASSIMP_BEGIN_EXCEPTION_REGION();
  238. // when they create scenes from scratch, users will likely create them not in verbose
  239. // format. They will likely not be aware that there is a flag in the scene to indicate
  240. // this, however. To avoid surprises and bug reports, we check for duplicates in
  241. // meshes upfront.
  242. const bool is_verbose_format = !(pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) || IsVerboseFormat(pScene);
  243. pimpl->mError = "";
  244. for (size_t i = 0; i < pimpl->mExporters.size(); ++i) {
  245. const Exporter::ExportFormatEntry& exp = pimpl->mExporters[i];
  246. if (!strcmp(exp.mDescription.id,pFormatId)) {
  247. try {
  248. // Always create a full copy of the scene. We might optimize this one day,
  249. // but for now it is the most pragmatic way.
  250. aiScene* scenecopy_tmp;
  251. SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
  252. std::auto_ptr<aiScene> scenecopy(scenecopy_tmp);
  253. const ScenePrivateData* const priv = ScenePriv(pScene);
  254. // steps that are not idempotent, i.e. we might need to run them again, usually to get back to the
  255. // original state before the step was applied first. When checking which steps we don't need
  256. // to run, those are excluded.
  257. const unsigned int nonIdempotentSteps = aiProcess_FlipWindingOrder | aiProcess_FlipUVs | aiProcess_MakeLeftHanded;
  258. // Erase all pp steps that were already applied to this scene
  259. const unsigned int pp = (exp.mEnforcePP | pPreprocessing) & ~(priv && !priv->mIsCopy
  260. ? (priv->mPPStepsApplied & ~nonIdempotentSteps)
  261. : 0u);
  262. // If no extra postprocessing was specified, and we obtained this scene from an
  263. // Assimp importer, apply the reverse steps automatically.
  264. // TODO: either drop this, or document it. Otherwise it is just a bad surprise.
  265. //if (!pPreprocessing && priv) {
  266. // pp |= (nonIdempotentSteps & priv->mPPStepsApplied);
  267. //}
  268. // If the input scene is not in verbose format, but there is at least postprocessing step that relies on it,
  269. // we need to run the MakeVerboseFormat step first.
  270. bool must_join_again = false;
  271. if (!is_verbose_format) {
  272. bool verbosify = false;
  273. for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
  274. BaseProcess* const p = pimpl->mPostProcessingSteps[a];
  275. if (p->IsActive(pp) && p->RequireVerboseFormat()) {
  276. verbosify = true;
  277. break;
  278. }
  279. }
  280. if (verbosify || (exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) {
  281. DefaultLogger::get()->debug("export: Scene data not in verbose format, applying MakeVerboseFormat step first");
  282. MakeVerboseFormatProcess proc;
  283. proc.Execute(scenecopy.get());
  284. if(!(exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) {
  285. must_join_again = true;
  286. }
  287. }
  288. }
  289. if (pp) {
  290. // the three 'conversion' steps need to be executed first because all other steps rely on the standard data layout
  291. {
  292. FlipWindingOrderProcess step;
  293. if (step.IsActive(pp)) {
  294. step.Execute(scenecopy.get());
  295. }
  296. }
  297. {
  298. FlipUVsProcess step;
  299. if (step.IsActive(pp)) {
  300. step.Execute(scenecopy.get());
  301. }
  302. }
  303. {
  304. MakeLeftHandedProcess step;
  305. if (step.IsActive(pp)) {
  306. step.Execute(scenecopy.get());
  307. }
  308. }
  309. // dispatch other processes
  310. for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
  311. BaseProcess* const p = pimpl->mPostProcessingSteps[a];
  312. if (p->IsActive(pp)
  313. && !dynamic_cast<FlipUVsProcess*>(p)
  314. && !dynamic_cast<FlipWindingOrderProcess*>(p)
  315. && !dynamic_cast<MakeLeftHandedProcess*>(p)) {
  316. p->Execute(scenecopy.get());
  317. }
  318. }
  319. ScenePrivateData* const privOut = ScenePriv(scenecopy.get());
  320. ai_assert(privOut);
  321. privOut->mPPStepsApplied |= pp;
  322. }
  323. if(must_join_again) {
  324. JoinVerticesProcess proc;
  325. proc.Execute(scenecopy.get());
  326. }
  327. ExportProperties emptyProperties; // Never pass NULL ExportProperties so Exporters don't have to worry.
  328. exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get(), pProperties ? pProperties : &emptyProperties);
  329. }
  330. catch (DeadlyExportError& err) {
  331. pimpl->mError = err.what();
  332. return AI_FAILURE;
  333. }
  334. return AI_SUCCESS;
  335. }
  336. }
  337. pimpl->mError = std::string("Found no exporter to handle this file format: ") + pFormatId;
  338. ASSIMP_END_EXCEPTION_REGION(aiReturn);
  339. return AI_FAILURE;
  340. }
  341. // ------------------------------------------------------------------------------------------------
  342. const char* Exporter :: GetErrorString() const
  343. {
  344. return pimpl->mError.c_str();
  345. }
  346. // ------------------------------------------------------------------------------------------------
  347. void Exporter :: FreeBlob( )
  348. {
  349. delete pimpl->blob;
  350. pimpl->blob = NULL;
  351. pimpl->mError = "";
  352. }
  353. // ------------------------------------------------------------------------------------------------
  354. const aiExportDataBlob* Exporter :: GetBlob() const
  355. {
  356. return pimpl->blob;
  357. }
  358. // ------------------------------------------------------------------------------------------------
  359. const aiExportDataBlob* Exporter :: GetOrphanedBlob() const
  360. {
  361. const aiExportDataBlob* tmp = pimpl->blob;
  362. pimpl->blob = NULL;
  363. return tmp;
  364. }
  365. // ------------------------------------------------------------------------------------------------
  366. size_t Exporter :: GetExportFormatCount() const
  367. {
  368. return pimpl->mExporters.size();
  369. }
  370. // ------------------------------------------------------------------------------------------------
  371. const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex ) const
  372. {
  373. if (pIndex >= GetExportFormatCount()) {
  374. return NULL;
  375. }
  376. // Return from static storage if the requested index is built-in.
  377. if (pIndex < sizeof(gExporters) / sizeof(gExporters[0])) {
  378. return &gExporters[pIndex].mDescription;
  379. }
  380. return &pimpl->mExporters[pIndex].mDescription;
  381. }
  382. // ------------------------------------------------------------------------------------------------
  383. aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
  384. {
  385. BOOST_FOREACH(const ExportFormatEntry& e, pimpl->mExporters) {
  386. if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
  387. return aiReturn_FAILURE;
  388. }
  389. }
  390. pimpl->mExporters.push_back(desc);
  391. return aiReturn_SUCCESS;
  392. }
  393. // ------------------------------------------------------------------------------------------------
  394. void Exporter :: UnregisterExporter(const char* id)
  395. {
  396. for(std::vector<ExportFormatEntry>::iterator it = pimpl->mExporters.begin(); it != pimpl->mExporters.end(); ++it) {
  397. if (!strcmp((*it).mDescription.id,id)) {
  398. pimpl->mExporters.erase(it);
  399. break;
  400. }
  401. }
  402. }
  403. ExportProperties :: ExportProperties() {}
  404. ExportProperties::ExportProperties(const ExportProperties &other)
  405. : mIntProperties(other.mIntProperties),
  406. mFloatProperties(other.mFloatProperties),
  407. mStringProperties(other.mStringProperties),
  408. mMatrixProperties(other.mMatrixProperties)
  409. {
  410. }
  411. // ------------------------------------------------------------------------------------------------
  412. // Set a configuration property
  413. bool ExportProperties :: SetPropertyInteger(const char* szName, int iValue)
  414. {
  415. return SetGenericProperty<int>(mIntProperties, szName,iValue);
  416. }
  417. // ------------------------------------------------------------------------------------------------
  418. // Set a configuration property
  419. bool ExportProperties :: SetPropertyFloat(const char* szName, float iValue)
  420. {
  421. return SetGenericProperty<float>(mFloatProperties, szName,iValue);
  422. }
  423. // ------------------------------------------------------------------------------------------------
  424. // Set a configuration property
  425. bool ExportProperties :: SetPropertyString(const char* szName, const std::string& value)
  426. {
  427. return SetGenericProperty<std::string>(mStringProperties, szName,value);
  428. }
  429. // ------------------------------------------------------------------------------------------------
  430. // Set a configuration property
  431. bool ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
  432. {
  433. return SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value);
  434. }
  435. // ------------------------------------------------------------------------------------------------
  436. // Get a configuration property
  437. int ExportProperties :: GetPropertyInteger(const char* szName,
  438. int iErrorReturn /*= 0xffffffff*/) const
  439. {
  440. return GetGenericProperty<int>(mIntProperties,szName,iErrorReturn);
  441. }
  442. // ------------------------------------------------------------------------------------------------
  443. // Get a configuration property
  444. float ExportProperties :: GetPropertyFloat(const char* szName,
  445. float iErrorReturn /*= 10e10*/) const
  446. {
  447. return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn);
  448. }
  449. // ------------------------------------------------------------------------------------------------
  450. // Get a configuration property
  451. const std::string ExportProperties :: GetPropertyString(const char* szName,
  452. const std::string& iErrorReturn /*= ""*/) const
  453. {
  454. return GetGenericProperty<std::string>(mStringProperties,szName,iErrorReturn);
  455. }
  456. // ------------------------------------------------------------------------------------------------
  457. // Has a configuration property
  458. const aiMatrix4x4 ExportProperties :: GetPropertyMatrix(const char* szName,
  459. const aiMatrix4x4& iErrorReturn /*= aiMatrix4x4()*/) const
  460. {
  461. return GetGenericProperty<aiMatrix4x4>(mMatrixProperties,szName,iErrorReturn);
  462. }
  463. // ------------------------------------------------------------------------------------------------
  464. // Has a configuration property
  465. bool ExportProperties :: HasPropertyInteger(const char* szName) const
  466. {
  467. return HasGenericProperty<int>(mIntProperties, szName);
  468. }
  469. // ------------------------------------------------------------------------------------------------
  470. // Has a configuration property
  471. bool ExportProperties :: HasPropertyBool(const char* szName) const
  472. {
  473. return HasGenericProperty<int>(mIntProperties, szName);
  474. };
  475. // ------------------------------------------------------------------------------------------------
  476. // Has a configuration property
  477. bool ExportProperties :: HasPropertyFloat(const char* szName) const
  478. {
  479. return HasGenericProperty<float>(mFloatProperties, szName);
  480. };
  481. // ------------------------------------------------------------------------------------------------
  482. // Has a configuration property
  483. bool ExportProperties :: HasPropertyString(const char* szName) const
  484. {
  485. return HasGenericProperty<std::string>(mStringProperties, szName);
  486. };
  487. // ------------------------------------------------------------------------------------------------
  488. // Has a configuration property
  489. bool ExportProperties :: HasPropertyMatrix(const char* szName) const
  490. {
  491. return HasGenericProperty<aiMatrix4x4>(mMatrixProperties, szName);
  492. };
  493. #endif // !ASSIMP_BUILD_NO_EXPORT