Add content_type attribute that takes a MIME type to specify the file contents for meshes, hfields, and textures.
PiperOrigin-RevId: 549302344 Change-Id: I30a8adfef5b5d87bb20479329f3396892f5137ff
This commit is contained in:
committed by
Copybara-Service
parent
5f327b0c31
commit
5fcdae771b
+29
-5
@@ -2081,7 +2081,10 @@ This adds an element to the tuple.
|
||||
|
||||
This is a grouping element for defining assets. It does not have attributes. Assets are created in the model so that
|
||||
they can be referenced from other model elements; recall the discussion of :ref:`Assets <Assets>` in the Overview
|
||||
chapter.
|
||||
chapter. Assets opened from a file can be identified in two different ways: filename extensions or the ``content_type``
|
||||
attribute. MuJoCo will attempt to open a file specified by the content type provided, and only defaults to the filename
|
||||
extension if no ``content_type`` attribute is specified. The content type is ignored if the asset isn't loaded from a
|
||||
file.
|
||||
|
||||
|
||||
.. _asset-texture:
|
||||
@@ -2097,8 +2100,8 @@ chapter.
|
||||
textures. Alternatively the data can be generated by the compiler as a procedural texture. Because different texture
|
||||
types require different parameters, only a subset of the attributes below are used for any given texture.
|
||||
| MuJoCo 2.0 introduced a second file format for loading textures, in addition to PNG. If the file name extension is
|
||||
different from .png or .PNG, MuJoCo assumes that the texture is in the new format. This is a custom binary file
|
||||
format, containing the following data:
|
||||
different from .png or .PNG, or if the ``content_type`` attribute is set to ``image/vnd.mujoco.texture``, then MuJoCo
|
||||
assumes that the texture is in the new format. This is a custom binary file format, containing the following data:
|
||||
|
||||
.. code:: Text
|
||||
|
||||
@@ -2153,6 +2156,13 @@ chapter.
|
||||
texrepeat attribute of :ref:`material <asset-material>`. The data can be loaded from a singlefile or created
|
||||
procedurally.
|
||||
|
||||
.. _asset-texture-content_type:
|
||||
|
||||
:at:`content_type`: :at-val:`string, optional`
|
||||
If the file attribute is specified, then this sets the `MIME <https://en.wikipedia.org/wiki/MIME>`_ type of the file
|
||||
to be loaded. Any filename extensions will be ignored. Currently ``image/png`` and ``image/vnd.mujoco.texture`` are
|
||||
supported.
|
||||
|
||||
.. _asset-texture-file:
|
||||
|
||||
:at:`file`: :at-val:`string, optional`
|
||||
@@ -2335,6 +2345,13 @@ also known as terrain map, is a 2D matrix of elevation data. The data can be spe
|
||||
Name of the height field, used for referencing. If the name is omitted and a file name is specified, the height field
|
||||
name equals the file name without the path and extension.
|
||||
|
||||
.. _asset-hfield-content_type:
|
||||
|
||||
:at:`content_type`: :at-val: `string, optional`
|
||||
If the file attribute is specified, then this sets the `MIME <https://en.wikipedia.org/wiki/MIME>`_ type of the file
|
||||
to be loaded. Any filename extensions will be overloaded. Currently ``image/png`` and ``image/vnd.mujoco.hfield``
|
||||
are supported.
|
||||
|
||||
.. _asset-hfield-file:
|
||||
|
||||
:at:`file`: :at-val:`string, optional`
|
||||
@@ -2500,12 +2517,19 @@ The full list of processing steps applied by the compiler to each mesh is as fol
|
||||
:at:`class`: :at-val:`string, optional`
|
||||
Defaults class for setting unspecified attributes (only scale in this case).
|
||||
|
||||
.. _asset-mesh-content_type:
|
||||
|
||||
:at:`content_type`: :at-val:`string, optional`
|
||||
If the file attribute is specified, then this sets the `MIME <https://en.wikipedia.org/wiki/MIME>`_ type of the file
|
||||
to be loaded. Any filename extensions will be overloaded. Currently ``model/vnd.mujoco.msh``, ``model/obj``, and
|
||||
``model/stl`` are supported.
|
||||
|
||||
.. _asset-mesh-file:
|
||||
|
||||
:at:`file`: :at-val:`string, optional`
|
||||
The file from which the mesh will be loaded. The path is determined as described in the meshdir attribute of
|
||||
:ref:`compiler <compiler>`. The file extension must be "stl" or "msh" (not case sensitive) specifying the file type.
|
||||
If the file name is omitted, the vertex attribute becomes required.
|
||||
:ref:`compiler <compiler>`. The file extension must be "stl", "msh", or "obj" (not case sensitive) specifying the
|
||||
file type. If the file name is omitted, the vertex attribute becomes required.
|
||||
|
||||
.. _asset-mesh-scale:
|
||||
|
||||
|
||||
+15
-13
@@ -509,41 +509,43 @@
|
||||
| :ref:`texture | \* | :class: mjcf-attributes |
|
||||
| <asset-texture>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`name<asset-texture-name>` | :ref:`type<asset-texture-type>` | :ref:`file<asset-texture-file>` | |
|
||||
| | | | :ref:`name<asset-texture-name>` | :ref:`type<asset-texture-type>` | :ref:`content_type<asset-texture-content_type>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`gridsize<asset-texture-gridsize>` | :ref:`gridlayout<asset-texture-gridlayout>` | :ref:`fileright<asset-texture-fileright>` | |
|
||||
| | | | :ref:`file<asset-texture-file>` | :ref:`gridsize<asset-texture-gridsize>` | :ref:`gridlayout<asset-texture-gridlayout>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`fileleft<asset-texture-fileleft>` | :ref:`fileup<asset-texture-fileup>` | :ref:`filedown<asset-texture-filedown>` | |
|
||||
| | | | :ref:`fileright<asset-texture-fileright>` | :ref:`fileleft<asset-texture-fileleft>` | :ref:`fileup<asset-texture-fileup>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`filefront<asset-texture-filefront>` | :ref:`fileback<asset-texture-fileback>` | :ref:`builtin<asset-texture-builtin>` | |
|
||||
| | | | :ref:`filedown<asset-texture-filedown>` | :ref:`filefront<asset-texture-filefront>` | :ref:`fileback<asset-texture-fileback>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`rgb1<asset-texture-rgb1>` | :ref:`rgb2<asset-texture-rgb2>` | :ref:`mark<asset-texture-mark>` | |
|
||||
| | | | :ref:`builtin<asset-texture-builtin>` | :ref:`rgb1<asset-texture-rgb1>` | :ref:`rgb2<asset-texture-rgb2>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`markrgb<asset-texture-markrgb>` | :ref:`random<asset-texture-random>` | :ref:`width<asset-texture-width>` | |
|
||||
| | | | :ref:`mark<asset-texture-mark>` | :ref:`markrgb<asset-texture-markrgb>` | :ref:`random<asset-texture-random>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`height<asset-texture-height>` | :ref:`hflip<asset-texture-hflip>` | :ref:`vflip<asset-texture-vflip>` | |
|
||||
| | | | :ref:`width<asset-texture-width>` | :ref:`height<asset-texture-height>` | :ref:`hflip<asset-texture-hflip>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`vflip<asset-texture-vflip>` | | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| asset |br| |_| |L| | | .. table:: |
|
||||
| :ref:`hfield | \* | :class: mjcf-attributes |
|
||||
| <asset-hfield>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`name<asset-hfield-name>` | :ref:`file<asset-hfield-file>` | :ref:`nrow<asset-hfield-nrow>` | |
|
||||
| | | | :ref:`name<asset-hfield-name>` | :ref:`content_type<asset-hfield-content_type>` | :ref:`file<asset-hfield-file>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`ncol<asset-hfield-ncol>` | :ref:`size<asset-hfield-size>` | | |
|
||||
| | | | :ref:`nrow<asset-hfield-nrow>` | :ref:`ncol<asset-hfield-ncol>` | :ref:`size<asset-hfield-size>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| asset |br| |_| |L| | | .. table:: |
|
||||
| :ref:`mesh | \* | :class: mjcf-attributes |
|
||||
| <asset-mesh>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`name<asset-mesh-name>` | :ref:`class<asset-mesh-class>` | :ref:`file<asset-mesh-file>` | |
|
||||
| | | | :ref:`name<asset-mesh-name>` | :ref:`class<asset-mesh-class>` | :ref:`content_type<asset-mesh-content_type>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`vertex<asset-mesh-vertex>` | :ref:`normal<asset-mesh-normal>` | :ref:`texcoord<asset-mesh-texcoord>` | |
|
||||
| | | | :ref:`file<asset-mesh-file>` | :ref:`vertex<asset-mesh-vertex>` | :ref:`normal<asset-mesh-normal>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`face<asset-mesh-face>` | :ref:`refpos<asset-mesh-refpos>` | :ref:`refquat<asset-mesh-refquat>` | |
|
||||
| | | | :ref:`texcoord<asset-mesh-texcoord>` | :ref:`face<asset-mesh-face>` | :ref:`refpos<asset-mesh-refpos>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`scale<asset-mesh-scale>` | :ref:`smoothnormal<asset-mesh-smoothnormal>` | | |
|
||||
| | | | :ref:`refquat<asset-mesh-refquat>` | :ref:`scale<asset-mesh-scale>` | :ref:`smoothnormal<asset-mesh-smoothnormal>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| asset |br| |_| |L| | | .. table:: |
|
||||
|
||||
+4
-1
@@ -9,11 +9,14 @@ General
|
||||
^^^^^^^
|
||||
|
||||
- Added primitive collider for sphere-cylinder contacts, previously this pair used the generic convex-convex collider.
|
||||
- Added an optional ``content_type`` attribute to hfield, texture, and mesh assets. This attribute supports a formatted
|
||||
`MIME <https://en.wikipedia.org/wiki/MIME>`_ string used to determine the type of the asset file without resorting to
|
||||
pulling the type from the file extension.
|
||||
- Added analytic derivatives for quaternion :ref:`subtraction<mjd_subQuat>` and :ref:`integration<mjd_quatIntegrate>`
|
||||
(rotation with an angular velocity). Derivatives are in the 3D tangent space.
|
||||
- Added :ref:`mjv_connector` which has identical functionality to :ref:`mjv_makeConnector`, but with more convenient
|
||||
"from-to" argument parametrization. :ref:`mjv_makeConnector` is now deprecated.
|
||||
- Bump oldest supported MacOS from version 10.12 to 11. MacOS 11 is the oldest version still maintained by Apple.
|
||||
- Bumped oldest supported MacOS from version 10.12 to 11. MacOS 11 is the oldest version still maintained by Apple.
|
||||
|
||||
Python bindings
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Reference in New Issue
Block a user