From b71b7982b5012d5a233b519511d9f33bd272447c Mon Sep 17 00:00:00 2001 From: Alexandre Avenel Date: Sat, 8 Dec 2018 22:58:24 +0100 Subject: [PATCH] Add silent flag to assimp cmd Add a new command line flag to assimp cmd in order to only display minimal info when loading a file. This is especially useful for quick profiling/fuzzing. --- tools/assimp_cmd/Info.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/assimp_cmd/Info.cpp b/tools/assimp_cmd/Info.cpp index ae858bfe8..d6d3de804 100644 --- a/tools/assimp_cmd/Info.cpp +++ b/tools/assimp_cmd/Info.cpp @@ -54,7 +54,8 @@ const char* AICMD_MSG_INFO_HELP_E = "assimp info [-r] [-v]\n" "\tPrint basic structure of a 3D model\n" "\t-r,--raw: No postprocessing, do a raw import\n" -"\t-v,--verbose: Print verbose info such as node transform data\n"; +"\t-v,--verbose: Print verbose info such as node transform data\n" +"\t-s, --silent: Print only minimal info\n"; const std::string TREE_BRANCH_ASCII = "|-"; const std::string TREE_BRANCH_UTF8 = "\xe2\x94\x9c\xe2\x95\xb4"; @@ -305,6 +306,7 @@ int Assimp_Info (const char* const* params, unsigned int num) // get -r and -v arguments bool raw = false; bool verbose = false; + bool silent = false; for(unsigned int i = 1; i < num; ++i) { if (!strcmp(params[i],"--raw")||!strcmp(params[i],"-r")) { raw = true; @@ -312,6 +314,9 @@ int Assimp_Info (const char* const* params, unsigned int num) if (!strcmp(params[i],"--verbose")||!strcmp(params[i],"-v")) { verbose = true; } + if (!strcmp(params[i], "--silent") || !strcmp(params[i], "-s")) { + silent = true; + } } // do maximum post-processing unless -r was specified @@ -380,6 +385,12 @@ int Assimp_Info (const char* const* params, unsigned int num) ) ; + if (silent) + { + printf("\n"); + return 0; + } + // meshes if (scene->mNumMeshes) { printf("\nMeshes: (name) [vertices / bones / faces | primitive_types]\n");