Returns a dict containing the binary assets referenced in this model. This will contain `{vfs_filename: contents}` pairs. `vfs_filename` will be the name of the asset in MuJoCo's Virtual File System, which corresponds to the filename given in the XML returned by `to_xml_string()`. `cont
(self)
| 1277 | return self.parent_model.root_model if self.parent_model else self |
| 1278 | |
| 1279 | def get_assets(self): |
| 1280 | """Returns a dict containing the binary assets referenced in this model. |
| 1281 | |
| 1282 | This will contain `{vfs_filename: contents}` pairs. `vfs_filename` will be |
| 1283 | the name of the asset in MuJoCo's Virtual File System, which corresponds to |
| 1284 | the filename given in the XML returned by `to_xml_string()`. `contents` is a |
| 1285 | bytestring. |
| 1286 | |
| 1287 | This dict can be used together with the result of `to_xml_string()` to |
| 1288 | construct a `mujoco.Physics` instance: |
| 1289 | |
| 1290 | ```python |
| 1291 | physics = mujoco.Physics.from_xml_string( |
| 1292 | xml_string=mjcf_model.to_xml_string(), |
| 1293 | assets=mjcf_model.get_assets()) |
| 1294 | ``` |
| 1295 | """ |
| 1296 | # Get the assets referenced within this `RootElement`'s namescope. |
| 1297 | assets = {file_obj.to_xml_string(): file_obj.get_contents() |
| 1298 | for file_obj in self.namescope.files |
| 1299 | if file_obj.value} |
| 1300 | |
| 1301 | # Recursively add assets belonging to attachments. |
| 1302 | for attached_model in self._attachments.values(): |
| 1303 | assets.update(attached_model.get_assets()) |
| 1304 | |
| 1305 | return assets |
| 1306 | |
| 1307 | @property |
| 1308 | def full_identifier(self): |