From 299cf7740f9ede85c7401978f0ec2dd02419e47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 23 Apr 2020 18:33:32 +0200 Subject: [PATCH] imageconverter,sceneconverter: add a --verbose option. --- doc/changelog.dox | 4 +++- src/Magnum/Trade/imageconverter.cpp | 7 ++++++- src/Magnum/Trade/sceneconverter.cpp | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 46567f3ed..8f4dcfd69 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -278,7 +278,9 @@ See also: specfify texture coordinate transform - Added @ref Trade::AbstractImporter::setFlags() and @ref Trade::AbstractImageConverter::setFlags() for configuring common - plugin behavior such as output verbosity level + plugin behavior such as output verbosity level; exposed also via a new + `--verbose` option in @ref magnum-imageconverter "magnum-imageconverter" + and @ref magnum-sceneconverter "magnum-sceneconverter" - @ref magnum-imageconverter "magnum-imageconverter" has a new `--info` option for printing detailed info about a particular file - RLE compression support in @ref Trade::TgaImporter "TgaImporter" diff --git a/src/Magnum/Trade/imageconverter.cpp b/src/Magnum/Trade/imageconverter.cpp index 157ff2092..df3ec9d1f 100644 --- a/src/Magnum/Trade/imageconverter.cpp +++ b/src/Magnum/Trade/imageconverter.cpp @@ -66,7 +66,8 @@ information. @code{.sh} magnum-imageconverter [-h|--help] [--importer IMPORTER] [--converter CONVERTER] [--plugin-dir DIR] [-i|--importer-options key=val,key2=val2,…] - [-c|--converter-options key=val,key2=val2,…] [--info] [--] input output + [-c|--converter-options key=val,key2=val2,…] [--info] [-v|--verbose] [--] + input output @endcode Arguments: @@ -84,6 +85,7 @@ Arguments: - `-c`, `--converter-options key=val,key2=val2,…` --- configuration options to pass to the converter - `--info` --- print info about the input file and exit +- `-v`, `--verbose` --- verbose output from importer and converter plugins Specifying `--importer raw:<format>` will treat the input as a raw tightly-packed square of pixels in given @ref PixelFormat. Specifying @@ -144,6 +146,7 @@ int main(int argc, char** argv) { .addOption('i', "importer-options").setHelp("importer-options", "configuration options to pass to the importer", "key=val,key2=val2,…") .addOption('c', "converter-options").setHelp("converter-options", "configuration options to pass to the converter", "key=val,key2=val2,…") .addBooleanOption("info").setHelp("info", "print info about the input file and exit") + .addBooleanOption('v', "verbose").setHelp("verbose", "verbose output from importer and converter plugins") .setParseErrorCallback([](const Utility::Arguments& args, Utility::Arguments::ParseError error, const std::string& key) { /* If --info is passed, we don't need the output argument */ if(error == Utility::Arguments::ParseError::MissingArgument && @@ -215,6 +218,7 @@ key=true.)") } /* Set options, if passed */ + if(args.isSet("verbose")) importer->setFlags(Trade::ImporterFlag::Verbose); Trade::Implementation::setOptions(*importer, args.value("importer-options")); /* Print image info, if requested */ @@ -289,6 +293,7 @@ key=true.)") } /* Set options, if passed */ + if(args.isSet("verbose")) converter->setFlags(Trade::ImageConverterFlag::Verbose); Trade::Implementation::setOptions(*converter, args.value("converter-options")); /* Save output file */ diff --git a/src/Magnum/Trade/sceneconverter.cpp b/src/Magnum/Trade/sceneconverter.cpp index d1d1dff64..b380e6f7d 100644 --- a/src/Magnum/Trade/sceneconverter.cpp +++ b/src/Magnum/Trade/sceneconverter.cpp @@ -63,7 +63,8 @@ information. @code{.sh} magnum-sceneconverter [-h|--help] [--importer IMPORTER] [--plugin-dir DIR] - [-i|--importer-options key=val,key2=val2,…] [--info] [--] input + [-i|--importer-options key=val,key2=val2,…] [--info] [-v|--verbose] [--] + input @endcode Arguments: @@ -76,6 +77,7 @@ Arguments: - `-i`, `--importer-options key=val,key2=val2,…` --- configuration options to pass to the importer - `--info` --- print info about the input file and exit +- `-v`, `--verbose` --- verbose output from importer plugins If `--info` is given, the utility will print information about all meshes and images present in the file. **This option is currently mandatory.** @@ -97,6 +99,7 @@ int main(int argc, char** argv) { .addOption("plugin-dir").setHelp("plugin-dir", "override base plugin dir", "DIR") .addOption('i', "importer-options").setHelp("importer-options", "configuration options to pass to the importer", "key=val,key2=val2,…") .addBooleanOption("info").setHelp("info", "print info about the input file and exit") + .addBooleanOption('v', "verbose").setHelp("verbose", "verbose output from importer plugins") /** @todo add the parse error callback from imageconverter once there's an output argument, also remove the "mandatory" from all docs */ .setGlobalHelp(R"(Converts scenes of different formats. @@ -120,6 +123,7 @@ is omitted, it's equivalent to saying key=true.)") } /* Set options, if passed */ + if(args.isSet("verbose")) importer->setFlags(Trade::ImporterFlag::Verbose); Trade::Implementation::setOptions(*importer, args.value("importer-options")); /* Print file info, if requested */