From 0b79d1ebda3b903d0b648153025d63625a1929e6 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 5 May 2016 19:11:33 +0200 Subject: [PATCH] Revert previous glTF fix (e5233283efa2b84a1bf) because it breaks ODR as pointed out by @turol, instead just make importer depend on the necessary definitions. --- code/glTFAsset.h | 8 ++------ code/glTFAssetWriter.h | 1 - code/glTFAssetWriter.inl | 10 +++++----- code/glTFExporter.cpp | 2 +- code/glTFImporter.cpp | 2 ++ 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/code/glTFAsset.h b/code/glTFAsset.h index b5ae84985..c7045a609 100644 --- a/code/glTFAsset.h +++ b/code/glTFAsset.h @@ -756,19 +756,17 @@ namespace glTF virtual void AttachToDocument(Document& doc) = 0; virtual void DetachFromDocument() = 0; -#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT virtual void WriteObjects(AssetWriter& writer) = 0; -#endif }; -#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT + template class LazyDict; //! (Implemented in glTFAssetWriter.h) template void WriteLazyDict(LazyDict& d, AssetWriter& w); -#endif + //! Manages lazy loading of the glTF top-level objects, and keeps a reference to them by ID //! It is the owner the loaded objects, so when it is destroyed it also deletes them @@ -790,10 +788,8 @@ namespace glTF void AttachToDocument(Document& doc); void DetachFromDocument(); -#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT void WriteObjects(AssetWriter& writer) { WriteLazyDict(*this, writer); } -#endif Ref Add(T* obj); diff --git a/code/glTFAssetWriter.h b/code/glTFAssetWriter.h index 55d75451d..370d2c0ab 100644 --- a/code/glTFAssetWriter.h +++ b/code/glTFAssetWriter.h @@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef glTFAssetWriter_H_INC #define glTFAssetWriter_H_INC -#define GLTF_ASSET_WITH_EXPORT_SUPPORT #include "glTFAsset.h" namespace glTF diff --git a/code/glTFAssetWriter.inl b/code/glTFAssetWriter.inl index 0e51ebd94..0fa8556c0 100644 --- a/code/glTFAssetWriter.inl +++ b/code/glTFAssetWriter.inl @@ -305,7 +305,7 @@ namespace glTF { } - AssetWriter::AssetWriter(Asset& a) + inline AssetWriter::AssetWriter(Asset& a) : mDoc() , mAsset(a) , mAl(mDoc.GetAllocator()) @@ -326,7 +326,7 @@ namespace glTF { } } - void AssetWriter::WriteFile(const char* path) + inline void AssetWriter::WriteFile(const char* path) { bool isBinary = mAsset.extensionsUsed.KHR_binary_glTF; @@ -363,7 +363,7 @@ namespace glTF { } } - void AssetWriter::WriteBinaryData(IOStream* outfile, size_t sceneLength) + inline void AssetWriter::WriteBinaryData(IOStream* outfile, size_t sceneLength) { // // write the body data @@ -413,7 +413,7 @@ namespace glTF { } - void AssetWriter::WriteMetadata() + inline void AssetWriter::WriteMetadata() { Value asset; asset.SetObject(); @@ -425,7 +425,7 @@ namespace glTF { mDoc.AddMember("asset", asset, mAl); } - void AssetWriter::WriteExtensionsUsed() + inline void AssetWriter::WriteExtensionsUsed() { Value exts; exts.SetArray(); diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 222947add..ca606ecdc 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER #include "glTFExporter.h" + #include "Exceptional.h" #include "StringComparison.h" #include "ByteSwapper.h" @@ -54,7 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include #include #include "glTFAssetWriter.h" diff --git a/code/glTFImporter.cpp b/code/glTFImporter.cpp index fa730ddd1..a17076d63 100644 --- a/code/glTFImporter.cpp +++ b/code/glTFImporter.cpp @@ -53,6 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "MakeVerboseFormat.h" #include "glTFAsset.h" +// This is included here so WriteLazyDict's definition is found. +#include "glTFAssetWriter.h" using namespace Assimp; using namespace glTF;