Commit Graph

1862 Commits

Author SHA1 Message Date
Haroon Qureshi b37caf6d0c Show save dialog (instead of open dialog) as needed.
PiperOrigin-RevId: 865374467
Change-Id: I599333659b12b05b7c779115fa397302f4978751
2026-02-04 06:20:01 -08:00
Haroon Qureshi 1a0fe29c41 Make missing decoder non-failing.
Otherwise, if you try to open a random file in studio, it will crash.

PiperOrigin-RevId: 865372002
Change-Id: I96d3121b6de792daaff53155ea2436ac3f6668db
2026-02-04 06:12:54 -08:00
Kyle Bayes 1a9ca3239a Replace comma operator with semi-colon.
PiperOrigin-RevId: 865353927
Change-Id: I3498d8dc17f96caf8fa1975613ed6a815d2f20e7
2026-02-04 05:14:17 -08:00
Haroon Qureshi c2ede20d08 Move model_, data_, and spec_ into private accessors.
This is in preparation for an upcoming change.

PiperOrigin-RevId: 865332731
Change-Id: I74041b3caf5de841f583f76682e1ced049557202
2026-02-04 04:02:52 -08:00
Haroon Qureshi 0add985a15 Handle null camera and vis_option.
PiperOrigin-RevId: 865088406
Change-Id: I4a3bf7f6cb696de1461bc53fd5d77b941ea0c0c5
2026-02-03 16:06:06 -08:00
Haroon Qureshi 1bd72428f1 Perform ImGui calls only when a context is available.
PiperOrigin-RevId: 865072901
Change-Id: I4b35d953df2f686d2f02f8e0aede7109729b5e04
2026-02-03 15:29:44 -08:00
Haroon Qureshi 144a8a9e85 Make EGL utils conditional on EGL.h.
PiperOrigin-RevId: 865064686
Change-Id: I3728de6e49e4c36d76b410c2458767f74df069c9
2026-02-03 15:09:51 -08:00
Haroon Qureshi feb3abcccf Fix paths.
PiperOrigin-RevId: 864933655
Change-Id: I44f34b47fe4f6725de59c6565f6b2b557b80eaa6
2026-02-03 10:16:19 -08:00
Haroon Qureshi ef8e6802ef Move EGL initialization into a separate class.
Initialize the EGL context in the Renderer when using the classic
rendering engine with no window.

PiperOrigin-RevId: 864884976
Change-Id: Ic6cc4637855a361e41f3bfb4b738c012ec93711f
2026-02-03 08:12:35 -08:00
Haroon Qureshi 7ec8b6e341 Pause sim when loading an empty model.
PiperOrigin-RevId: 864855430
Change-Id: Ib8c2b0949ee6fda8dd1490017e146d792119e840
2026-02-03 06:49:58 -08:00
Haroon Qureshi 34add7bb32 Removing trailing newline in zenity file dialogs.
PiperOrigin-RevId: 864842389
Change-Id: Ie4cc61a91732fcde0ef2c7eba927aede217b2e6d
2026-02-03 06:15:37 -08:00
Haroon Qureshi e82253e86c Prevent file dialog from reopening after being dismissed.
PiperOrigin-RevId: 864842269
Change-Id: I91819a3418875fe06dbed0cf7777e1dc7d358079
2026-02-03 06:14:35 -08:00
Haroon Qureshi 1a2bca4986 Use runtime enum for the renderer backend instead of preprocessor macros.
TESTED:
  studio:vulkan
  studio:vulkan --offscreen_mode=true
  studio:opengl
  studio:opengl_egl
  studio:classic
  studio:classic --offscreen_mode=true
  studio:server
  robot_sim/frontend:debug_server
  pyviewer:example
  pyviewer:example --define=mujoco_gl=vulkan
