From 5efb3bef4550ef74299b974576a1d9a9accf3b05 Mon Sep 17 00:00:00 2001 From: Kiss Lorand <50251547+kisslorand@users.noreply.github.com> Date: Sun, 4 Oct 2026 14:06:23 +0300 Subject: [PATCH] Fix missing slicing progress on the first slice (#16000) Restore slicing progress after notification reset Ensure the cleared slicing-progress controller is recreated before its initial state transition, and calculate the Daily Tips size before positioning the popup. --- src/slic3r/GUI/DailyTips.cpp | 7 ++++--- src/slic3r/GUI/NotificationManager.cpp | 21 ++++++++++++------- .../GUI/SlicingProgressNotification.cpp | 11 +++++----- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/DailyTips.cpp b/src/slic3r/GUI/DailyTips.cpp index 8563766f81..51079f856c 100644 --- a/src/slic3r/GUI/DailyTips.cpp +++ b/src/slic3r/GUI/DailyTips.cpp @@ -276,8 +276,9 @@ void DailyTipsPanel::set_position(const ImVec2& pos) void DailyTipsPanel::set_size(const ImVec2& size) { m_width = size.x; - m_height = size.y; - m_content_height = m_height - m_footer_height; + //Orca: Keep the requested content height so expanding a collapsed panel restores its full size. + m_content_height = size.y - m_footer_height; + m_height = m_can_expand && !m_is_expanded ? m_footer_height : size.y; } void DailyTipsPanel::set_can_expand(bool can_expand) @@ -647,4 +648,4 @@ void DailyTipsWindow::on_change_color_mode(bool is_dark) m_panel->on_change_color_mode(is_dark); } -}} \ No newline at end of file +}} diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index cc391df8b5..5f2ec5d859 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -2880,17 +2880,24 @@ void NotificationManager::update_slicing_notif_dailytips(bool need_change) // Slicing progress notification was not found - init it thru plater so correct cancel callback function is appended wxGetApp().plater()->init_notification_manager(); } +// Orca: Ensures the slicing-progress controller exists before applying the first slicing transition. void NotificationManager::set_slicing_progress_began() { - for (std::unique_ptr & notification : m_pop_notifications) { - if (notification->get_type() == NotificationType::SlicingProgress) { - SlicingProgressNotification* spn = dynamic_cast(notification.get()); - spn->set_progress_state(SlicingProgressNotification::SlicingProgressState::SP_BEGAN); - return; + auto find_slicing_progress = [this]() -> SlicingProgressNotification* { + for (std::unique_ptr& notification : m_pop_notifications) { + if (notification->get_type() == NotificationType::SlicingProgress) + return dynamic_cast(notification.get()); } + return nullptr; + }; + + SlicingProgressNotification* notification = find_slicing_progress(); + if (notification == nullptr) { + wxGetApp().plater()->init_notification_manager(); + notification = find_slicing_progress(); } - // Slicing progress notification was not found - init it thru plater so correct cancel callback function is appended - wxGetApp().plater()->init_notification_manager(); + if (notification != nullptr) + notification->set_progress_state(SlicingProgressNotification::SlicingProgressState::SP_BEGAN); } void NotificationManager::set_slicing_progress_percentage(const std::string& text, float percentage) { diff --git a/src/slic3r/GUI/SlicingProgressNotification.cpp b/src/slic3r/GUI/SlicingProgressNotification.cpp index 161e9d0e61..9282b34af8 100644 --- a/src/slic3r/GUI/SlicingProgressNotification.cpp +++ b/src/slic3r/GUI/SlicingProgressNotification.cpp @@ -239,12 +239,15 @@ void NotificationManager::SlicingProgressNotification::render(GLCanvas3D& canvas const float gcodeviewer_height = wxGetApp().plater()->get_preview_canvas3D()->get_gcode_viewer().get_legend_height(); //const float dailytips_panel_height = std::min(380.0f * scale, std::max(90.0f, (cnv_size.get_height() - gcodeviewer_height - progress_panel_height - dailytips_child_window_padding.y - initial_y - m_line_height * 4))); const float dailytips_panel_height = 125.0f * scale; + const ImVec2 dailytips_size = ImVec2(dailytips_panel_width, dailytips_panel_height); + //Orca: Update the child's effective height before positioning this parent window. + m_dailytips_panel->set_size(dailytips_size); float right_gap = right_margin + (move_from_overlay ? overlay_width + m_line_height * 5 : 0); - m_window_pos = ImVec2((float)cnv_size.get_width() - right_gap - m_window_width, (float)cnv_size.get_height() - m_top_y); - imgui.set_next_window_pos(m_window_pos.x, m_window_pos.y, ImGuiCond_Always, 0.0f, 0.0f); m_window_height = progress_panel_height + m_dailytips_panel->get_size().y + progress_child_window_padding.y + dailytips_child_window_padding.y + bottom_padding.y; m_top_y = initial_y + m_window_height; + m_window_pos = ImVec2((float)cnv_size.get_width() - right_gap - m_window_width, (float)cnv_size.get_height() - m_top_y); + imgui.set_next_window_pos(m_window_pos.x, m_window_pos.y, ImGuiCond_Always, 0.0f, 0.0f); ImGui::SetNextWindowSizeConstraints(ImVec2(m_window_width, m_window_height), ImVec2(m_window_width, m_window_height)); // name of window indentifies window - has to be unique string @@ -307,9 +310,7 @@ void NotificationManager::SlicingProgressNotification::render(GLCanvas3D& canvas child_name = "##DailyTipsPanel" + std::to_string(parent_window->ID); ImVec2 dailytips_pos = ImGui::GetCursorScreenPos() + dailytips_child_window_padding; - ImVec2 dailytips_size = ImVec2(dailytips_panel_width, dailytips_panel_height); m_dailytips_panel->set_position(dailytips_pos); - m_dailytips_panel->set_size(dailytips_size); m_dailytips_panel->set_fade_opacity(m_current_fade_opacity); ImGui::SetNextWindowPos(dailytips_pos); if (ImGui::BeginChild(child_name.c_str(), ImVec2(dailytips_panel_width, dailytips_panel_height), false, child_window_flags)) { @@ -504,4 +505,4 @@ void NotificationManager::SlicingProgressNotification::render_progress_close_but } } -}} \ No newline at end of file +}}