Add support for binding to arrays of mjs element.

Fixes #2402.

PiperOrigin-RevId: 726449592
Change-Id: I0cde44889837a71a222b20cf91fa56568b4af689
This commit is contained in:
Alessio Quaglino
2025-02-13 06:00:31 -08:00
committed by Copybara-Service
parent 1b4258d274
commit 5b924fec98
3 changed files with 101 additions and 3 deletions
+2 -2
View File
@@ -1720,7 +1720,7 @@ This is useful for example when the MJB is not available as a file on disk.)"));
#define XGROUP(spectype, field) \
mjModel.def( \
"bind", \
"bind_scalar", \
[](MjModelWrapper& m, spectype& spec) -> auto& { \
return m.indexer().field##_by_name(mjs_getString(spec.name)); \
}, \
@@ -2066,7 +2066,7 @@ This is useful for example when the MJB is not available as a file on disk.)"));
#define XGROUP(spectype, field) \
mjData.def( \
"bind", \
"bind_scalar", \
[](MjDataWrapper& d, spectype& spec) -> auto& { \
return d.indexer().field##_by_name(mjs_getString(spec.name)); \
}, \