Browse Source

Scene: keep an internal flag whether the scene was copied using aiCopyScene() (and potentially modified by the user afterwards)

acgessler 12 years ago
parent
commit
9d4f7c32e4
2 changed files with 9 additions and 0 deletions
  1. 1 0
      code/AssimpCExport.cpp
  2. 8 0
      code/ScenePrivate.h

+ 1 - 0
code/AssimpCExport.cpp

@@ -73,6 +73,7 @@ ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)
 	}
 	}
 
 
 	SceneCombiner::CopyScene(pOut,pIn,true);
 	SceneCombiner::CopyScene(pOut,pIn,true);
+	ScenePriv(*pOut)->mIsCopy = true;
 }
 }
 
 
 
 

+ 8 - 0
code/ScenePrivate.h

@@ -53,6 +53,7 @@ struct ScenePrivateData {
 	ScenePrivateData()
 	ScenePrivateData()
 		: mOrigImporter()
 		: mOrigImporter()
 		, mPPStepsApplied()
 		, mPPStepsApplied()
+		, mIsCopy()
 	{}
 	{}
 
 
 	// Importer that originally loaded the scene though the C-API
 	// 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.
 	// List of postprocessing steps already applied to the scene.
 	unsigned int mPPStepsApplied;
 	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
 // Access private data stored in the scene