Browse Source

imageconverter,sceneconverter: add a --verbose option.

pull/427/merge
Vladimír Vondruš 6 years ago
parent
commit
299cf7740f
  1. 4
      doc/changelog.dox
  2. 7
      src/Magnum/Trade/imageconverter.cpp
  3. 6
      src/Magnum/Trade/sceneconverter.cpp

4
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"

7
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 */

6
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 */

Loading…
Cancel
Save