mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Follow-up 409849d238:
				
					
				
			Added check for visibility for all loaded presets. Added notification about this action. + PresetComboBox: Fixed update() function for physical printers, when some of related presets are invisible.
This commit is contained in:
		
							parent
							
								
									532659a7f6
								
							
						
					
					
						commit
						28b92215c3
					
				
					 3 changed files with 51 additions and 14 deletions
				
			
		|  | @ -877,16 +877,6 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // 3.1) If loaded filaments are invisible/non-instaled, set them as visible
 | ||||
|         for (const std::string& filament : this->filament_presets) { | ||||
|             Preset* preset = this->filaments.find_preset(filament); | ||||
|             if (preset && !preset->is_visible) { | ||||
|                 preset->is_visible = true; | ||||
|                 if (preset->name == this->filaments.m_edited_preset.name) | ||||
|                     this->filaments.get_selected_preset().is_visible = true; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // 4) Load the project config values (the per extruder wipe matrix etc).
 | ||||
|         this->project_config.apply_only(config, s_project_options); | ||||
| 
 | ||||
|  |  | |||
|  | @ -2189,9 +2189,56 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_ | |||
|                 { | ||||
|                     if (!config.empty()) { | ||||
|                         Preset::normalize(config); | ||||
|                         wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config)); | ||||
|                         PresetBundle* preset_bundle = wxGetApp().preset_bundle; | ||||
|                         preset_bundle->load_config_model(filename.string(), std::move(config)); | ||||
|                         { | ||||
|                             // After loading of the presets from project, check if they are visible.
 | ||||
|                             // Set them to visible if they are not.
 | ||||
| 
 | ||||
|                             auto update_selected_preset_visibility = [](PresetCollection& presets, std::vector<std::string>& names) { | ||||
|                                 if (!presets.get_selected_preset().is_visible) { | ||||
|                                     assert(presets.get_selected_preset().name == presets.get_edited_preset().name); | ||||
|                                     presets.get_selected_preset().is_visible = true; | ||||
|                                     presets.get_edited_preset().is_visible = true; | ||||
|                                     names.emplace_back(presets.get_selected_preset().name); | ||||
|                                 } | ||||
|                             }; | ||||
| 
 | ||||
|                             std::vector<std::string> names; | ||||
|                             if (printer_technology == ptFFF) { | ||||
|                                 update_selected_preset_visibility(preset_bundle->prints, names); | ||||
|                                 for (const std::string& filament : preset_bundle->filament_presets) { | ||||
|                                     Preset* preset = preset_bundle->filaments.find_preset(filament); | ||||
|                                     if (preset && !preset->is_visible) { | ||||
|                                         preset->is_visible = true; | ||||
|                                         names.emplace_back(preset->name); | ||||
|                                         if (preset->name == preset_bundle->filaments.get_edited_preset().name) | ||||
|                                             preset_bundle->filaments.get_selected_preset().is_visible = true; | ||||
|                                     } | ||||
|                                 } | ||||
|                             } | ||||
|                             else { | ||||
|                                 update_selected_preset_visibility(preset_bundle->sla_prints, names); | ||||
|                                 update_selected_preset_visibility(preset_bundle->sla_materials, names); | ||||
|                             } | ||||
|                             update_selected_preset_visibility(preset_bundle->printers, names); | ||||
| 
 | ||||
|                             preset_bundle->update_compatible(PresetSelectCompatibleType::Never); | ||||
| 
 | ||||
|                             // show notification about temporary instaled presets
 | ||||
|                             if (!names.empty()) { | ||||
|                                 std::string notif_text = into_u8(_L_PLURAL("The preset below was temporary instaled on active instance of PrusaSlicer", | ||||
|                                                                            "The presets below were temporary instaled on active instance of PrusaSlicer", names.size())) + ":"; | ||||
|                                 for (std::string& name : names) | ||||
|                                     notif_text += "\n - " + name; | ||||
|                                 notification_manager->push_notification(NotificationType::CustomNotification, | ||||
|                                     NotificationManager::NotificationLevel::RegularNotification, notif_text); | ||||
|                             } | ||||
|                         } | ||||
| 
 | ||||
|                         if (printer_technology == ptFFF) | ||||
|                             CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &wxGetApp().preset_bundle->project_config); | ||||
|                             CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &preset_bundle->project_config); | ||||
| 
 | ||||
|                         // For exporting from the amf/3mf we shouldn't check printer_presets for the containing information about "Print Host upload"
 | ||||
|                         wxGetApp().load_current_presets(false); | ||||
|                         // Update filament colors for the MM-printer profile in the full config 
 | ||||
|  |  | |||
|  | @ -899,7 +899,7 @@ void PlaterPresetComboBox::update() | |||
|             for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { | ||||
|                 for (const std::string& preset_name : it->get_preset_names()) { | ||||
|                     Preset* preset = m_collection->find_preset(preset_name); | ||||
|                     if (!preset) | ||||
|                     if (!preset || !preset->is_visible) | ||||
|                         continue; | ||||
|                     std::string main_icon_name, bitmap_key = main_icon_name = preset->printer_technology() == ptSLA ? "sla_printer" : m_main_bitmap_name; | ||||
|                     wxBitmap* bmp = get_bmp(main_icon_name, wide_icons, main_icon_name); | ||||
|  | @ -1086,7 +1086,7 @@ void TabPresetComboBox::update() | |||
|             for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { | ||||
|                 for (const std::string& preset_name : it->get_preset_names()) { | ||||
|                     Preset* preset = m_collection->find_preset(preset_name); | ||||
|                     if (!preset) | ||||
|                     if (!preset || !preset->is_visible) | ||||
|                         continue; | ||||
|                     std::string main_icon_name = preset->printer_technology() == ptSLA ? "sla_printer" : m_main_bitmap_name; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka