diff --git a/doc/APIreference/functions.rst b/doc/APIreference/functions.rst index d37bdd0f..885bfa59 100644 --- a/doc/APIreference/functions.rst +++ b/doc/APIreference/functions.rst @@ -66,18 +66,11 @@ Parse spec from a file. .. mujoco-include:: mj_encode -Encode :ref:`mjSpec` or :ref:`mjModel` to a file. The output format is determined by the file extension (case insensitive) or -``content_type``. Returns the number of bytes written on success, -1 on failure. +Encode :ref:`mjSpec` or :ref:`mjModel` to a file. The output format is determined by the file extension +(case insensitive) or ``content_type``. Returns the number of bytes written on success, -1 on failure. -The following formats are supported natively, without a registered encoder: - -- **MJCF XML** — extension: ``.xml``, content_type: ``text/xml``. If an :ref:`mjSpec` is provided, saves via - :ref:`mj_saveXML`. Otherwise falls back to :ref:`mj_saveLastXML`, which requires a compiled :ref:`mjModel`. -- **MJB** — extension: ``.mjb``. MuJoCo binary format. Requires a compiled :ref:`mjModel`. -- **TXT** — extension: ``.txt``, content_type: ``text/plain``. Human-readable text dump via :ref:`mj_printModel`. - Requires a compiled :ref:`mjModel`. - -For all other formats, a registered encoder is looked up via :ref:`mjp_findEncoder`. +For detailed documentation, supported output formats (``.xml``, ``.mjb``, ``.txt``, ``.mjz``), and custom encoder +plugins, see :ref:`Model Encoding & Saving `. *Nullable:* ``s``, ``m``, ``vfs``, ``error`` diff --git a/doc/APIreference/functions_override.rst b/doc/APIreference/functions_override.rst index cf61a14d..9290a562 100644 --- a/doc/APIreference/functions_override.rst +++ b/doc/APIreference/functions_override.rst @@ -74,18 +74,11 @@ Save spec to XML file, return 0 on success, -1 otherwise. XML saving requires th .. _mj_encode: -Encode :ref:`mjSpec` or :ref:`mjModel` to a file. The output format is determined by the file extension (case insensitive) or -``content_type``. Returns the number of bytes written on success, -1 on failure. +Encode :ref:`mjSpec` or :ref:`mjModel` to a file. The output format is determined by the file extension +(case insensitive) or ``content_type``. Returns the number of bytes written on success, -1 on failure. -The following formats are supported natively, without a registered encoder: - -- **MJCF XML** — extension: ``.xml``, content_type: ``text/xml``. If an :ref:`mjSpec` is provided, saves via - :ref:`mj_saveXML`. Otherwise falls back to :ref:`mj_saveLastXML`, which requires a compiled :ref:`mjModel`. -- **MJB** — extension: ``.mjb``. MuJoCo binary format. Requires a compiled :ref:`mjModel`. -- **TXT** — extension: ``.txt``, content_type: ``text/plain``. Human-readable text dump via :ref:`mj_printModel`. - Requires a compiled :ref:`mjModel`. - -For all other formats, a registered encoder is looked up via :ref:`mjp_findEncoder`. +For detailed documentation, supported output formats (``.xml``, ``.mjb``, ``.txt``, ``.mjz``), and custom encoder +plugins, see :ref:`Model Encoding & Saving `. *Nullable:* ``s``, ``m``, ``vfs``, ``error`` diff --git a/doc/changelog.rst b/doc/changelog.rst index b9c6a1b6..6a6e4ad7 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -143,11 +143,11 @@ Compiler - The :ref:`attach` element now supports self-attachment (attaching elements of the current model to itself) by omitting the :ref:`model` attribute. It also supports attaching a frame via the new :ref:`frame` attribute, which is mutually exclusive with :ref:`body`. -- Fixed loading of ``.mjz`` archives in :ref:`simulate`: the archive was unmounted before model compilation, - so assets failed to load. Failures in the ``mjz`` decoder now emit a warning with the underlying error instead of the - generic "could not decode content" message. -- The ``mjz`` decoder now searches for ``model.xml`` at the root of the archive as a fallback if the archive-named XML - is not found. +- Fixed loading of :ref:`.mjz ` archives in :ref:`simulate`: the archive was unmounted + before model compilation, so assets failed to load. Failures in the :ref:`mjz ` decoder now emit a + warning with the underlying error instead of the generic "could not decode content" message. +- The :ref:`mjz ` decoder now searches for ``model.xml`` at the root of the archive as a fallback if the + archive-named XML is not found. - Added support for resource writing via :ref:`mju_writeResource` and the ``write`` callback in :ref:`mjpResourceProvider`. @@ -166,6 +166,12 @@ Python bindings ^^^^^^^^^^^^^^^ - The bindings now support free threading (`PEP 703 `__) for Python 3.14. +Documentation +^^^^^^^^^^^^^ +- Expanded documentation for :ref:`spec.encode ` workflows and added detailed documentation for the + :ref:`MJZ Archive ` format (``.mjz`` / ``.zip``). + + Version 3.10.0 (June 22, 2026) ------------------------------ @@ -234,8 +240,8 @@ Bug fixes 15. :commit:`a8eaccd2` Fixed a vulnerability in the System Identification toolbox where loading a trajectory or time series called ``np.load`` with ``allow_pickle=True``, allowing arbitrary code execution from a malicious ``.npz`` file. Signal metadata is now serialized as JSON and loaded with ``allow_pickle=False``. -16. :commit:`b9fb817a` Fixed a bug in the ``mjz`` :ref:`decoder ` where unnormalized paths would fail to be - read. +16. :commit:`b9fb817a` Fixed a bug in the :ref:`mjz ` :ref:`decoder ` where unnormalized paths + would fail to be read. 17. :commit:`986d73c0` Fixed a bug where the mesh compiler would produce non-unit convex hull polygon normals. Version 3.9.0 (May 27, 2026) diff --git a/doc/modeling.rst b/doc/modeling.rst index d3dbb432..263b2ed3 100644 --- a/doc/modeling.rst +++ b/doc/modeling.rst @@ -5,91 +5,33 @@ Modeling Introduction ------------ -MuJoCo can load XML model files in its native **MJCF** format, as well as in the popular but more limited **URDF** -format. This chapter is the MJCF modeling guide. The reference manual is available in the :doc:`XMLreference` -chapter. The URDF documentation can be found elsewhere; here we only describe -MuJoCo-specific :ref:`URDF extensions `. +MuJoCo's native model format is **MJCF**, an XML-based language designed to describe complex dynamical systems. This +chapter is the primary MJCF modeling guide. The complete element and attribute reference manual is available in the +:doc:`XMLreference` chapter. MuJoCo also supports loading models from other formats such as URDF (see :ref:`URDF +extensions `), MJZ Zip archives (see :ref:`MJZ Archives `), and OpenUSD (see :doc:`OpenUSD/index`). MJCF models can represent complex dynamical systems with a wide range of features and model elements. Accessing all these features requires a rich modeling format, which can become cumbersome if it is not designed with usability in mind. Therefore we have made an effort to design MJCF as a scalable format, allowing users to start small and build more detailed models later. Particularly helpful in this regard is the extensive :ref:`default setting ` -mechanism inspired by the idea of Cascading Style Sheets (CSS) inlined in HTML. It enables users to rapidly create -new models and experiment with them. Experimentation is further aided by numerous :ref:`options