Add assets to MjSpec wrapper.

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 commit is contained in:
Alessio Quaglino
2025-01-13 08:40:56 -08:00
committed by Copybara-Service
parent 64d0f57c50
commit ba183adb67
2 changed files with 56 additions and 30 deletions
+3 -1
View File
@@ -714,8 +714,10 @@ class SpecsTest(absltest.TestCase):
geom = spec.worldbody.add_geom()
geom.type = mujoco.mjtGeom.mjGEOM_MESH
geom.meshname = 'cube'
model = spec.compile({'cube.obj': cube})
spec.assets = {'cube.obj': cube}
model = spec.compile()
self.assertEqual(model.nmeshvert, 8)
self.assertEqual(spec.assets['cube.obj'], cube)
def test_include(self):
included_xml = """