Magnum::Trade::AnySceneConverter class new in 2020.06

Any scene converter plugin.

Detects file type based on file extension, loads corresponding plugin and then tries to convert the file with it. Supported formats:

Only converting to files is supported.

Usage

This plugin depends on the Trade library and is built if MAGNUM_WITH_ANYSCENECONVERTER is enabled when building Magnum. To use as a dynamic plugin, load "AnySceneConverter" via Corrade::PluginManager::Manager.

Additionally, if you're using Magnum as a CMake subproject, do the following:

set(MAGNUM_WITH_ANYSCENECONVERTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)

# So the dynamically loaded plugin gets built implicitly
add_dependencies(your-app Magnum::AnySceneConverter)

To use as a static plugin or as a dependency of another plugin with CMake, you need to request the AnySceneConverter component of the Magnum package and link to the Magnum::AnySceneConverter target:

find_package(Magnum REQUIRED AnySceneConverter)

# ...
target_link_libraries(your-app PRIVATE Magnum::AnySceneConverter)

See Downloading and building, Usage with CMake, Loading and using plugins and File format support for more information.

Interface proxying and option propagation

On a call to convertToFile() or beginFile(), a target file format is detected from the extension and a corresponding plugin is loaded. After that, flags set via setFlags() and options set through configuration() are propagated to the concrete implementation. A warning is emitted in case an option set is not present in the default configuration of the target plugin.

The features() initially report just SceneConverterFeature::ConvertMeshToFile and ConvertMultipleToFile — i.e., not advertising support for any actual data types. These are included only once beginFile() is called, taken from the concrete plugin implementation.

Calls to the endFile(), add() and related functions are then proxied to the concrete implementation. The abort() function aborts and destroys the internally instantiated plugin; isConverting() works as usual.

Besides delegating the flags, the AnySceneConverter itself recognizes SceneConverterFlag::Verbose, printing info about the concrete plugin being used when the flag is enabled. SceneConverterFlag::Quiet is recognized as well and causes all warnings to be suppressed.

Base classes

class AbstractSceneConverter new in 2020.06
Base for scene converter plugins.

Constructors, destructors, conversion operators

AnySceneConverter(PluginManager::Manager<AbstractSceneConverter>& manager) explicit
Constructor with access to plugin manager.
AnySceneConverter(PluginManager::AbstractManager& manager, const Containers::StringView& plugin) explicit
Plugin manager constructor.