From 8ac1de3287851d04d6a4cf03fac0a080149ad5bc Mon Sep 17 00:00:00 2001 From: kim kulling Date: Tue, 23 Jan 2018 15:12:57 +0100 Subject: [PATCH] closes https://github.com/assimp/assimp/issues/1390: aiScene now stores metadata as well. --- code/Version.cpp | 18 +++++++++++------- include/assimp/scene.h | 10 ++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/code/Version.cpp b/code/Version.cpp index eb4cab417..a9ecb6a3a 100644 --- a/code/Version.cpp +++ b/code/Version.cpp @@ -118,19 +118,20 @@ ASSIMP_API const char *aiGetBranchName() { // ------------------------------------------------------------------------------------------------ ASSIMP_API aiScene::aiScene() : mFlags(0) -, mRootNode(NULL) +, mRootNode(nullptr) , mNumMeshes(0) -, mMeshes(NULL) +, mMeshes(nullptr) , mNumMaterials(0) -, mMaterials(NULL) +, mMaterials(nullptr) , mNumAnimations(0) -, mAnimations(NULL) +, mAnimations(nullptr) , mNumTextures(0) -, mTextures(NULL) +, mTextures(nullptr) , mNumLights(0) -, mLights(NULL) +, mLights(nullptr) , mNumCameras(0) -, mCameras(NULL) +, mCameras(nullptr) +, mMetaData(nullptr) , mPrivate(new Assimp::ScenePrivateData()) { // empty } @@ -173,6 +174,9 @@ ASSIMP_API aiScene::~aiScene() { delete mCameras[a]; delete [] mCameras; + aiMetadata::Dealloc(mMetaData); + mMetaData = nullptr; + delete static_cast( mPrivate ); } diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 00fa42142..82b38797e 100644 --- a/include/assimp/scene.h +++ b/include/assimp/scene.h @@ -326,6 +326,16 @@ struct aiScene */ C_STRUCT aiCamera** mCameras; + /** + * @brief The global metadata assigned to the scene itself. + * + * This data contains global metadata which belongs to the scene like + * unit-conversions, versions, vendors or other model-specific data. This + * can be used to store format-specific metadata as well. + */ + C_STRUCT aiMetadata* mMetaData; + + #ifdef __cplusplus //! Default constructor - set everything to 0/NULL