Skip to content

Commit 91d7834

Browse files
okmatijacopybara-github
authored andcommitted
Replace the Studio parser module with a pure Python implementation
PiperOrigin-RevId: 953181335 Change-Id: I1d2ce6f27f50aa4c30cce6d43caed80186ddef42
1 parent a9f56da commit 91d7834

3 files changed

Lines changed: 24 additions & 58 deletions

File tree

python/mujoco/experimental/studio/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ set(STUDIO_COMMON_LIBS
2323
structs_wrappers
2424
)
2525

26-
mujoco_pybind11_module(parser parser.cc)
27-
target_link_libraries(parser PRIVATE ${STUDIO_COMMON_LIBS})
28-
2926
mujoco_pybind11_module(native_viewer_cc native_viewer.cc)
3027
target_link_libraries(native_viewer_cc PRIVATE ${STUDIO_COMMON_LIBS})
3128

@@ -39,7 +36,6 @@ mujoco_pybind11_module(sim sim.cc)
3936
target_link_libraries(sim PRIVATE ${STUDIO_COMMON_LIBS})
4037

4138
set(MUJOCO_STUDIO_TARGETS
42-
parser
4339
native_viewer_cc
4440
renderer
4541
ux
@@ -73,7 +69,6 @@ set_target_properties(implot PROPERTIES
7369
# when linking both GLFW (via Filament) and SDL2 statically on Linux.
7470
if(UNIX AND NOT APPLE)
7571
set(STUDIO_PY_MODULES
76-
parser
7772
native_viewer_cc
7873
renderer
7974
ux
@@ -86,7 +81,6 @@ endif()
8681

8782
if(APPLE)
8883
set(STUDIO_PY_MODULES
89-
parser
9084
native_viewer_cc
9185
renderer
9286
ux

python/mujoco/experimental/studio/parser.cc

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2026 DeepMind Technologies Limited
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""Loads and compiles MuJoCo models for the studio viewer."""
15+
16+
import mujoco
17+
18+
19+
def parse(filepath: str) -> mujoco.MjData:
20+
if filepath.endswith('.mjb'):
21+
model = mujoco.MjModel.from_binary_path(filepath)
22+
else:
23+
model = mujoco.MjSpec.from_file(filepath).compile()
24+
return mujoco.MjData(model)

0 commit comments

Comments
 (0)