mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-03 02:00:40 +08:00
Hide sliced info and action buttons when autoslicing
This commit is contained in:
parent
dbb12e9537
commit
62f5fafe15
@ -416,14 +416,15 @@ void MultipleBeds::start_autoslice(std::function<void(int, bool)> select_bed_fn)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MultipleBeds::stop_autoslice(bool restore_original)
|
bool MultipleBeds::stop_autoslice(bool restore_original)
|
||||||
{
|
{
|
||||||
if (! is_autoslicing())
|
if (! is_autoslicing())
|
||||||
return;
|
return false;
|
||||||
m_autoslicing = false;
|
m_autoslicing = false;
|
||||||
|
|
||||||
if (restore_original)
|
if (restore_original)
|
||||||
m_select_bed_fn(m_autoslicing_original_bed, false);
|
m_select_bed_fn(m_autoslicing_original_bed, false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
void ensure_wipe_towers_on_beds(Model& model, const std::vector<std::unique_ptr<Print>>& prints);
|
void ensure_wipe_towers_on_beds(Model& model, const std::vector<std::unique_ptr<Print>>& prints);
|
||||||
|
|
||||||
void start_autoslice(std::function<void(int,bool)>);
|
void start_autoslice(std::function<void(int,bool)>);
|
||||||
void stop_autoslice(bool restore_original);
|
bool stop_autoslice(bool restore_original);
|
||||||
bool is_autoslicing() const { return m_autoslicing; }
|
bool is_autoslicing() const { return m_autoslicing; }
|
||||||
void autoslice_next_bed();
|
void autoslice_next_bed();
|
||||||
|
|
||||||
|
@ -143,8 +143,10 @@ void GLCanvas3D::select_bed(int i, bool triggered_by_user)
|
|||||||
}
|
}
|
||||||
wxGetApp().plater()->schedule_background_process();
|
wxGetApp().plater()->schedule_background_process();
|
||||||
wxGetApp().plater()->object_list_changed(); // Updates Slice Now / Export buttons.
|
wxGetApp().plater()->object_list_changed(); // Updates Slice Now / Export buttons.
|
||||||
if (s_multiple_beds.is_autoslicing() && triggered_by_user)
|
if (s_multiple_beds.is_autoslicing() && triggered_by_user) {
|
||||||
s_multiple_beds.stop_autoslice(false);
|
s_multiple_beds.stop_autoslice(false);
|
||||||
|
wxGetApp().sidebar().switch_from_autoslicing_mode();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6716,8 +6718,10 @@ void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2());
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2());
|
||||||
|
|
||||||
if (imgui.image_button(ImGui::SliceAllBtnIcon, "Slice All")) {
|
if (imgui.image_button(ImGui::SliceAllBtnIcon, "Slice All")) {
|
||||||
if (!s_multiple_beds.is_autoslicing())
|
if (!s_multiple_beds.is_autoslicing()) {
|
||||||
s_multiple_beds.start_autoslice([this](int i, bool user) { this->select_bed(i, user); });
|
s_multiple_beds.start_autoslice([this](int i, bool user) { this->select_bed(i, user); });
|
||||||
|
wxGetApp().sidebar().switch_to_autoslicing_mode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -2314,6 +2314,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||||||
notification_manager->set_slicing_progress_hidden();
|
notification_manager->set_slicing_progress_hidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((invalidated != Print::APPLY_STATUS_UNCHANGED || force_validation) && ! background_process.empty()) {
|
if ((invalidated != Print::APPLY_STATUS_UNCHANGED || force_validation) && ! background_process.empty()) {
|
||||||
// The delayed error message is no more valid.
|
// The delayed error message is no more valid.
|
||||||
delayed_error_message.clear();
|
delayed_error_message.clear();
|
||||||
@ -2970,11 +2971,13 @@ void Plater::priv::set_current_panel(wxPanel* panel)
|
|||||||
#endif // __WXMAC__
|
#endif // __WXMAC__
|
||||||
|
|
||||||
ScopeGuard guard([]() { s_reload_preview_after_switching_beds = false; });
|
ScopeGuard guard([]() { s_reload_preview_after_switching_beds = false; });
|
||||||
|
|
||||||
if (current_panel == panel) {
|
if (current_panel == panel) {
|
||||||
if (! s_reload_preview_after_switching_beds)
|
if (! s_reload_preview_after_switching_beds)
|
||||||
return;
|
return;
|
||||||
else
|
else {
|
||||||
update_background_process();
|
update_background_process();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPanel* old_panel = current_panel;
|
wxPanel* old_panel = current_panel;
|
||||||
@ -3004,7 +3007,10 @@ void Plater::priv::set_current_panel(wxPanel* panel)
|
|||||||
|
|
||||||
if (current_panel == view3D) {
|
if (current_panel == view3D) {
|
||||||
|
|
||||||
s_multiple_beds.stop_autoslice(true);
|
if(s_multiple_beds.stop_autoslice(true)) {
|
||||||
|
sidebar->switch_from_autoslicing_mode();
|
||||||
|
update_background_process();
|
||||||
|
}
|
||||||
|
|
||||||
if (old_panel == preview)
|
if (old_panel == preview)
|
||||||
preview->get_canvas3d()->unbind_event_handlers();
|
preview->get_canvas3d()->unbind_event_handlers();
|
||||||
|
@ -500,20 +500,20 @@ Sidebar::Sidebar(Plater *parent)
|
|||||||
|
|
||||||
enable_buttons(false);
|
enable_buttons(false);
|
||||||
|
|
||||||
auto *btns_sizer = new wxBoxSizer(wxVERTICAL);
|
m_btns_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
auto* complect_btns_sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto *complect_btns_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
complect_btns_sizer->Add(m_btn_export_gcode, 1, wxEXPAND);
|
complect_btns_sizer->Add(m_btn_export_gcode, 1, wxEXPAND);
|
||||||
complect_btns_sizer->Add(m_btn_connect_gcode, 1, wxEXPAND | wxLEFT, margin_5);
|
complect_btns_sizer->Add(m_btn_connect_gcode, 1, wxEXPAND | wxLEFT, margin_5);
|
||||||
complect_btns_sizer->Add(m_btn_send_gcode, 0, wxLEFT, margin_5);
|
complect_btns_sizer->Add(m_btn_send_gcode, 0, wxLEFT, margin_5);
|
||||||
complect_btns_sizer->Add(m_btn_export_gcode_removable, 0, wxLEFT, margin_5);
|
complect_btns_sizer->Add(m_btn_export_gcode_removable, 0, wxLEFT, margin_5);
|
||||||
|
|
||||||
btns_sizer->Add(m_btn_reslice, 0, wxEXPAND | wxTOP, margin_5);
|
m_btns_sizer->Add(m_btn_reslice, 0, wxEXPAND | wxTOP, margin_5);
|
||||||
btns_sizer->Add(complect_btns_sizer, 0, wxEXPAND | wxTOP, margin_5);
|
m_btns_sizer->Add(complect_btns_sizer, 0, wxEXPAND | wxTOP, margin_5);
|
||||||
|
|
||||||
auto *sizer = new wxBoxSizer(wxVERTICAL);
|
auto *sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
sizer->Add(m_scrolled_panel, 1, wxEXPAND);
|
sizer->Add(m_scrolled_panel, 1, wxEXPAND);
|
||||||
sizer->Add(btns_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM
|
sizer->Add(m_btns_sizer, 0, wxEXPAND | wxLEFT | wxBOTTOM
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
| wxRIGHT
|
| wxRIGHT
|
||||||
#endif // __linux__
|
#endif // __linux__
|
||||||
@ -856,11 +856,17 @@ void Sidebar::show_info_sizer()
|
|||||||
const int obj_idx = selection.get_object_idx();
|
const int obj_idx = selection.get_object_idx();
|
||||||
const int inst_idx = selection.get_instance_idx();
|
const int inst_idx = selection.get_instance_idx();
|
||||||
|
|
||||||
if (m_mode < comExpert || objects.empty() || obj_idx < 0 || int(objects.size()) <= obj_idx ||
|
if (
|
||||||
inst_idx < 0 || int(objects[obj_idx]->instances.size()) <= inst_idx ||
|
m_mode < comExpert
|
||||||
objects[obj_idx]->volumes.empty() || // hack to avoid crash when deleting the last object on the bed
|
|| objects.empty()
|
||||||
(selection.is_single_full_object() && objects[obj_idx]->instances.size()> 1) ||
|
|| obj_idx < 0
|
||||||
!(selection.is_single_full_instance() || selection.is_single_volume())) {
|
|| int(objects.size()) <= obj_idx
|
||||||
|
|| inst_idx < 0
|
||||||
|
|| int(objects[obj_idx]->instances.size()) <= inst_idx
|
||||||
|
|| objects[obj_idx]->volumes.empty() // hack to avoid crash when deleting the last object on the bed
|
||||||
|
|| (selection.is_single_full_object() && objects[obj_idx]->instances.size()> 1)
|
||||||
|
|| !(selection.is_single_full_instance() || selection.is_single_volume())
|
||||||
|
) {
|
||||||
m_object_info->Show(false);
|
m_object_info->Show(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1065,6 +1071,10 @@ void Sidebar::update_sliced_info_sizer()
|
|||||||
|
|
||||||
void Sidebar::show_sliced_info_sizer(const bool show)
|
void Sidebar::show_sliced_info_sizer(const bool show)
|
||||||
{
|
{
|
||||||
|
if (m_autoslicing_mode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wxWindowUpdateLocker freeze_guard(this);
|
wxWindowUpdateLocker freeze_guard(this);
|
||||||
|
|
||||||
m_sliced_info->Show(show);
|
m_sliced_info->Show(show);
|
||||||
@ -1075,6 +1085,19 @@ void Sidebar::show_sliced_info_sizer(const bool show)
|
|||||||
m_scrolled_panel->Refresh();
|
m_scrolled_panel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sidebar::show_btns_sizer(const bool show)
|
||||||
|
{
|
||||||
|
if (m_autoslicing_mode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindowUpdateLocker freeze_guard(this);
|
||||||
|
m_btns_sizer->Show(show);
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
m_scrolled_panel->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
void Sidebar::enable_buttons(bool enable)
|
void Sidebar::enable_buttons(bool enable)
|
||||||
{
|
{
|
||||||
m_btn_reslice->Enable(enable);
|
m_btn_reslice->Enable(enable);
|
||||||
@ -1084,11 +1107,50 @@ void Sidebar::enable_buttons(bool enable)
|
|||||||
m_btn_connect_gcode->Enable(enable);
|
m_btn_connect_gcode->Enable(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sidebar::show_reslice(bool show) const { return m_btn_reslice->Show(show); }
|
bool Sidebar::show_reslice(bool show) const {
|
||||||
bool Sidebar::show_export(bool show) const { return m_btn_export_gcode->Show(show); }
|
if (this->m_autoslicing_mode) {
|
||||||
bool Sidebar::show_send(bool show) const { return m_btn_send_gcode->Show(show); }
|
return false;
|
||||||
bool Sidebar::show_export_removable(bool show) const { return m_btn_export_gcode_removable->Show(show); }
|
}
|
||||||
bool Sidebar::show_connect(bool show) const { return m_btn_connect_gcode->Show(show); }
|
return m_btn_reslice->Show(show);
|
||||||
|
}
|
||||||
|
bool Sidebar::show_export(bool show) const {
|
||||||
|
if (this->m_autoslicing_mode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_btn_export_gcode->Show(show);
|
||||||
|
}
|
||||||
|
bool Sidebar::show_send(bool show) const {
|
||||||
|
if (this->m_autoslicing_mode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_btn_send_gcode->Show(show);
|
||||||
|
}
|
||||||
|
bool Sidebar::show_export_removable(bool show) const {
|
||||||
|
if (this->m_autoslicing_mode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_btn_export_gcode_removable->Show(show);
|
||||||
|
}
|
||||||
|
bool Sidebar::show_connect(bool show) const {
|
||||||
|
if (this->m_autoslicing_mode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_btn_connect_gcode->Show(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sidebar::switch_to_autoslicing_mode() {
|
||||||
|
this->show_sliced_info_sizer(false);
|
||||||
|
this->show_btns_sizer(false);
|
||||||
|
this->m_autoslicing_mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sidebar::switch_from_autoslicing_mode() {
|
||||||
|
if (!this->m_autoslicing_mode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->m_autoslicing_mode = false;
|
||||||
|
this->show_sliced_info_sizer(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Sidebar::update_mode()
|
void Sidebar::update_mode()
|
||||||
|
@ -75,6 +75,7 @@ class Sidebar : public wxPanel
|
|||||||
ObjectList* m_object_list { nullptr };
|
ObjectList* m_object_list { nullptr };
|
||||||
ObjectInfo* m_object_info { nullptr };
|
ObjectInfo* m_object_info { nullptr };
|
||||||
SlicedInfo* m_sliced_info { nullptr };
|
SlicedInfo* m_sliced_info { nullptr };
|
||||||
|
wxBoxSizer* m_btns_sizer { nullptr };
|
||||||
|
|
||||||
wxButton* m_btn_export_gcode { nullptr };
|
wxButton* m_btn_export_gcode { nullptr };
|
||||||
wxButton* m_btn_reslice { nullptr };
|
wxButton* m_btn_reslice { nullptr };
|
||||||
@ -87,6 +88,7 @@ class Sidebar : public wxPanel
|
|||||||
std::unique_ptr<ObjectSettings> m_object_settings;
|
std::unique_ptr<ObjectSettings> m_object_settings;
|
||||||
std::unique_ptr<ObjectLayers> m_object_layers;
|
std::unique_ptr<ObjectLayers> m_object_layers;
|
||||||
|
|
||||||
|
bool m_autoslicing_mode{ false };
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wxString m_reslice_btn_tooltip;
|
wxString m_reslice_btn_tooltip;
|
||||||
#endif
|
#endif
|
||||||
@ -117,6 +119,8 @@ public:
|
|||||||
|
|
||||||
void show_info_sizer();
|
void show_info_sizer();
|
||||||
void show_sliced_info_sizer(const bool show);
|
void show_sliced_info_sizer(const bool show);
|
||||||
|
void show_btns_sizer(const bool show);
|
||||||
|
|
||||||
void update_sliced_info_sizer();
|
void update_sliced_info_sizer();
|
||||||
|
|
||||||
void enable_buttons(bool enable);
|
void enable_buttons(bool enable);
|
||||||
@ -127,6 +131,9 @@ public:
|
|||||||
bool show_export_removable(bool show) const;
|
bool show_export_removable(bool show) const;
|
||||||
bool show_connect(bool show) const;
|
bool show_connect(bool show) const;
|
||||||
|
|
||||||
|
void switch_to_autoslicing_mode();
|
||||||
|
void switch_from_autoslicing_mode();
|
||||||
|
|
||||||
void collapse(bool collapse);
|
void collapse(bool collapse);
|
||||||
void set_extruders_count(size_t extruders_count);
|
void set_extruders_count(size_t extruders_count);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user