Browse Source

Added Assimp logging option to AssetImporter.

Lasse Öörni 12 years ago
parent
commit
56c91aa1a0
2 changed files with 13 additions and 0 deletions
  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
             if its name contains any of the filters. Prefix filter with minus
             sign to use as an exclude. For example -s "Bip01;-Dummy;-Helper"
             sign to use as an exclude. For example -s "Bip01;-Dummy;-Helper"
 -t          Generate tangents
 -t          Generate tangents
+-v          Enable verbose Assimp library logging
 \endverbatim
 \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.
 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/cimport.h>
 #include <assimp/scene.h>
 #include <assimp/scene.h>
 #include <assimp/postprocess.h>
 #include <assimp/postprocess.h>
+#include <assimp/DefaultLogger.hpp>
+
 #include <cstring>
 #include <cstring>
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
@@ -105,6 +107,7 @@ bool noAnimations_ = false;
 bool noMaterials_ = false;
 bool noMaterials_ = false;
 bool saveMaterialList_ = false;
 bool saveMaterialList_ = false;
 bool includeNonSkinningBones_ = false;
 bool includeNonSkinningBones_ = false;
+bool verboseLog_ = false;
 Vector<String> nonSkinningBoneIncludes_;
 Vector<String> nonSkinningBoneIncludes_;
 Vector<String> nonSkinningBoneExcludes_;
 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"
             "            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"
             "            sign to use as an exclude. For example -s \"Bip01;-Dummy;-Helper\"\n"
             "-t          Generate tangents\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())
         if (command != "dump" && outFile.Empty())
             ErrorExit("No output file defined");
             ErrorExit("No output file defined");
         
         
+        if (verboseLog_)
+            Assimp::DefaultLogger::create("", Assimp::Logger::VERBOSE, aiDefaultLogStream_STDOUT);
+        
         PrintLine("Reading file " + inFile);
         PrintLine("Reading file " + inFile);
         scene_ = aiImportFile(GetNativePath(inFile).CString(), flags);
         scene_ = aiImportFile(GetNativePath(inFile).CString(), flags);
         if (!scene_)
         if (!scene_)
             ErrorExit("Could not open or parse input file " + inFile);
             ErrorExit("Could not open or parse input file " + inFile);
         
         
+        if (verboseLog_)
+            Assimp::DefaultLogger::kill();
+        
         rootNode_ = scene_->mRootNode;
         rootNode_ = scene_->mRootNode;
         if (!rootNodeName.Empty())
         if (!rootNodeName.Empty())
         {
         {