From 9d4f7c32e49f75bd84fc77eb9d539190a5d59d00 Mon Sep 17 00:00:00 2001 From: acgessler Date: Sat, 5 Oct 2013 16:26:16 +0200 Subject: [PATCH] Scene: keep an internal flag whether the scene was copied using aiCopyScene() (and potentially modified by the user afterwards) --- code/AssimpCExport.cpp | 1 + code/ScenePrivate.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/code/AssimpCExport.cpp b/code/AssimpCExport.cpp index 9483eb2d3..053e1b9f4 100644 --- a/code/AssimpCExport.cpp +++ b/code/AssimpCExport.cpp @@ -73,6 +73,7 @@ ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut) } SceneCombiner::CopyScene(pOut,pIn,true); + ScenePriv(*pOut)->mIsCopy = true; } diff --git a/code/ScenePrivate.h b/code/ScenePrivate.h index dc11bb4fa..8e9fde7ac 100644 --- a/code/ScenePrivate.h +++ b/code/ScenePrivate.h @@ -53,6 +53,7 @@ struct ScenePrivateData { ScenePrivateData() : mOrigImporter() , mPPStepsApplied() + , mIsCopy() {} // Importer that originally loaded the scene though the C-API @@ -61,6 +62,13 @@ struct ScenePrivateData { // List of postprocessing steps already applied to the scene. unsigned int mPPStepsApplied; + + // true if the scene is a copy made with aiCopyScene() + // or the corresponding C++ API. This means that user code + // may have made modifications to it, so mPPStepsApplied + // and mOrigImporter are no longer safe to rely on and only + // serve informative purposes. + bool mIsCopy; }; // Access private data stored in the scene