From 2ad01960c6e660a930fdb18dca4179ec2eaad8b2 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Fri, 8 May 2026 03:32:13 -0700 Subject: [PATCH] Studio UI tweaks - RHS: Make Inspector be focused by default. - RHS: Remove Noise pane, put the functionality in the Controls pane. - Improve Frame and Label dropdowns. PiperOrigin-RevId: 912434712 Change-Id: I2ee5b647febfc4a90a0cf9387b1d416f5a0dd4a1 --- src/experimental/platform/ux/gui.cc | 10 ++++++---- src/experimental/studio/app.cc | 29 +++++++++++++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/experimental/platform/ux/gui.cc b/src/experimental/platform/ux/gui.cc index b952688e..b0ffbadf 100644 --- a/src/experimental/platform/ux/gui.cc +++ b/src/experimental/platform/ux/gui.cc @@ -464,7 +464,8 @@ bool LabelSelectionGui(mjvOption* opts) { bool changed = false; const std::string label_preview = - std::string(ICON_LABEL) + " " + kLabelNames[opts->label]; + opts->label == 0 ? std::string(ICON_LABEL) + " Label" + : std::string(ICON_LABEL) + " " + kLabelNames[opts->label]; if (ImGui::BeginCombo("##Label", label_preview.c_str(), ImGuiComboFlags_NoArrowButton)) { for (int n = 0; n < IM_ARRAYSIZE(kLabelNames); n++) { @@ -486,7 +487,8 @@ bool FrameSelectionGui(mjvOption* opts) { bool changed = false; const std::string frame_preview = - std::string(ICON_FRAME) + " " + kFrameNames[opts->frame]; + opts->frame == 0 ? std::string(ICON_FRAME) + " Frame" + : std::string(ICON_FRAME) + " " + kFrameNames[opts->frame]; if (ImGui::BeginCombo("##Frame", frame_preview.c_str(), ImGuiComboFlags_NoArrowButton)) { for (int n = 0; n < IM_ARRAYSIZE(kFrameNames); n++) { @@ -1071,8 +1073,8 @@ void NoiseGui(const mjModel* model, const mjData* data, float& noise_scale, float& noise_rate) { const float item_width = ImGui::GetWindowWidth() * .6f; ImGui::PushItemWidth(item_width); - ImGui::SliderFloat("Scale", &noise_scale, 0, 1); - ImGui::SliderFloat("Rate", &noise_rate, 0, 4); + ImGui::SliderFloat("Noise scale", &noise_scale, 0, 1); + ImGui::SliderFloat("Noise rate", &noise_rate, 0, 4); ImGui::PopItemWidth(); } diff --git a/src/experimental/studio/app.cc b/src/experimental/studio/app.cc index 1bed7a85..3952c9f9 100644 --- a/src/experimental/studio/app.cc +++ b/src/experimental/studio/app.cc @@ -872,11 +872,6 @@ void App::BuildGui() { } if (tmp_.inspector_panel) { - if (ImGui::Begin("Inspector", &tmp_.inspector_panel)) { - DataInspectorGui(); - } - ImGui::End(); - if (ImGui::Begin("Explorer", &tmp_.inspector_panel)) { SpecExplorerGui(); } @@ -886,6 +881,11 @@ void App::BuildGui() { SpecEditorGui(); } ImGui::End(); + + if (ImGui::Begin("Inspector", &tmp_.inspector_panel)) { + DataInspectorGui(); + } + ImGui::End(); } if (tmp_.chart_performance) { @@ -1071,17 +1071,6 @@ void App::DataInspectorGui() { const ImGuiTreeNodeFlags node_flags = ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_Framed; - ImGui::BeginChild("NoiseGui", {0, 0}, child_flags); - if (ImGui::TreeNodeEx("Noise", node_flags)) { - float noise_scale = 0; - float noise_rate = 0; - step_control_.GetNoiseParameters(noise_scale, noise_rate); - platform::NoiseGui(model(), data(), noise_scale, noise_rate); - step_control_.SetNoiseParameters(noise_scale, noise_rate); - ImGui::TreePop(); - } - ImGui::EndChild(); - ImGui::BeginChild("JointsGui", {0, 0}, child_flags); if (ImGui::TreeNodeEx("Joints", node_flags)) { platform::JointsGui(model(), data(), &vis_options_); @@ -1091,6 +1080,14 @@ void App::DataInspectorGui() { ImGui::BeginChild("ControlsGui", {0, 0}, child_flags); if (ImGui::TreeNodeEx("Controls", node_flags)) { + + float noise_scale = 0; + float noise_rate = 0; + step_control_.GetNoiseParameters(noise_scale, noise_rate); + platform::NoiseGui(model(), data(), noise_scale, noise_rate); + step_control_.SetNoiseParameters(noise_scale, noise_rate); + ImGui::Separator(); + platform::ControlsGui(model(), data(), &vis_options_); ImGui::TreePop(); }