From eb5e829436a0497e84325609040d65aabfe30be6 Mon Sep 17 00:00:00 2001 From: kkulling Date: Thu, 11 Jul 2019 17:43:03 +0200 Subject: [PATCH] Assjson: add json export to list of exporters. --- code/Assjson/json_exporter.cpp | 8 +++++++- code/Common/Exporter.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/Assjson/json_exporter.cpp b/code/Assjson/json_exporter.cpp index 2696e779d..848a08b4d 100644 --- a/code/Assjson/json_exporter.cpp +++ b/code/Assjson/json_exporter.cpp @@ -6,6 +6,9 @@ Licensed under a 3-clause BSD license. See the LICENSE file for more information */ +#ifndef ASSIMP_BUILD_NO_EXPORT +#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER + #include #include #include @@ -821,7 +824,7 @@ void Write(JSONWriter& out, const aiScene& ai) } -void Assimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) +void ExportAssimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, const Assimp::ExportProperties*) { std::unique_ptr str(io->Open(file,"wt")); if(!str) { @@ -851,3 +854,6 @@ void Assimp2Json(const char* file, Assimp::IOSystem* io, const aiScene* scene, c } } // + +#endif // ASSIMP_BUILD_NO_ASSJSON_EXPORTER +#endif // ASSIMP_BUILD_NO_EXPORT diff --git a/code/Common/Exporter.cpp b/code/Common/Exporter.cpp index b1caa4f96..58cad3be8 100644 --- a/code/Common/Exporter.cpp +++ b/code/Common/Exporter.cpp @@ -102,6 +102,7 @@ void ExportSceneX3D(const char*, IOSystem*, const aiScene*, const ExportProperti void ExportSceneFBX(const char*, IOSystem*, const aiScene*, const ExportProperties*); void ExportSceneFBXA(const char*, IOSystem*, const aiScene*, const ExportProperties*); void ExportScene3MF( const char*, IOSystem*, const aiScene*, const ExportProperties* ); +void ExportAssimp2Json(const char* , IOSystem*, const aiScene* , const Assimp::ExportProperties*); // ------------------------------------------------------------------------------------------------ // global array of all export formats which Assimp supports in its current build @@ -179,7 +180,11 @@ Exporter::ExportFormatEntry gExporters[] = #endif #ifndef ASSIMP_BUILD_NO_3MF_EXPORTER - Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ) + Exporter::ExportFormatEntry( "3mf", "The 3MF-File-Format", "3mf", &ExportScene3MF, 0 ), +#endif + +#ifndef ASSIMP_BUILD_NO_ASSJSON_EXPORTER + Exporter::ExportFormatEntry("json", "Plain JSON representation of the Assimp scene data structure", "json", &ExportAssimp2Json, 0) #endif };