mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-15 15:18:08 +08:00
Suppress change preset to SLA if we have multi-part object
This commit is contained in:
parent
be9ba936e9
commit
2add733caa
@ -1536,5 +1536,18 @@ void ObjectList::last_volume_is_deleted(const int obj_idx)
|
|||||||
volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObjectList::has_multi_part_objects()
|
||||||
|
{
|
||||||
|
if (!m_objects_model->IsEmpty()) {
|
||||||
|
wxDataViewItemArray items;
|
||||||
|
m_objects_model->GetChildren(wxDataViewItem(0), items);
|
||||||
|
|
||||||
|
for (auto& item : items)
|
||||||
|
if (m_objects_model->GetItemByType(item, itVolume))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace GUI
|
} //namespace GUI
|
||||||
} //namespace Slic3r
|
} //namespace Slic3r
|
@ -166,6 +166,7 @@ public:
|
|||||||
void change_part_type();
|
void change_part_type();
|
||||||
|
|
||||||
void last_volume_is_deleted(const int obj_idx);
|
void last_volume_is_deleted(const int obj_idx);
|
||||||
|
bool has_multi_part_objects();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <wx/wupdlock.h>
|
#include <wx/wupdlock.h>
|
||||||
|
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "GUI_ObjectList.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@ -2368,6 +2369,9 @@ void Tab::select_preset(std::string preset_name)
|
|||||||
const Preset &new_printer_preset = *m_presets->find_preset(preset_name, true);
|
const Preset &new_printer_preset = *m_presets->find_preset(preset_name, true);
|
||||||
PrinterTechnology old_printer_technology = m_presets->get_edited_preset().printer_technology();
|
PrinterTechnology old_printer_technology = m_presets->get_edited_preset().printer_technology();
|
||||||
PrinterTechnology new_printer_technology = new_printer_preset.printer_technology();
|
PrinterTechnology new_printer_technology = new_printer_preset.printer_technology();
|
||||||
|
if (new_printer_technology == ptSLA && old_printer_technology == ptFFF && !may_switch_to_SLA_preset())
|
||||||
|
canceled = true;
|
||||||
|
else {
|
||||||
struct PresetUpdate {
|
struct PresetUpdate {
|
||||||
Preset::Type tab_type;
|
Preset::Type tab_type;
|
||||||
PresetCollection *presets;
|
PresetCollection *presets;
|
||||||
@ -2390,15 +2394,14 @@ void Tab::select_preset(std::string preset_name)
|
|||||||
if (!canceled) {
|
if (!canceled) {
|
||||||
for (PresetUpdate &pu : updates) {
|
for (PresetUpdate &pu : updates) {
|
||||||
// The preset will be switched to a different, compatible preset, or the '-- default --'.
|
// The preset will be switched to a different, compatible preset, or the '-- default --'.
|
||||||
if (pu.technology == new_printer_technology) {
|
if (pu.technology == new_printer_technology)
|
||||||
// m_reload_dependent_tabs.emplace_back(pu.name);
|
|
||||||
m_dependent_tabs.emplace_back(pu.tab_type);
|
m_dependent_tabs.emplace_back(pu.tab_type);
|
||||||
}
|
|
||||||
if (pu.old_preset_dirty)
|
if (pu.old_preset_dirty)
|
||||||
pu.presets->discard_current_changes();
|
pu.presets->discard_current_changes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (canceled) {
|
if (canceled) {
|
||||||
update_tab_ui();
|
update_tab_ui();
|
||||||
// Trigger the on_presets_changed event so that we also restore the previous value in the plater selector,
|
// Trigger the on_presets_changed event so that we also restore the previous value in the plater selector,
|
||||||
@ -2457,6 +2460,21 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
|
|||||||
return confirm->ShowModal() == wxID_YES;
|
return confirm->ShowModal() == wxID_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are switching from the FFF-preset to the SLA, we should to control the printed objects if they have a part(s).
|
||||||
|
// Because of we can't to print the multi-part objects with SLA technology.
|
||||||
|
bool Tab::may_switch_to_SLA_preset()
|
||||||
|
{
|
||||||
|
if (wxGetApp().obj_list()->has_multi_part_objects())
|
||||||
|
{
|
||||||
|
show_info( parent(),
|
||||||
|
_(L("It's impossible to print multi-part object(s) with SLA technology.")) +
|
||||||
|
_(L("\n\nPlease check your object list before preset changing.")),
|
||||||
|
_(L("Attention!")) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Tab::OnTreeSelChange(wxTreeEvent& event)
|
void Tab::OnTreeSelChange(wxTreeEvent& event)
|
||||||
{
|
{
|
||||||
if (m_disable_tree_sel_changed_event) return;
|
if (m_disable_tree_sel_changed_event) return;
|
||||||
|
@ -222,6 +222,7 @@ public:
|
|||||||
void update_page_tree_visibility();
|
void update_page_tree_visibility();
|
||||||
void select_preset(std::string preset_name = "");
|
void select_preset(std::string preset_name = "");
|
||||||
bool may_discard_current_dirty_preset(PresetCollection* presets = nullptr, const std::string& new_printer_name = "");
|
bool may_discard_current_dirty_preset(PresetCollection* presets = nullptr, const std::string& new_printer_name = "");
|
||||||
|
bool may_switch_to_SLA_preset();
|
||||||
wxSizer* compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox, wxButton** btn);
|
wxSizer* compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox, wxButton** btn);
|
||||||
|
|
||||||
void load_key_value(const std::string& opt_key, const boost::any& value, bool saved_value = false);
|
void load_key_value(const std::string& opt_key, const boost::any& value, bool saved_value = false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user