Skip to content

Commit 514766f

Browse files
authored
Enhance modify_scene_fn argument handling
Add conditional handling for modify_scene_fn arguments.
1 parent b1417e4 commit 514766f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mujoco_playground/_src/mjx_env.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ def get_image(state, modify_scn_fn=None) -> np.ndarray:
343343
mujoco.mj_forward(mj_model, d)
344344
renderer.update_scene(d, camera=camera, scene_option=scene_option)
345345
if modify_scn_fn is not None:
346-
modify_scn_fn(renderer.scene)
346+
if modify_scene_fn.__code__.co_argcount == 1:
347+
modify_scn_fn(renderer.scene)
348+
elif modify_scene_fn.__code__.co_argcount == 2:
349+
modify_scn_fn(renderer.scene, state)
347350
return renderer.render()
348351

349352
if isinstance(trajectory, list):

0 commit comments

Comments
 (0)