mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -06:00 
			
		
		
		
	"SLA Print Settings" implementation (start)
This commit is contained in:
		
							parent
							
								
									7cb99f8e27
								
							
						
					
					
						commit
						2fa055903f
					
				
					 11 changed files with 296 additions and 20 deletions
				
			
		|  | @ -1663,8 +1663,9 @@ void GCode::append_full_config(const Print& print, std::string& str) | |||
|     } | ||||
|     const DynamicConfig &full_config = print.placeholder_parser().config(); | ||||
| 	for (const char *key : { | ||||
| 		"print_settings_id", "filament_settings_id", "sla_material_settings_id", "printer_settings_id", | ||||
| 		"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_material_profile", | ||||
| 		"print_settings_id", "filament_settings_id", "sla_print_settings_id", "sla_material_settings_id", "printer_settings_id", | ||||
| 		"printer_model", "printer_variant",  | ||||
| 	    "default_print_profile", "default_filament_profile", "default_sla_print_profile", "default_sla_material_profile", | ||||
| 		"compatible_printers_condition_cummulative", "inherits_cummulative" }) { | ||||
| 		const ConfigOption *opt = full_config.option(key); | ||||
| 		if (opt != nullptr) | ||||
|  |  | |||
|  | @ -2434,6 +2434,120 @@ void PrintConfigDef::init_sla_params() | |||
| 
 | ||||
|     def = this->add("sla_material_settings_id", coString); | ||||
|     def->default_value = new ConfigOptionString(""); | ||||
| 
 | ||||
| 
 | ||||
|     def = this->add("default_sla_print_profile", coString); | ||||
|     def->label = L("Default SLA material profile"); | ||||
|     def->tooltip = L("Default print profile associated with the current printer profile. " | ||||
|                    "On selection of the current printer profile, this print profile will be activated."); | ||||
|     def->default_value = new ConfigOptionString(); | ||||
| 
 | ||||
|     def = this->add("sla_print_settings_id", coString); | ||||
|     def->default_value = new ConfigOptionString(""); | ||||
| 
 | ||||
|     def = this->add("support_head_front_radius", coFloat); | ||||
|     def->label = L("Support head front radius"); | ||||
|     def->tooltip = L("Radius of the pointing side of the head"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(0.2); | ||||
| 
 | ||||
|     def = this->add("support_head_penetration", coFloat); | ||||
|     def->label = L("Support head penetration"); | ||||
|     def->tooltip = L("How much the pinhead has to penetrate the model surface"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(0.2); | ||||
| 
 | ||||
|     def = this->add("support_head_back_radius", coFloat); | ||||
|     def->label = L("Support head back radius"); | ||||
|     def->tooltip = L("Radius of the back side of the 3d arrow"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(0.5); | ||||
| 
 | ||||
|     def = this->add("support_head_width", coFloat); | ||||
|     def->label = L("Support head width"); | ||||
|     def->tooltip = L("Width from the back sphere center to the front sphere center"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| 
 | ||||
|     def = this->add("support_pillar_radius", coFloat); | ||||
|     def->label = L("Support pillar radius"); | ||||
|     def->tooltip = L("Radius in mm of the support pillars"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(0.8); | ||||
| 
 | ||||
|     def = this->add("support_base_radius", coFloat); | ||||
|     def->label = L("Support base radius"); | ||||
|     def->tooltip = L("Radius in mm of the pillar base"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(2.0); | ||||
| 
 | ||||
|     def = this->add("support_base_height", coFloat); | ||||
|     def->label = L("Support base height"); | ||||
|     def->tooltip = L("The height of the pillar base cone"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| 
 | ||||
|     def = this->add("support_critical_angle", coFloat); | ||||
|     def->label = L("Critical angle"); | ||||
|     def->tooltip = L("The default angle for connecting support sticks and junctions."); | ||||
|     def->sidetext = L("°"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(45); | ||||
| 
 | ||||
|     def = this->add("support_max_bridge_length", coFloat); | ||||
|     def->label = L("Max bridge length"); | ||||
|     def->tooltip = L("The max length of a bridge"); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(); | ||||
| 
 | ||||
|     def = this->add("pad_wall_thickness", coFloat); | ||||
|     def->label = L("Pad wall thickness"); | ||||
|     def->tooltip = L(""); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(2.0); | ||||
| 
 | ||||
|     def = this->add("pad_wall_height", coFloat); | ||||
|     def->label = L("Pad wall height"); | ||||
|     def->tooltip = L(""); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(5.0); | ||||
| 
 | ||||
|     def = this->add("pad_max_merge_distance", coFloat); | ||||
|     def->label = L("Max merge distance"); | ||||
|     def->tooltip = L(""); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(50.0); | ||||
| 
 | ||||
|     def = this->add("pad_edge_radius", coFloat); | ||||
|     def->label = L("pad edge radius"); | ||||
|     def->tooltip = L(""); | ||||
|     def->sidetext = L("mm"); | ||||
|     def->cli = ""; | ||||
|     def->min = 0; | ||||
|     def->default_value = new ConfigOptionFloat(1.0); | ||||
| } | ||||
| 
 | ||||
| void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value) | ||||
|  |  | |||
|  | @ -908,7 +908,7 @@ public: | |||
|     ConfigOptionFloat support_head_front_radius /*= 0.2*/; | ||||
| 
 | ||||
|     // How much the pinhead has to penetrate the model surface
 | ||||
|     ConfigOptionFloat support_head_penetraiton /*= 0.2*/; | ||||
|     ConfigOptionFloat support_head_penetration /*= 0.2*/; | ||||
| 
 | ||||
|     // Radius of the back side of the 3d arrow.
 | ||||
|     ConfigOptionFloat support_head_back_radius /*= 0.5*/; | ||||
|  | @ -951,7 +951,7 @@ protected: | |||
|     { | ||||
|         OPT_PTR(layer_height); | ||||
|         OPT_PTR(support_head_front_radius); | ||||
|         OPT_PTR(support_head_penetraiton); | ||||
|         OPT_PTR(support_head_penetration); | ||||
|         OPT_PTR(support_head_back_radius); | ||||
|         OPT_PTR(support_head_width); | ||||
|         OPT_PTR(support_pillar_radius); | ||||
|  |  | |||
|  | @ -140,7 +140,7 @@ void MainFrame::init_tabpanel() | |||
|     Bind(EVT_TAB_PRESETS_CHANGED, &MainFrame::on_presets_changed, this); | ||||
| 
 | ||||
|     create_preset_tabs(); | ||||
|     std::vector<std::string> tab_names = { "print", "filament", "sla_material", "printer" };     | ||||
|     std::vector<std::string> tab_names = { "print", "filament", "sla_print", "sla_material", "printer" };     | ||||
|     for (auto tab_name : tab_names) | ||||
|         m_options_tabs[tab_name] = get_preset_tab(tab_name.c_str());  | ||||
| 
 | ||||
|  | @ -160,6 +160,7 @@ void MainFrame::init_tabpanel() | |||
| std::vector<PresetTab> preset_tabs = { | ||||
|     { "print", nullptr, ptFFF }, | ||||
|     { "filament", nullptr, ptFFF }, | ||||
|     { "sla_print", nullptr, ptSLA }, | ||||
|     { "sla_material", nullptr, ptSLA } | ||||
| }; | ||||
| 
 | ||||
|  | @ -194,6 +195,7 @@ void MainFrame::create_preset_tabs() | |||
| { | ||||
|     wxGetApp().update_label_colours_from_appconfig(); | ||||
|     add_created_tab(new TabPrint(m_tabpanel)); | ||||
|     add_created_tab(new TabSLAPrint(m_tabpanel)); | ||||
|     add_created_tab(new TabFilament(m_tabpanel)); | ||||
|     add_created_tab(new TabSLAMaterial(m_tabpanel)); | ||||
|     add_created_tab(new TabPrinter(m_tabpanel)); | ||||
|  | @ -202,7 +204,7 @@ void MainFrame::create_preset_tabs() | |||
| void MainFrame::add_created_tab(Tab* panel) | ||||
| { | ||||
|     panel->create_preset_tab(); | ||||
| 
 | ||||
|     /*
 | ||||
|     const wxString& tab_name = panel->GetName(); | ||||
|     bool add_panel = true; | ||||
| 
 | ||||
|  | @ -214,6 +216,8 @@ void MainFrame::add_created_tab(Tab* panel) | |||
|     } | ||||
| 
 | ||||
|     if (add_panel) | ||||
| */     | ||||
|     if (panel->supports_printer_technology(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology())) | ||||
|         m_tabpanel->AddPage(panel, panel->title()); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -424,6 +424,7 @@ struct Sidebar::priv | |||
|     PresetComboBox *combo_print; | ||||
|     std::vector<PresetComboBox*> combos_filament; | ||||
|     wxBoxSizer *sizer_filaments; | ||||
|     PresetComboBox *combo_sla_print; | ||||
|     PresetComboBox *combo_sla_material; | ||||
|     PresetComboBox *combo_printer; | ||||
| 
 | ||||
|  | @ -454,7 +455,7 @@ void Sidebar::priv::show_preset_comboboxes() | |||
|     for (size_t i = 0; i < 4; ++i) | ||||
|         sizer_presets->Show(i, !showSLA); | ||||
| 
 | ||||
|     for (size_t i = 4; i < 6; ++i) { | ||||
|     for (size_t i = 4; i < 8; ++i) { | ||||
|         if (sizer_presets->IsShown(i) != showSLA) | ||||
|             sizer_presets->Show(i, showSLA); | ||||
|     } | ||||
|  | @ -479,7 +480,7 @@ Sidebar::Sidebar(Plater *parent) | |||
|     p->scrolled->SetSizer(scrolled_sizer); | ||||
| 
 | ||||
|     // The preset chooser
 | ||||
|     p->sizer_presets = new wxFlexGridSizer(4, 2, 1, 2); | ||||
|     p->sizer_presets = new wxFlexGridSizer(5, 2, 1, 2); | ||||
|     p->sizer_presets->AddGrowableCol(1, 1); | ||||
|     p->sizer_presets->SetFlexibleDirection(wxBOTH); | ||||
|     p->sizer_filaments = new wxBoxSizer(wxVERTICAL); | ||||
|  | @ -502,10 +503,11 @@ Sidebar::Sidebar(Plater *parent) | |||
|     }; | ||||
| 
 | ||||
|     p->combos_filament.push_back(nullptr); | ||||
|     init_combo(&p->combo_print, _(L("Print settings")), Preset::TYPE_PRINT, false); | ||||
|     init_combo(&p->combos_filament[0], _(L("Filament")), Preset::TYPE_FILAMENT, true); | ||||
|     init_combo(&p->combo_sla_material, _(L("SLA material")), Preset::TYPE_SLA_MATERIAL, false); | ||||
|     init_combo(&p->combo_printer, _(L("Printer")), Preset::TYPE_PRINTER, false); | ||||
|     init_combo(&p->combo_print,         _(L("Print settings")), Preset::TYPE_PRINT,         false); | ||||
|     init_combo(&p->combos_filament[0],  _(L("Filament")),       Preset::TYPE_FILAMENT,      true); | ||||
|     init_combo(&p->combo_sla_print,     _(L("SLA print")),      Preset::TYPE_SLA_PRINT,     false); | ||||
|     init_combo(&p->combo_sla_material,  _(L("SLA material")),   Preset::TYPE_SLA_MATERIAL,  false); | ||||
|     init_combo(&p->combo_printer,       _(L("Printer")),        Preset::TYPE_PRINTER,       false); | ||||
| 
 | ||||
|     // calculate width of the preset labels 
 | ||||
|     p->sizer_presets->Layout(); | ||||
|  | @ -620,6 +622,10 @@ void Sidebar::update_presets(Preset::Type preset_type) | |||
| 		preset_bundle.prints.update_platter_ui(p->combo_print); | ||||
|         break; | ||||
| 
 | ||||
|     case Preset::TYPE_SLA_PRINT: | ||||
| 		preset_bundle.sla_prints.update_platter_ui(p->combo_sla_print); | ||||
|         break; | ||||
| 
 | ||||
|     case Preset::TYPE_SLA_MATERIAL: | ||||
| 		preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material); | ||||
|         break; | ||||
|  | @ -629,8 +635,10 @@ void Sidebar::update_presets(Preset::Type preset_type) | |||
| 		// Update the print choosers to only contain the compatible presets, update the dirty flags.
 | ||||
| 		if (p->plater->printer_technology() == ptFFF) | ||||
| 			preset_bundle.prints.update_platter_ui(p->combo_print); | ||||
| 		else | ||||
| 			preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material); | ||||
|         else { | ||||
|             preset_bundle.sla_prints.update_platter_ui(p->combo_sla_print); | ||||
|             preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material); | ||||
|         } | ||||
| 		// Update the printer choosers, update the dirty flags.
 | ||||
| 		preset_bundle.printers.update_platter_ui(p->combo_printer); | ||||
| 		// Update the filament choosers to only contain the compatible presets, update the color preview,
 | ||||
|  |  | |||
|  | @ -396,6 +396,34 @@ const std::vector<std::string>& Preset::sla_material_options() | |||
|     return s_opts; | ||||
| } | ||||
| 
 | ||||
| const std::vector<std::string>& Preset::sla_print_options() | ||||
| {     | ||||
|     static std::vector<std::string> s_opts; | ||||
|     if (s_opts.empty()) { | ||||
|         s_opts = { | ||||
|             "layer_height", | ||||
|             "support_head_front_radius", | ||||
|             "support_head_penetration", | ||||
|             "support_head_back_radius", | ||||
|             "support_head_width", | ||||
|             "support_pillar_radius", | ||||
|             "support_base_radius", | ||||
|             "support_base_height", | ||||
|             "support_critical_angle", | ||||
|             "support_max_bridge_length", | ||||
|             "pad_wall_thickness", | ||||
|             "pad_wall_height", | ||||
|             "pad_max_merge_distance", | ||||
|             "pad_edge_radius", | ||||
|             "default_sla_print_profile", | ||||
|             "compatible_printers", | ||||
|             "compatible_printers_condition",  | ||||
|             "inherits" | ||||
|         }; | ||||
|     } | ||||
|     return s_opts; | ||||
| } | ||||
| 
 | ||||
| PresetCollection::PresetCollection(Preset::Type type, const std::vector<std::string> &keys, const Slic3r::StaticPrintConfig &defaults, const std::string &default_name) : | ||||
|     m_type(type), | ||||
|     m_edited_preset(type, "", false), | ||||
|  |  | |||
|  | @ -84,6 +84,7 @@ public: | |||
|     { | ||||
|         TYPE_INVALID, | ||||
|         TYPE_PRINT, | ||||
|         TYPE_SLA_PRINT, | ||||
|         TYPE_FILAMENT, | ||||
|         TYPE_SLA_MATERIAL, | ||||
|         TYPE_PRINTER, | ||||
|  | @ -173,6 +174,7 @@ public: | |||
| 
 | ||||
|     static const std::vector<std::string>&  sla_printer_options(); | ||||
|     static const std::vector<std::string>&  sla_material_options(); | ||||
|     static const std::vector<std::string>&  sla_print_options(); | ||||
| 
 | ||||
| 	static void                             update_suffix_modified(); | ||||
|     static void                             normalize(DynamicPrintConfig &config); | ||||
|  |  | |||
|  | @ -45,6 +45,7 @@ PresetBundle::PresetBundle() : | |||
|     prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast<const HostConfig&>(FullPrintConfig::defaults())),  | ||||
|     filaments(Preset::TYPE_FILAMENT, Preset::filament_options(), static_cast<const HostConfig&>(FullPrintConfig::defaults())),  | ||||
|     sla_materials(Preset::TYPE_SLA_MATERIAL, Preset::sla_material_options(), static_cast<const SLAMaterialConfig&>(SLAFullPrintConfig::defaults())),  | ||||
|     sla_prints(Preset::TYPE_SLA_PRINT, Preset::sla_print_options(), static_cast<const SLAPrintObjectConfig&>(SLAFullPrintConfig::defaults())), | ||||
|     printers(Preset::TYPE_PRINTER, Preset::printer_options(), static_cast<const HostConfig&>(FullPrintConfig::defaults()), "- default FFF -"), | ||||
|     m_bitmapCompatible(new wxBitmap), | ||||
|     m_bitmapIncompatible(new wxBitmap), | ||||
|  | @ -76,6 +77,10 @@ PresetBundle::PresetBundle() : | |||
|     this->sla_materials.default_preset().compatible_printers_condition(); | ||||
|     this->sla_materials.default_preset().inherits(); | ||||
| 
 | ||||
|     this->sla_prints.default_preset().config.optptr("sla_print_settings_id", true); | ||||
|     this->sla_prints.default_preset().compatible_printers_condition(); | ||||
|     this->sla_prints.default_preset().inherits(); | ||||
| 
 | ||||
|     this->printers.add_default_preset(Preset::sla_printer_options(), static_cast<const SLAMaterialConfig&>(SLAFullPrintConfig::defaults()), "- default SLA -"); | ||||
|     this->printers.preset(1).printer_technology() = ptSLA; | ||||
|     for (size_t i = 0; i < 2; ++ i) { | ||||
|  | @ -88,14 +93,18 @@ PresetBundle::PresetBundle() : | |||
|         if (i == 0) { | ||||
|             preset.config.optptr("default_print_profile", true); | ||||
|             preset.config.option<ConfigOptionStrings>("default_filament_profile", true)->values = { "" }; | ||||
|         } else  | ||||
|         } | ||||
|         else { | ||||
|             preset.config.optptr("default_sla_material_profile", true); | ||||
|             preset.config.optptr("default_sla_print_profile", true); | ||||
|         } | ||||
|         // default_sla_material_profile
 | ||||
|         preset.inherits(); | ||||
|     } | ||||
| 
 | ||||
| 	// Load the default preset bitmaps.
 | ||||
|     this->prints       .load_bitmap_default("cog.png"); | ||||
|     this->sla_prints   .load_bitmap_default("package_green.png"); | ||||
|     this->filaments    .load_bitmap_default("spool.png"); | ||||
|     this->sla_materials.load_bitmap_default("package_green.png"); | ||||
|     this->printers     .load_bitmap_default("printer_empty.png"); | ||||
|  | @ -103,6 +112,7 @@ PresetBundle::PresetBundle() : | |||
| 
 | ||||
|     // Re-activate the default presets, so their "edited" preset copies will be updated with the additional configuration values above.
 | ||||
|     this->prints       .select_preset(0); | ||||
|     this->sla_prints   .select_preset(0); | ||||
|     this->filaments    .select_preset(0); | ||||
|     this->sla_materials.select_preset(0); | ||||
|     this->printers     .select_preset(0); | ||||
|  | @ -133,12 +143,14 @@ void PresetBundle::reset(bool delete_files) | |||
|     // Clear the existing presets, delete their respective files.
 | ||||
|     this->vendors.clear(); | ||||
|     this->prints       .reset(delete_files); | ||||
|     this->sla_prints   .reset(delete_files); | ||||
|     this->filaments    .reset(delete_files); | ||||
|     this->sla_materials.reset(delete_files); | ||||
|     this->printers     .reset(delete_files); | ||||
|     this->filament_presets.clear(); | ||||
|     this->filament_presets.emplace_back(this->filaments.get_selected_preset_name()); | ||||
|     this->obsolete_presets.prints.clear(); | ||||
|     this->obsolete_presets.sla_prints.clear(); | ||||
|     this->obsolete_presets.filaments.clear(); | ||||
|     this->obsolete_presets.sla_materials.clear(); | ||||
|     this->obsolete_presets.printers.clear(); | ||||
|  | @ -193,6 +205,11 @@ void PresetBundle::load_presets(const AppConfig &config) | |||
|     } catch (const std::runtime_error &err) { | ||||
|         errors_cummulative += err.what(); | ||||
|     } | ||||
|     try { | ||||
|         this->sla_prints.load_presets(dir_user_presets, "sla_print"); | ||||
|     } catch (const std::runtime_error &err) { | ||||
|         errors_cummulative += err.what(); | ||||
|     } | ||||
|     try { | ||||
|         this->filaments.load_presets(dir_user_presets, "filament"); | ||||
|     } catch (const std::runtime_error &err) { | ||||
|  | @ -267,13 +284,16 @@ std::vector<std::string> PresetBundle::merge_presets(PresetBundle &&other) | |||
| { | ||||
|     this->vendors.insert(other.vendors.begin(), other.vendors.end()); | ||||
|     std::vector<std::string> duplicate_prints        = this->prints       .merge_presets(std::move(other.prints),        this->vendors); | ||||
|     std::vector<std::string> duplicate_sla_prints    = this->sla_prints   .merge_presets(std::move(other.sla_prints),    this->vendors); | ||||
|     std::vector<std::string> duplicate_filaments     = this->filaments    .merge_presets(std::move(other.filaments),     this->vendors); | ||||
|     std::vector<std::string> duplicate_sla_materials = this->sla_materials.merge_presets(std::move(other.sla_materials), this->vendors); | ||||
|     std::vector<std::string> duplicate_printers      = this->printers     .merge_presets(std::move(other.printers),      this->vendors); | ||||
| 	append(this->obsolete_presets.prints,        std::move(other.obsolete_presets.prints)); | ||||
| 	append(this->obsolete_presets.sla_prints,    std::move(other.obsolete_presets.sla_prints)); | ||||
| 	append(this->obsolete_presets.filaments,     std::move(other.obsolete_presets.filaments)); | ||||
|     append(this->obsolete_presets.sla_materials, std::move(other.obsolete_presets.sla_materials)); | ||||
| 	append(this->obsolete_presets.printers,      std::move(other.obsolete_presets.printers)); | ||||
| 	append(duplicate_prints, std::move(duplicate_sla_prints)); | ||||
| 	append(duplicate_prints, std::move(duplicate_filaments)); | ||||
|     append(duplicate_prints, std::move(duplicate_sla_materials)); | ||||
|     append(duplicate_prints, std::move(duplicate_printers)); | ||||
|  | @ -307,6 +327,7 @@ void PresetBundle::load_selections(const AppConfig &config) | |||
| 
 | ||||
|     // Parse the initial print / filament / printer profile names.
 | ||||
|     std::string initial_print_profile_name        = remove_ini_suffix(config.get("presets", "print")); | ||||
|     std::string initial_sla_print_profile_name    = remove_ini_suffix(config.get("presets", "sla_print")); | ||||
|     std::string initial_filament_profile_name     = remove_ini_suffix(config.get("presets", "filament")); | ||||
|     std::string initial_sla_material_profile_name = remove_ini_suffix(config.get("presets", "sla_material")); | ||||
| 	std::string initial_printer_profile_name      = remove_ini_suffix(config.get("presets", "printer")); | ||||
|  | @ -320,10 +341,12 @@ void PresetBundle::load_selections(const AppConfig &config) | |||
|     if (printer_technology == ptFFF) { | ||||
|         prints.select_preset_by_name_strict(initial_print_profile_name); | ||||
|         filaments.select_preset_by_name_strict(initial_filament_profile_name); | ||||
|         sla_prints.select_preset_by_name(initial_sla_material_profile_name, true); | ||||
|         sla_materials.select_preset_by_name(initial_sla_material_profile_name, true); | ||||
|     } else { | ||||
|         prints.select_preset_by_name(initial_print_profile_name, true); | ||||
|         filaments.select_preset_by_name(initial_filament_profile_name, true); | ||||
|         sla_prints.select_preset_by_name_strict(initial_sla_material_profile_name); | ||||
|         sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name); | ||||
|     } | ||||
| 
 | ||||
|  | @ -358,6 +381,7 @@ void PresetBundle::export_selections(AppConfig &config) | |||
| 	assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front()); | ||||
|     config.clear_section("presets"); | ||||
|     config.set("presets", "print",        prints.get_selected_preset_name()); | ||||
|     config.set("presets", "sla_print",    sla_prints.get_selected_preset_name()); | ||||
|     config.set("presets", "filament",     filament_presets.front()); | ||||
| 	for (int i = 1; i < filament_presets.size(); ++i) { | ||||
|         char name[64]; | ||||
|  | @ -378,6 +402,7 @@ void PresetBundle::export_selections(PlaceholderParser &pp) | |||
|         pp.set("filament_preset",     filament_presets); | ||||
|         break; | ||||
|     case ptSLA: | ||||
|         pp.set("sla_print_preset",    sla_prints.get_selected_preset().name); | ||||
|         pp.set("sla_material_preset", sla_materials.get_selected_preset().name); | ||||
|         break; | ||||
|     } | ||||
|  | @ -401,24 +426,28 @@ bool PresetBundle::load_compatible_bitmaps() | |||
|     if (loaded_compatible) { | ||||
|         prints       .set_bitmap_compatible(m_bitmapCompatible); | ||||
|         filaments    .set_bitmap_compatible(m_bitmapCompatible); | ||||
|         sla_prints   .set_bitmap_compatible(m_bitmapCompatible); | ||||
|         sla_materials.set_bitmap_compatible(m_bitmapCompatible); | ||||
| //        printers .set_bitmap_compatible(m_bitmapCompatible);
 | ||||
|     } | ||||
|     if (loaded_incompatible) { | ||||
|         prints       .set_bitmap_incompatible(m_bitmapIncompatible); | ||||
|         filaments    .set_bitmap_incompatible(m_bitmapIncompatible); | ||||
|         sla_prints   .set_bitmap_incompatible(m_bitmapIncompatible); | ||||
|         sla_materials.set_bitmap_incompatible(m_bitmapIncompatible); | ||||
| //        printers .set_bitmap_incompatible(m_bitmapIncompatible);
 | ||||
|     } | ||||
|     if (loaded_lock) { | ||||
|         prints       .set_bitmap_lock(m_bitmapLock); | ||||
|         filaments    .set_bitmap_lock(m_bitmapLock); | ||||
|         sla_prints   .set_bitmap_lock(m_bitmapLock); | ||||
|         sla_materials.set_bitmap_lock(m_bitmapLock); | ||||
|         printers     .set_bitmap_lock(m_bitmapLock); | ||||
|     } | ||||
|     if (loaded_lock_open) { | ||||
|         prints       .set_bitmap_lock_open(m_bitmapLock); | ||||
|         filaments    .set_bitmap_lock_open(m_bitmapLock); | ||||
|         sla_prints   .set_bitmap_lock_open(m_bitmapLock); | ||||
|         sla_materials.set_bitmap_lock_open(m_bitmapLock); | ||||
|         printers     .set_bitmap_lock_open(m_bitmapLock); | ||||
|     } | ||||
|  | @ -533,14 +562,17 @@ DynamicPrintConfig PresetBundle::full_sla_config() const | |||
| {     | ||||
|     DynamicPrintConfig out; | ||||
|     out.apply(SLAFullPrintConfig::defaults()); | ||||
|     out.apply(this->sla_prints.get_edited_preset().config); | ||||
|     out.apply(this->sla_materials.get_edited_preset().config); | ||||
|     out.apply(this->printers.get_edited_preset().config); | ||||
|     // There are no project configuration values as of now, the project_config is reserved for FFF printers.
 | ||||
| //    out.apply(this->project_config);
 | ||||
| 
 | ||||
|     // Collect the "compatible_printers_condition" and "inherits" values over all presets (sla_materials, printers) into a single vector.
 | ||||
|     // Collect the "compatible_printers_condition" and "inherits" values over all presets (sla_prints, sla_materials, printers) into a single vector.
 | ||||
|     std::vector<std::string> compatible_printers_condition; | ||||
|     std::vector<std::string> inherits; | ||||
|     compatible_printers_condition.emplace_back(this->/*prints*/sla_prints.get_edited_preset().compatible_printers_condition()); | ||||
|     inherits                     .emplace_back(this->/*prints*/sla_prints.get_edited_preset().inherits()); | ||||
|     compatible_printers_condition.emplace_back(this->/*prints*/sla_materials.get_edited_preset().compatible_printers_condition()); | ||||
|     inherits                     .emplace_back(this->/*prints*/sla_materials.get_edited_preset().inherits()); | ||||
|     inherits                     .emplace_back(this->printers.get_edited_preset().inherits()); | ||||
|  | @ -550,6 +582,7 @@ DynamicPrintConfig PresetBundle::full_sla_config() const | |||
|     out.erase("compatible_printers_condition"); | ||||
|     out.erase("inherits"); | ||||
|      | ||||
|     out.option<ConfigOptionString >("sla_print_settings_id",    true)->value  = this->sla_prints.get_selected_preset().name; | ||||
|     out.option<ConfigOptionString >("sla_material_settings_id", true)->value  = this->sla_materials.get_selected_preset().name; | ||||
|     out.option<ConfigOptionString >("printer_settings_id",      true)->value  = this->printers.get_selected_preset().name; | ||||
| 
 | ||||
|  | @ -661,6 +694,8 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool | |||
| 
 | ||||
|     // 2) If the loading succeeded, split and load the config into print / filament / printer settings.
 | ||||
|     // First load the print and printer presets.
 | ||||
| 
 | ||||
|     // #ys_FIXME_SLA_PRINT
 | ||||
|     for (size_t i_group = 0; i_group < 2; ++ i_group) { | ||||
|         PresetCollection &presets = (i_group == 0) ? ((printer_technology == ptFFF) ? this->prints : this->sla_materials) : this->printers; | ||||
|         // Split the "compatible_printers_condition" and "inherits" values one by one from a single vector to the print & printer profiles.
 | ||||
|  | @ -794,6 +829,7 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const | |||
|         return preset_name_dst; | ||||
|     }; | ||||
|     load_one(this->prints,        tmp_bundle.prints,        tmp_bundle.prints       .get_selected_preset().name, true); | ||||
|     load_one(this->sla_prints,    tmp_bundle.sla_prints,    tmp_bundle.sla_prints   .get_selected_preset().name, true); | ||||
|     load_one(this->filaments,     tmp_bundle.filaments,     tmp_bundle.filaments    .get_selected_preset().name, true); | ||||
|     load_one(this->sla_materials, tmp_bundle.sla_materials, tmp_bundle.sla_materials.get_selected_preset().name, true); | ||||
|     load_one(this->printers,      tmp_bundle.printers,      tmp_bundle.printers     .get_selected_preset().name, true); | ||||
|  | @ -919,6 +955,7 @@ static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree, co | |||
| static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree) | ||||
| { | ||||
|     flatten_configbundle_hierarchy(tree, "print"); | ||||
|     flatten_configbundle_hierarchy(tree, "sla_print"); | ||||
|     flatten_configbundle_hierarchy(tree, "filament"); | ||||
|     flatten_configbundle_hierarchy(tree, "sla_material"); | ||||
|     flatten_configbundle_hierarchy(tree, "printer"); | ||||
|  | @ -957,10 +994,12 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla | |||
|     // Parse the obsolete preset names, to be deleted when upgrading from the old configuration structure.
 | ||||
|     std::vector<std::string> loaded_prints; | ||||
|     std::vector<std::string> loaded_filaments; | ||||
|     std::vector<std::string> loaded_sla_prints; | ||||
|     std::vector<std::string> loaded_sla_materials; | ||||
|     std::vector<std::string> loaded_printers; | ||||
|     std::string              active_print; | ||||
|     std::vector<std::string> active_filaments; | ||||
|     std::string              active_sla_print; | ||||
|     std::string              active_sla_material; | ||||
|     std::string              active_printer; | ||||
|     size_t                   presets_loaded = 0; | ||||
|  | @ -976,6 +1015,10 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla | |||
|             presets = &this->filaments; | ||||
|             loaded  = &loaded_filaments; | ||||
|             preset_name = section.first.substr(9); | ||||
|         } else if (boost::starts_with(section.first, "sla_print:")) { | ||||
|             presets = &this->sla_prints; | ||||
|             loaded  = &loaded_sla_prints; | ||||
|             preset_name = section.first.substr(13); | ||||
|         } else if (boost::starts_with(section.first, "sla_material:")) { | ||||
|             presets = &this->sla_materials; | ||||
|             loaded  = &loaded_sla_materials; | ||||
|  | @ -996,6 +1039,8 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla | |||
|                             active_filaments.resize(idx + 1, std::string()); | ||||
|                         active_filaments[idx] = kvp.second.data(); | ||||
|                     } | ||||
|                 } else if (kvp.first == "sla_print") { | ||||
|                     active_sla_print = kvp.second.data(); | ||||
|                 } else if (kvp.first == "sla_material") { | ||||
|                     active_sla_material = kvp.second.data(); | ||||
|                 } else if (kvp.first == "printer") { | ||||
|  | @ -1011,6 +1056,8 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla | |||
|                     dst = &this->obsolete_presets.prints; | ||||
|                 else if (kvp.first == "filament") | ||||
|                     dst = &this->obsolete_presets.filaments; | ||||
|                 else if (kvp.first == "sla_print") | ||||
|                     dst = &this->obsolete_presets.sla_prints; | ||||
|                 else if (kvp.first == "sla_material") | ||||
|                     dst = &this->obsolete_presets.sla_materials; | ||||
|                 else if (kvp.first == "printer") | ||||
|  | @ -1113,6 +1160,8 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla | |||
|     if ((flags & LOAD_CFGBNDLE_SYSTEM) == 0) { | ||||
|         if (! active_print.empty())  | ||||
|             prints.select_preset_by_name(active_print, true); | ||||
|         if (! active_sla_print.empty())  | ||||
|             sla_materials.select_preset_by_name(active_sla_print, true); | ||||
|         if (! active_sla_material.empty())  | ||||
|             sla_materials.select_preset_by_name(active_sla_material, true); | ||||
|         if (! active_printer.empty()) | ||||
|  | @ -1217,6 +1266,13 @@ void PresetBundle::update_compatible_with_printer(bool select_other_if_incompati | |||
|             this->sla_materials.update_compatible_with_printer(printer_preset, select_other_if_incompatible) : | ||||
| 			this->sla_materials.update_compatible_with_printer(printer_preset, select_other_if_incompatible, | ||||
|                 [&prefered_sla_material_profile](const std::string& profile_name){ return profile_name == prefered_sla_material_profile; }); | ||||
| 		 | ||||
|         const std::string              &prefered_sla_print_profile        = printer_preset.config.opt_string("default_sla_print_profile"); | ||||
|         prefered_sla_print_profile.empty() ? | ||||
|             this->sla_prints.update_compatible_with_printer(printer_preset, select_other_if_incompatible) : | ||||
| 			this->sla_prints.update_compatible_with_printer(printer_preset, select_other_if_incompatible, | ||||
|             [&prefered_sla_print_profile](const std::string& profile_name){ return profile_name == prefered_sla_print_profile; }); | ||||
| 
 | ||||
| 		break; | ||||
| 	} | ||||
|     } | ||||
|  | @ -1231,6 +1287,8 @@ void PresetBundle::export_configbundle(const std::string &path) //, const Dynami | |||
|     c << "# " << Slic3r::header_slic3r_generated() << std::endl; | ||||
| 
 | ||||
|     // Export the print, filament and printer profiles.
 | ||||
| 
 | ||||
|     // #ys_FIXME_SLA_PRINT
 | ||||
|     for (size_t i_group = 0; i_group < 3; ++ i_group) { | ||||
|         const PresetCollection &presets = (i_group == 0) ? this->prints : (i_group == 1) ? this->filaments : this->printers; | ||||
|         for (const Preset &preset : presets()) { | ||||
|  | @ -1246,6 +1304,7 @@ void PresetBundle::export_configbundle(const std::string &path) //, const Dynami | |||
|     // Export the names of the active presets.
 | ||||
|     c << std::endl << "[presets]" << std::endl; | ||||
|     c << "print = " << this->prints.get_selected_preset().name << std::endl; | ||||
|     c << "sla_print = " << this->sla_prints.get_selected_preset().name << std::endl; | ||||
|     c << "sla_material = " << this->sla_materials.get_selected_preset().name << std::endl; | ||||
|     c << "printer = " << this->printers.get_selected_preset().name << std::endl; | ||||
|     for (size_t i = 0; i < this->filament_presets.size(); ++ i) { | ||||
|  | @ -1401,6 +1460,7 @@ void PresetBundle::set_default_suppressed(bool default_suppressed) | |||
| { | ||||
|     prints.set_default_suppressed(default_suppressed); | ||||
|     filaments.set_default_suppressed(default_suppressed); | ||||
|     sla_prints.set_default_suppressed(default_suppressed); | ||||
|     sla_materials.set_default_suppressed(default_suppressed); | ||||
|     printers.set_default_suppressed(default_suppressed); | ||||
| } | ||||
|  |  | |||
|  | @ -39,6 +39,7 @@ public: | |||
|     void            export_selections(PlaceholderParser &pp); | ||||
| 
 | ||||
|     PresetCollection            prints; | ||||
|     PresetCollection            sla_prints; | ||||
|     PresetCollection            filaments; | ||||
|     PresetCollection            sla_materials; | ||||
|     PrinterPresetCollection     printers; | ||||
|  | @ -57,6 +58,7 @@ public: | |||
| 
 | ||||
|     struct ObsoletePresets { | ||||
|         std::vector<std::string> prints; | ||||
|         std::vector<std::string> sla_prints; | ||||
|         std::vector<std::string> filaments; | ||||
|         std::vector<std::string> sla_materials; | ||||
|         std::vector<std::string> printers; | ||||
|  |  | |||
|  | @ -27,7 +27,6 @@ | |||
| #include "wxExtensions.hpp" | ||||
| #include <wx/wupdlock.h> | ||||
| 
 | ||||
| #include <chrono> | ||||
| #include "GUI_App.hpp" | ||||
| 
 | ||||
| namespace Slic3r { | ||||
|  | @ -41,6 +40,7 @@ wxDEFINE_EVENT(EVT_TAB_PRESETS_CHANGED, SimpleEvent); | |||
| void Tab::set_type() | ||||
| { | ||||
|     if (m_name == "print")              { m_type = Slic3r::Preset::TYPE_PRINT; } | ||||
|     else if (m_name == "sla_print")     { m_type = Slic3r::Preset::TYPE_SLA_PRINT; } | ||||
|     else if (m_name == "filament")      { m_type = Slic3r::Preset::TYPE_FILAMENT; } | ||||
|     else if (m_name == "sla_material")  { m_type = Slic3r::Preset::TYPE_SLA_MATERIAL; } | ||||
|     else if (m_name == "printer")       { m_type = Slic3r::Preset::TYPE_PRINTER; } | ||||
|  | @ -828,6 +828,10 @@ void Tab::update_preset_description_line() | |||
| 				const std::string &default_sla_material_profile = preset.config.opt_string("default_sla_material_profile"); | ||||
| 				if (!default_sla_material_profile.empty()) | ||||
| 					description_line += "\n\n\t" + _(L("default SLA material profile")) + ": \n\t\t" + default_sla_material_profile; | ||||
| 
 | ||||
| 				const std::string &default_sla_print_profile = preset.config.opt_string("default_sla_print_profile"); | ||||
| 				if (!default_sla_print_profile.empty()) | ||||
| 					description_line += "\n\n\t" + _(L("default SLA print profile")) + ": \n\t\t" + default_sla_print_profile; | ||||
| 				break; | ||||
| 			} | ||||
| 			} | ||||
|  | @ -2347,6 +2351,7 @@ void Tab::select_preset(std::string preset_name) | |||
| 	auto current_dirty = m_presets->current_is_dirty(); | ||||
| 	auto printer_tab   = m_presets->name() == "printer"; | ||||
| 	auto canceled      = false; | ||||
| // 	m_reload_dependent_tabs = {};
 | ||||
| 	m_dependent_tabs = {}; | ||||
| 	if (current_dirty && !may_discard_current_dirty_preset()) { | ||||
| 		canceled = true; | ||||
|  | @ -2370,6 +2375,7 @@ void Tab::select_preset(std::string preset_name) | |||
| 		}; | ||||
| 		std::vector<PresetUpdate> updates = { | ||||
| 			{ Preset::Type::TYPE_PRINT,       &m_preset_bundle->prints,			ptFFF }, | ||||
| 			{ Preset::Type::TYPE_SLA_PRINT,   &m_preset_bundle->sla_prints,		ptSLA }, | ||||
| 			{ Preset::Type::TYPE_FILAMENT,    &m_preset_bundle->filaments,		ptFFF }, | ||||
|  			{ Preset::Type::TYPE_SLA_MATERIAL,&m_preset_bundle->sla_materials,	ptSLA } | ||||
| 		}; | ||||
|  | @ -2382,8 +2388,10 @@ void Tab::select_preset(std::string preset_name) | |||
| 		if (! canceled) { | ||||
| 			for (PresetUpdate &pu : updates) { | ||||
| 				// 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); | ||||
| 				} | ||||
| 				if (pu.old_preset_dirty) | ||||
| 					pu.presets->discard_current_changes(); | ||||
| 			} | ||||
|  | @ -2918,7 +2926,7 @@ void TabSLAMaterial::build() | |||
|     auto page = add_options_page(_(L("Material")), "package_green.png"); | ||||
| 
 | ||||
|     auto optgroup = page->new_optgroup(_(L("Layers"))); | ||||
|     optgroup->append_single_option_line("layer_height"); | ||||
| //     optgroup->append_single_option_line("layer_height");
 | ||||
|     optgroup->append_single_option_line("initial_layer_height"); | ||||
| 
 | ||||
|     optgroup = page->new_optgroup(_(L("Exposure"))); | ||||
|  | @ -2973,7 +2981,43 @@ void TabSLAMaterial::build() | |||
| void TabSLAMaterial::update() | ||||
| { | ||||
|     if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF) | ||||
|         return; // ys_FIXME
 | ||||
|         return; // #ys_FIXME
 | ||||
| } | ||||
| 
 | ||||
| void TabSLAPrint::build() | ||||
| { | ||||
|     m_presets = &m_preset_bundle->sla_prints; | ||||
|     load_initial_data(); | ||||
| 
 | ||||
|     auto page = add_options_page(_(L("Layers and perimeters")), "package_green.png"); | ||||
| 
 | ||||
|     auto optgroup = page->new_optgroup(_(L("Layers"))); | ||||
|     optgroup->append_single_option_line("layer_height"); | ||||
| 
 | ||||
|     page = add_options_page(_(L("Dependencies")), "wrench.png"); | ||||
|     optgroup = page->new_optgroup(_(L("Profile dependencies"))); | ||||
|     Line line = optgroup->create_single_option_line("compatible_printers");//Line { _(L("Compatible printers")), "" };
 | ||||
|     line.widget = [this](wxWindow* parent) { | ||||
|         return compatible_printers_widget(parent, &m_compatible_printers_checkbox, &m_compatible_printers_btn); | ||||
|     }; | ||||
|     optgroup->append_line(line, &m_colored_Label); | ||||
| 
 | ||||
|     Option option = optgroup->get_option("compatible_printers_condition"); | ||||
|     option.opt.full_width = true; | ||||
|     optgroup->append_single_option_line(option); | ||||
| 
 | ||||
|     line = Line{ "", "" }; | ||||
|     line.full_width = 1; | ||||
|     line.widget = [this](wxWindow* parent) { | ||||
|         return description_line_widget(parent, &m_parent_preset_description_line); | ||||
|     }; | ||||
|     optgroup->append_line(line); | ||||
| } | ||||
| 
 | ||||
| void TabSLAPrint::update() | ||||
| { | ||||
|     if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF) | ||||
|         return; // #ys_FIXME
 | ||||
| } | ||||
| 
 | ||||
| } // GUI
 | ||||
|  |  | |||
|  | @ -370,6 +370,19 @@ public: | |||
|     bool 		supports_printer_technology(const PrinterTechnology tech) override { return tech == ptSLA; } | ||||
| }; | ||||
| 
 | ||||
| class TabSLAPrint : public Tab | ||||
| { | ||||
| public: | ||||
|     TabSLAPrint() {} | ||||
|     TabSLAPrint(wxNotebook* parent) : | ||||
|         Tab(parent, _(L("SLA Print Settings")), "sla_print") {} | ||||
|     ~TabSLAPrint() {} | ||||
|         void		build() override; | ||||
|     void		update() override; | ||||
| //     void		init_options_list() override;
 | ||||
|     bool 		supports_printer_technology(const PrinterTechnology tech) override { return tech == ptSLA; } | ||||
| }; | ||||
| 
 | ||||
| class SavePresetWindow :public wxDialog | ||||
| { | ||||
| public: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka