Skip to content

Commit bd9d30a

Browse files
yuvaltassacopybara-github
authored andcommitted
Improve documentation of mj_saveLastXML fixes #2075
PiperOrigin-RevId: 735672207 Change-Id: I951b8be9cf12a2a4965a40bb8db4de4ddda18570
1 parent 019e0a8 commit bd9d30a

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

doc/APIreference/functions.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@ instances will be deleted; as in :ref:`mj_compile`, the compilation error can be
7575

7676
.. mujoco-include:: mj_saveLastXML
7777

78-
Update XML data structures with info from low-level model, save as MJCF.
78+
Update XML data structures with info from low-level model created with :ref:`mj_loadXML`, save as MJCF.
7979
If error is not NULL, it must have size error_sz.
8080

81+
Note that this function only saves models that have been loaded with :ref:`mj_loadXML`, the legacy loading mechanism.
82+
See the :ref:`model editing<meOverview>` chapter to understand the difference between the old and new model loading and
83+
saving mechanisms.
84+
8185
.. _mj_freeLastXML:
8286

8387
`mj_freeLastXML <#mj_freeLastXML>`__

doc/APIreference/functions_override.rst

+9
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ struct pointers while editing the model programmatically.
4747
:ref:`mj_recompile` returns 0 if compilation succeed. In the case of failure, the given :ref:`mjModel` and :ref:`mjData`
4848
instances will be deleted; as in :ref:`mj_compile`, the compilation error can be read with :ref:`mjs_getError`.
4949

50+
.. _mj_saveLastXML:
51+
52+
Update XML data structures with info from low-level model created with :ref:`mj_loadXML`, save as MJCF.
53+
If error is not NULL, it must have size error_sz.
54+
55+
Note that this function only saves models that have been loaded with :ref:`mj_loadXML`, the legacy loading mechanism.
56+
See the :ref:`model editing<meOverview>` chapter to understand the difference between the old and new model loading and
57+
saving mechanisms.
58+
5059
.. _mj_saveXMLString:
5160

5261
Save spec to XML string, return 0 on success, -1 on failure. If the length of the output buffer is too small, returns

include/mujoco/mujoco.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ MJAPI mjModel* mj_compile(mjSpec* s, const mjVFS* vfs);
110110
// Recompile spec to model, preserving the state, return 0 on success.
111111
MJAPI int mj_recompile(mjSpec* s, const mjVFS* vfs, mjModel* m, mjData* d);
112112

113-
// Update XML data structures with info from low-level model, save as MJCF.
113+
// Update XML data structures with info from low-level model created with mj_loadXML, save as MJCF.
114114
// If error is not NULL, it must have size error_sz.
115115
MJAPI int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int error_sz);
116116

python/mujoco/introspect/functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
type=ValueType(name='int'),
309309
),
310310
),
311-
doc='Update XML data structures with info from low-level model, save as MJCF. If error is not NULL, it must have size error_sz.', # pylint: disable=line-too-long
311+
doc='Update XML data structures with info from low-level model created with mj_loadXML, save as MJCF. If error is not NULL, it must have size error_sz.', # pylint: disable=line-too-long
312312
)),
313313
('mj_freeLastXML',
314314
FunctionDecl(

0 commit comments

Comments
 (0)