소스 검색

Added Assimp logging option to AssetImporter.

Lasse Öörni 12 년 전
부모
커밋
56c91aa1a0
2개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      Docs/Reference.dox
  2. 12 0
      Source/Tools/AssetImporter/AssetImporter.cpp

+ 1 - 0
Docs/Reference.dox

@@ -1721,6 +1721,7 @@ Options:
             if its name contains any of the filters. Prefix filter with minus
             sign to use as an exclude. For example -s "Bip01;-Dummy;-Helper"
 -t          Generate tangents
+-v          Enable verbose Assimp library logging
 \endverbatim
 
 The material list is a text file, one material per line, saved alongside the Urho3D model. It is used by the scene editor to automatically apply the imported default materials when setting a new model for a StaticModel, StaticModelGroup, AnimatedModel or Skybox component, and can also be manually invoked by calling \ref StaticModel::ApplyMaterialList "ApplyMaterialList()". The list files can safely be deleted if not needed.

+ 12 - 0
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -54,6 +54,8 @@
 #include <assimp/cimport.h>
 #include <assimp/scene.h>
 #include <assimp/postprocess.h>
+#include <assimp/DefaultLogger.hpp>
+
 #include <cstring>
 
 #include "DebugNew.h"
@@ -105,6 +107,7 @@ bool noAnimations_ = false;
 bool noMaterials_ = false;
 bool saveMaterialList_ = false;
 bool includeNonSkinningBones_ = false;
+bool verboseLog_ = false;
 Vector<String> nonSkinningBoneIncludes_;
 Vector<String> nonSkinningBoneExcludes_;
 
@@ -213,6 +216,7 @@ void Run(const Vector<String>& arguments)
             "            if its name contains any of the filters. Prefix filter with minus\n"
             "            sign to use as an exclude. For example -s \"Bip01;-Dummy;-Helper\"\n"
             "-t          Generate tangents\n"
+            "-v          Enable verbose Assimp library logging\n"
         );
     }
     
@@ -317,6 +321,8 @@ void Run(const Vector<String>& arguments)
                     }
                 }
             }
+            else if (argument == "v")
+                verboseLog_ = true;
         }
     }
     
@@ -347,11 +353,17 @@ void Run(const Vector<String>& arguments)
         if (command != "dump" && outFile.Empty())
             ErrorExit("No output file defined");
         
+        if (verboseLog_)
+            Assimp::DefaultLogger::create("", Assimp::Logger::VERBOSE, aiDefaultLogStream_STDOUT);
+        
         PrintLine("Reading file " + inFile);
         scene_ = aiImportFile(GetNativePath(inFile).CString(), flags);
         if (!scene_)
             ErrorExit("Could not open or parse input file " + inFile);
         
+        if (verboseLog_)
+            Assimp::DefaultLogger::kill();
+        
         rootNode_ = scene_->mRootNode;
         if (!rootNodeName.Empty())
         {