From c58dcee5b9c452e5ee6eafaafe8663a6aa28254f Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 23 Mar 2010 18:16:22 +0000 Subject: [PATCH] Add 'testbatchload' verb to assimp_cmd. It expects a list of input files and loads them all. This is intended to test reusability of a single importer. Not mentioned in doc. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@624 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- tools/assimp_cmd/Info.cpp | 2 +- tools/assimp_cmd/Main.cpp | 20 ++++++++++++++++++++ tools/assimp_cmd/Main.h | 18 ++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index 6e0ac577e..b7ae56279 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -205,7 +205,7 @@ void PrintHierarchy(const aiNode* root, unsigned int maxnest, unsigned int maxli // ----------------------------------------------------------------------------------- // Implementation of the assimp info utility to print basic file info -int Assimp_Info (const char** params, unsigned int num) +int Assimp_Info (const char* const* params, unsigned int num) { if (num < 1) { printf("assimp info: Invalid number of arguments. " diff --git a/tools/assimp_cmd/Main.cpp b/tools/assimp_cmd/Main.cpp index 3c8ab0ad3..9b1eb852f 100644 --- a/tools/assimp_cmd/Main.cpp +++ b/tools/assimp_cmd/Main.cpp @@ -154,6 +154,14 @@ int main (int argc, char* argv[]) return Assimp_Extract (&argv[2],argc-2); } + // assimp testbatchload + // Used by /test/other/streamload.py to load a list of files + // using the same importer instance to check for incompatible + // importers. + if (! strcmp(argv[1], "testbatchload")) { + return Assimp_TestBatchLoad (&argv[2],argc-2); + } + printf("Unrecognized command. Use \'assimp help\' for a detailed command list\n"); return 1; } @@ -372,3 +380,15 @@ int ProcessStandardArguments( return 0; } + +// ------------------------------------------------------------------------------ +int Assimp_TestBatchLoad ( + const char* const* params, + unsigned int num) +{ + for(unsigned int i = 0; i < num; ++i) { + globalImporter->ReadFile(params[i],aiProcessPreset_TargetRealtime_MaxQuality); + // we're totally silent. scene destructs automatically. + } + return 0; +} diff --git a/tools/assimp_cmd/Main.h b/tools/assimp_cmd/Main.h index ef2028a6e..02d51e5c9 100644 --- a/tools/assimp_cmd/Main.h +++ b/tools/assimp_cmd/Main.h @@ -146,13 +146,23 @@ int Assimp_CompareDump ( const char* const* params, unsigned int num); - // ------------------------------------------------------------------------------ /** @brief assimp info utility * @param params Command line parameters to 'assimp info' * @param Number of params - * @return 0 for success - */ -int Assimp_Info (const char** params, unsigned int num); + * @return 0 for success */ +int Assimp_Info ( + const char* const* params, + unsigned int num); + +// ------------------------------------------------------------------------------ +/** @brief assimp testbatchload utility + * @param params Command line parameters to 'assimp testbatchload' + * @param Number of params + * @return 0 for success */ +int Assimp_TestBatchLoad ( + const char* const* params, + unsigned int num); + #endif // !! AICMD_MAIN_INCLUDED \ No newline at end of file