Commit Graph

7 Commits

Author SHA1 Message Date
Copybara-Service 6c78c8664e Merge pull request #3340 from devshahofficial:devshahofficial/mjr-renderer-info
PiperOrigin-RevId: 948183711
Change-Id: I28b256eca22e86ec0ba05a4fa26458d678aca130
2026-07-15 01:37:11 -07:00
devshahofficial 564007204c Fix AttributeError in Renderer.__del__ on partial construction.
If Renderer.__init__ raises before the rendering contexts are assigned
(e.g. width > offwidth raises ValueError, or MjrContext construction
fails), __del__ calls close() which accesses self._gl_context and
self._mjr_context unconditionally, raising AttributeError. This masks
the real __init__ failure with a noisy "Exception ignored in..." message
during garbage collection.

Pre-initialize both attributes to None at the top of __init__ so that
close() is safe on a partially-constructed instance. Add a regression
test that captures sys.unraisablehook and asserts that __del__ raises
nothing when __init__ fails via the width > offwidth path.

Fixes #3213.
2026-04-15 12:15:24 -07:00
Baruch Tabanpour f3b3024291 Add pyink and isort config. Reformat.
PiperOrigin-RevId: 704533915
Change-Id: I37e9fd51261bd166b725c7460fc65d02fed2b391
2024-12-09 21:10:50 -08:00
Kevin Zakka 53883ce86a Add a close() method to mujoco.Renderer which explicitly frees the gl context.
PiperOrigin-RevId: 590221484
Change-Id: I07392f9c53f662a37a57ab23acfef9aa5a98a49b
2023-12-12 08:59:46 -08:00
Kyle Bayes 631b16e7ad Add better user error messages to Python renderer update_scene along with missing unit tests.
PiperOrigin-RevId: 554482720
Change-Id: Ief3ba496fb5720668f98fb9d44a5c82e6a14b9cc
2023-08-07 08:22:34 -07:00
DeepMind c34826ef1a mujoco.renderer.render to output copy of pixel array.
Previously, it returned a view into the internal rgb array, which can be confusing to the user.

PiperOrigin-RevId: 517630186
Change-Id: Ibc1e86b6b6345269523bb4c82c37dd325961a8ec
2023-03-18 05:30:46 -07:00
Kyle Bayes ef695bb8a8 Add Renderer class to Python native bindings.
PiperOrigin-RevId: 492994751
Change-Id: Iebbe5980668a15b1cd62c0076cc131255462b2eb
2022-12-05 06:54:33 -08:00