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
This commit is contained in:
Yuval Tassa
2026-05-08 03:32:13 -07:00
committed by Copybara-Service
parent 3ef083eecc
commit 2ad01960c6
2 changed files with 19 additions and 20 deletions
+6 -4
View File
@@ -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();
}
+13 -16
View File
@@ -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();
}