Exporter.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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 <memory>
  54. #include <assimp/Exporter.hpp>
  55. #include <assimp/mesh.h>
  56. #include <assimp/postprocess.h>
  57. #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. void ExportSceneX3D(const char*, IOSystem*, const aiScene*, const ExportProperties*);
  79. // ------------------------------------------------------------------------------------------------
  80. // global array of all export formats which Assimp supports in its current build
  81. Exporter::ExportFormatEntry gExporters[] =
  82. {
  83. #ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
  84. Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada),
  85. #endif
  86. #ifndef ASSIMP_BUILD_NO_X_EXPORTER
  87. Exporter::ExportFormatEntry( "x", "X Files", "x", &ExportSceneXFile,
  88. aiProcess_MakeLeftHanded | aiProcess_FlipWindingOrder | aiProcess_FlipUVs),
  89. #endif
  90. #ifndef ASSIMP_BUILD_NO_STEP_EXPORTER
  91. Exporter::ExportFormatEntry( "stp", "Step Files", "stp", &ExportSceneStep, 0),
  92. #endif
  93. #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
  94. Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
  95. aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */),
  96. #endif
  97. #ifndef ASSIMP_BUILD_NO_STL_EXPORTER
  98. Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL,
  99. aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
  100. ),
  101. Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary,
  102. aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
  103. ),
  104. #endif
  105. #ifndef ASSIMP_BUILD_NO_PLY_EXPORTER
  106. Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly,
  107. aiProcess_PreTransformVertices
  108. ),
  109. Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
  110. aiProcess_PreTransformVertices
  111. ),
  112. #endif
  113. #ifndef ASSIMP_BUILD_NO_3DS_EXPORTER
  114. Exporter::ExportFormatEntry( "3ds", "Autodesk 3DS (legacy)", "3ds" , &ExportScene3DS,
  115. aiProcess_Triangulate | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices),
  116. #endif
  117. #ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
  118. Exporter::ExportFormatEntry( "gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
  119. aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
  120. Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
  121. aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
  122. #endif
  123. #ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
  124. Exporter::ExportFormatEntry( "assbin", "Assimp Binary", "assbin" , &ExportSceneAssbin, 0),
  125. #endif
  126. #ifndef ASSIMP_BUILD_NO_ASSXML_EXPORTER
  127. Exporter::ExportFormatEntry( "assxml", "Assxml Document", "assxml" , &ExportSceneAssxml, 0),
  128. #endif
  129. #ifndef ASSIMP_BUILD_NO_X3D_EXPORTER
  130. Exporter::ExportFormatEntry( "x3d", "Extensible 3D", "x3d" , &ExportSceneX3D, 0),
  131. #endif
  132. };
  133. #define ASSIMP_NUM_EXPORTERS (sizeof(gExporters)/sizeof(gExporters[0]))
  134. class ExporterPimpl {
  135. public:
  136. ExporterPimpl()
  137. : blob()
  138. , mIOSystem(new Assimp::DefaultIOSystem())
  139. , mIsDefaultIOHandler(true)
  140. {
  141. GetPostProcessingStepInstanceList(mPostProcessingSteps);
  142. // grab all built-in exporters
  143. mExporters.resize(ASSIMP_NUM_EXPORTERS);
  144. std::copy(gExporters,gExporters+ASSIMP_NUM_EXPORTERS,mExporters.begin());
  145. }
  146. ~ExporterPimpl()
  147. {
  148. delete blob;
  149. // Delete all post-processing plug-ins
  150. for( unsigned int a = 0; a < mPostProcessingSteps.size(); a++) {
  151. delete mPostProcessingSteps[a];
  152. }
  153. }
  154. public:
  155. aiExportDataBlob* blob;
  156. std::shared_ptr< Assimp::IOSystem > mIOSystem;
  157. bool mIsDefaultIOHandler;
  158. /** Post processing steps we can apply at the imported data. */
  159. std::vector< BaseProcess* > mPostProcessingSteps;
  160. /** Last fatal export error */
  161. std::string mError;
  162. /** Exporters, this includes those registered using #Assimp::Exporter::RegisterExporter */
  163. std::vector<Exporter::ExportFormatEntry> mExporters;
  164. };
  165. } // end of namespace Assimp
  166. using namespace Assimp;
  167. // ------------------------------------------------------------------------------------------------
  168. Exporter :: Exporter()
  169. : pimpl(new ExporterPimpl())
  170. {
  171. }
  172. // ------------------------------------------------------------------------------------------------
  173. Exporter :: ~Exporter()
  174. {
  175. FreeBlob();
  176. delete pimpl;
  177. }
  178. // ------------------------------------------------------------------------------------------------
  179. void Exporter :: SetIOHandler( IOSystem* pIOHandler)
  180. {
  181. pimpl->mIsDefaultIOHandler = !pIOHandler;
  182. pimpl->mIOSystem.reset(pIOHandler);
  183. }
  184. // ------------------------------------------------------------------------------------------------
  185. IOSystem* Exporter :: GetIOHandler() const
  186. {
  187. return pimpl->mIOSystem.get();
  188. }
  189. // ------------------------------------------------------------------------------------------------
  190. bool Exporter :: IsDefaultIOHandler() const
  191. {
  192. return pimpl->mIsDefaultIOHandler;
  193. }
  194. // ------------------------------------------------------------------------------------------------
  195. const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int, const ExportProperties* pProperties)
  196. {
  197. if (pimpl->blob) {
  198. delete pimpl->blob;
  199. pimpl->blob = NULL;
  200. }
  201. std::shared_ptr<IOSystem> old = pimpl->mIOSystem;
  202. BlobIOSystem* blobio = new BlobIOSystem();
  203. pimpl->mIOSystem = std::shared_ptr<IOSystem>( blobio );
  204. if (AI_SUCCESS != Export(pScene,pFormatId,blobio->GetMagicFileName())) {
  205. pimpl->mIOSystem = old;
  206. return NULL;
  207. }
  208. pimpl->blob = blobio->GetBlobChain();
  209. pimpl->mIOSystem = old;
  210. return pimpl->blob;
  211. }
  212. // ------------------------------------------------------------------------------------------------
  213. bool IsVerboseFormat(const aiMesh* mesh)
  214. {
  215. // avoid slow vector<bool> specialization
  216. std::vector<unsigned int> seen(mesh->mNumVertices,0);
  217. for(unsigned int i = 0; i < mesh->mNumFaces; ++i) {
  218. const aiFace& f = mesh->mFaces[i];
  219. for(unsigned int j = 0; j < f.mNumIndices; ++j) {
  220. if(++seen[f.mIndices[j]] == 2) {
  221. // found a duplicate index
  222. return false;
  223. }
  224. }
  225. }
  226. return true;
  227. }
  228. // ------------------------------------------------------------------------------------------------
  229. bool IsVerboseFormat(const aiScene* pScene)
  230. {
  231. for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
  232. if(!IsVerboseFormat(pScene->mMeshes[i])) {
  233. return false;
  234. }
  235. }
  236. return true;
  237. }
  238. // ------------------------------------------------------------------------------------------------
  239. aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing, const ExportProperties* pProperties)
  240. {
  241. ASSIMP_BEGIN_EXCEPTION_REGION();
  242. // when they create scenes from scratch, users will likely create them not in verbose
  243. // format. They will likely not be aware that there is a flag in the scene to indicate
  244. // this, however. To avoid surprises and bug reports, we check for duplicates in
  245. // meshes upfront.
  246. const bool is_verbose_format = !(pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) || IsVerboseFormat(pScene);
  247. pimpl->mError = "";
  248. for (size_t i = 0; i < pimpl->mExporters.size(); ++i) {
  249. const Exporter::ExportFormatEntry& exp = pimpl->mExporters[i];
  250. if (!strcmp(exp.mDescription.id,pFormatId)) {
  251. try {
  252. // Always create a full copy of the scene. We might optimize this one day,
  253. // but for now it is the most pragmatic way.
  254. aiScene* scenecopy_tmp = NULL;
  255. SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
  256. std::unique_ptr<aiScene> scenecopy(scenecopy_tmp);
  257. const ScenePrivateData* const priv = ScenePriv(pScene);
  258. // steps that are not idempotent, i.e. we might need to run them again, usually to get back to the
  259. // original state before the step was applied first. When checking which steps we don't need
  260. // to run, those are excluded.
  261. const unsigned int nonIdempotentSteps = aiProcess_FlipWindingOrder | aiProcess_FlipUVs | aiProcess_MakeLeftHanded;
  262. // Erase all pp steps that were already applied to this scene
  263. const unsigned int pp = (exp.mEnforcePP | pPreprocessing) & ~(priv && !priv->mIsCopy
  264. ? (priv->mPPStepsApplied & ~nonIdempotentSteps)
  265. : 0u);
  266. // If no extra postprocessing was specified, and we obtained this scene from an
  267. // Assimp importer, apply the reverse steps automatically.
  268. // TODO: either drop this, or document it. Otherwise it is just a bad surprise.
  269. //if (!pPreprocessing && priv) {
  270. // pp |= (nonIdempotentSteps & priv->mPPStepsApplied);
  271. //}
  272. // If the input scene is not in verbose format, but there is at least postprocessing step that relies on it,
  273. // we need to run the MakeVerboseFormat step first.
  274. bool must_join_again = false;
  275. if (!is_verbose_format) {
  276. bool verbosify = false;
  277. for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
  278. BaseProcess* const p = pimpl->mPostProcessingSteps[a];
  279. if (p->IsActive(pp) && p->RequireVerboseFormat()) {
  280. verbosify = true;
  281. break;
  282. }
  283. }
  284. if (verbosify || (exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) {
  285. DefaultLogger::get()->debug("export: Scene data not in verbose format, applying MakeVerboseFormat step first");
  286. MakeVerboseFormatProcess proc;
  287. proc.Execute(scenecopy.get());
  288. if(!(exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) {
  289. must_join_again = true;
  290. }
  291. }
  292. }
  293. if (pp) {
  294. // the three 'conversion' steps need to be executed first because all other steps rely on the standard data layout
  295. {
  296. FlipWindingOrderProcess step;
  297. if (step.IsActive(pp)) {
  298. step.Execute(scenecopy.get());
  299. }
  300. }
  301. {
  302. FlipUVsProcess step;
  303. if (step.IsActive(pp)) {
  304. step.Execute(scenecopy.get());
  305. }
  306. }
  307. {
  308. MakeLeftHandedProcess step;
  309. if (step.IsActive(pp)) {
  310. step.Execute(scenecopy.get());
  311. }
  312. }
  313. // dispatch other processes
  314. for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
  315. BaseProcess* const p = pimpl->mPostProcessingSteps[a];
  316. if (p->IsActive(pp)
  317. && !dynamic_cast<FlipUVsProcess*>(p)
  318. && !dynamic_cast<FlipWindingOrderProcess*>(p)
  319. && !dynamic_cast<MakeLeftHandedProcess*>(p)) {
  320. p->Execute(scenecopy.get());
  321. }
  322. }
  323. ScenePrivateData* const privOut = ScenePriv(scenecopy.get());
  324. ai_assert(privOut);
  325. privOut->mPPStepsApplied |= pp;
  326. }
  327. if(must_join_again) {
  328. JoinVerticesProcess proc;
  329. proc.Execute(scenecopy.get());
  330. }
  331. ExportProperties emptyProperties; // Never pass NULL ExportProperties so Exporters don't have to worry.
  332. exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get(), pProperties ? pProperties : &emptyProperties);
  333. }
  334. catch (DeadlyExportError& err) {
  335. pimpl->mError = err.what();
  336. return AI_FAILURE;
  337. }
  338. return AI_SUCCESS;
  339. }
  340. }
  341. pimpl->mError = std::string("Found no exporter to handle this file format: ") + pFormatId;
  342. ASSIMP_END_EXCEPTION_REGION(aiReturn);
  343. return AI_FAILURE;
  344. }
  345. // ------------------------------------------------------------------------------------------------
  346. const char* Exporter :: GetErrorString() const
  347. {
  348. return pimpl->mError.c_str();
  349. }
  350. // ------------------------------------------------------------------------------------------------
  351. void Exporter :: FreeBlob( )
  352. {
  353. delete pimpl->blob;
  354. pimpl->blob = NULL;
  355. pimpl->mError = "";
  356. }
  357. // ------------------------------------------------------------------------------------------------
  358. const aiExportDataBlob* Exporter :: GetBlob() const
  359. {
  360. return pimpl->blob;
  361. }
  362. // ------------------------------------------------------------------------------------------------
  363. const aiExportDataBlob* Exporter :: GetOrphanedBlob() const
  364. {
  365. const aiExportDataBlob* tmp = pimpl->blob;
  366. pimpl->blob = NULL;
  367. return tmp;
  368. }
  369. // ------------------------------------------------------------------------------------------------
  370. size_t Exporter :: GetExportFormatCount() const
  371. {
  372. return pimpl->mExporters.size();
  373. }
  374. // ------------------------------------------------------------------------------------------------
  375. const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex ) const
  376. {
  377. if (pIndex >= GetExportFormatCount()) {
  378. return NULL;
  379. }
  380. // Return from static storage if the requested index is built-in.
  381. if (pIndex < sizeof(gExporters) / sizeof(gExporters[0])) {
  382. return &gExporters[pIndex].mDescription;
  383. }
  384. return &pimpl->mExporters[pIndex].mDescription;
  385. }
  386. // ------------------------------------------------------------------------------------------------
  387. aiReturn Exporter :: RegisterExporter(const ExportFormatEntry& desc)
  388. {
  389. for(const ExportFormatEntry& e : pimpl->mExporters) {
  390. if (!strcmp(e.mDescription.id,desc.mDescription.id)) {
  391. return aiReturn_FAILURE;
  392. }
  393. }
  394. pimpl->mExporters.push_back(desc);
  395. return aiReturn_SUCCESS;
  396. }
  397. // ------------------------------------------------------------------------------------------------
  398. void Exporter :: UnregisterExporter(const char* id)
  399. {
  400. for(std::vector<ExportFormatEntry>::iterator it = pimpl->mExporters.begin(); it != pimpl->mExporters.end(); ++it) {
  401. if (!strcmp((*it).mDescription.id,id)) {
  402. pimpl->mExporters.erase(it);
  403. break;
  404. }
  405. }
  406. }
  407. ExportProperties :: ExportProperties() {}
  408. ExportProperties::ExportProperties(const ExportProperties &other)
  409. : mIntProperties(other.mIntProperties),
  410. mFloatProperties(other.mFloatProperties),
  411. mStringProperties(other.mStringProperties),
  412. mMatrixProperties(other.mMatrixProperties)
  413. {
  414. }
  415. // ------------------------------------------------------------------------------------------------
  416. // Set a configuration property
  417. bool ExportProperties :: SetPropertyInteger(const char* szName, int iValue)
  418. {
  419. return SetGenericProperty<int>(mIntProperties, szName,iValue);
  420. }
  421. // ------------------------------------------------------------------------------------------------
  422. // Set a configuration property
  423. bool ExportProperties :: SetPropertyFloat(const char* szName, ai_real iValue)
  424. {
  425. return SetGenericProperty<ai_real>(mFloatProperties, szName,iValue);
  426. }
  427. // ------------------------------------------------------------------------------------------------
  428. // Set a configuration property
  429. bool ExportProperties :: SetPropertyString(const char* szName, const std::string& value)
  430. {
  431. return SetGenericProperty<std::string>(mStringProperties, szName,value);
  432. }
  433. // ------------------------------------------------------------------------------------------------
  434. // Set a configuration property
  435. bool ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4& value)
  436. {
  437. return SetGenericProperty<aiMatrix4x4>(mMatrixProperties, szName,value);
  438. }
  439. // ------------------------------------------------------------------------------------------------
  440. // Get a configuration property
  441. int ExportProperties :: GetPropertyInteger(const char* szName,
  442. int iErrorReturn /*= 0xffffffff*/) const
  443. {
  444. return GetGenericProperty<int>(mIntProperties,szName,iErrorReturn);
  445. }
  446. // ------------------------------------------------------------------------------------------------
  447. // Get a configuration property
  448. ai_real ExportProperties :: GetPropertyFloat(const char* szName,
  449. ai_real iErrorReturn /*= 10e10*/) const
  450. {
  451. return GetGenericProperty<ai_real>(mFloatProperties,szName,iErrorReturn);
  452. }
  453. // ------------------------------------------------------------------------------------------------
  454. // Get a configuration property
  455. const std::string ExportProperties :: GetPropertyString(const char* szName,
  456. const std::string& iErrorReturn /*= ""*/) const
  457. {
  458. return GetGenericProperty<std::string>(mStringProperties,szName,iErrorReturn);
  459. }
  460. // ------------------------------------------------------------------------------------------------
  461. // Has a configuration property
  462. const aiMatrix4x4 ExportProperties :: GetPropertyMatrix(const char* szName,
  463. const aiMatrix4x4& iErrorReturn /*= aiMatrix4x4()*/) const
  464. {
  465. return GetGenericProperty<aiMatrix4x4>(mMatrixProperties,szName,iErrorReturn);
  466. }
  467. // ------------------------------------------------------------------------------------------------
  468. // Has a configuration property
  469. bool ExportProperties :: HasPropertyInteger(const char* szName) const
  470. {
  471. return HasGenericProperty<int>(mIntProperties, szName);
  472. }
  473. // ------------------------------------------------------------------------------------------------
  474. // Has a configuration property
  475. bool ExportProperties :: HasPropertyBool(const char* szName) const
  476. {
  477. return HasGenericProperty<int>(mIntProperties, szName);
  478. }
  479. // ------------------------------------------------------------------------------------------------
  480. // Has a configuration property
  481. bool ExportProperties :: HasPropertyFloat(const char* szName) const
  482. {
  483. return HasGenericProperty<ai_real>(mFloatProperties, szName);
  484. }
  485. // ------------------------------------------------------------------------------------------------
  486. // Has a configuration property
  487. bool ExportProperties :: HasPropertyString(const char* szName) const
  488. {
  489. return HasGenericProperty<std::string>(mStringProperties, szName);
  490. }
  491. // ------------------------------------------------------------------------------------------------
  492. // Has a configuration property
  493. bool ExportProperties :: HasPropertyMatrix(const char* szName) const
  494. {
  495. return HasGenericProperty<aiMatrix4x4>(mMatrixProperties, szName);
  496. }
  497. #endif // !ASSIMP_BUILD_NO_EXPORT