class
#include <Magnum/Trade/AbstractImporter.h>
AbstractImporter Base for importer plugins.
Contents
- Usage
- Data dependency
- Subclassing
- Reference
Provides interface for importing 2D/3D scene, camera, light, animation, mesh, material, texture and image data.
Usage
Importers are most commonly implemented as plugins. For example, loading an image from the filesystem using the AnyImageImporter plugin can be done like this, completely with all error handling:
PluginManager::Manager<Trade::AbstractImporter> manager; Containers::Pointer<Trade::AbstractImporter> importer = manager.loadAndInstantiate("AnyImageImporter"); if(!importer || !importer->openFile("image.png")) Fatal{} << "Can't open image.png with AnyImageImporter"; Containers::Optional<Trade::ImageData2D> image = importer->image2D(0); if(!image) Fatal{} << "Importing the image failed"; // use the image ...
See Loading and using plugins for more information about general plugin usage and *Importer
classes in the Trade namespace for available importer plugins.
Loading data from memory, using file callbacks
Besides loading data directly from the filesystem using openFile() like shown above, it's possible to use openData() to import data from memory. Note that the particular importer implementation has to support ImporterFeature::
Complex scene files often reference other files such as images and in that case you may want to intercept those references and load them in a custom way as well. For importers that advertise support for this with ImporterFeature::
struct Data { std::unordered_map<std::string, Containers::Array<const char, Utility::Directory::MapDeleter>> files; } data; importer->setFileCallback([](const std::string& filename, InputFileCallbackPolicy policy, Data& data) -> Containers::Optional<Containers::ArrayView<const char>> { auto found = data.files.find(filename); /* Discard the memory mapping, if not needed anymore */ if(policy == InputFileCallbackPolicy::Close) { if(found != data.files.end()) data.files.erase(found); return {}; } /* Load if not there yet */ if(found == data.files.end()) found = data.files.emplace( filename, Utility::Directory::mapRead(filename)).first; return Containers::arrayView(found->second); }, data); importer->openFile("scene.gltf"); // memory-maps all files
For importers that don't support ImporterFeature::
The input file callback signature is the same for Trade::
Internal importer state
Some importers, especially ones that make use of well-known external libraries, expose internal state through various accessors:
- importerState() can expose a pointer to the global importer state for currently opened file
- MaterialData::
importerState() can expose importer state for given material imported by material() - AnimationData::
importerState() can expose importer state for given animation imported by animation() - CameraData::
importerState() can expose importer state for a camera importer by camera() - ImageData::
importerState() can expose importer state for an image imported by image1D(), image2D() or image3D() - LightData::
importerState() can expose importer state for a light imported by light() - MeshData::
importerState() can expose importer state for a mesh imported by mesh() - ObjectData3D::
importerState() can expose importer state for an object imported by object2D() or object3D() - SceneData::
importerState() can expose importer state for a scene imported by scene() - SkinData::
importerState() can expose importer state for a scene imported by skin2D() or skin3D() - TextureData::
importerState() can expose importer state for a texture imported by texture()
Besides exposing internal state, importers that support the ImporterFeature::
Polymorphic imported data types
Some data access functions return Corrade::
Containers::Pointer<Trade::ObjectData3D> data = importer->object3D(12); if(data && data->instanceType() == Trade::ObjectInstanceType3D::Mesh) { auto& mesh = static_cast<Trade::MeshObjectData3D&>(*data); materialIndex = mesh.material(); // ... }
Another option is making use of the Containers::
Data dependency
The *Data
instances returned from various functions by design have no dependency on the importer instance and neither on the dynamic plugin module. In other words, you don't need to keep the importer instance (or the plugin manager instance) around in order to have the *Data
instances valid. Moreover, all Corrade::
The only exception are various importerState()
functions described above, but in that case the relation is weak — these are valid only as long as the currently opened file is kept open. If the file gets closed or the importer instance deleted, the state pointers become dangling, and that's fine as long as you don't access them.
Subclassing
The plugin needs to implement the doFeatures(), doIsOpened() functions, at least one of doOpenData() / doOpenFile() / doOpenState() functions, function doClose() and one or more tuples of data access functions, based on what features are supported in given format.
In order to support ImporterFeature::
For multi-data formats the file opening shouldn't take long and all parsing should be done in the data parsing functions instead, because the user might want to import only some data. This is obviously not the case for single-data formats like images, as the file contains all the data the user wants to import.
You don't need to do most of the redundant sanity checks, these things are checked by the implementation:
- The doOpenData(), doOpenFile() and doOpenState() functions are called after the previous file was closed, function doClose() is called only if there is any file opened.
- The doOpenData() function is called only if ImporterFeature::
OpenData is supported. - The doOpenState() function is called only if ImporterFeature::
OpenState is supported. - The doSetFileCallback() function is called only if ImporterFeature::
FileCallback is supported and there is no file opened. - All
do*()
implementations working on an opened file as well as doImporterState() are called only if there is any file opened. - All
do*()
implementations taking data ID as parameter are called only if the ID is from valid range. - For doMesh() and
doImage*()
andlevel
parameter being nonzero, implementations are called only if it is from valid range. Level zero is always expected to be present and thus no check is done in that case.
Derived classes
- class AnyImageImporter
- Any image importer plugin.
- class AnySceneImporter
- Any scene importer plugin.
- class AssimpImporter
- Assimp importer.
- class BasisImporter new in 2019.10
- Basis Universal importer plugin.
- class DdsImporter
- DDS image importer plugin.
- class DevIlImageImporter
- DevIL Image importer plugin.
- class IcoImporter new in 2020.06
- ICO importer plugin.
- class JpegImporter
- JPEG importer plugin.
- class ObjImporter
- OBJ importer plugin.
- class OpenGexImporter
- OpenGEX importer.
- class PngImporter
- PNG importer plugin.
- class PrimitiveImporter new in 2020.06
- Primitive importer plugin.
- class StanfordImporter
- Stanford PLY importer plugin.
- class StbImageImporter
- Image importer plugin using stb_image.
- class StlImporter new in 2020.06
- STL importer plugin.
- class TgaImporter
- TGA importer plugin.
- class TinyGltfImporter
- TinyGltf importer plugin.
Public types
- using Feature = ImporterFeature deprecated in 2020.06
- Features supported by an importer.
- using Features = ImporterFeatures deprecated in 2020.06
- Set of features supported by an importer.
Public static functions
-
static auto pluginInterface() -> std::
string - Plugin interface.
-
static auto pluginSearchPaths() -> std::
vector<std:: string> - Plugin search paths.
Constructors, destructors, conversion operators
- AbstractImporter() explicit
- Default constructor.
-
AbstractImporter(PluginManager::
Manager<AbstractImporter>& manager) explicit - Constructor with access to plugin manager.
-
AbstractImporter(PluginManager::
AbstractManager& manager, const std:: string& plugin) explicit - Plugin manager constructor.
Public functions
- auto features() const -> ImporterFeatures
- Features supported by this importer.
- auto flags() const -> ImporterFlags new in 2020.06
- Importer flags.
- void setFlags(ImporterFlags flags) new in 2020.06
- Set importer flags.
- auto fileCallback() -> auto
- File opening callback function.
- auto fileCallbackUserData() const -> void*
- File opening callback user data.
-
void setFileCallback(Containers::
Optional<Containers:: ArrayView<const char>>(*)(const std:: string&, InputFileCallbackPolicy, void*) callback, void* userData = nullptr) - Set file opening callback.
-
template<class T>void setFileCallback(Containers::
Optional<Containers:: ArrayView<const char>>(*)(const std:: string&, InputFileCallbackPolicy, T&) callback, T& userData) - Set file opening callback.
- auto isOpened() const -> bool
- Whether any file is opened.
-
auto openData(Containers::
ArrayView<const char> data) -> bool - Open raw data.
-
auto openState(const void* state,
const std::
string& filePath = {}) -> bool - Open already loaded state.
-
auto openFile(const std::
string& filename) -> bool - Open a file.
- void close()
- Close currently opened file.
- auto importerState() const -> const void*
- Plugin-specific access to internal importer state.
Protected functions
-
void doOpenFile(const std::
string& filename) virtual - Implementation for openFile()
Private functions
- auto doFeatures() const -> ImporterFeatures pure virtual
- Implementation for features()
- void doSetFlags(ImporterFlags flags) virtual
- Implementation for setFlags()
-
void doSetFileCallback(Containers::
Optional<Containers:: ArrayView<const char>>(*)(const std:: string&, InputFileCallbackPolicy, void*) callback, void* userData) virtual - Implementation for setFileCallback()
- auto doIsOpened() const -> bool pure virtual
- Implementation for isOpened()
-
void doOpenData(Containers::
ArrayView<const char> data) virtual - Implementation for openData()
-
void doOpenState(const void* state,
const std::
string& filePath) virtual - Implementation for openState()
- void doClose() pure virtual
- Implementation for close()
- auto doDefaultScene() const -> Int virtual
- Implementation for defaultScene()
- auto doSceneCount() const -> UnsignedInt virtual
- Implementation for sceneCount()
-
auto doSceneForName(const std::
string& name) -> Int virtual - Implementation for sceneForName()
-
auto doSceneName(UnsignedInt id) -> std::
string virtual - Implementation for sceneName()
-
auto doScene(UnsignedInt id) -> Containers::
Optional<SceneData> virtual - Implementation for scene()
- auto doAnimationCount() const -> UnsignedInt virtual
- Implementation for animationCount()
-
auto doAnimationForName(const std::
string& name) -> Int virtual - Implementation for animationForName()
-
auto doAnimationName(UnsignedInt id) -> std::
string virtual - Implementation for animationName()
-
auto doAnimation(UnsignedInt id) -> Containers::
Optional<AnimationData> virtual - Implementation for animation()
- auto doLightCount() const -> UnsignedInt virtual
- Implementation for lightCount()
-
auto doLightForName(const std::
string& name) -> Int virtual - Implementation for lightForName()
-
auto doLightName(UnsignedInt id) -> std::
string virtual - Implementation for lightName()
-
auto doLight(UnsignedInt id) -> Containers::
Optional<LightData> virtual - Implementation for light()
- auto doCameraCount() const -> UnsignedInt virtual
- Implementation for cameraCount()
-
auto doCameraForName(const std::
string& name) -> Int virtual - Implementation for cameraForName()
-
auto doCameraName(UnsignedInt id) -> std::
string virtual - Implementation for cameraName()
-
auto doCamera(UnsignedInt id) -> Containers::
Optional<CameraData> virtual - Implementation for camera()
- auto doObject2DCount() const -> UnsignedInt virtual
- Implementation for object2DCount()
-
auto doObject2DForName(const std::
string& name) -> Int virtual - Implementation for object2DForName()
-
auto doObject2DName(UnsignedInt id) -> std::
string virtual - Implementation for object2DName()
-
auto doObject2D(UnsignedInt id) -> Containers::
Pointer<ObjectData2D> virtual - Implementation for object2D()
- auto doObject3DCount() const -> UnsignedInt virtual
- Implementation for object3DCount()
-
auto doObject3DForName(const std::
string& name) -> Int virtual - Implementation for object3DForName()
-
auto doObject3DName(UnsignedInt id) -> std::
string virtual - Implementation for object3DName()
-
auto doObject3D(UnsignedInt id) -> Containers::
Pointer<ObjectData3D> virtual - Implementation for object3D()
- auto doSkin2DCount() const -> UnsignedInt virtual new in Git master
- Implementation for skin2DCount()
-
auto doSkin2DForName(const std::
string& name) -> Int virtual new in Git master - Implementation for skin2DForName()
-
auto doSkin2DName(UnsignedInt id) -> std::
string virtual new in Git master - Implementation for skin2DName()
-
auto doSkin2D(UnsignedInt id) -> Containers::
Optional<SkinData2D> virtual new in Git master - Implementation for skin2D()
- auto doSkin3DCount() const -> UnsignedInt virtual new in Git master
- Implementation for skin3DCount()
-
auto doSkin3DForName(const std::
string& name) -> Int virtual new in Git master - Implementation for skin3DForName()
-
auto doSkin3DName(UnsignedInt id) -> std::
string virtual new in Git master - Implementation for skin3DName()
-
auto doSkin3D(UnsignedInt id) -> Containers::
Optional<SkinData3D> virtual new in Git master - Implementation for skin3D()
- auto doMeshCount() const -> UnsignedInt virtual new in 2020.06
- Implementation for meshCount()
- auto doMeshLevelCount(UnsignedInt id) -> UnsignedInt virtual new in 2020.06
- Implementation for meshLevelCount()
-
auto doMeshForName(const std::
string& name) -> Int virtual new in 2020.06 - Implementation for meshForName()
-
auto doMeshName(UnsignedInt id) -> std::
string virtual new in 2020.06 - Implementation for meshName()
-
auto doMesh(UnsignedInt id,
UnsignedInt level) -> Containers::
Optional<MeshData> virtual new in 2020.06 - Implementation for mesh()
-
auto doMeshAttributeForName(const std::
string& name) -> MeshAttribute virtual new in 2020.06 - Implementation for meshAttributeForName()
-
auto doMeshAttributeName(UnsignedShort name) -> std::
string virtual new in 2020.06 - Implementation for meshAttributeName()
- auto doMesh2DCount() const -> UnsignedInt deprecated in 2020.06 virtual
- Implementation for mesh2DCount()
-
auto doMesh2DForName(const std::
string& name) -> Int deprecated in 2020.06 virtual - Implementation for mesh2DForName()
-
auto doMesh2DName(UnsignedInt id) -> std::
string deprecated in 2020.06 virtual - Implementation for mesh2DName()
-
auto doMesh2D(UnsignedInt id) -> Containers::
Optional<MeshData2D> deprecated in 2020.06 virtual - Implementation for mesh2D()
- auto doMesh3DCount() const -> UnsignedInt deprecated in 2020.06 virtual
- Implementation for mesh3DCount()
-
auto doMesh3DForName(const std::
string& name) -> Int deprecated in 2020.06 virtual - Implementation for mesh3DForName()
-
auto doMesh3DName(UnsignedInt id) -> std::
string deprecated in 2020.06 virtual - Implementation for mesh3DName()
-
auto doMesh3D(UnsignedInt id) -> Containers::
Optional<MeshData3D> deprecated in 2020.06 virtual - Implementation for mesh3D()
- auto doMaterialCount() const -> UnsignedInt virtual
- Implementation for materialCount()
-
auto doMaterialForName(const std::
string& name) -> Int virtual - Implementation for materialForName()
-
auto doMaterialName(UnsignedInt id) -> std::
string virtual - Implementation for materialName()
-
auto doMaterial(UnsignedInt id) -> Containers::
Optional<MaterialData> virtual - Implementation for material()
- auto doTextureCount() const -> UnsignedInt virtual
- Implementation for textureCount()
-
auto doTextureForName(const std::
string& name) -> Int virtual - Implementation for textureForName()
-
auto doTextureName(UnsignedInt id) -> std::
string virtual - Implementation for textureName()
-
auto doTexture(UnsignedInt id) -> Containers::
Optional<TextureData> virtual - Implementation for texture()
- auto doImage1DCount() const -> UnsignedInt virtual
- Implementation for image1DCount()
- auto doImage1DLevelCount(UnsignedInt id) -> UnsignedInt virtual new in 2020.06
- Implementation for image1DLevelCount()
-
auto doImage1DForName(const std::
string& name) -> Int virtual - Implementation for image1DForName()
-
auto doImage1DName(UnsignedInt id) -> std::
string virtual - Implementation for image1DName()
-
auto doImage1D(UnsignedInt id,
UnsignedInt level) -> Containers::
Optional<ImageData1D> virtual - Implementation for image1D()
- auto doImage2DCount() const -> UnsignedInt virtual
- Implementation for image2DCount()
- auto doImage2DLevelCount(UnsignedInt id) -> UnsignedInt virtual new in 2020.06
- Implementation for image2DLevelCount()
-
auto doImage2DForName(const std::
string& name) -> Int virtual - Implementation for image2DForName()
-
auto doImage2DName(UnsignedInt id) -> std::
string virtual - Implementation for image2DName()
-
auto doImage2D(UnsignedInt id,
UnsignedInt level) -> Containers::
Optional<ImageData2D> virtual - Implementation for image2D()
- auto doImage3DCount() const -> UnsignedInt virtual
- Implementation for image3DCount()
- auto doImage3DLevelCount(UnsignedInt id) -> UnsignedInt virtual new in 2020.06
- Implementation for image3DLevelCount()
-
auto doImage3DForName(const std::
string& name) -> Int virtual - Implementation for image3DForName()
-
auto doImage3DName(UnsignedInt id) -> std::
string virtual - Implementation for image3DName()
-
auto doImage3D(UnsignedInt id,
UnsignedInt level) -> Containers::
Optional<ImageData3D> virtual - Implementation for image3D()
- auto doImporterState() const -> const void* virtual
- Implementation for importerState()
Data accessors
Each function tuple provides access to given data.
- auto defaultScene() const -> Int
- Default scene.
- auto sceneCount() const -> UnsignedInt
- Scene count.
-
auto sceneForName(const std::
string& name) -> Int - Scene ID for given name.
-
auto sceneName(UnsignedInt id) -> std::
string - Scene name.
-
auto scene(UnsignedInt id) -> Containers::
Optional<SceneData> - Scene.
-
auto scene(const std::
string& name) -> Containers:: Optional<SceneData> new in 2020.06 - Scene for given name.
- auto animationCount() const -> UnsignedInt
- Animation count.
-
auto animationForName(const std::
string& name) -> Int - Animation ID for given name.
-
auto animationName(UnsignedInt id) -> std::
string - Animation name.
-
auto animation(UnsignedInt id) -> Containers::
Optional<AnimationData> - Animation.
-
auto animation(const std::
string& name) -> Containers:: Optional<AnimationData> new in 2020.06 - Animation for given name.
- auto lightCount() const -> UnsignedInt
- Light count.
-
auto lightForName(const std::
string& name) -> Int - Light ID for given name.
-
auto lightName(UnsignedInt id) -> std::
string - Light name.
-
auto light(UnsignedInt id) -> Containers::
Optional<LightData> - Light.
-
auto light(const std::
string& name) -> Containers:: Optional<LightData> new in 2020.06 - Light for given name.
- auto cameraCount() const -> UnsignedInt
- Camera count.
-
auto cameraForName(const std::
string& name) -> Int - Camera ID for given name.
-
auto cameraName(UnsignedInt id) -> std::
string - Camera name.
-
auto camera(UnsignedInt id) -> Containers::
Optional<CameraData> - Camera.
-
auto camera(const std::
string& name) -> Containers:: Optional<CameraData> new in 2020.06 - Camera for given name.
- auto object2DCount() const -> UnsignedInt
- Two-dimensional object count.
-
auto object2DForName(const std::
string& name) -> Int - Two-dimensional object ID for given name.
-
auto object2DName(UnsignedInt id) -> std::
string - Two-dimensional object name.
-
auto object2D(UnsignedInt id) -> Containers::
Pointer<ObjectData2D> - Two-dimensional object.
-
auto object2D(const std::
string& name) -> Containers:: Pointer<ObjectData2D> new in 2020.06 - Two-dimensional object for given name.
- auto object3DCount() const -> UnsignedInt
- Three-dimensional object count.
-
auto object3DForName(const std::
string& name) -> Int - Three-dimensional object ID for given name.
-
auto object3DName(UnsignedInt id) -> std::
string - Three-dimensional object name.
-
auto object3D(UnsignedInt id) -> Containers::
Pointer<ObjectData3D> - Three-dimensional object.
-
auto object3D(const std::
string& name) -> Containers:: Pointer<ObjectData3D> new in 2020.06 - Three-dimensional object for given name.
- auto skin2DCount() const -> UnsignedInt new in Git master
- Two-dimensional skin count.
-
auto skin2DForName(const std::
string& name) -> Int new in Git master - Two-dimensional skin ID for given name.
-
auto skin2DName(UnsignedInt id) -> std::
string new in Git master - Two-dimensional skin name.
-
auto skin2D(UnsignedInt id) -> Containers::
Optional<SkinData2D> new in Git master - Two-dimensional skin.
-
auto skin2D(const std::
string& name) -> Containers:: Optional<SkinData2D> new in Git master - Two-dimensional skin for given name.
- auto skin3DCount() const -> UnsignedInt new in Git master
- Three-dimensional skin count.
-
auto skin3DForName(const std::
string& name) -> Int new in Git master - Three-dimensional skin ID for given name.
-
auto skin3DName(UnsignedInt id) -> std::
string new in Git master - Three-dimensional skin name.
-
auto skin3D(UnsignedInt id) -> Containers::
Optional<SkinData3D> new in Git master - Three-dimensional skin.
-
auto skin3D(const std::
string& name) -> Containers:: Optional<SkinData3D> new in Git master - Three-dimensional object for given name.
- auto meshCount() const -> UnsignedInt new in 2020.06
- Mesh count.
- auto meshLevelCount(UnsignedInt id) -> UnsignedInt new in 2020.06
- Mesh level count.
-
auto meshForName(const std::
string& name) -> Int new in 2020.06 - Mesh ID for given name.
-
auto meshName(UnsignedInt id) -> std::
string new in 2020.06 - Mesh name.
-
auto mesh(UnsignedInt id,
UnsignedInt level = 0) -> Containers::
Optional<MeshData> new in 2020.06 - Mesh.
-
auto mesh(const std::
string& name, UnsignedInt level = 0) -> Containers:: Optional<MeshData> new in 2020.06 - Mesh for given name.
-
auto meshAttributeForName(const std::
string& name) -> MeshAttribute new in 2020.06 - Mesh attribute for given name.
-
auto meshAttributeName(MeshAttribute name) -> std::
string new in 2020.06 - String name for given custom mesh attribute.
- auto mesh2DCount() const -> UnsignedInt deprecated in 2020.06
- Two-dimensional mesh count.
-
auto mesh2DForName(const std::
string& name) -> Int deprecated in 2020.06 - Two-dimensional mesh ID for given name.
-
auto mesh2DName(UnsignedInt id) -> std::
string deprecated in 2020.06 - Two-dimensional mesh name.
-
auto mesh2D(UnsignedInt id) -> Containers::
Optional<MeshData2D> deprecated in 2020.06 - Two-dimensional mesh.
- auto mesh3DCount() const -> UnsignedInt deprecated in 2020.06
- Three-dimensional mesh count.
-
auto mesh3DForName(const std::
string& name) -> Int deprecated in 2020.06 - Three-dimensional mesh ID for given name.
-
auto mesh3DName(UnsignedInt id) -> std::
string deprecated in 2020.06 - Three-dimensional mesh name.
-
auto mesh3D(UnsignedInt id) -> Containers::
Optional<MeshData3D> deprecated in 2020.06 - Three-dimensional mesh.
- auto materialCount() const -> UnsignedInt
- Material count.
-
auto materialForName(const std::
string& name) -> Int - Material ID for given name.
-
auto materialName(UnsignedInt id) -> std::
string - Material name.
-
auto material(UnsignedInt id) -> Containers::
Optional<MaterialData> - Material.
-
auto material(const std::
string& name) -> Containers:: Optional<MaterialData> new in 2020.06 - Material for given name.
- auto textureCount() const -> UnsignedInt
- Texture count.
-
auto textureForName(const std::
string& name) -> Int - Texture ID for given name.
-
auto textureName(UnsignedInt id) -> std::
string - Texture name.
-
auto texture(UnsignedInt id) -> Containers::
Optional<TextureData> - Texture.
-
auto texture(const std::
string& name) -> Containers:: Optional<TextureData> new in 2020.06 - Texture for given name.
- auto image1DCount() const -> UnsignedInt
- One-dimensional image count.
- auto image1DLevelCount(UnsignedInt id) -> UnsignedInt new in 2020.06
- One-dimensional image mip level count.
-
auto image1DForName(const std::
string& name) -> Int - One-dimensional image ID for given name.
-
auto image1DName(UnsignedInt id) -> std::
string - One-dimensional image name.
-
auto image1D(UnsignedInt id,
UnsignedInt level = 0) -> Containers::
Optional<ImageData1D> - One-dimensional image.
-
auto image1D(const std::
string& name, UnsignedInt level = 0) -> Containers:: Optional<ImageData1D> new in 2020.06 - One-dimensional image for given name.
- auto image2DCount() const -> UnsignedInt
- Two-dimensional image count.
- auto image2DLevelCount(UnsignedInt id) -> UnsignedInt new in 2020.06
- Two-dimensional image mip level count.
-
auto image2DForName(const std::
string& name) -> Int - Two-dimensional image ID for given name.
-
auto image2DName(UnsignedInt id) -> std::
string - Two-dimensional image name.
-
auto image2D(UnsignedInt id,
UnsignedInt level = 0) -> Containers::
Optional<ImageData2D> - Two-dimensional image.
-
auto image2D(const std::
string& name, UnsignedInt level = 0) -> Containers:: Optional<ImageData2D> new in 2020.06 - Two-dimensional image for given name.
- auto image3DCount() const -> UnsignedInt
- Three-dimensional image count.
- auto image3DLevelCount(UnsignedInt id) -> UnsignedInt new in 2020.06
- Three-dimensional image mip level count.
-
auto image3DForName(const std::
string& name) -> Int - Three-dimensional image ID for given name.
-
auto image3DName(UnsignedInt id) -> std::
string - Three-dimensional image name.
-
auto image3D(UnsignedInt id,
UnsignedInt level = 0) -> Containers::
Optional<ImageData3D> - Three-dimensional image.
-
auto image3D(const std::
string& name, UnsignedInt level = 0) -> Containers:: Optional<ImageData3D> new in 2020.06 - Three-dimensional image for given name.
Typedef documentation
typedef ImporterFeature Magnum:: Trade:: AbstractImporter:: Feature
Features supported by an importer.
typedef ImporterFeatures Magnum:: Trade:: AbstractImporter:: Features
Set of features supported by an importer.
Function documentation
static std:: string Magnum:: Trade:: AbstractImporter:: pluginInterface()
Plugin interface.
"cz.mosra.magnum.Trade.AbstractImporter/0.3.3"
static std:: vector<std:: string> Magnum:: Trade:: AbstractImporter:: pluginSearchPaths()
Plugin search paths.
Looks into magnum/importers/
or magnum-d/importers/
next to the dynamic Trade library, next to the executable and elsewhere according to the rules documented in Corrade::MAGNUM_PLUGINS_DIR
CMake variables, see Downloading and building for more information.
Not defined on platforms without dynamic plugin support.
void Magnum:: Trade:: AbstractImporter:: setFlags(ImporterFlags flags) new in 2020.06
Set importer flags.
It's expected that this function is called before a file is opened. Some flags can be set only if the importer supports particular features, see documentation of each ImporterFlag for more information. By default no flags are set.
auto Magnum:: Trade:: AbstractImporter:: fileCallback()
File opening callback function.
void* Magnum:: Trade:: AbstractImporter:: fileCallbackUserData() const
File opening callback user data.
void Magnum:: Trade:: AbstractImporter:: setFileCallback(Containers:: Optional<Containers:: ArrayView<const char>>(*)(const std:: string&, InputFileCallbackPolicy, void*) callback,
void* userData = nullptr)
Set file opening callback.
In case the importer supports ImporterFeature::userData
pointer as input and returns a non-owning view on the loaded data as output or a Corrade::nullptr
can't be used to indicate a failure.
In case the importer doesn't support ImporterFeature::
In case callback
is nullptr
, the current callback (if any) is reset. This function expects that the importer supports either ImporterFeature::
It's expected that this function is called before a file is opened. It's also expected that the loaded data are kept in scope for as long as the importer needs them, based on the value of InputFileCallbackPolicy. Documentation of particular importers provides more information about the expected callback behavior.
Following is an example of setting up a file loading callback for fetching compiled-in resources from Corrade::
importer->setFileCallback([](const std::string& filename, InputFileCallbackPolicy, void*) { Utility::Resource rs{"data"}; return Containers::optional(rs.getRaw(filename)); });
template<class T>
void Magnum:: Trade:: AbstractImporter:: setFileCallback(Containers:: Optional<Containers:: ArrayView<const char>>(*)(const std:: string&, InputFileCallbackPolicy, T&) callback,
T& userData)
Set file opening callback.
Equivalent to calling the above with a lambda wrapper that casts void*
back to T*
and dereferences it in order to pass it to callback
. Example usage — this reuses an existing Corrade::
const Utility::Resource rs{"data"}; importer->setFileCallback([](const std::string& filename, InputFileCallbackPolicy, const Utility::Resource& rs) { return Containers::optional(rs.getRaw(filename)); }, rs);
bool Magnum:: Trade:: AbstractImporter:: openData(Containers:: ArrayView<const char> data)
Open raw data.
Closes previous file, if it was opened, and tries to open given raw data. Available only if ImporterFeature::true
on success, false
otherwise. The data
is not expected to be alive after the function exits.
bool Magnum:: Trade:: AbstractImporter:: openState(const void* state,
const std:: string& filePath = {})
Open already loaded state.
Parameters | |
---|---|
state | Pointer to importer-specific state |
filePath | Base file directory for opening external data like textures and materials. |
Closes previous file, if it was opened, and tries to open given state. Available only if ImporterFeature::true
on success, false
otherwise.
See documentation of a particular plugin for more information about type and contents of the state
parameter.
bool Magnum:: Trade:: AbstractImporter:: openFile(const std:: string& filename)
Open a file.
Closes previous file, if it was opened, and tries to open given file. Returns true
on success, false
otherwise. If file loading callbacks are set via setFileCallback() and ImporterFeature::
void Magnum:: Trade:: AbstractImporter:: close()
Close currently opened file.
On particular implementations an explicit call to this function may result in freed memory. This call is also done automatically when the importer gets destructed or when another file is opened.
const void* Magnum:: Trade:: AbstractImporter:: importerState() const
Plugin-specific access to internal importer state.
The importer might provide access to its internal data structures for currently opened document through this function. See documentation of a particular plugin for more information about returned type and contents. Returns nullptr
by default. Expects that a file is opened.
void Magnum:: Trade:: AbstractImporter:: doOpenFile(const std:: string& filename) virtual protected
Implementation for openFile()
If ImporterFeature::
This function is not called when file callbacks are set through setFileCallback() and ImporterFeature::
void Magnum:: Trade:: AbstractImporter:: doSetFlags(ImporterFlags flags) virtual private
Implementation for setFlags()
Useful when the importer needs to modify some internal state on flag setup. Default implementation does nothing and this function doesn't need to be implemented — the flags are available through flags().
To reduce the amount of error checking on user side, this function isn't expected to fail — if a flag combination is invalid / unsuported, error reporting should be delayed to openFile() and others, where the user is expected to do error handling anyway.
void Magnum:: Trade:: AbstractImporter:: doSetFileCallback(Containers:: Optional<Containers:: ArrayView<const char>>(*)(const std:: string&, InputFileCallbackPolicy, void*) callback,
void* userData) virtual private
Implementation for setFileCallback()
Useful when the importer needs to modify some internal state on callback setup. Default implementation does nothing and this function doesn't need to be implemented — the callback function and user data pointer are available through fileCallback() and fileCallbackUserData().
Int Magnum:: Trade:: AbstractImporter:: doDefaultScene() const virtual private
Implementation for defaultScene()
Default implementation returns -1
. This function isn't expected to fail — if an import error occus (for example because the default scene index is out of bounds), it should be handled already during file opening.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doSceneCount() const virtual private
Implementation for sceneCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doScene() (with correct scene count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doSceneForName(const std:: string& name) virtual private
Implementation for sceneForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doSceneName(UnsignedInt id) virtual private
Implementation for sceneName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doAnimationCount() const virtual private
Implementation for animationCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doAnimation() (with correct animation count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doAnimationForName(const std:: string& name) virtual private
Implementation for animationForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doAnimationName(UnsignedInt id) virtual private
Implementation for animationName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doLightCount() const virtual private
Implementation for lightCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doLight() (with correct light count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doLightForName(const std:: string& name) virtual private
Implementation for lightForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doLightName(UnsignedInt id) virtual private
Implementation for lightName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doCameraCount() const virtual private
Implementation for cameraCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doCamera() (with correct camera count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doCameraForName(const std:: string& name) virtual private
Implementation for cameraForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doCameraName(UnsignedInt id) virtual private
Implementation for cameraName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doObject2DCount() const virtual private
Implementation for object2DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doObject2D() (with correct object count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doObject2DForName(const std:: string& name) virtual private
Implementation for object2DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doObject2DName(UnsignedInt id) virtual private
Implementation for object2DName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doObject3DCount() const virtual private
Implementation for object3DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doObject3D() (with correct object count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doObject3DForName(const std:: string& name) virtual private
Implementation for object3DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doObject3DName(UnsignedInt id) virtual private
Implementation for object3DName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doSkin2DCount() const virtual private new in Git master
Implementation for skin2DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doSkin2D() (with correct skin count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doSkin2DForName(const std:: string& name) virtual private new in Git master
Implementation for skin2DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doSkin2DName(UnsignedInt id) virtual private new in Git master
Implementation for skin2DName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doSkin3DCount() const virtual private new in Git master
Implementation for skin3DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doSkin3D() (with correct skin count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doSkin3DForName(const std:: string& name) virtual private new in Git master
Implementation for skin3DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doSkin3DName(UnsignedInt id) virtual private new in Git master
Implementation for skin3DName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doMeshCount() const virtual private new in 2020.06
Implementation for meshCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doMesh() (with correct mesh count reported), and if not possible, already during file opening.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doMeshLevelCount(UnsignedInt id) virtual private new in 2020.06
Implementation for meshLevelCount()
Default implementation returns 1
. Similarly to all other *Count()
functions, this function isn't expected to fail — if an import error occus, this function should return 1
and the error state should be returned from mesh() instead.
Deliberately not const
to allow plugins cache decoded data.
Int Magnum:: Trade:: AbstractImporter:: doMeshForName(const std:: string& name) virtual private new in 2020.06
Implementation for meshForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doMeshName(UnsignedInt id) virtual private new in 2020.06
Implementation for meshName()
Default implementation returns an empty string.
MeshAttribute Magnum:: Trade:: AbstractImporter:: doMeshAttributeForName(const std:: string& name) virtual private new in 2020.06
Implementation for meshAttributeForName()
Default implementation returns an invalid (zero) value.
std:: string Magnum:: Trade:: AbstractImporter:: doMeshAttributeName(UnsignedShort name) virtual private new in 2020.06
Implementation for meshAttributeName()
Receives the custom ID extracted via meshAttributeCustom(MeshAttribute). Default implementation returns an empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doMesh2DCount() const virtual private
Implementation for mesh2DCount()
Default implementation returns 0
. There weren't any importers in existence known to implement 2D mesh import, so unlike doMesh3DCount() this function doesn't delegate to doMeshCount().
Int Magnum:: Trade:: AbstractImporter:: doMesh2DForName(const std:: string& name) virtual private
Implementation for mesh2DForName()
Default implementation returns -1
. There weren't any importers in existence known to implement 2D mesh import, so unlike doMesh3DForName() this function doesn't delegate to doMeshForName().
std:: string Magnum:: Trade:: AbstractImporter:: doMesh2DName(UnsignedInt id) virtual private
Implementation for mesh2DName()
Default implementation returns empty string. There weren't any importers in existence known to implement 2D mesh import, so unlike doMesh3DName() this function doesn't delegate to doMeshName().
Containers:: Optional<MeshData2D> Magnum:: Trade:: AbstractImporter:: doMesh2D(UnsignedInt id) virtual private
Implementation for mesh2D()
There weren't any importers in existence known to implement 2D mesh import, so unlike doMesh3D() this function doesn't delegate to doMesh().
UnsignedInt Magnum:: Trade:: AbstractImporter:: doMesh3DCount() const virtual private
Implementation for mesh3DCount()
Default implementation returns doMeshCount() for backwards compatibility.
Int Magnum:: Trade:: AbstractImporter:: doMesh3DForName(const std:: string& name) virtual private
Implementation for mesh3DForName()
Default implementation returns doMeshForName() for backwards compatibility.
std:: string Magnum:: Trade:: AbstractImporter:: doMesh3DName(UnsignedInt id) virtual private
Implementation for mesh3DName()
Default implementation returns doMeshName() for backwards compatibility.
Containers:: Optional<MeshData3D> Magnum:: Trade:: AbstractImporter:: doMesh3D(UnsignedInt id) virtual private
Implementation for mesh3D()
Default implementation returns doMesh() converted to MeshData3D
for backwards compatibility.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doMaterialCount() const virtual private
Implementation for materialCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doMaterial() (with correct material count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doMaterialForName(const std:: string& name) virtual private
Implementation for materialForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doMaterialName(UnsignedInt id) virtual private
Implementation for materialName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doTextureCount() const virtual private
Implementation for textureCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doTexture() (with correct texture count reported), and if not possible, already during file opening.
Int Magnum:: Trade:: AbstractImporter:: doTextureForName(const std:: string& name) virtual private
Implementation for textureForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doTextureName(UnsignedInt id) virtual private
Implementation for textureName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doImage1DCount() const virtual private
Implementation for image1DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doImage1D() (with correct image count reported), and if not possible, already during file opening.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doImage1DLevelCount(UnsignedInt id) virtual private new in 2020.06
Implementation for image1DLevelCount()
Default implementation returns 1
. See doImage2DLevelCount() for expected implementation behavior.
Int Magnum:: Trade:: AbstractImporter:: doImage1DForName(const std:: string& name) virtual private
Implementation for image1DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doImage1DName(UnsignedInt id) virtual private
Implementation for image1DName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doImage2DCount() const virtual private
Implementation for image2DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doImage2D() (with correct image count reported), and if not possible, already during file opening.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doImage2DLevelCount(UnsignedInt id) virtual private new in 2020.06
Implementation for image2DLevelCount()
Default implementation returns 1
. Similarly to all other *Count()
functions, this function isn't expected to fail — if an import error occus, this function should return 1
and the error state should be returned from image2D() instead; if a file really contains a zero-level image, the implementation should exclude that image from doImage2DCount() instead of returning 0
here.
Deliberately not const
to allow plugins cache decoded data.
Int Magnum:: Trade:: AbstractImporter:: doImage2DForName(const std:: string& name) virtual private
Implementation for image2DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doImage2DName(UnsignedInt id) virtual private
Implementation for image2DName()
Default implementation returns empty string.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doImage3DCount() const virtual private
Implementation for image3DCount()
Default implementation returns 0
. This function isn't expected to fail — if an import error occus, it should be handled preferrably during doImage3D() (with correct image count reported), and if not possible, already during file opening.
UnsignedInt Magnum:: Trade:: AbstractImporter:: doImage3DLevelCount(UnsignedInt id) virtual private new in 2020.06
Implementation for image3DLevelCount()
Default implementation returns 1
. See doImage2DLevelCount() for expected implementation behavior.
Int Magnum:: Trade:: AbstractImporter:: doImage3DForName(const std:: string& name) virtual private
Implementation for image3DForName()
Default implementation returns -1
.
std:: string Magnum:: Trade:: AbstractImporter:: doImage3DName(UnsignedInt id) virtual private
Implementation for image3DName()
Default implementation returns empty string.
Int Magnum:: Trade:: AbstractImporter:: defaultScene() const
Default scene.
When there is more than one scene, returns ID of the default one. If there is no default scene, returns -1
. Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: sceneCount() const
Scene count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: sceneForName(const std:: string& name)
Scene ID for given name.
If no scene for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: sceneName(UnsignedInt id)
Scene name.
Parameters | |
---|---|
id | Scene ID, from range [0, sceneCount()). |
Expects that a file is opened.
Containers:: Optional<SceneData> Magnum:: Trade:: AbstractImporter:: scene(UnsignedInt id)
Scene.
Parameters | |
---|---|
id | Scene ID, from range [0, sceneCount()). |
Returns given scene or Containers::
Containers:: Optional<SceneData> Magnum:: Trade:: AbstractImporter:: scene(const std:: string& name) new in 2020.06
Scene for given name.
A convenience API combining sceneForName() and scene(UnsignedInt). If sceneForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: animationCount() const
Animation count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: animationForName(const std:: string& name)
Animation ID for given name.
If no animation for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: animationName(UnsignedInt id)
Animation name.
Parameters | |
---|---|
id | Animation ID, from range [0, animationCount()). |
Expects that a file is opened.
Containers:: Optional<AnimationData> Magnum:: Trade:: AbstractImporter:: animation(UnsignedInt id)
Animation.
Parameters | |
---|---|
id | Animation ID, from range [0, animationCount()). |
Returns given animation or Containers::
Containers:: Optional<AnimationData> Magnum:: Trade:: AbstractImporter:: animation(const std:: string& name) new in 2020.06
Animation for given name.
A convenience API combining animationForName() and animation(UnsignedInt). If animationForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: lightCount() const
Light count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: lightForName(const std:: string& name)
Light ID for given name.
If no light for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: lightName(UnsignedInt id)
Light name.
Parameters | |
---|---|
id | Light ID, from range [0, lightCount()). |
Expects that a file is opened.
Containers:: Optional<LightData> Magnum:: Trade:: AbstractImporter:: light(UnsignedInt id)
Light.
Parameters | |
---|---|
id | Light ID, from range [0, lightCount()). |
Returns given light or Containers::
Containers:: Optional<LightData> Magnum:: Trade:: AbstractImporter:: light(const std:: string& name) new in 2020.06
Light for given name.
A convenience API combining lightForName() and light(UnsignedInt). If lightForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: cameraCount() const
Camera count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: cameraForName(const std:: string& name)
Camera ID for given name.
If no camera for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: cameraName(UnsignedInt id)
Camera name.
Parameters | |
---|---|
id | Camera ID, from range [0, cameraCount()). |
Expects that a file is opened.
Containers:: Optional<CameraData> Magnum:: Trade:: AbstractImporter:: camera(UnsignedInt id)
Camera.
Parameters | |
---|---|
id | Camera ID, from range [0, cameraCount()). |
Returns given camera or Containers::
Containers:: Optional<CameraData> Magnum:: Trade:: AbstractImporter:: camera(const std:: string& name) new in 2020.06
Camera for given name.
A convenience API combining cameraForName() and camera(UnsignedInt). If cameraForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: object2DCount() const
Two-dimensional object count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: object2DForName(const std:: string& name)
Two-dimensional object ID for given name.
If no object for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: object2DName(UnsignedInt id)
Two-dimensional object name.
Parameters | |
---|---|
id | Object ID, from range [0, object2DCount()). |
Expects that a file is opened.
Containers:: Pointer<ObjectData2D> Magnum:: Trade:: AbstractImporter:: object2D(UnsignedInt id)
Two-dimensional object.
Parameters | |
---|---|
id | Object ID, from range [0, object2DCount()). |
Returns given object or nullptr
if importing failed. Expects that a file is opened.
Containers:: Pointer<ObjectData2D> Magnum:: Trade:: AbstractImporter:: object2D(const std:: string& name) new in 2020.06
Two-dimensional object for given name.
A convenience API combining object2DForName() and object2D(UnsignedInt). If object2DForName() returns -1
, prints an error message and returns nullptr
, otherwise propagates the result from object2D(UnsignedInt). Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: object3DCount() const
Three-dimensional object count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: object3DForName(const std:: string& name)
Three-dimensional object ID for given name.
If no object for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: object3DName(UnsignedInt id)
Three-dimensional object name.
Parameters | |
---|---|
id | Object ID, from range [0, object3DCount()). |
Expects that a file is opened.
Containers:: Pointer<ObjectData3D> Magnum:: Trade:: AbstractImporter:: object3D(UnsignedInt id)
Three-dimensional object.
Parameters | |
---|---|
id | Object ID, from range [0, object3DCount()). |
Returns given object or nullptr
if importing failed. Expects that a file is opened.
Containers:: Pointer<ObjectData3D> Magnum:: Trade:: AbstractImporter:: object3D(const std:: string& name) new in 2020.06
Three-dimensional object for given name.
A convenience API combining object3DForName() and object3D(UnsignedInt). If object3DForName() returns -1
, prints an error message and returns nullptr
, otherwise propagates the result from object3D(UnsignedInt). Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: skin2DCount() const new in Git master
Two-dimensional skin count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: skin2DForName(const std:: string& name) new in Git master
Two-dimensional skin ID for given name.
If no skin for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: skin2DName(UnsignedInt id) new in Git master
Two-dimensional skin name.
Parameters | |
---|---|
id | Skin ID, from range [0, skin2DCount()). |
Expects that a file is opened.
Containers:: Optional<SkinData2D> Magnum:: Trade:: AbstractImporter:: skin2D(UnsignedInt id) new in Git master
Two-dimensional skin.
Parameters | |
---|---|
id | Skin ID, from range [0, skin2DCount()). |
Returns given skin or Containers::
Containers:: Optional<SkinData2D> Magnum:: Trade:: AbstractImporter:: skin2D(const std:: string& name) new in Git master
Two-dimensional skin for given name.
A convenience API combining skin2DForName() and skin2D(UnsignedInt). If skin2DForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: skin3DCount() const new in Git master
Three-dimensional skin count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: skin3DForName(const std:: string& name) new in Git master
Three-dimensional skin ID for given name.
If no skin for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: skin3DName(UnsignedInt id) new in Git master
Three-dimensional skin name.
Parameters | |
---|---|
id | Skin ID, from range [0, skin3DCount()). |
Expects that a file is opened.
Containers:: Optional<SkinData3D> Magnum:: Trade:: AbstractImporter:: skin3D(UnsignedInt id) new in Git master
Three-dimensional skin.
Parameters | |
---|---|
id | Skin ID, from range [0, skin3DCount()). |
Returns given skin or Containers::
Containers:: Optional<SkinData3D> Magnum:: Trade:: AbstractImporter:: skin3D(const std:: string& name) new in Git master
Three-dimensional object for given name.
A convenience API combining skin3DForName() and skin3D(UnsignedInt). If skin3DForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: meshCount() const new in 2020.06
Mesh count.
Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: meshLevelCount(UnsignedInt id) new in 2020.06
Mesh level count.
Parameters | |
---|---|
id | Mesh ID, from range [0, meshCount()). |
Always returns at least one level, import failures are deferred to mesh(). Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: meshForName(const std:: string& name) new in 2020.06
Mesh ID for given name.
If no mesh for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: meshName(UnsignedInt id) new in 2020.06
Mesh name.
Parameters | |
---|---|
id | Mesh ID, from range [0, meshCount()). |
Expects that a file is opened.
Containers:: Optional<MeshData> Magnum:: Trade:: AbstractImporter:: mesh(UnsignedInt id,
UnsignedInt level = 0) new in 2020.06
Mesh.
Parameters | |
---|---|
id | Mesh ID, from range [0, meshCount()). |
level | Mesh level, from range [0, meshLevelCount()) |
Returns given mesh or Containers::level
parameter allows access to additional data and is largely left as importer-specific — for example allowing access to per-instance, per-face or per-edge data. Expects that a file is opened.
Containers:: Optional<MeshData> Magnum:: Trade:: AbstractImporter:: mesh(const std:: string& name,
UnsignedInt level = 0) new in 2020.06
Mesh for given name.
A convenience API combining meshForName() and mesh(UnsignedInt, UnsignedInt). If meshForName() returns -1
, prints an error message and returns Containers::
MeshAttribute Magnum:: Trade:: AbstractImporter:: meshAttributeForName(const std:: string& name) new in 2020.06
Mesh attribute for given name.
If the name is not recognized, returns a zero (invalid) MeshAttribute, otherwise returns a custom mesh attribute. Note that the value returned by this function may depend on whether a file is opened or not and also be different for different files — see documentation of a particular importer for more information.
std:: string Magnum:: Trade:: AbstractImporter:: meshAttributeName(MeshAttribute name) new in 2020.06
String name for given custom mesh attribute.
Given a custom name
returned by mesh() in a MeshData, returns a string identifier. If a string representation is not available or name
is not recognized, returns an empty string. Expects that name
is custom. Note that the value returned by this function may depend on whether a file is opened or not and also be different for different files — see documentation of a particular importer for more information.
UnsignedInt Magnum:: Trade:: AbstractImporter:: mesh2DCount() const
Two-dimensional mesh count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: mesh2DForName(const std:: string& name)
Two-dimensional mesh ID for given name.
If no mesh for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: mesh2DName(UnsignedInt id)
Two-dimensional mesh name.
Parameters | |
---|---|
id | Mesh ID, from range [0, mesh2DCount()). |
Expects that a file is opened.
Containers:: Optional<MeshData2D> Magnum:: Trade:: AbstractImporter:: mesh2D(UnsignedInt id)
Two-dimensional mesh.
Parameters | |
---|---|
id | Mesh ID, from range [0, mesh2DCount()). |
Returns given mesh or Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: mesh3DCount() const
Three-dimensional mesh count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: mesh3DForName(const std:: string& name)
Three-dimensional mesh ID for given name.
If no mesh for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: mesh3DName(UnsignedInt id)
Three-dimensional mesh name.
Parameters | |
---|---|
id | Mesh ID, from range [0, mesh3DCount()). |
Expects that a file is opened.
Containers:: Optional<MeshData3D> Magnum:: Trade:: AbstractImporter:: mesh3D(UnsignedInt id)
Three-dimensional mesh.
Parameters | |
---|---|
id | Mesh ID, from range [0, mesh3DCount()). |
Returns given mesh or Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: materialCount() const
Material count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: materialForName(const std:: string& name)
Material ID for given name.
If no material for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: materialName(UnsignedInt id)
Material name.
Parameters | |
---|---|
id | Material ID, from range [0, materialCount()). |
Expects that a file is opened.
Containers:: Optional<MaterialData> Magnum:: Trade:: AbstractImporter:: material(UnsignedInt id)
Material.
Parameters | |
---|---|
id | Material ID, from range [0, materialCount()). |
Returns given material or Containers::
Containers:: Optional<MaterialData> Magnum:: Trade:: AbstractImporter:: material(const std:: string& name) new in 2020.06
Material for given name.
A convenience API combining materialForName() and material(UnsignedInt). If materialForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: textureCount() const
Texture count.
Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: textureForName(const std:: string& name)
Texture ID for given name.
If no texture for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: textureName(UnsignedInt id)
Texture name.
Parameters | |
---|---|
id | Texture ID, from range [0, textureCount()). |
Expects that a file is opened.
Containers:: Optional<TextureData> Magnum:: Trade:: AbstractImporter:: texture(UnsignedInt id)
Texture.
Parameters | |
---|---|
id | Texture ID, from range [0, textureCount()). |
Returns given texture or Containers::
Containers:: Optional<TextureData> Magnum:: Trade:: AbstractImporter:: texture(const std:: string& name) new in 2020.06
Texture for given name.
A convenience API combining textureForName() and texture(UnsignedInt). If textureForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: image1DCount() const
One-dimensional image count.
Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: image1DLevelCount(UnsignedInt id) new in 2020.06
One-dimensional image mip level count.
Parameters | |
---|---|
id | Image ID, from range [0, image1DCount()) |
Always returns at least one level, import failures are deferred to image1D(). Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: image1DForName(const std:: string& name)
One-dimensional image ID for given name.
If no image for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: image1DName(UnsignedInt id)
One-dimensional image name.
Parameters | |
---|---|
id | Image ID, from range [0, image1DCount()). |
Expects that a file is opened.
Containers:: Optional<ImageData1D> Magnum:: Trade:: AbstractImporter:: image1D(UnsignedInt id,
UnsignedInt level = 0)
One-dimensional image.
Parameters | |
---|---|
id | Image ID, from range [0, image1DCount()). |
level | Mip level, from range [0, image1DLevelCount()) |
Returns given image or Containers::
Containers:: Optional<ImageData1D> Magnum:: Trade:: AbstractImporter:: image1D(const std:: string& name,
UnsignedInt level = 0) new in 2020.06
One-dimensional image for given name.
A convenience API combining image1DForName() and image1D(UnsignedInt, UnsignedInt). If image1DForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: image2DCount() const
Two-dimensional image count.
Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: image2DLevelCount(UnsignedInt id) new in 2020.06
Two-dimensional image mip level count.
Parameters | |
---|---|
id | Image ID, from range [0, image2DCount()). |
Always returns at least one level, import failures are deferred to image2D(). Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: image2DForName(const std:: string& name)
Two-dimensional image ID for given name.
If no image for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: image2DName(UnsignedInt id)
Two-dimensional image name.
Parameters | |
---|---|
id | Image ID, from range [0, image2DCount()). |
Expects that a file is opened.
Containers:: Optional<ImageData2D> Magnum:: Trade:: AbstractImporter:: image2D(UnsignedInt id,
UnsignedInt level = 0)
Two-dimensional image.
Parameters | |
---|---|
id | Image ID, from range [0, image2DCount()). |
level | Mip level, from range [0, image2DLevelCount()) |
Returns given image or Containers::
Containers:: Optional<ImageData2D> Magnum:: Trade:: AbstractImporter:: image2D(const std:: string& name,
UnsignedInt level = 0) new in 2020.06
Two-dimensional image for given name.
A convenience API combining image2DForName() and image2D(UnsignedInt, UnsignedInt). If image2DForName() returns -1
, prints an error message and returns Containers::
UnsignedInt Magnum:: Trade:: AbstractImporter:: image3DCount() const
Three-dimensional image count.
Expects that a file is opened.
UnsignedInt Magnum:: Trade:: AbstractImporter:: image3DLevelCount(UnsignedInt id) new in 2020.06
Three-dimensional image mip level count.
Parameters | |
---|---|
id | Image ID, from range [0, image3DCount()) |
Always returns at least one level, import failures are deferred to image3D(). Expects that a file is opened.
Int Magnum:: Trade:: AbstractImporter:: image3DForName(const std:: string& name)
Three-dimensional image ID for given name.
If no image for given name exists, returns -1
. Expects that a file is opened.
std:: string Magnum:: Trade:: AbstractImporter:: image3DName(UnsignedInt id)
Three-dimensional image name.
Parameters | |
---|---|
id | Image ID, from range [0, image3DCount()). |
Expects that a file is opened.
Containers:: Optional<ImageData3D> Magnum:: Trade:: AbstractImporter:: image3D(UnsignedInt id,
UnsignedInt level = 0)
Three-dimensional image.
Parameters | |
---|---|
id | Image ID, from range [0, image3DCount()). |
level | Mip level, from range [0, image3DLevelCount()) |
Returns given image or Containers::
Containers:: Optional<ImageData3D> Magnum:: Trade:: AbstractImporter:: image3D(const std:: string& name,
UnsignedInt level = 0) new in 2020.06
Three-dimensional image for given name.
A convenience API combining image3DForName() and image3D(UnsignedInt, UnsignedInt). If image3DForName() returns -1
, prints an error message and returns Containers::