浏览代码

Merge pull request #76 from assimp/fixes

Fixes
Alexander Gessler 12 年之前
父节点
当前提交
9e4776abf7
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      code/Exporter.cpp

+ 12 - 1
code/Exporter.cpp

@@ -60,6 +60,7 @@ Here we implement only the C++ interface (Assimp::Exporter).
 #include "BaseProcess.h" 
 #include "BaseProcess.h" 
 #include "Importer.h" // need this for GetPostProcessingStepInstanceList()
 #include "Importer.h" // need this for GetPostProcessingStepInstanceList()
 
 
+#include "JoinVerticesProcess.h"
 #include "MakeVerboseFormat.h"
 #include "MakeVerboseFormat.h"
 #include "ConvertToLHProcess.h"
 #include "ConvertToLHProcess.h"
 
 
@@ -86,7 +87,7 @@ Exporter::ExportFormatEntry gExporters[] =
 
 
 #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
 #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
 	Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj, 
 	Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj, 
-		aiProcess_GenNormals | aiProcess_PreTransformVertices),
+		aiProcess_GenNormals /*| aiProcess_PreTransformVertices */),
 #endif
 #endif
 
 
 #ifndef ASSIMP_BUILD_NO_STL_EXPORTER
 #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,
 				// 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.
 				// we need to run the MakeVerboseFormat step first.
+				bool must_join_again = false;
 				if (scenecopy->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) {
 				if (scenecopy->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) {
 					
 					
 					bool verbosify = false;
 					bool verbosify = false;
@@ -277,6 +279,10 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
 
 
 						MakeVerboseFormatProcess proc;
 						MakeVerboseFormatProcess proc;
 						proc.Execute(scenecopy.get());
 						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;
 					privOut->mPPStepsApplied |= pp;
 				}
 				}
 
 
+				if(must_join_again) {
+					JoinVerticesProcess proc;
+					proc.Execute(scenecopy.get());
+				}
+
 				exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get());
 				exp.mExportFunction(pPath,pimpl->mIOSystem.get(),scenecopy.get());
 			}
 			}
 			catch (DeadlyExportError& err) {
 			catch (DeadlyExportError& err) {