From f5dfddb72afdc5182cb28b63b3c692a9f00535fe Mon Sep 17 00:00:00 2001 From: dzid26 Date: Sun, 8 Nov 2026 23:19:24 +0000 Subject: [PATCH] jotpluggler: fix custom series loading (#39188) * tools: evaluate custom series when layouts load or reset reload_layout/reset_layout never refreshed custom curves, so custom series stayed empty until the next route load (curves without local samples are dropped by plot.cc). * tools: restore subplots after closing the custom series editor The editor replaces the subplots while it is open; on close the subplots stayed collapsed into a single pane until a window resize. Reselect the workspace tab and rebuild its view. * tools: allow reloading the current layout Selecting the already-current layout did nothing. Reload it like any other layout selection. --- openpilot/tools/jotpluggler/app.cc | 10 ++++++++-- openpilot/tools/jotpluggler/layout.cc | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/openpilot/tools/jotpluggler/app.cc b/openpilot/tools/jotpluggler/app.cc index c7a74a0ecb..6917815ecb 100644 --- a/openpilot/tools/jotpluggler/app.cc +++ b/openpilot/tools/jotpluggler/app.cc @@ -829,7 +829,7 @@ void draw_sidebar(AppSession *session, const UiMetrics &ui, UiState *state, bool const std::string current_layout = session->layout_path.empty() ? std::string("untitled") : session->layout_path.stem().string(); for (const std::string &layout_name : layouts) { const bool selected = layout_name == current_layout; - if (ImGui::Selectable(layout_name.c_str(), selected) && !selected) { + if (ImGui::Selectable(layout_name.c_str(), selected)) { reload_layout(session, state, layout_name); } if (selected) { @@ -1644,7 +1644,8 @@ void draw_workspace(AppSession *session, const UiMetrics &ui, UiState *state) { }; TabActionKind pending_action = TabActionKind::None; int pending_tab_index = -1; - bool custom_series_tab_open = state->custom_series.open; + const bool custom_open_at_start = state->custom_series.open; + bool custom_series_tab_open = custom_open_at_start; bool suppress_aux_tabs_this_frame = state->request_close_tab && session->layout.tabs.size() == 1; for (size_t i = 0; i < session->layout.tabs.size(); ++i) { const WorkspaceTab &tab = session->layout.tabs[i]; @@ -1768,6 +1769,11 @@ void draw_workspace(AppSession *session, const UiMetrics &ui, UiState *state) { state->custom_series.open = false; state->custom_series.request_select = false; } + if (custom_open_at_start && !state->custom_series.open) { + // Editor hid the DockSpace while open (render.cc); rebuild dock tree on close. + request_tab_selection(state, state->active_tab_index); + mark_tab_dock_dirty(state, state->active_tab_index); + } if (rename_tab_rect.has_value()) { draw_inline_tab_editor(session, state, *rename_tab_rect); diff --git a/openpilot/tools/jotpluggler/layout.cc b/openpilot/tools/jotpluggler/layout.cc index 1f1f72c7d7..533eda5c07 100644 --- a/openpilot/tools/jotpluggler/layout.cc +++ b/openpilot/tools/jotpluggler/layout.cc @@ -477,6 +477,7 @@ bool reset_layout(AppSession *session, UiState *state) { session->autosave_path = autosave_path_for_layout(session->layout_path); state->undo.reset(session->layout); refresh_replaced_layout_ui(session, state, false); + refresh_all_custom_curves(session, state); reset_shared_range(state, *session); state->status_text = "Reset layout"; return true; @@ -501,6 +502,7 @@ bool reload_layout(AppSession *session, UiState *state, const std::string &layou state->layout_dirty = load_draft; state->undo.reset(session->layout); refresh_replaced_layout_ui(session, state, true); + refresh_all_custom_curves(session, state); if (preserve_shared_range) { state->has_shared_range = true; state->x_view_min = preserved_x_min;