Magnum::Trade::AnySceneImporter class

Any scene importer plugin.

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

  • 3ds Max 3DS and ASE (*.3ds, *.ase), loaded with any plugin that provides 3dsImporter
  • 3D Manufacturing Format (*.3mf), loaded with any plugin that provides 3mfImporter
  • AC3D (*.ac), loaded with any plugin that provides Ac3dImporter
  • Blender 3D (*.blend), loaded with any plugin that provides BlenderImporter
  • Biovision BVH (*.bvh), loaded with any plugin that provides BvhImporter
  • CharacterStudio Motion (*.csm), loaded with any plugin that provides CsmImporter
  • COLLADA (*.dae), loaded with any plugin that provides ColladaImporter
  • DirectX X (*.x), loaded with any plugin that provides DirectXImporter
  • AutoCAD DXF (*.dxf), loaded with any plugin that provides DxfImporter
  • Autodesk FBX (*.fbx), loaded with any plugin that provides FbxImporter
  • glTF (*.gltf, *.glb), loaded with GltfImporter or any other plugin that provides it
  • Industry Foundation Classes (IFC/Step) (*.ifc), loaded with any plugin that provides IfcImporter
  • Irrlicht Mesh and Scene (*.irrmesh, *.irr), loaded with any plugin that provides IrrlichtImporter
  • LightWave, LightWave Scene (*.lwo, *.lws), loaded with any plugin that provides LightWaveImporter
  • Modo (*.lxo), loaded with any plugin that provides ModoImporter
  • Milkshape 3D (*.ms3d), loaded with any plugin that provides MilkshapeImporter
  • Wavefront OBJ (*.obj), loaded with ObjImporter or any other plugin that provides it
  • Ogre XML (*.xml), loaded with any plugin that provides OgreImporter
  • OpenGEX (*.ogex), loaded with OpenGexImporter or any other plugin that provides it
  • Stanford (*.ply), loaded with StanfordImporter or any other plugin that provides it
  • Stereolitography (*.stl), loaded with any plugin that provides StlImporter
  • TrueSpace (*.cob, *.scn), loaded with any plugin that provides TrueSpaceImporter
  • Unreal (*.3d), loaded with any plugin that provides UnrealImporter
  • Valve Model (*.smd, *.vta), loaded with any plugin that provides ValveImporter
  • XGL (*.xgl, *.zgl), loaded with any plugin that provides XglImporter

Only loading from files is supported as the filename is used to detect the format, however ImporterFeature::FileCallback is supported as well.

Usage

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

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

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

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

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

find_package(Magnum REQUIRED AnySceneImporter)

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

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 openFile(), a file format is detected from the extension and a corresponding plugin is loaded. After that, flags set via setFlags(), file callbacks set via setFileCallback() 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.

Calls to the animation(), scene(), light(), camera(), skin2D(), skin3D(), mesh(), material(), texture(), image1D(), image2D(), image3D() and corresponding count-/name-related functions are then proxied to the concrete implementation. The close() function closes and discards the internally instantiated plugin; isOpened() works as usual.

While the meshAttributeName(), meshAttributeForName(), sceneFieldName() and sceneFieldForName() APIs can be called without a file opened, they return an empty string or an invalid attribute in that case.

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

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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