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

@ -404,7 +404,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
auto support_type = config->opt_enum<SupportType>("support_type");
auto support_style = config->opt_enum<SupportMaterialStyle>("support_style");
std::set<int> enum_set_normal = {0, 1, 2};
std::set<int> enum_set_tree = {0, 3, 4, 5};
std::set<int> enum_set_tree = {0, 3, 4, 5, 6};
auto & set = is_tree(support_type) ? enum_set_tree : enum_set_normal;
if (set.find(support_style) == set.end()) {
DynamicPrintConfig new_conf = *config;
@ -595,18 +595,22 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
//toggle_field("support_closing_radius", have_support_material && support_style == smsSnug);
bool support_is_tree = config->opt_bool("enable_support") && is_tree(support_type);
for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance",
"tree_support_branch_diameter", "tree_support_adaptive_layer_height", "tree_support_auto_brim", "tree_support_brim_width"})
toggle_field(el, support_is_tree);
// hide tree support settings when normal is selected
for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance",
"tree_support_branch_diameter", "max_bridge_length", "tree_support_adaptive_layer_height", "tree_support_auto_brim", "tree_support_brim_width"})
bool support_is_normal_tree = support_is_tree && support_style != smsOrganic;
bool support_is_organic = support_is_tree && !support_is_normal_tree;
// settings shared by normal and organic trees
for (auto el : {"tree_support_branch_angle", "tree_support_branch_distance", "tree_support_branch_diameter" })
toggle_line(el, support_is_tree);
// settings specific to normal trees
for (auto el : {"tree_support_wall_count", "tree_support_auto_brim", "tree_support_brim_width", "tree_support_adaptive_layer_height"})
toggle_line(el, support_is_normal_tree);
// settings specific to organic trees
for (auto el : {"tree_support_angle_slow","tree_support_tip_diameter", "tree_support_top_rate", "tree_support_branch_diameter_angle", "tree_support_branch_diameter_double_wall"})
toggle_line(el, support_is_organic);
toggle_field("tree_support_brim_width", support_is_tree && !config->opt_bool("tree_support_auto_brim"));
// tree support use max_bridge_length instead of bridge_no_support
toggle_line("bridge_no_support", !support_is_tree);
// non-organic tree support use max_bridge_length instead of bridge_no_support
toggle_line("max_bridge_length", support_is_normal_tree);
toggle_line("bridge_no_support", !support_is_normal_tree);
for (auto el : { "support_interface_spacing", "support_interface_filament",
"support_interface_loop_pattern", "support_bottom_interface_spacing" })
@ -625,8 +629,10 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_field("support_filament", have_support_material || have_skirt);
toggle_line("raft_contact_distance", have_raft && !have_support_soluble);
// Orca: Raft, grid, snug and organic supports use these two parameters to control the size & density of the "brim"/flange
for (auto el : { "raft_first_layer_expansion", "raft_first_layer_density"})
toggle_line(el, have_raft);
toggle_field(el, have_support_material && !support_is_normal_tree);
bool has_ironing = (config->opt_enum<IroningType>("ironing_type") != IroningType::NoIroning);
for (auto el : { "ironing_flow", "ironing_spacing", "ironing_speed" })