PiperOrigin-RevId: 864768322
Change-Id: I4478e0115b3807060d60d98b4ddfd63da9389aac
2026-02-03 02:13:15 -08:00
Alessio Quaglino a54c9f1d78 Specialized box and capsule collision primitives for stable 2D flex interactions.
PiperOrigin-RevId: 864500749
Change-Id: I52aed6e29569477a8a0b6b5eb55ad483f1077c0e
2026-02-02 13:36:42 -08:00
Sam Haves 49b4790877 Enable multithreading for texture compilation, use new user ThreadPool for compilation.
PiperOrigin-RevId: 864449279
Change-Id: I5dd053ab0b1f14d81e1f68296eadc59cd5b8d698
2026-02-02 11:35:41 -08:00
Sam Haves 683b1b5d38 Create threadpool for src/user and primarily compiler usage.
PiperOrigin-RevId: 864328236
Change-Id: Iffaa9b8e6eacdb038020af9d6ad82d7cb7a6c941
2026-02-02 06:31:00 -08:00
Haroon Qureshi b7a46d04b6 Implement OS-specific file dialogs.
PiperOrigin-RevId: 864235878
Change-Id: I709fc52c0c467f317694ba0772572a448c45de35
2026-02-02 01:33:40 -08:00
Yuval Tassa 815dbb996e Use body_weldid to find the first movable body in a chain.
PiperOrigin-RevId: 863774053
Change-Id: I8df96d5af7cc80d78a6f35560c3c31bed8be550e
2026-01-31 17:16:36 -08:00
Haroon Qureshi b073cd2ca4 Refactor mjVFS and resource management.
Resource operations (e.g. mju_openResource, mju_readResource, and
mju_closeResource, etc.) are now all handled by a VFS instance. It
is now up to the VFS to determine which provider to use in order to
handle those operations.

This allows us to dynamically add/remove (aka "mount") providers to
a VFS to handle special requests. mj_addFileVFS and mj_addBufferVFS
have been reimplemented as two such use-cases. Moreover, we expose
the mounting behaviour with two new functions: mj_mountVFS and
mj_unmountVFS.

PiperOrigin-RevId: 863248779
Change-Id: I8bcbd5445814ba1e72c6d7b80ad6a054f5f1df57
2026-01-30 08:20:53 -08:00
Haroon Qureshi 9da834c12c Tweak status bar layout.
PiperOrigin-RevId: 863184918
Change-Id: Ibff6c71e6004f4dd2ad2b49cc889d2f9c2dfd41e
2026-01-30 05:07:11 -08:00
Haroon Qureshi e35c981f48 Add uv offsets to autogenerated 2D uv coordinates.
The original render_gl3.c code does the following:

```
mjr_setf4(plane, 0.5*scl[0], 0, 0, -0.5);
glTexGenfv(GL_S, GL_OBJECT_PLANE, plane);
mjr_setf4(plane, 0, -0.5*scl[1], 0, -0.5);
glTexGenfv(GL_T, GL_OBJECT_PLANE, plane);
```

The 4th component of the GL_OBJECT_PLANE function effectively
describes a UV-offset for the generates uvs. In our filament
implementation, we had overlooked this 4th component.

PiperOrigin-RevId: 863181644
Change-Id: I60688117ea2019257da683cdda0c7d389dd5af1e
2026-01-30 04:55:31 -08:00
Haroon Qureshi f6796f36b2 Only update GuiView::UpdateRenderable (which calls imGui::EndFrame
internally) when we want to render the GUI to the same target as the
scene.

PiperOrigin-RevId: 862647358
Change-Id: If3656032b74a168b804dfa34ef3eb97c9817c2c0
2026-01-29 02:54:44 -08:00
Haroon Qureshi 86f82d18a2 Temporarily disable mjz support.
PiperOrigin-RevId: 862383413
Change-Id: I32927f59852e149b7aaf8b5225f35020532eb7f9
2026-01-28 13:58:41 -08:00
Yuval Tassa 510cbceda5 Add missing space after comma
PiperOrigin-RevId: 862235154
Change-Id: I60ad15fcc918accf52abeced7e22a5a1d599df82
2026-01-28 07:53:18 -08:00
Matija Kecman 0eff7acf80 Improve filament gui
* Added color to widgets which have changed from their initial values and the ability to revert to their initial values by clicking with the right mouse button
* Added some reasonable range limits, which are especially useful for drag widgets

