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.
This commit is contained in:
Kiss Lorand
2026-10-04 14:06:23 +03:00
committed by GitHub
parent 90ac58d3cd
commit 9530f019b3
3 changed files with 24 additions and 15 deletions
+4 -3
View File
@@ -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);
}
}}
}}
+14 -7
View File
@@ -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<PopNotification> & notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::SlicingProgress) {
SlicingProgressNotification* spn = dynamic_cast<SlicingProgressNotification*>(notification.get());
spn->set_progress_state(SlicingProgressNotification::SlicingProgressState::SP_BEGAN);
return;
auto find_slicing_progress = [this]() -> SlicingProgressNotification* {
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::SlicingProgress)
return dynamic_cast<SlicingProgressNotification*>(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)
{
@@ -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
}
}
}}
}}