Documentation pass for model editing, model encoding, and mjz.

PiperOrigin-RevId: 951665744
Change-Id: I1dfe3b40f451cca686431c263815039a9c38efc8
This commit is contained in:
Sam Haves
2026-07-21 13:24:50 -07:00
committed by Copybara-Service
parent 259e6c4dc6
commit 1f1bfa9e4e
8 changed files with 226 additions and 127 deletions
+4 -11
View File
@@ -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 <meSaving>`.
*Nullable:* ``s``, ``m``, ``vfs``, ``error``
+4 -11
View File
@@ -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 <meSaving>`.
*Nullable:* ``s``, ``m``, ``vfs``, ``error``