Rename "Stats" window to "Info" and remove "Stats" dock.
PiperOrigin-RevId: 936026479 Change-Id: I72e4f2cba6df255d5446faedc81727b39ef735bc
This commit is contained in:
committed by
Copybara-Service
parent
4b1320a5f9
commit
e2528cbd93
@@ -118,7 +118,7 @@ class StudioApp:
|
|||||||
self.step_control = sim.StepControl()
|
self.step_control = sim.StepControl()
|
||||||
self.ux_state = ux.UxState()
|
self.ux_state = ux.UxState()
|
||||||
self.theme = ux.GuiTheme.LIGHT
|
self.theme = ux.GuiTheme.LIGHT
|
||||||
self.show_stats = False
|
self.show_info = False
|
||||||
self.show_solver = False
|
self.show_solver = False
|
||||||
self.should_quit = False
|
self.should_quit = False
|
||||||
self.status = 'Ready'
|
self.status = 'Ready'
|
||||||
@@ -368,12 +368,12 @@ class StudioApp:
|
|||||||
if imgui.BeginMenu('Charts'):
|
if imgui.BeginMenu('Charts'):
|
||||||
if imgui.MenuItem('Solver', '', self.show_solver):
|
if imgui.MenuItem('Solver', '', self.show_solver):
|
||||||
self.show_solver = not self.show_solver
|
self.show_solver = not self.show_solver
|
||||||
if imgui.MenuItem('Stats', '', self.show_stats):
|
if imgui.MenuItem('Info', '', self.show_info):
|
||||||
self.show_stats = not self.show_stats
|
self.show_info = not self.show_info
|
||||||
imgui.EndMenu()
|
imgui.EndMenu()
|
||||||
if imgui.BeginMenu('Help'):
|
if imgui.BeginMenu('Help'):
|
||||||
if imgui.MenuItem('Stats', '', self.show_stats):
|
if imgui.MenuItem('Info', '', self.show_info):
|
||||||
self.show_stats = not self.show_stats
|
self.show_info = not self.show_info
|
||||||
imgui.Separator()
|
imgui.Separator()
|
||||||
version = f'Version {mujoco.mj_versionString()}'
|
version = f'Version {mujoco.mj_versionString()}'
|
||||||
imgui.MenuItem(version)
|
imgui.MenuItem(version)
|
||||||
@@ -462,10 +462,10 @@ class StudioApp:
|
|||||||
ux.convergence_gui(self.model, self.data)
|
ux.convergence_gui(self.model, self.data)
|
||||||
imgui.End()
|
imgui.End()
|
||||||
|
|
||||||
if self.show_stats:
|
if self.show_info:
|
||||||
_, self.show_stats = imgui.Begin('Stats', self.show_stats)
|
_, self.show_info = imgui.Begin('Info', self.show_info)
|
||||||
paused = self.step_control.get_pause_state() != sim.PauseState.UNPAUSED
|
paused = self.step_control.get_pause_state() != sim.PauseState.UNPAUSED
|
||||||
ux.stats_gui(self.model, self.data, paused, 0.0)
|
ux.info_gui(self.model, self.data, paused, 0.0)
|
||||||
imgui.End()
|
imgui.End()
|
||||||
|
|
||||||
# -- Status bar -----------------------------------------------------------
|
# -- Status bar -----------------------------------------------------------
|
||||||
|
|||||||
@@ -324,14 +324,14 @@ PYBIND11_MODULE(ux, m) {
|
|||||||
py::arg("model"), py::arg("data"), "Render the solver counts chart.");
|
py::arg("model"), py::arg("data"), "Render the solver counts chart.");
|
||||||
|
|
||||||
m.def(
|
m.def(
|
||||||
"stats_gui",
|
"info_gui",
|
||||||
[](const mujoco::python::MjModelWrapper& model,
|
[](const mujoco::python::MjModelWrapper& model,
|
||||||
mujoco::python::MjDataWrapper& data, bool paused, float fps) {
|
mujoco::python::MjDataWrapper& data, bool paused, float fps) {
|
||||||
py::gil_scoped_release no_gil;
|
py::gil_scoped_release no_gil;
|
||||||
mujoco::platform::StatsGui(model.get(), data.get(), paused, fps);
|
mujoco::platform::InfoGui(model.get(), data.get(), paused, fps);
|
||||||
},
|
},
|
||||||
py::arg("model"), py::arg("data"), py::arg("paused"), py::arg("fps"),
|
py::arg("model"), py::arg("data"), py::arg("paused"), py::arg("fps"),
|
||||||
"Render the simulation statistics UI.");
|
"Render the simulation info UI.");
|
||||||
|
|
||||||
m.attr("FREE_CAMERA_IDX") = mujoco::platform::kFreeCameraIdx;
|
m.attr("FREE_CAMERA_IDX") = mujoco::platform::kFreeCameraIdx;
|
||||||
m.attr("TUMBLE_CAMERA_IDX") = mujoco::platform::kTumbleCameraIdx;
|
m.attr("TUMBLE_CAMERA_IDX") = mujoco::platform::kTumbleCameraIdx;
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ ImVec4 ConfigureDockingLayout() {
|
|||||||
|
|
||||||
const float kOptionsRelWidth = 0.15f;
|
const float kOptionsRelWidth = 0.15f;
|
||||||
const float kInspectorRelWidth = 0.22f;
|
const float kInspectorRelWidth = 0.22f;
|
||||||
const float kStatsRelHeight = 0.3f;
|
const float kPropertiesRelHeight = 0.3f;
|
||||||
const float kToolsBarHeight = 36.f * scale * font_scale;
|
const float kToolsBarHeight = 36.f * scale * font_scale;
|
||||||
const float kStatusBarHeight = 32.f * scale * font_scale;
|
const float kStatusBarHeight = 32.f * scale * font_scale;
|
||||||
|
|
||||||
@@ -388,12 +388,8 @@ ImVec4 ConfigureDockingLayout() {
|
|||||||
ImGui::DockBuilderSplitNode(main, ImGuiDir_Right, kInspectorRelWidth,
|
ImGui::DockBuilderSplitNode(main, ImGuiDir_Right, kInspectorRelWidth,
|
||||||
&inspector, &main);
|
&inspector, &main);
|
||||||
|
|
||||||
ImGuiID stats = 0;
|
|
||||||
ImGui::DockBuilderSplitNode(options, ImGuiDir_Down, kStatsRelHeight, &stats,
|
|
||||||
&options);
|
|
||||||
|
|
||||||
ImGuiID properties = 0;
|
ImGuiID properties = 0;
|
||||||
ImGui::DockBuilderSplitNode(inspector, ImGuiDir_Down, kStatsRelHeight,
|
ImGui::DockBuilderSplitNode(inspector, ImGuiDir_Down, kPropertiesRelHeight,
|
||||||
&properties, &inspector);
|
&properties, &inspector);
|
||||||
|
|
||||||
ImGuiID profiler = 0;
|
ImGuiID profiler = 0;
|
||||||
@@ -405,7 +401,6 @@ ImVec4 ConfigureDockingLayout() {
|
|||||||
ImGui::DockBuilderDockWindow("Editor", inspector);
|
ImGui::DockBuilderDockWindow("Editor", inspector);
|
||||||
ImGui::DockBuilderDockWindow("Inspector", inspector);
|
ImGui::DockBuilderDockWindow("Inspector", inspector);
|
||||||
ImGui::DockBuilderDockWindow("Properties", properties);
|
ImGui::DockBuilderDockWindow("Properties", properties);
|
||||||
ImGui::DockBuilderDockWindow("Stats", stats);
|
|
||||||
ImGui::DockBuilderDockWindow("Profiler", profiler);
|
ImGui::DockBuilderDockWindow("Profiler", profiler);
|
||||||
ImGui::DockBuilderFinish(root);
|
ImGui::DockBuilderFinish(root);
|
||||||
}
|
}
|
||||||
@@ -1472,8 +1467,8 @@ void CountsGui(const mjModel* model, mjData* data, ImVec2 plot_size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsGui(const mjModel* model, const mjData* data, bool paused,
|
void InfoGui(const mjModel* model, const mjData* data, bool paused,
|
||||||
float fps) {
|
float fps) {
|
||||||
const int num_islands = std::clamp(data->nisland, 1, mjNISLAND);
|
const int num_islands = std::clamp(data->nisland, 1, mjNISLAND);
|
||||||
|
|
||||||
// compute solver error (maximum over islands)
|
// compute solver error (maximum over islands)
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ void RescaleDock(float ratio);
|
|||||||
// or manipulating mjData elements (e.g. ControlsGui).
|
// or manipulating mjData elements (e.g. ControlsGui).
|
||||||
// "Explorer": secondary tab connected to the Inspector; designed for
|
// "Explorer": secondary tab connected to the Inspector; designed for
|
||||||
// displaying the tree of mjSpec elements.
|
// displaying the tree of mjSpec elements.
|
||||||
// "Stats": resizable section below the options; designed for displaying
|
|
||||||
// basic simulation statistics (e.g. StatsGui); hidden by default.
|
|
||||||
// "Properties": resizable section below the explorer; designed for displaying
|
// "Properties": resizable section below the explorer; designed for displaying
|
||||||
// properties of mjSpec elements (e.g. BodyPropertiesGui); hidden by
|
// properties of mjSpec elements (e.g. BodyPropertiesGui); hidden by
|
||||||
// default.
|
// default.
|
||||||
@@ -161,7 +159,7 @@ void ProfilerGui(const mjModel* model, mjData* data, SimProfiler* profiler);
|
|||||||
|
|
||||||
// UX for displaying basic simulation information. Note that the pause state and
|
// UX for displaying basic simulation information. Note that the pause state and
|
||||||
// FPS needs to be tracked by the caller and passed here to be displayed.
|
// FPS needs to be tracked by the caller and passed here to be displayed.
|
||||||
void StatsGui(const mjModel* model, const mjData* data, bool paused, float fps);
|
void InfoGui(const mjModel* model, const mjData* data, bool paused, float fps);
|
||||||
|
|
||||||
} // namespace mujoco::platform
|
} // namespace mujoco::platform
|
||||||
|
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ void App::HandleKeyboardEvents() {
|
|||||||
} else if (ImGui_IsChordJustPressed(ImGuiKey_F1)) {
|
} else if (ImGui_IsChordJustPressed(ImGuiKey_F1)) {
|
||||||
ToggleWindow(tmp_.help);
|
ToggleWindow(tmp_.help);
|
||||||
} else if (ImGui_IsChordJustPressed(ImGuiKey_F2)) {
|
} else if (ImGui_IsChordJustPressed(ImGuiKey_F2)) {
|
||||||
ToggleWindow(tmp_.stats);
|
ToggleWindow(tmp_.info);
|
||||||
} else if (ImGui_IsChordJustPressed(ImGuiKey_F3)) {
|
} else if (ImGui_IsChordJustPressed(ImGuiKey_F3)) {
|
||||||
ToggleWindow(tmp_.profiler);
|
ToggleWindow(tmp_.profiler);
|
||||||
} else if (ImGui_IsChordJustPressed(ImGuiKey_F6)) {
|
} else if (ImGui_IsChordJustPressed(ImGuiKey_F6)) {
|
||||||
@@ -934,7 +934,7 @@ void App::BuildGui() {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_.stats) {
|
if (tmp_.info) {
|
||||||
platform::ScopedStyle style;
|
platform::ScopedStyle style;
|
||||||
style.Var(ImGuiStyleVar_Alpha, 0.8f);
|
style.Var(ImGuiStyleVar_Alpha, 0.8f);
|
||||||
const float scale = ImGui::GetWindowDpiScale();
|
const float scale = ImGui::GetWindowDpiScale();
|
||||||
@@ -952,7 +952,7 @@ void App::BuildGui() {
|
|||||||
ImGuiWindowFlags_NoSavedSettings;
|
ImGuiWindowFlags_NoSavedSettings;
|
||||||
if (ImGui::Begin("Info", nullptr, flags)) {
|
if (ImGui::Begin("Info", nullptr, flags)) {
|
||||||
const float fps = renderer_->GetFps();
|
const float fps = renderer_->GetFps();
|
||||||
platform::StatsGui(
|
platform::InfoGui(
|
||||||
model(), data(),
|
model(), data(),
|
||||||
step_control_.GetPauseState() == PauseState::kNormalPaused, fps);
|
step_control_.GetPauseState() == PauseState::kNormalPaused, fps);
|
||||||
}
|
}
|
||||||
@@ -1674,8 +1674,8 @@ void App::MainMenuGui() {
|
|||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if (ImGui::MenuItem("Info", "F2", tmp_.stats)) {
|
if (ImGui::MenuItem("Info", "F2", tmp_.info)) {
|
||||||
ToggleWindow(tmp_.stats);
|
ToggleWindow(tmp_.info);
|
||||||
}
|
}
|
||||||
if (ImGui::MenuItem("Profiler", "F3", tmp_.profiler)) {
|
if (ImGui::MenuItem("Profiler", "F3", tmp_.profiler)) {
|
||||||
ToggleWindow(tmp_.profiler);
|
ToggleWindow(tmp_.profiler);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class App {
|
|||||||
|
|
||||||
// Windows.
|
// Windows.
|
||||||
bool help = false;
|
bool help = false;
|
||||||
bool stats = false;
|
bool info = false;
|
||||||
bool profiler = false;
|
bool profiler = false;
|
||||||
bool picture_in_picture = false;
|
bool picture_in_picture = false;
|
||||||
bool options_panel = true;
|
bool options_panel = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user