Browse Source

AssetImporter Optimize Graph process not done by default, but needs to be manually activated with the -o switch.

Lasse Öörni 12 years ago
parent
commit
be9cef51a4
2 changed files with 9 additions and 10 deletions
  1. 4 1
      Docs/Reference.dox
  2. 5 9
      Tools/AssetImporter/AssetImporter.cpp

+ 4 - 1
Docs/Reference.dox

@@ -1474,6 +1474,7 @@ lod   Combine several Urho3D models as LOD levels of the output model
 
 Options:
 -b    Save scene in binary format, default format is XML
+-h    Generate hard instead of smooth normals if input file has no normals
 -i    Use local ID's for scene nodes
 -na   Do not output animations
 -nm   Do not output materials
@@ -1482,7 +1483,9 @@ Options:
 -nf   Do not fix infacing normals
 -pX   Set path X for scene resources. Default is output file path
 -rX   Use scene node X as root node
--t    Generate tangents to model(s)
+-fX   Animation tick frequency to use if unspecified. Default 4800
+-o    Optimize scene hierarchy. Loses animations
+-t    Generate tangents
 \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, AnimatedModel or Skybox component. The list files can safely be deleted if not needed, and should not be included in production builds of Urho3D applications.

+ 5 - 9
Tools/AssetImporter/AssetImporter.cpp

@@ -198,6 +198,7 @@ void Run(const Vector<String>& arguments)
             "-pX   Set path X for scene resources. Default is output file path\n"
             "-rX   Use scene node X as root node\n"
             "-fX   Animation tick frequency to use if unspecified. Default 4800\n"
+            "-o    Optimize scene hierarchy. Loses animations\n"
             "-t    Generate tangents\n"
         );
     }
@@ -265,6 +266,10 @@ void Run(const Vector<String>& arguments)
                 defaultTicksPerSecond_ = ToFloat(parameter);
                 break;
                 
+            case 'o':
+                flags |= aiProcess_OptimizeGraph | aiProcess_PreTransformVertices;
+                break;
+                
             case 'n':
                 if (!parameter.Empty())
                 {
@@ -327,15 +332,6 @@ void Run(const Vector<String>& arguments)
         if (!scene_)
             ErrorExit("Could not open or parse input file " + inFile);
         
-        // In model mode, if scene has no animations, can flatten the hierarchy to combine submeshes with same material
-        /// \todo It is slow to load scene twice just to know whether there are animations
-        if (command == "model" && (!scene_->HasAnimations() || noAnimations_))
-        {
-            aiReleaseImport(scene_);
-            flags |= aiProcess_OptimizeGraph | aiProcess_PreTransformVertices;
-            scene_ = aiImportFile(GetNativePath(inFile).CString(), flags);
-        }
-
         rootNode_ = scene_->mRootNode;
         if (!rootNodeName.Empty())
         {