Having defaults in the names of the attribute or function names is confusing for the users since the defaults are not re-applied but are only used for writing to XML. The alternative would be to change mjs_setDefault to re-apply them, but this would overwrite any other attribute set by the user so far.
PiperOrigin-RevId: 726431090
Change-Id: I41f4a23e1722e278b0ecc0a00b07db9b384fe994
This keeps track of specs attached with the full attach function `attach`. It does not track fine-grained attach via `attach_body` and `attach_frame`.
PiperOrigin-RevId: 722597081
Change-Id: I56188f1718592128b7033538acc9a40553cbbed2
This clarifies the difference between attaching a full spec, which converts the worldbody to a frame, and attaching a specific body (or frame).
PiperOrigin-RevId: 721297010
Change-Id: Iff87fe99b81746e6ab3a189a3057b274d3c9a939
When specified, child asset with repeated names will override parent's, rather than throw an error. Default behavior is to override.
PiperOrigin-RevId: 717979621
Change-Id: I18022dc266619b4ba1a8636d1c60f85b0eb5f862
Old API:
```
site.attach(child_spec)
frame.attach(child_spec)
```
New API:
```
parent_spec.attach(child_spec, frame=frame_name_or_object)
parent_spec.attach(site_spec, site=site_name_or_object)
```
This enables accessing the parent object during attach, which will be used in a follow-up CL to automatically append the child assets to the parent.
PiperOrigin-RevId: 717908589
Change-Id: I0fb27e99694c954cb8ba8a8c98484ffd53a4d6db
This enables associating assets with a spec object.
Also, remove `spec.compile(assets)` and replace it with the `spec.assets` attribute, which must be be set before compile if assets are present.
PiperOrigin-RevId: 714981385
Change-Id: Ic3a33c3b75d3a7e14868622aadb57b2a8461a649
This method allows users to bind a spec to a model or data object, making it less verbose to access its arrays.
PiperOrigin-RevId: 699952211
Change-Id: I6b71a88d5a6968bc0f902bd49db7c568b46a4dfb
Using ids is error prone in scenarios of repeated attachment and detachment. Python users are encouraged to use names for unique identification of model elements.
PiperOrigin-RevId: 699227286
Change-Id: Ifd83e6d85d36ff72ea43caf8b82eab9e4d552440
Note:
- Move compiler options into `mjsCompiler` struct.
- The compiler options from the attached model are not written by mj_SaveXML.
PiperOrigin-RevId: 689391440
Change-Id: I1d63c146a32f87c737b7a55b64a54b0ffe3aecc9
For `mjs_attachFrame` and `mjs_attachBody`, require either a prefix or suffix.
It is tempting for users to not use a prefix (see #2162), but this causes issues. For example, it creates a duplicate "main" default class in the parent as a child of the already existing "main" default.
PiperOrigin-RevId: 688535755
Change-Id: I653181ca35943f1e4eb89c70fca8b5289818324e
The `extension` section used to discard the plugin name and write the instance name in `plugin.name`, while all of the other sections wrote the instance name in `plugin.instance_name` and optionally the plugin name in `plugin.name` (via the function `OnePlugin`). Now all plugin names are in `plugin.plugin_name` and the instance is written in `plugin.name`, so that it is possible to lookup a plugin via its unique instance name.
PiperOrigin-RevId: 683183804
Change-Id: I179ef5d221143b720db24d745b09e327bf1449ef
This enables to generate a list of all body children of a given type.
Also, add recursive option to mjs_firstChild and mjs_nextChild. Fixes#2112.
PiperOrigin-RevId: 681039348
Change-Id: Iebbb26fd5ec314150206edfdddd88633baa0bec6