From 0e3d0585041b7ac61758bfc2bcee8a361b1b62a3 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 17 Oct 2021 15:10:25 +0200 Subject: [PATCH] Add some exporter macros. --- code/AssetLib/3MF/D3MFExporter.h | 6 ++++-- code/AssetLib/Assbin/AssbinExporter.h | 4 +++- code/AssetLib/Assbin/AssbinFileWriter.cpp | 23 +++++++++++------------ test/unit/ImportExport/utExporter.cpp | 4 ++++ test/unit/utColladaImportExport.cpp | 4 ++++ 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/code/AssetLib/3MF/D3MFExporter.h b/code/AssetLib/3MF/D3MFExporter.h index 3da74fb37..df25e305e 100644 --- a/code/AssetLib/3MF/D3MFExporter.h +++ b/code/AssetLib/3MF/D3MFExporter.h @@ -101,9 +101,11 @@ private: std::vector mRelations; }; -#endif // ASSIMP_BUILD_NO_3MF_EXPORTER -#endif // ASSIMP_BUILD_NO_EXPORT } // Namespace D3MF } // Namespace Assimp +#endif // ASSIMP_BUILD_NO_3MF_EXPORTER +#endif // ASSIMP_BUILD_NO_EXPORT + + diff --git a/code/AssetLib/Assbin/AssbinExporter.h b/code/AssetLib/Assbin/AssbinExporter.h index 4871b5021..b6f2acd3d 100644 --- a/code/AssetLib/Assbin/AssbinExporter.h +++ b/code/AssetLib/Assbin/AssbinExporter.h @@ -48,11 +48,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +#ifndef ASSIMP_BUILD_NO_EXPORT + // nothing really needed here - reserved for future use like properties namespace Assimp { void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/); } - +#endif #endif // AI_ASSBINEXPORTER_H_INC diff --git a/code/AssetLib/Assbin/AssbinFileWriter.cpp b/code/AssetLib/Assbin/AssbinFileWriter.cpp index 2519b0b93..21bfd8512 100644 --- a/code/AssetLib/Assbin/AssbinFileWriter.cpp +++ b/code/AssetLib/Assbin/AssbinFileWriter.cpp @@ -43,13 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "AssbinFileWriter.h" - #include "Common/assbin_chunks.h" #include "PostProcessing/ProcessHelper.h" #include #include -#include #include #ifdef ASSIMP_BUILD_NO_OWN_ZLIB @@ -58,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../contrib/zlib/zlib.h" #endif -#include +#include #if _MSC_VER #pragma warning(push) @@ -277,7 +275,7 @@ public: // empty } - virtual ~AssbinChunkWriter() { + ~AssbinChunkWriter() override { if (container) { container->Write(&magic, sizeof(uint32_t), 1); container->Write(&cursor, sizeof(uint32_t), 1); @@ -288,26 +286,27 @@ public: void *GetBufferPointer() { return buffer; } - // ------------------------------------------------------------------- - virtual size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) { + size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override { return 0; } - virtual aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) { + + aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override { return aiReturn_FAILURE; } - virtual size_t Tell() const { + + size_t Tell() const override { return cursor; } - virtual void Flush() { + + void Flush() override { // not implemented } - virtual size_t FileSize() const { + size_t FileSize() const override { return cursor; } - // ------------------------------------------------------------------- - virtual size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) { + size_t Write(const void *pvBuffer, size_t pSize, size_t pCount) override { pSize *= pCount; if (cursor + pSize > cur_size) { Grow(cursor + pSize); diff --git a/test/unit/ImportExport/utExporter.cpp b/test/unit/ImportExport/utExporter.cpp index b1e1ec362..e153d3e4d 100644 --- a/test/unit/ImportExport/utExporter.cpp +++ b/test/unit/ImportExport/utExporter.cpp @@ -45,6 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace Assimp; +#ifndef ASSIMP_BUILD_NO_EXPORT + class TestProgressHandler : public ProgressHandler { public: TestProgressHandler() : @@ -101,3 +103,5 @@ TEST_F(ExporterTest, ExporterIdTest) { const aiExportFormatDesc *desc = exporter.GetExportFormatDescription(exportFormatCount); EXPECT_EQ(nullptr, desc) << "More exporters than claimed"; } + +#endif \ No newline at end of file diff --git a/test/unit/utColladaImportExport.cpp b/test/unit/utColladaImportExport.cpp index 76a39336e..44f988852 100644 --- a/test/unit/utColladaImportExport.cpp +++ b/test/unit/utColladaImportExport.cpp @@ -233,6 +233,8 @@ unsigned int GetMeshUseCount(const aiNode *rootNode) { return result; } +#ifndef ASSIMP_BUILD_NO_EXPORT + TEST_F(utColladaImportExport, exportRootNodeMeshTest) { Assimp::Importer importer; Assimp::Exporter exporter; @@ -342,6 +344,8 @@ TEST_F(utColladaImportExport, exporterUniqueIdsTest) { ImportAsNames(outFileNamed, scene); } +#endif + class utColladaZaeImportExport : public AbstractImportExportBase { public: virtual bool importerTest() final {