Initial port of organic tree support from PrusaSlicer (#1938)

* Initial port of organic tree support from PrusaSlicer

* Port missing Organic support parameters from PrusaSlicer

* Update parameter naming

* Reorganize the `raft_first_layer_expansion` and `raft_first_layer_density` parameters as they are not only used by rafts

* Reset support style only in simple mode

* Sync latest update from PrusaSlicer & copyrights

* Fix organic tree support crash with invalid parameters

---------

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>
This commit is contained in:
Noisyfox 2023-09-02 17:29:43 +08:00 committed by GitHub
parent b50dfb69a2
commit a1464735ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 13299 additions and 38 deletions

View file

@ -1420,7 +1420,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
}
// BBS set support style to default when support type changes
if (opt_key == "support_type") {
// Orca: do this only in simple mode
if (opt_key == "support_type" && m_mode == comSimple) {
DynamicPrintConfig new_conf = *m_config;
new_conf.set_key_value("support_style", new ConfigOptionEnum<SupportMaterialStyle>(smsDefault));
m_config_manipulation.apply(m_config, &new_conf);
@ -2003,6 +2004,8 @@ void TabPrint::build()
optgroup->append_single_option_line("support_type", "support#support-types");
optgroup->append_single_option_line("support_style", "support#support-styles");
optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle");
optgroup->append_single_option_line("raft_first_layer_density");
optgroup->append_single_option_line("raft_first_layer_expansion");
optgroup->append_single_option_line("support_on_build_plate_only");
optgroup->append_single_option_line("support_critical_regions_only");
optgroup->append_single_option_line("support_remove_small_overhang");
@ -2011,8 +2014,6 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Raft"), L"param_raft");
optgroup->append_single_option_line("raft_layers");
optgroup->append_single_option_line("raft_contact_distance");
optgroup->append_single_option_line("raft_first_layer_density");
optgroup->append_single_option_line("raft_first_layer_expansion");
optgroup = page->new_optgroup(L("Support filament"), L"param_support_filament");
optgroup->append_single_option_line("support_filament", "support#support-filament");
@ -2022,9 +2023,14 @@ void TabPrint::build()
//BBS
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced");
optgroup->append_single_option_line("tree_support_tip_diameter");
optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options");
optgroup->append_single_option_line("tree_support_top_rate");
optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options");
optgroup->append_single_option_line("tree_support_branch_diameter_angle");
optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options");
optgroup->append_single_option_line("tree_support_angle_slow");
optgroup->append_single_option_line("tree_support_branch_diameter_double_wall");
optgroup->append_single_option_line("tree_support_wall_count");
optgroup->append_single_option_line("tree_support_adaptive_layer_height");
optgroup->append_single_option_line("tree_support_auto_brim");
@ -2165,7 +2171,7 @@ void TabPrint::toggle_options()
if (auto choice = dynamic_cast<Choice*>(field)) {
auto def = print_config_def.get("support_style");
std::vector<int> enum_set_normal = {0, 1, 2};
std::vector<int> enum_set_tree = {0, 3, 4, 5};
std::vector<int> enum_set_tree = {0, 3, 4, 5, 6};
auto & set = is_tree(support_type) ? enum_set_tree : enum_set_normal;
auto & opt = const_cast<ConfigOptionDef &>(field->m_opt);
auto cb = dynamic_cast<ComboBox *>(choice->window);