Skip to content

Commit a3e66cd

Browse files
haroonqcopybara-github
authored andcommitted
Combine performance charts; add fullscreen mode.
PiperOrigin-RevId: 847751915 Change-Id: I819eb8d36224ddba38ef8532a038a2ef350890c8
1 parent 223ba99 commit a3e66cd

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

src/experimental/studio/app.cc

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,9 @@ void App::HandleKeyboardEvents() {
605605
} else if (ImGui_IsChordJustPressed(ImGuiKey_F9)) {
606606
tmp_.chart_solver = !tmp_.chart_solver;
607607
} else if (ImGui_IsChordJustPressed(ImGuiKey_F10)) {
608-
tmp_.chart_cpu_time = !tmp_.chart_cpu_time;
608+
tmp_.chart_performance = !tmp_.chart_performance;
609609
} else if (ImGui_IsChordJustPressed(ImGuiKey_F11)) {
610-
tmp_.chart_dimensions = !tmp_.chart_dimensions;
610+
tmp_.full_screen = !tmp_.full_screen;
611611
} else if (ImGui_IsChordJustPressed(ImGuiKey_H)) {
612612
ToggleFlag(vis_options_.flags[mjVIS_CONVEXHULL]);
613613
} else if (ImGui_IsChordJustPressed(ImGuiKey_X)) {
@@ -773,11 +773,15 @@ void App::MoveCamera(platform::CameraMotion motion, mjtNum reldx,
773773
}
774774

775775
void App::BuildGui() {
776+
if (tmp_.full_screen) {
777+
return;
778+
}
779+
776780
SetupTheme(ui_.theme);
777781
const ImVec4 workspace_rect = platform::ConfigureDockingLayout();
778782

779783
// Place charts in bottom right corner of the workspace.
780-
const ImVec2 chart_size(250, 250);
784+
const ImVec2 chart_size(250, 500);
781785
const ImVec2 chart_pos(workspace_rect.x + workspace_rect.z - chart_size.x,
782786
workspace_rect.y + workspace_rect.w - chart_size.y);
783787

@@ -827,19 +831,11 @@ void App::BuildGui() {
827831
}
828832
}
829833

830-
if (tmp_.chart_cpu_time) {
834+
if (tmp_.chart_performance) {
831835
ImGui::SetNextWindowPos(chart_pos, ImGuiCond_FirstUseEver);
832836
ImGui::SetNextWindowSize(chart_size, ImGuiCond_FirstUseEver);
833-
if (ImGui::Begin("Cpu Time", &tmp_.chart_cpu_time)) {
837+
if (ImGui::Begin("Performance", &tmp_.chart_performance)) {
834838
profiler_.CpuTimeGraph();
835-
}
836-
ImGui::End();
837-
}
838-
839-
if (tmp_.chart_dimensions) {
840-
ImGui::SetNextWindowPos(chart_pos, ImGuiCond_FirstUseEver);
841-
ImGui::SetNextWindowSize(chart_size, ImGuiCond_FirstUseEver);
842-
if (ImGui::Begin("Dimensions", &tmp_.chart_dimensions)) {
843839
profiler_.DimensionsGraph();
844840
}
845841
ImGui::End();
@@ -1145,10 +1141,14 @@ void App::HelpGui() {
11451141
ImGui::Text("Stats");
11461142
ImGui::Text("Cycle Frames");
11471143
ImGui::Text("Cycle Labels");
1144+
ImGui::Text("Solver Charts");
1145+
ImGui::Text("Perf. Charts");
1146+
ImGui::Text("Toggle Fullscreen");
11481147
ImGui::Text("Free Camera");
11491148
ImGui::Text("Toggle Pause");
11501149
ImGui::Text("Reset Sim");
1151-
ImGui::Text("Show/Hide UI");
1150+
ImGui::Text("Toggle Left UI");
1151+
ImGui::Text("Toggle Right UI");
11521152
ImGui::Text("Speed Up");
11531153
ImGui::Text("Speed Down");
11541154
ImGui::Text("Prev Camera");
@@ -1166,10 +1166,14 @@ void App::HelpGui() {
11661166
ImGui::Text("F2");
11671167
ImGui::Text("F6");
11681168
ImGui::Text("F7");
1169+
ImGui::Text("F9");
1170+
ImGui::Text("F10");
1171+
ImGui::Text("F11");
11691172
ImGui::Text("Esc");
11701173
ImGui::Text("Spc");
11711174
ImGui::Text("Bksp");
11721175
ImGui::Text("Tab");
1176+
ImGui::Text("Sh+Tab");
11731177
ImGui::Text("=");
11741178
ImGui::Text("-");
11751179
ImGui::Text("[");
@@ -1560,17 +1564,17 @@ void App::MainMenuGui() {
15601564
"Shift+Tab")) {
15611565
tmp_.inspector_panel = !tmp_.inspector_panel;
15621566
}
1567+
if (ImGui::MenuItem("Full Screen", "F11")) {
1568+
tmp_.full_screen = !tmp_.full_screen;
1569+
}
15631570
ImGui::EndMenu();
15641571
}
15651572
if (ImGui::BeginMenu("Charts")) {
15661573
if (ImGui::MenuItem("Solver", "F9")) {
15671574
tmp_.chart_solver = !tmp_.chart_solver;
15681575
}
1569-
if (ImGui::MenuItem("CPU Time", "F10")) {
1570-
tmp_.chart_cpu_time = !tmp_.chart_cpu_time;
1571-
}
1572-
if (ImGui::MenuItem("Dimensions", "F11")) {
1573-
tmp_.chart_dimensions = !tmp_.chart_dimensions;
1576+
if (ImGui::MenuItem("Performance", "F10")) {
1577+
tmp_.chart_performance = !tmp_.chart_performance;
15741578
}
15751579
ImGui::EndMenu();
15761580
}

src/experimental/studio/app.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ class App {
9595
// Windows.
9696
bool help = false;
9797
bool stats = false;
98-
bool chart_cpu_time = false;
99-
bool chart_dimensions = false;
10098
bool chart_solver = false;
99+
bool chart_performance = false;
101100
bool options_panel = true;
102101
bool inspector_panel = true;
102+
bool full_screen = false;
103103
bool style_editor = false;
104104
bool imgui_demo = false;
105105
bool implot_demo = false;

0 commit comments

Comments
 (0)