From a2fb2dfb280c21d893f48a3b57b2c3f803100227 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Mon, 12 Aug 2013 23:42:30 +0200 Subject: [PATCH 1/2] Exporter: if the scene data was converted to verbose format to meet the requirements of a preprocessing step, we should un-verbosify it again before the actual exporter is run. --- code/Exporter.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/Exporter.cpp b/code/Exporter.cpp index 3b2badab7..b6d15e25f 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -60,6 +60,7 @@ Here we implement only the C++ interface (Assimp::Exporter). #include "BaseProcess.h" #include "Importer.h" // need this for GetPostProcessingStepInstanceList() +#include "JoinVerticesProcess.h" #include "MakeVerboseFormat.h" #include "ConvertToLHProcess.h" @@ -86,7 +87,7 @@ Exporter::ExportFormatEntry gExporters[] = #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj, - aiProcess_GenNormals | aiProcess_PreTransformVertices), + aiProcess_GenNormals /*| aiProcess_PreTransformVertices */), #endif #ifndef ASSIMP_BUILD_NO_STL_EXPORTER @@ -260,6 +261,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const // If the input scene is not in verbose format, but there is at least postprocessing step that relies on it, // we need to run the MakeVerboseFormat step first. + bool must_join_again = false; if (scenecopy->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) { bool verbosify = false; @@ -277,6 +279,10 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const MakeVerboseFormatProcess proc; proc.Execute(scenecopy.get()); + + if(!(exp.mEnforcePP & aiProcess_JoinIdenticalVertices)) { + must_join_again = true; + } } } @@ -321,6 +327,11 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const privOut->mPPStepsApplied |= pp; } + if(must_join_again) { + JoinVerticesProcess proc; + proc.Execute(scenecopy.get()); + } + exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get()); } catch (DeadlyExportError& err) { From fe248c89ecd2383c977558579af3fc6ea524e1c8 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Mon, 12 Aug 2013 23:42:46 +0200 Subject: [PATCH 2/2] Exporter.hpp: predeclare IOSystem --- include/assimp/Exporter.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/assimp/Exporter.hpp b/include/assimp/Exporter.hpp index 30db01508..20cd7dc6e 100644 --- a/include/assimp/Exporter.hpp +++ b/include/assimp/Exporter.hpp @@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { class ExporterPimpl; + class IOSystem; // ----------------------------------------------------------------------------------