PiperOrigin-RevId: 862220411
Change-Id: I1d2c61d8889d5ec29890d81b5f97af576cb5c611
2026-01-28 07:09:01 -08:00
Haroon Qureshi 40f2fe0977 CMakeLists for mjz.
PiperOrigin-RevId: 862214752
Change-Id: I498a1f0092adc9e94016bf23589403296bffb4f7
2026-01-28 06:53:06 -08:00
Haroon Qureshi 2fd9b5e92f Partial roll back VFS refactor due internal breakages
PiperOrigin-RevId: 862210191
Change-Id: Ia15a345a267bcef4b593d507d54f1668da0c0611
2026-01-28 06:40:11 -08:00
Yuval Tassa 19ff06155a Refactor sensor computation into per-sensor functions.
PiperOrigin-RevId: 862180688
Change-Id: I9f3f4da8ca8abed778965fd3970171276ee4570d
2026-01-28 05:04:59 -08:00
Yuval Tassa 1d2d0b1c37 Remove batching optimization from GEOM* sensors
PiperOrigin-RevId: 861938606
Change-Id: Ibb135a4d99cab9ce23a04f844f7c730e8f3b31c8
2026-01-27 16:44:10 -08:00
Yuval Tassa 5fb47df197 Add mjData flags marking lazily evaluated pipeline stages
PiperOrigin-RevId: 861763477
Change-Id: Ib613c56949264573a16306800658f868d2aa7665
2026-01-27 09:45:06 -08:00
Alessio Quaglino ba32568138 Move flex vertex-edge adjacency to mjModel.
PiperOrigin-RevId: 861717037
Change-Id: I2ad8090b0318cb04b43d13966cb42260c82ef930
2026-01-27 07:41:47 -08:00
Haroon Qureshi 669e9b7484 Add an "offscreen" mode that allows users to render studio to a texture
then uses SDL to blit the texture into the window.

PiperOrigin-RevId: 861697047
Change-Id: Ib949b4ade0c79d867ba74ce013bc2b6fa2571f56
2026-01-27 06:48:16 -08:00
Yuval Tassa dce2ed00ea Change not required, issue was addressed in e48da1e38c
PiperOrigin-RevId: 861680910
Change-Id: Iea5c7190bf826c9254eb1bd2f78b0098073cba20
2026-01-27 06:03:04 -08:00
Yuval Tassa e787f8717d Change not required, issue was addressed in e48da1e38c
PiperOrigin-RevId: 861680071
Change-Id: I374f091cd2686737e53234ca0edc8703897fbd4a
2026-01-27 06:01:14 -08:00
Haroon Qureshi 75715ab966 Update logic for dealing with file dialogs.
This in preparation for an upcoming change that uses native file dialogs instead
of our very basic ImGui file dialog.

PiperOrigin-RevId: 861671041
Change-Id: I9b00c05efdda5e37ffe15048a2ccf66f6eca89d9
2026-01-27 05:31:01 -08:00
Haroon Qureshi ad482a57bb Add a headless OpenGL renderer target.
PiperOrigin-RevId: 861642051
Change-Id: Ie0b880a2d3d85205dcd41bca5dc270efd35b7767
2026-01-27 04:08:33 -08:00
Haroon Qureshi fe16255602 Add mjz support to studio.
PiperOrigin-RevId: 861627355
Change-Id: Iafd291965ca78d03fdc1efe0e40dabcd4f2dacc4
2026-01-27 03:22:58 -08:00
Haroon Qureshi 32a4412e2b First-pass implementation of a spec loader for zipped assets.
PiperOrigin-RevId: 861625990
Change-Id: I65cf601cd9aa3aab4915a5a247dda00a6a9aa3db
2026-01-27 03:18:30 -08:00
Haroon Qureshi e43ed60d29 Allow GUI to be rendered to texture as well.
Update SetFrameBuffer to allow users to customize which swap chain
(window or offscreen) to use for rendering both the main mjvScene
as well as the GUI.

PiperOrigin-RevId: 861624061
Change-Id: Ife7bfc447afb007016300438fc5f88a8e4cfa0f6
2026-01-27 03:12:05 -08:00
Haroon Qureshi 0ddbb46fa1 Refactor mjVFS and resource management.
Resource operations (e.g. mju_openResource, mju_readResource, and
mju_closeResource, etc.) are now all handled by a VFS instance. It
is now up to the VFS to determine which provider to use in order to
handle those operations.

