Expose MJX light_active model field#3278
Open
tkelestemur wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This exposes
light_activeas a publicmjx.Modelfield, matchingmujoco.MjModel.light_activeand the nearby MJX light fields likelight_posandlight_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 domodel.replace(light_active=...)and includelight_activedirectly in model pytree batching /in_axessetup.The actual source-of-truth change is adding
light_activeto publicmjx.Model. After regenerating the WARP files,ModelWarpno longer keeps a duplicate WARP-only copy of the field, and the render shim now readsm.light_activeinstead ofm._impl.light_active.I added focused tests to check that
put_modelcopiesMjModel.light_active, thatreplace(light_active=...)works, and thatlight_activeparticipates in a batched model pytree.Validated with:
python -m pytest mjx/mujoco/mjx/_src/io_test.py -k 'light_active' -qpython -m pytest mjx/mujoco/mjx/_src/io_test.py::ModelIOTest -qgit diff --check