From b389b28b87523370c1aa47c320e3d1e15f4b2435 Mon Sep 17 00:00:00 2001 From: Matija Kecman Date: Sat, 1 Aug 2026 06:46:23 -0700 Subject: [PATCH] Support parsing .mjz files in the Studio parser module PiperOrigin-RevId: 957616406 Change-Id: I582d23039b4aec745e0525392c062102f4d9ae25 --- python/mujoco/experimental/studio/parser.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/mujoco/experimental/studio/parser.py b/python/mujoco/experimental/studio/parser.py index 5b7463bd..54d7ba88 100644 --- a/python/mujoco/experimental/studio/parser.py +++ b/python/mujoco/experimental/studio/parser.py @@ -19,6 +19,12 @@ import mujoco def parse(filepath: str) -> mujoco.MjData: if filepath.endswith('.mjb'): model = mujoco.MjModel.from_binary_path(filepath) + elif filepath.endswith(('.mjz', '.zip')): + # .mjz archives mount assets into a VFS during parsing; the same VFS must + # be passed to compile() so the assets remain accessible. + with mujoco.MjVfs() as vfs: + spec = mujoco.MjSpec.from_file(filepath, vfs=vfs) + model = spec.compile(vfs=vfs) else: model = mujoco.MjSpec.from_file(filepath).compile() return mujoco.MjData(model)