This allows us to dynamically add/remove (aka "mount") providers to
a VFS to handle special requests. mj_addFileVFS and mj_addBufferVFS
have been reimplemented as two such use-cases. Moreover, we expose
the mounting behaviour with two new functions: mj_mountVFS and
mj_unmountVFS.

PiperOrigin-RevId: 861550939
Change-Id: I070eb4bcc2982466c8f368f7918005538baa5185
2026-01-26 23:53:29 -08:00
Haroon Qureshi bdb553ff8a Add a ModelPlugin that can be used to load and update models.
PiperOrigin-RevId: 861077626
Change-Id: I3ef4989cfbfff3632c5915c00ebda1e7a48716e8
2026-01-26 01:24:43 -08:00
Alessio Quaglino e933081ff1 Optimize flexvert Jacobian computation.
The dense Jacobian arrays `J0_dense` and `J1_dense` are now zeroed only once before the vertex loop. Inside the loop, only the entries that were actually used are zeroed out after being added to the sparse Jacobian, allowing for efficient reuse of the dense arrays across all vertices.

PiperOrigin-RevId: 860799056
Change-Id: Ia61daae5eeb2f4dbc0c5d8c0064622a881e92b7a
2026-01-25 05:22:44 -08:00
Alessio Quaglino e9c61694e1 Align flex_vert0 to the XY plane during model initialization if dim=2.
PiperOrigin-RevId: 860435368
Change-Id: Ida616e1e69c224f7c0dbad2a10dd59e64cbadf49
2026-01-24 00:50:01 -08:00
Alessio Quaglino 769109630f Move flexvert_J and flexedge_J sparsity pattern to mjModel.
PiperOrigin-RevId: 860392796
Change-Id: Ie1264f2df5bf04b5794a3c7d8ad1a92524a6a567
2026-01-23 22:00:14 -08:00
Alessio Quaglino 7da271c687 Add vertex equality option.
PiperOrigin-RevId: 860299454
Change-Id: I7befd8e5f4c8bac6d74684a96a9cc3cee9ae1e29
2026-01-23 16:30:05 -08:00
Yuval Tassa a5de40b400 Replace mjtSize with size_t for size calculations in engine.
Use unsigned size_t instead of signed mjtSize for size multiplications to avoid Clang's overflow-checking intrinsic. This is semantically correct as size calculations are inherently unsigned.

PiperOrigin-RevId: 860213177
Change-Id: I837aa6556335478969d4977492d0f231419f020a
2026-01-23 12:35:13 -08:00
Yuval Tassa 68537e1e32 Replace mjtSize with size_t for size calculations.
Use unsigned size_t instead of signed mjtSize for size multiplications to avoid Clang's overflow-checking intrinsic. This is semantically correct as size calculations are inherently unsigned.

PiperOrigin-RevId: 860172221
Change-Id: I3b6cb720db8771b8f266f1927e2980ac7514538b
2026-01-23 10:51:43 -08:00
Yuval Tassa 30b903b6c0 Migrate mjModel size fields from int to mjtSize.
This change updates all size-related members within the `mjModel` struct from `int` to `mjtSize`. This allows MuJoCo to handle models with a larger number of elements. Corresponding changes were made to macros, function signatures, and I/O routines to accommodate the new `mjtSize` type.

PiperOrigin-RevId: 860144595
Change-Id: I701c6d607715d240766b6210a9773cd9e4258c59
2026-01-23 09:41:49 -08:00
Sam Haves 2582a83ac3 Add equalityJointAPI to mjcPhysics.
PiperOrigin-RevId: 860081702
Change-Id: Ifd961dcb2a8e0f5d885e9e9dadc0153b03cb5f4d
2026-01-23 06:28:29 -08:00
Haroon Qureshi bab468703c Display error message when requested file does not exist.
PiperOrigin-RevId: 859583121
Change-Id: Id9969e486499a70769e325161c3cd2c204006d9a
2026-01-22 06:34:35 -08:00