Skip to content

Expose MJX light_active model field#3278

Open
tkelestemur wants to merge 1 commit into
google-deepmind:mainfrom
tkelestemur:tarik/mjx-light-active-public-api
Open

Expose MJX light_active model field#3278
tkelestemur wants to merge 1 commit into
google-deepmind:mainfrom
tkelestemur:tarik/mjx-light-active-public-api

Conversation

@tkelestemur
Copy link
Copy Markdown
Contributor

This exposes light_active as a public mjx.Model field, matching mujoco.MjModel.light_active and the nearby MJX light fields like light_pos and light_castshadow.

The current WARP path already carries this value, but only under mjx_model._impl.light_active. That means code that wants to toggle or randomize lights has to reach into private implementation state, while similar light fields can be updated with normal public model operations. With this change, users can do model.replace(light_active=...) and include light_active directly in model pytree batching / in_axes setup.

The actual source-of-truth change is adding light_active to public mjx.Model. After regenerating the WARP files, ModelWarp no longer keeps a duplicate WARP-only copy of the field, and the render shim now reads m.light_active instead of m._impl.light_active.

I added focused tests to check that put_model copies MjModel.light_active, that replace(light_active=...) works, and that light_active participates in a batched model pytree.

Validated with:

python -m pytest mjx/mujoco/mjx/_src/io_test.py -k 'light_active' -q

python -m pytest mjx/mujoco/mjx/_src/io_test.py::ModelIOTest -q

git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant