You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
282 lines
12 KiB
282 lines
12 KiB
.. |
|
This file is part of Magnum. |
|
|
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
|
2020, 2021, 2022 Vladimír Vondruš <mosra@centrum.cz> |
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a |
|
copy of this software and associated documentation files (the "Software"), |
|
to deal in the Software without restriction, including without limitation |
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
and/or sell copies of the Software, and to permit persons to whom the |
|
Software is furnished to do so, subject to the following conditions: |
|
|
|
The above copyright notice and this permission notice shall be included |
|
in all copies or substantial portions of the Software. |
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
DEALINGS IN THE SOFTWARE. |
|
.. |
|
|
|
.. py:class:: magnum.trade.ImageData1D |
|
|
|
See :ref:`ImageData2D` for more information. |
|
|
|
.. py:class:: magnum.trade.ImageData2D |
|
|
|
Similarly to :ref:`Image2D`, holds its own data buffer, thus doesn't have |
|
an equivalent to :ref:`ImageView2D.owner`. Implicitly convertible to |
|
:ref:`ImageView2D` / :ref:`MutableImageView2D`, so all APIs consuming image |
|
views work with this type as well. |
|
|
|
.. py:class:: magnum.trade.ImageData3D |
|
|
|
See :ref:`ImageData2D` for more information. |
|
|
|
.. py:property:: magnum.trade.ImageData1D.storage |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData2D.storage |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData3D.storage |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
|
|
.. py:property:: magnum.trade.ImageData1D.format |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData2D.format |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData3D.format |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
|
|
.. py:property:: magnum.trade.ImageData1D.pixel_size |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData2D.pixel_size |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData3D.pixel_size |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
|
|
.. py:property:: magnum.trade.ImageData1D.pixels |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData2D.pixels |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
.. py:property:: magnum.trade.ImageData3D.pixels |
|
:raise AttributeError: If :ref:`is_compressed` is :py:`True` |
|
|
|
.. py:class:: magnum.trade.MeshData |
|
|
|
Compared to the C++ API, there's no |
|
:dox:`Trade::MeshData::findAttributeId()`, the desired workflow is instead |
|
calling :ref:`attribute_id()` and catching an exception if not found. |
|
|
|
.. py:property:: magnum.trade.MeshData.mutable_index_data |
|
:raise AttributeError: If :ref:`index_data_flags` doesn't contain |
|
:ref:`DataFlag.MUTABLE` |
|
.. py:property:: magnum.trade.MeshData.mutable_vertex_data |
|
:raise AttributeError: If :ref:`vertex_data_flags` doesn't contain |
|
:ref:`DataFlag.MUTABLE` |
|
.. py:property:: magnum.trade.MeshData.index_count |
|
:raise AttributeError: If :ref:`is_indexed` is :py:`False` |
|
.. py:property:: magnum.trade.MeshData.index_type |
|
:raise AttributeError: If :ref:`is_indexed` is :py:`False` |
|
.. py:property:: magnum.trade.MeshData.index_offset |
|
:raise AttributeError: If :ref:`is_indexed` is :py:`False` |
|
.. py:property:: magnum.trade.MeshData.index_stride |
|
:raise AttributeError: If :ref:`is_indexed` is :py:`False` |
|
.. py:function:: magnum.trade.MeshData.attribute_name |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` |
|
.. py:function:: magnum.trade.MeshData.attribute_id |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` |
|
:raise KeyError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` for :p:`name` |
|
.. py:function:: magnum.trade.MeshData.attribute_format |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` |
|
:raise KeyError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` for :p:`name` |
|
.. py:function:: magnum.trade.MeshData.attribute_offset |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` |
|
:raise KeyError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` for :p:`name` |
|
.. py:function:: magnum.trade.MeshData.attribute_stride |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` |
|
:raise KeyError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` for :p:`name` |
|
.. py:function:: magnum.trade.MeshData.attribute_array_size |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` |
|
:raise KeyError: If :p:`id` is negative or not less than |
|
:ref:`attribute_count()` for :p:`name` |
|
|
|
.. py:class:: magnum.trade.ImporterManager |
|
:summary: Manager for :ref:`AbstractImporter` plugin instances |
|
|
|
Each plugin returned by :ref:`instantiate()` or :ref:`load_and_instantiate()` |
|
references its owning :ref:`ImporterManager` through |
|
:ref:`AbstractImporter.manager`, ensuring the manager is not deleted before |
|
the plugin instances are. |
|
|
|
.. py:class:: magnum.trade.AbstractImporter |
|
|
|
Similarly to C++, importer plugins are loaded through :ref:`ImporterManager`: |
|
|
|
.. |
|
>>> from magnum import trade |
|
|
|
.. code:: py |
|
|
|
>>> manager = trade.ImporterManager() |
|
>>> importer = manager.load_and_instantiate('PngImporter') |
|
|
|
Unlike C++, errors in both API usage and file parsing are reported by |
|
raising an exception. See particular function documentation for detailed |
|
behavior. |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.open_data |
|
:raise RuntimeError: If file opening fails |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.open_file |
|
:raise RuntimeError: If file opening fails |
|
|
|
.. py:property:: magnum.trade.AbstractImporter.mesh_count |
|
:raise AssertionError: If no file is opened |
|
.. py:function:: magnum.trade.AbstractImporter.mesh_level_count |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than :ref:`mesh_count` |
|
.. py:function:: magnum.trade.AbstractImporter.mesh_for_name |
|
:raise AssertionError: If no file is opened |
|
.. py:function:: magnum.trade.AbstractImporter.mesh_name |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than :ref:`mesh_count` |
|
|
|
.. TODO this needs distinction by parameter names, at least |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.mesh |
|
:raise AssertionError: If no file is opened |
|
:raise RuntimeError: If mesh import fails |
|
:raise IndexError: If :p:`id` is negative or not less than :ref:`mesh_count` |
|
:raise KeyError: If :p:`name` was not found |
|
|
|
.. py:property:: magnum.trade.AbstractImporter.image1d_count |
|
:raise AssertionError: If no file is opened |
|
.. py:property:: magnum.trade.AbstractImporter.image2d_count |
|
:raise AssertionError: If no file is opened |
|
.. py:property:: magnum.trade.AbstractImporter.image3d_count |
|
:raise AssertionError: If no file is opened |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.image1d_level_count |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image1d_count` |
|
.. py:function:: magnum.trade.AbstractImporter.image2d_level_count |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image2d_count` |
|
.. py:function:: magnum.trade.AbstractImporter.image3d_level_count |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image3d_count` |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.image1d_for_name |
|
:raise AssertionError: If no file is opened |
|
.. py:function:: magnum.trade.AbstractImporter.image2d_for_name |
|
:raise AssertionError: If no file is opened |
|
.. py:function:: magnum.trade.AbstractImporter.image3d_for_name |
|
:raise AssertionError: If no file is opened |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.image1d_name |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image1d_count` |
|
.. py:function:: magnum.trade.AbstractImporter.image2d_name |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image2d_count` |
|
.. py:function:: magnum.trade.AbstractImporter.image3d_name |
|
:raise AssertionError: If no file is opened |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image3d_count` |
|
|
|
.. TODO this needs distinction by parameter names, at least |
|
|
|
.. py:function:: magnum.trade.AbstractImporter.image1d |
|
:raise AssertionError: If no file is opened |
|
:raise RuntimeError: If image import fails |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image1d_count` |
|
:raise KeyError: If :p:`name` was not found |
|
.. py:function:: magnum.trade.AbstractImporter.image2d |
|
:raise AssertionError: If no file is opened |
|
:raise RuntimeError: If image import fails |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image2d_count` |
|
:raise KeyError: If :p:`name` was not found |
|
.. py:function:: magnum.trade.AbstractImporter.image3d |
|
:raise AssertionError: If no file is opened |
|
:raise RuntimeError: If image import fails |
|
:raise IndexError: If :p:`id` is negative or not less than |
|
:ref:`image3d_count` |
|
:raise KeyError: If :p:`name` was not found |
|
|
|
.. py:class:: magnum.trade.ImageConverterManager |
|
:summary: Manager for :ref:`AbstractImageConverter` plugin instances |
|
|
|
Each plugin returned by :ref:`instantiate()` or :ref:`load_and_instantiate()` |
|
references its owning :ref:`ImageConverterManager` through |
|
:ref:`AbstractImageConverter.manager`, ensuring the manager is not deleted |
|
before the plugin instances are. |
|
|
|
.. py:class:: magnum.trade.AbstractImageConverter |
|
|
|
Similarly to C++, image converter plugins are loaded through |
|
:ref:`ImageConverterManager`: |
|
|
|
.. |
|
>>> from magnum import trade |
|
|
|
.. code:: py |
|
|
|
>>> manager = trade.ImageConverterManager() |
|
>>> converter = manager.load_and_instantiate('PngImageConverter') |
|
|
|
Unlike C++, errors in both API usage and file parsing are reported by |
|
raising an exception. See particular function documentation for detailed |
|
behavior. |
|
|
|
.. py:function:: magnum.trade.AbstractImageConverter.convert_to_file |
|
:raise RuntimeError: If image conversion fails |
|
|
|
.. py:class:: magnum.trade.SceneConverterManager |
|
:summary: Manager for :ref:`AbstractSceneConverter` plugin instances |
|
|
|
Each plugin returned by :ref:`instantiate()` or :ref:`load_and_instantiate()` |
|
references its owning :ref:`SceneConverterManager` through |
|
:ref:`AbstractSceneConverter.manager`, ensuring the manager is not deleted |
|
before the plugin instances are. |
|
|
|
.. py:class:: magnum.trade.AbstractSceneConverter |
|
|
|
Similarly to C++, image converter plugins are loaded through |
|
:ref:`SceneConverterManager`: |
|
|
|
.. |
|
>>> from magnum import trade |
|
|
|
.. code:: py |
|
|
|
>>> manager = trade.SceneConverterManager() |
|
>>> converter = manager.load_and_instantiate('StanfordSceneConverter') |
|
|
|
Unlike C++, errors in both API usage and file parsing are reported by |
|
raising an exception. See particular function documentation for detailed |
|
behavior. |
|
|
|
.. py:function:: magnum.trade.AbstractSceneConverter.convert_to_file |
|
:raise RuntimeError: If scene conversion fails
|
|
|