mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 17:25:54 +08:00
Next improvements and fixing of the crash on "Output options" tab selection.
Follow-up d22809bf0d
This commit is contained in:
parent
f04545f1e6
commit
2159caf03b
@ -1215,18 +1215,19 @@ void add_correct_opts_to_diff(const std::string &opt_key, t_config_option_keys&
|
|||||||
}
|
}
|
||||||
|
|
||||||
// list of options with vector variable, which is independent from number of extruders
|
// list of options with vector variable, which is independent from number of extruders
|
||||||
static const std::vector<std::string> independent_from_extruder_number_options = {
|
static const std::set<std::string> independent_from_extruder_number_options = {
|
||||||
"bed_shape",
|
"bed_shape",
|
||||||
"thumbnails",
|
"compatible_printers",
|
||||||
|
"compatible_prints",
|
||||||
"filament_ramming_parameters",
|
"filament_ramming_parameters",
|
||||||
"gcode_substitutions",
|
"gcode_substitutions",
|
||||||
"compatible_prints",
|
"post_process",
|
||||||
"compatible_printers"
|
"thumbnails",
|
||||||
};
|
};
|
||||||
|
|
||||||
bool PresetCollection::is_independent_from_extruder_number_option(const std::string& opt_key)
|
bool PresetCollection::is_independent_from_extruder_number_option(const std::string& opt_key)
|
||||||
{
|
{
|
||||||
return std::find(independent_from_extruder_number_options.begin(), independent_from_extruder_number_options.end(), opt_key) != independent_from_extruder_number_options.end();
|
return independent_from_extruder_number_options.find(opt_key) != independent_from_extruder_number_options.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use deep_diff to correct return of changed options, considering individual options for each extruder.
|
// Use deep_diff to correct return of changed options, considering individual options for each extruder.
|
||||||
|
@ -1001,10 +1001,18 @@ bool OptionsGroup::launch_browser(const std::string& path_end)
|
|||||||
return wxGetApp().open_browser_with_warning_dialog(OptionsGroup::get_url(path_end), wxGetApp().mainframe->m_tabpanel);
|
return wxGetApp().open_browser_with_warning_dialog(OptionsGroup::get_url(path_end), wxGetApp().mainframe->m_tabpanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// list of options, which doesn't have a related filed
|
||||||
|
static const std::set<std::string> options_without_field = {
|
||||||
|
"compatible_printers",
|
||||||
|
"compatible_prints",
|
||||||
|
"bed_shape",
|
||||||
|
"filament_ramming_parameters",
|
||||||
|
"gcode_substitutions",
|
||||||
|
};
|
||||||
|
|
||||||
bool OptionsGroup::is_option_without_field(const std::string& opt_key)
|
bool OptionsGroup::is_option_without_field(const std::string& opt_key)
|
||||||
{
|
{
|
||||||
return opt_key!= "thumbnails" // "thumbnails" has related field
|
return options_without_field.find(opt_key) != options_without_field.end();
|
||||||
&& PresetCollection::is_independent_from_extruder_number_option(opt_key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void OptionsSearcher::append_options(DynamicPrintConfig* config, Preset::Type ty
|
|||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
if ( (type == Preset::TYPE_SLA_MATERIAL || type == Preset::TYPE_PRINTER || type == Preset::TYPE_PRINT) && opt_key != "bed_shape" && opt_key != "thumbnails")
|
if ( type != Preset::TYPE_FILAMENT && !PresetCollection::is_independent_from_extruder_number_option(opt_key) )
|
||||||
switch (config->option(opt_key)->type())
|
switch (config->option(opt_key)->type())
|
||||||
{
|
{
|
||||||
case coInts: change_opt_key<ConfigOptionInts >(opt_key, config, cnt); break;
|
case coInts: change_opt_key<ConfigOptionInts >(opt_key, config, cnt); break;
|
||||||
|
@ -647,7 +647,7 @@ void Tab::init_options_list()
|
|||||||
m_options_list.clear();
|
m_options_list.clear();
|
||||||
|
|
||||||
for (const std::string& opt_key : m_config->keys())
|
for (const std::string& opt_key : m_config->keys())
|
||||||
emplace_option(opt_key);
|
emplace_option(opt_key, m_type != Preset::TYPE_FILAMENT && !PresetCollection::is_independent_from_extruder_number_option(opt_key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -677,44 +677,14 @@ void Tab::emplace_option(const std::string& opt_key, bool respect_vec_values/* =
|
|||||||
m_options_list.emplace(opt_key, m_opt_status_value);
|
m_options_list.emplace(opt_key, m_opt_status_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabPrint::init_options_list()
|
|
||||||
{
|
|
||||||
m_options_list.clear();
|
|
||||||
|
|
||||||
for (const std::string& opt_key : m_config->keys())
|
|
||||||
emplace_option(opt_key, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabPrinter::init_options_list()
|
void TabPrinter::init_options_list()
|
||||||
{
|
{
|
||||||
m_options_list.clear();
|
Tab::init_options_list();
|
||||||
|
|
||||||
for (const std::string& opt_key : m_config->keys())
|
|
||||||
{
|
|
||||||
if (opt_key == "bed_shape" || opt_key == "thumbnails") {
|
|
||||||
m_options_list.emplace(opt_key, m_opt_status_value);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
emplace_option(opt_key, true);
|
|
||||||
}
|
|
||||||
if (m_printer_technology == ptFFF)
|
if (m_printer_technology == ptFFF)
|
||||||
m_options_list.emplace("extruders_count", m_opt_status_value);
|
m_options_list.emplace("extruders_count", m_opt_status_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabSLAMaterial::init_options_list()
|
|
||||||
{
|
|
||||||
m_options_list.clear();
|
|
||||||
|
|
||||||
for (const std::string& opt_key : m_config->keys())
|
|
||||||
{
|
|
||||||
if (opt_key == "compatible_prints" || opt_key == "compatible_printers") {
|
|
||||||
m_options_list.emplace(opt_key, m_opt_status_value);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
emplace_option(opt_key, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page)
|
void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page)
|
||||||
{
|
{
|
||||||
auto opt = m_options_list.find(opt_key);
|
auto opt = m_options_list.find(opt_key);
|
||||||
|
@ -417,7 +417,6 @@ public:
|
|||||||
void toggle_options() override;
|
void toggle_options() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void clear_pages() override;
|
void clear_pages() override;
|
||||||
void init_options_list() override;
|
|
||||||
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptFFF; }
|
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptFFF; }
|
||||||
wxSizer* create_manage_substitution_widget(wxWindow* parent);
|
wxSizer* create_manage_substitution_widget(wxWindow* parent);
|
||||||
wxSizer* create_substitutions_widget(wxWindow* parent);
|
wxSizer* create_substitutions_widget(wxWindow* parent);
|
||||||
@ -522,7 +521,6 @@ public:
|
|||||||
void build() override;
|
void build() override;
|
||||||
void toggle_options() override;
|
void toggle_options() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void init_options_list() override;
|
|
||||||
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptSLA; }
|
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptSLA; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user