FIX:Flushing volume button interaction optimization

Jira:STUDIO-14583

Change-Id: Ic1a600e92fb408b690febbd3f7a78924aed42e7a
(cherry picked from commit 672b3b54119b46c8e19f635520d4f78710128815)
This commit is contained in:
weizhen.xie
2025-09-15 11:42:53 +08:00
committed by Noisyfox
parent 21cd25d5af
commit 2959f7549c
5 changed files with 33 additions and 29 deletions

View File

@@ -10282,14 +10282,14 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
if (state) {
auto callback = [](wxEvtHandler *) {
auto plater = wxGetApp().plater();
auto flushing_volume_btn = wxGetApp().sidebar().get_flushing_volume_btn();
const wxEventTypeTag<SimpleEvent> EVT_SCHEDULE_BACKGROUND_PROCESS(wxNewEventType());
open_flushing_dialog(flushing_volume_btn, plater, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, plater));
open_flushing_dialog(plater, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, plater));
plater->get_view3D_canvas3D()->reload_scene(true);
return false;
};
notification_manager.push_slicing_customize_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel, text, _u8L("Flushing Volume"), callback);
notification_manager.push_flushing_volume_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel, text, _u8L("Flushing Volume"), callback);
} else
notification_manager.close_slicing_customize_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel);
notification_manager.close_flushing_volume_error_notification(NotificationType::BBLFlushingVolumeZero, NotificationLevel::WarningNotificationLevel);
}
else {
if (state)

View File

@@ -1857,16 +1857,11 @@ Sidebar::Sidebar(Plater *parent)
p->m_flushing_volume_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Compact);
p->m_flushing_volume_btn->SetId(wxID_RESET);
auto has_modify = is_flush_config_modified();
if (has_modify) {
p->m_flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0));
p->m_flushing_volume_btn->SetTextColor(wxColour(255, 111, 0));
} else {
p->m_flushing_volume_btn->SetBorderColor(wxColour(172, 172, 172));
p->m_flushing_volume_btn->SetTextColor(wxColour(172, 172, 172));
}
set_flushing_volume_warning(has_modify);
p->m_flushing_volume_btn->Bind(wxEVT_BUTTON, ([parent, this](wxCommandEvent &e) {
open_flushing_dialog(p->m_flushing_volume_btn, parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent));
open_flushing_dialog(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent));
p->plater->get_view3D_canvas3D()->reload_scene(true);
}));
bSizer39->Add(p->m_flushing_volume_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(4));
@@ -3345,9 +3340,24 @@ wxButton* Sidebar::get_wiping_dialog_button()
return NULL;
}
Button* Sidebar::get_flushing_volume_btn() {
return p->m_flushing_volume_btn;
}
void Sidebar::set_flushing_volume_warning(const bool flushing_volume_modify)
{
if (flushing_volume_modify){
p->m_flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0));
p->m_flushing_volume_btn->SetTextColor(wxColour(255, 111, 0));
}
else {
StateColor flush_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
p->m_flushing_volume_btn->SetBorderColor(flush_bd_col);
p->m_flushing_volume_btn->SetTextColor(flush_fg_col);
}
}
void Sidebar::enable_buttons(bool enable)
{
@@ -11185,6 +11195,9 @@ void Plater::load_project(wxString const& filename2,
wxGetApp().params_panel()->switch_to_object_if_has_object_configs();
auto has_modify = is_flush_config_modified();
sidebar().set_flushing_volume_warning(has_modify);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " load project done";
m_loading_project = false;
}

View File

@@ -213,7 +213,7 @@ public:
ConfigOptionsGroup* og_freq_chng_params(const bool is_fff);
wxButton* get_wiping_dialog_button();
Button* get_flushing_volume_btn();
void set_flushing_volume_warning(const bool flushing_volume_modify);
// BBS
void enable_buttons(bool enable);

View File

@@ -235,7 +235,7 @@ bool is_flush_config_modified()
return has_modify;
}
void open_flushing_dialog(Button *flushing_volume_btn, wxEvtHandler *parent, const wxEvent &event)
void open_flushing_dialog(wxEvtHandler *parent, const wxEvent &event)
{
auto &project_config = wxGetApp().preset_bundle->project_config;
const std::vector<double> &init_matrix = (project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values;
@@ -258,17 +258,9 @@ void open_flushing_dialog(Button *flushing_volume_btn, wxEvtHandler *parent, con
auto flush_multipliers = dlg.GetMultipliers();
(project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values = std::vector<double>(matrix.begin(), matrix.end());
(project_config.option<ConfigOptionFloats>("flush_multiplier"))->values = std::vector<double>(flush_multipliers.begin(), flush_multipliers.end());
auto has_modify = is_flush_config_modified();
if (has_modify) {
flushing_volume_btn->SetBorderColor(wxColour(255, 111, 0));
flushing_volume_btn->SetTextColor(wxColour(255, 111, 0));
} else {
flushing_volume_btn->SetBorderColor(wxColour(172, 172, 172));
flushing_volume_btn->SetTextColor(wxColour(172, 172, 172));
}
bool flushing_volume_modify = is_flush_config_modified();
wxGetApp().sidebar().set_flushing_volume_warning(flushing_volume_modify);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
wxGetApp().plater()->update_project_dirty_from_presets();
wxPostEvent(parent, event);
}

View File

@@ -38,10 +38,9 @@ private:
};
class Button;
bool is_flush_config_modified();
void open_flushing_dialog(Button *flushing_volume_btn, wxEvtHandler *parent, const wxEvent &event);
void open_flushing_dialog(wxEvtHandler *parent, const wxEvent &event);
class WipingDialog : public wxDialog
{