Check for duplicated names when setting element names.

PiperOrigin-RevId: 778827590
Change-Id: I77a208c1571cf735cae80840ea830aa347681f71
This commit is contained in:
Alessio Quaglino
2025-07-03 03:19:51 -07:00
committed by Copybara-Service
parent 594e17074a
commit 564c51ddb9
12 changed files with 96 additions and 74 deletions
+1 -1
View File
@@ -4235,7 +4235,7 @@ Attribute setters
.. mujoco-include:: mjs_setName
Set element's name.
Set element's name, return 0 on success.
.. _mjs_setBuffer:
+3
View File
@@ -17,6 +17,9 @@ General
:ref:`visual/global/cameraid<visual-global-cameraid>`.
- Added support to only sync the state in the Python :ref:`passive viewer<PyViewerPassive>`'s ``Sync`` method, this is
useful to improve performance. The default behavior is unchanged and copies the entire model and data.
- In the mjSpec C API, directly setting an element's name using :ref:`mjs_setString` has been replaced with a new
function :ref:`mjs_setName` which allows checking for naming collisions at set-time rather than compile-time, for
earlier catching of errors.
Bug fixes
^^^^^^^^^
+1 -1
View File
@@ -3456,7 +3456,7 @@ mjsElement* mjs_firstChild(mjsBody* body, mjtObj type, int recurse);
mjsElement* mjs_nextChild(mjsBody* body, mjsElement* child, int recurse);
mjsElement* mjs_firstElement(mjSpec* s, mjtObj type);
mjsElement* mjs_nextElement(mjSpec* s, mjsElement* element);
void mjs_setName(mjsElement* element, const char* name);
int mjs_setName(mjsElement* element, const char* name);
void mjs_setBuffer(mjByteVec* dest, const void* array, int size);
void mjs_setString(mjString* dest, const char* text);
void mjs_setStringVec(mjStringVec* dest, const char* text);