Revert previous glTF fix (e5233283ef) because it breaks ODR as pointed out by @turol, instead just make importer depend on the necessary definitions.

pull/877/head
Alexander Gessler 2016-05-05 19:11:33 +02:00
parent f5327a99ba
commit 0b79d1ebda
5 changed files with 10 additions and 13 deletions

View File

@ -756,19 +756,17 @@ namespace glTF
virtual void AttachToDocument(Document& doc) = 0; virtual void AttachToDocument(Document& doc) = 0;
virtual void DetachFromDocument() = 0; virtual void DetachFromDocument() = 0;
#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT
virtual void WriteObjects(AssetWriter& writer) = 0; virtual void WriteObjects(AssetWriter& writer) = 0;
#endif
}; };
#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT
template<class T> template<class T>
class LazyDict; class LazyDict;
//! (Implemented in glTFAssetWriter.h) //! (Implemented in glTFAssetWriter.h)
template<class T> template<class T>
void WriteLazyDict(LazyDict<T>& d, AssetWriter& w); void WriteLazyDict(LazyDict<T>& d, AssetWriter& w);
#endif
//! Manages lazy loading of the glTF top-level objects, and keeps a reference to them by ID //! 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 //! 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 AttachToDocument(Document& doc);
void DetachFromDocument(); void DetachFromDocument();
#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT
void WriteObjects(AssetWriter& writer) void WriteObjects(AssetWriter& writer)
{ WriteLazyDict<T>(*this, writer); } { WriteLazyDict<T>(*this, writer); }
#endif
Ref<T> Add(T* obj); Ref<T> Add(T* obj);

View File

@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef glTFAssetWriter_H_INC #ifndef glTFAssetWriter_H_INC
#define glTFAssetWriter_H_INC #define glTFAssetWriter_H_INC
#define GLTF_ASSET_WITH_EXPORT_SUPPORT
#include "glTFAsset.h" #include "glTFAsset.h"
namespace glTF namespace glTF

View File

@ -305,7 +305,7 @@ namespace glTF {
} }
AssetWriter::AssetWriter(Asset& a) inline AssetWriter::AssetWriter(Asset& a)
: mDoc() : mDoc()
, mAsset(a) , mAsset(a)
, mAl(mDoc.GetAllocator()) , 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; 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 // write the body data
@ -413,7 +413,7 @@ namespace glTF {
} }
void AssetWriter::WriteMetadata() inline void AssetWriter::WriteMetadata()
{ {
Value asset; Value asset;
asset.SetObject(); asset.SetObject();
@ -425,7 +425,7 @@ namespace glTF {
mDoc.AddMember("asset", asset, mAl); mDoc.AddMember("asset", asset, mAl);
} }
void AssetWriter::WriteExtensionsUsed() inline void AssetWriter::WriteExtensionsUsed()
{ {
Value exts; Value exts;
exts.SetArray(); exts.SetArray();

View File

@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER #ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
#include "glTFExporter.h" #include "glTFExporter.h"
#include "Exceptional.h" #include "Exceptional.h"
#include "StringComparison.h" #include "StringComparison.h"
#include "ByteSwapper.h" #include "ByteSwapper.h"
@ -54,7 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h> #include <assimp/material.h>
#include <assimp/scene.h> #include <assimp/scene.h>
#include <memory>
#include <memory> #include <memory>
#include "glTFAssetWriter.h" #include "glTFAssetWriter.h"

View File

@ -53,6 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MakeVerboseFormat.h" #include "MakeVerboseFormat.h"
#include "glTFAsset.h" #include "glTFAsset.h"
// This is included here so WriteLazyDict<T>'s definition is found.
#include "glTFAssetWriter.h"
using namespace Assimp; using namespace Assimp;
using namespace glTF; using namespace glTF;