Simplify MuJoCo Studio viewer selection and unify model flags.
This change removes the ViewerMode enum and instead infers whether to launch the Web Viewer or Native Viewer based on the graphics mode (gfx) setting. Specifically, setting gfx to "web" or "webgl" will now launch the Web Viewer (in future "webgpu" would also launch the Web Viewer). Additionally, this unifies command-line flags across studio scripts and samples by replacing the --mjcf flag with --model (with positional argument fallback) and standardizing absl flags usage. --model is a better name since formats like .mjz and .mjb are also supported by this argument. PiperOrigin-RevId: 959058940 Change-Id: If4e0ace664ddc6e45cb681d168679148e8c4901d
This commit is contained in:
committed by
Copybara-Service
parent
0a10860257
commit
b3ef7a8c2f
@@ -33,17 +33,11 @@ GFX_MODES = (
|
||||
'opengl_software',
|
||||
'vulkan',
|
||||
'vulkan_software',
|
||||
'web',
|
||||
'webgl',
|
||||
)
|
||||
|
||||
|
||||
class ViewerMode(enum.StrEnum):
|
||||
"""Determines where the viewer is rendered."""
|
||||
|
||||
NATIVE = 'native'
|
||||
WEB = 'web'
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Viewer configuration.
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -56,11 +50,8 @@ class ViewerConfig:
|
||||
title: str = ''
|
||||
width: int = 1200
|
||||
height: int = 800
|
||||
gfx: str = ''
|
||||
viewer_mode: ViewerMode = ViewerMode.NATIVE
|
||||
# Web viewer only: public port. 0 picks the first free port starting at 8080,
|
||||
# so several viewers can run side by side.
|
||||
http_port: int = 0
|
||||
gfx: str = '' # Graphics mode ('web' launches Web Viewer).
|
||||
http_port: int = 0 # Web Viewer port (0 picks first free port >= 8080).
|
||||
|
||||
|
||||
# Legacy message types kept for backward compatibility.
|
||||
|
||||
Reference in New Issue
Block a user