mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
ENH: add new config transfer logic for model,region,layer config
jira: NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I995ebb45b992bba3879b71afd3fe21510335f24c (cherry picked from commit d45dacff9a97132c8999b1072c54c10bd0a2d12d) (cherry picked from commit 0b4e224aefbcdbc4b4ed88c3343948f68361a72b)
This commit is contained in:
@@ -4187,6 +4187,7 @@ void TabPrinter::build_fff()
|
||||
|
||||
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(m_config->option("nozzle_diameter"));
|
||||
m_initial_extruders_count = m_extruders_count = nozzle_diameter->values.size();
|
||||
m_extruder_variant_list = m_config->option<ConfigOptionStrings>("printer_extruder_variant")->values;
|
||||
// BBS
|
||||
//wxGetApp().obj_list()->update_objects_list_filament_column(m_initial_extruders_count);
|
||||
|
||||
@@ -4940,6 +4941,8 @@ void TabPrinter::on_preset_loaded()
|
||||
if (m_extruders_count != extruders_count)
|
||||
extruders_count_changed(extruders_count);
|
||||
|
||||
m_extruder_variant_list = m_config->option<ConfigOptionStrings>("printer_extruder_variant")->values;
|
||||
|
||||
if (base_name != m_base_preset_name) {
|
||||
bool use_default_nozzle_volume_type = true;
|
||||
m_base_preset_name = base_name;
|
||||
@@ -5231,7 +5234,8 @@ void Tab::load_current_preset()
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<<boost::format(": enter, m_type %1%")%Preset::get_type_string(m_type);
|
||||
const Preset& preset = m_presets->get_edited_preset();
|
||||
int previous_extruder_count = 0;
|
||||
std::vector<std::string> prev_variant_list;
|
||||
int prev_extruder_count = 0;
|
||||
|
||||
update_btns_enabling();
|
||||
|
||||
@@ -5239,7 +5243,8 @@ void Tab::load_current_preset()
|
||||
if (m_type == Slic3r::Preset::TYPE_PRINTER) {
|
||||
// For the printer profile, generate the extruder pages.
|
||||
if (preset.printer_technology() == ptFFF) {
|
||||
previous_extruder_count = static_cast<TabPrinter*>(this)->m_extruders_count;
|
||||
prev_variant_list = static_cast<TabPrinter*>(this)->m_extruder_variant_list;
|
||||
prev_extruder_count = static_cast<TabPrinter*>(this)->m_extruders_count;
|
||||
on_preset_loaded();
|
||||
}
|
||||
else
|
||||
@@ -5250,10 +5255,12 @@ void Tab::load_current_preset()
|
||||
update_extruder_variants();
|
||||
if (m_type == Preset::TYPE_PRINT) {
|
||||
if (auto tab = wxGetApp().plate_tab) {
|
||||
tab->m_config->apply(*m_config);
|
||||
tab->update_extruder_variants();
|
||||
tab->reload_config();
|
||||
}
|
||||
for (auto tab : wxGetApp().model_tabs_list) {
|
||||
tab->m_config->apply(*m_config);
|
||||
tab->update_extruder_variants();
|
||||
tab->reload_config();
|
||||
}
|
||||
@@ -5328,8 +5335,9 @@ void Tab::load_current_preset()
|
||||
}
|
||||
//update the object config due to extruder count change
|
||||
DynamicPrintConfig& new_print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
std::vector<std::string> new_variant_list = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionStrings>("printer_extruder_variant")->values;
|
||||
int new_extruder_count = wxGetApp().preset_bundle->get_printer_extruder_count();
|
||||
if (previous_extruder_count != new_extruder_count)
|
||||
if (prev_extruder_count != new_extruder_count || prev_variant_list.size() != new_variant_list.size())
|
||||
{
|
||||
//process the object params here
|
||||
Model& model = wxGetApp().plater()->model();
|
||||
@@ -5338,20 +5346,14 @@ void Tab::load_current_preset()
|
||||
ModelObject* object = model.objects[i];
|
||||
DynamicPrintConfig object_config = object->config.get();
|
||||
if (!object_config.empty()) {
|
||||
if (previous_extruder_count < new_extruder_count)
|
||||
object_config.update_values_from_single_to_multi_2(new_print_config, print_options_with_variant);
|
||||
else
|
||||
object_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
object_config.update_values_from_multi_to_multi(prev_variant_list,new_variant_list,new_print_config, print_options_with_variant);
|
||||
object->config.assign_config(std::move(object_config));
|
||||
}
|
||||
for (ModelVolume* v : object->volumes) {
|
||||
if (v->is_model_part() || v->is_modifier()) {
|
||||
DynamicPrintConfig volume_config = v->config.get();
|
||||
if (!volume_config.empty()) {
|
||||
if (previous_extruder_count < new_extruder_count)
|
||||
volume_config.update_values_from_single_to_multi_2(new_print_config, print_options_with_variant);
|
||||
else
|
||||
volume_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
volume_config.update_values_from_multi_to_multi(prev_variant_list,new_variant_list,new_print_config, print_options_with_variant);
|
||||
v->config.assign_config(std::move(volume_config));
|
||||
}
|
||||
}
|
||||
@@ -5361,11 +5363,8 @@ void Tab::load_current_preset()
|
||||
ModelConfig& layer_model_config = layer_config_it.second;
|
||||
DynamicPrintConfig layer_config = layer_model_config.get();
|
||||
if (!layer_config.empty()) {
|
||||
if (previous_extruder_count < new_extruder_count)
|
||||
layer_config.update_values_from_single_to_multi_2(new_print_config, print_options_with_variant);
|
||||
else
|
||||
layer_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
layer_model_config.assign_config(std::move(layer_config));
|
||||
layer_config.update_values_from_multi_to_multi(prev_variant_list,new_variant_list,new_print_config, print_options_with_variant);
|
||||
layer_model_config.assign_config(std::move(layer_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user