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:
committed by
Copybara-Service
parent
3ef083eecc
commit
2ad01960c6
@@ -464,7 +464,8 @@ bool LabelSelectionGui(mjvOption* opts) {
|
|||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
const std::string label_preview =
|
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(),
|
if (ImGui::BeginCombo("##Label", label_preview.c_str(),
|
||||||
ImGuiComboFlags_NoArrowButton)) {
|
ImGuiComboFlags_NoArrowButton)) {
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(kLabelNames); n++) {
|
for (int n = 0; n < IM_ARRAYSIZE(kLabelNames); n++) {
|
||||||
@@ -486,7 +487,8 @@ bool FrameSelectionGui(mjvOption* opts) {
|
|||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
const std::string frame_preview =
|
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(),
|
if (ImGui::BeginCombo("##Frame", frame_preview.c_str(),
|
||||||
ImGuiComboFlags_NoArrowButton)) {
|
ImGuiComboFlags_NoArrowButton)) {
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(kFrameNames); n++) {
|
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) {
|
float& noise_rate) {
|
||||||
const float item_width = ImGui::GetWindowWidth() * .6f;
|
const float item_width = ImGui::GetWindowWidth() * .6f;
|
||||||
ImGui::PushItemWidth(item_width);
|
ImGui::PushItemWidth(item_width);
|
||||||
ImGui::SliderFloat("Scale", &noise_scale, 0, 1);
|
ImGui::SliderFloat("Noise scale", &noise_scale, 0, 1);
|
||||||
ImGui::SliderFloat("Rate", &noise_rate, 0, 4);
|
ImGui::SliderFloat("Noise rate", &noise_rate, 0, 4);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -872,11 +872,6 @@ void App::BuildGui() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_.inspector_panel) {
|
if (tmp_.inspector_panel) {
|
||||||
if (ImGui::Begin("Inspector", &tmp_.inspector_panel)) {
|
|
||||||
DataInspectorGui();
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
|
|
||||||
if (ImGui::Begin("Explorer", &tmp_.inspector_panel)) {
|
if (ImGui::Begin("Explorer", &tmp_.inspector_panel)) {
|
||||||
SpecExplorerGui();
|
SpecExplorerGui();
|
||||||
}
|
}
|
||||||
@@ -886,6 +881,11 @@ void App::BuildGui() {
|
|||||||
SpecEditorGui();
|
SpecEditorGui();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
if (ImGui::Begin("Inspector", &tmp_.inspector_panel)) {
|
||||||
|
DataInspectorGui();
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_.chart_performance) {
|
if (tmp_.chart_performance) {
|
||||||
@@ -1071,17 +1071,6 @@ void App::DataInspectorGui() {
|
|||||||
const ImGuiTreeNodeFlags node_flags =
|
const ImGuiTreeNodeFlags node_flags =
|
||||||
ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_Framed;
|
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);
|
ImGui::BeginChild("JointsGui", {0, 0}, child_flags);
|
||||||
if (ImGui::TreeNodeEx("Joints", node_flags)) {
|
if (ImGui::TreeNodeEx("Joints", node_flags)) {
|
||||||
platform::JointsGui(model(), data(), &vis_options_);
|
platform::JointsGui(model(), data(), &vis_options_);
|
||||||
@@ -1091,6 +1080,14 @@ void App::DataInspectorGui() {
|
|||||||
|
|
||||||
ImGui::BeginChild("ControlsGui", {0, 0}, child_flags);
|
ImGui::BeginChild("ControlsGui", {0, 0}, child_flags);
|
||||||
if (ImGui::TreeNodeEx("Controls", node_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_);
|
platform::ControlsGui(model(), data(), &vis_options_);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user