Fix + Support 'Default' filament option (index 0) (#13887)
* Support 'Default' filament option (index 0) Treat filament index 0 as the new "Default" (use active object/part filament) instead of using 1. Update config defaults and tooltips for wall/sparse/solid infill filament options (min/default -> 0, tooltip explains "Default"). Adjust normalization and propagation logic to respect explicit feature overrides and only apply base extruder when feature values are zero; only copy sparse->solid infill when sparse > 0. Introduce FeatureFilamentOverrideMask and clamp_feature_filament_to_valid to resolve and clamp feature filaments. Update UI lists and selection behavior to expose a "Default" entry and handle zero-based indices in PartPlate and Plater. * enable_filament_for_features option Co-Authored-By: LixNix <105106115+lixnix@users.noreply.github.com> * \n * Allow wipe_tower_filament to equal nozzle count Relax the assertion in Print::extruders to permit wipe_tower_filament == config().nozzle_diameter.size(). The configuration value is 1-based and the code subtracts 1 when pushing the extruder index, so equality should be valid and selecting the last nozzle should not trigger an assertion. * Revert "Allow wipe_tower_filament to equal nozzle count" This reverts commit 2c976574327a8bcdc74a1b296bf1aaff7752a94e. * Revert "enable_filament_for_features option" This reverts commit 01c13baeddb8e26793f752deab788ee4d086975b. * Migrate legacy feature filament defaults Add migration logic to convert legacy feature filament selections from 1 to 0 for older 3mf files. Introduces a local migrate_legacy_feature_filament_defaults lambda in src/OrcaSlicer.cpp and src/slic3r/GUI/Plater.cpp that scans keys (wall_filament, sparse_infill_filament, solid_infill_filament, support_filament, support_interface_filament) on configs/objects/volumes, updates values, counts conversions and logs the result. Also adds a Semver check for "2.4.0-dev" in OrcaSlicer to trigger the migration for files older than that version. This preserves expected default filament selections when loading older project files. * Update OrcaSlicer.cpp * Extract migration helper to ConfigMigrations Centralize legacy feature-filament default migration by moving the duplicated lambda into ConfigMigrations::migrate_legacy_feature_filament_defaults (src/libslic3r/Config.cpp) and declaring it in Config.hpp. Update OrcaSlicer.cpp and slic3r/GUI/Plater.cpp to call the new function instead of inline lambdas. The helper converts specific feature filament keys (wall_filament, sparse_infill_filament, solid_infill_filament, support_filament, support_interface_filament) from int 1 to 0 and returns the count of conversions to avoid duplicated migration logic. * Remove DynamicFilamentList1Based and consolidate lists Delete the specialized DynamicFilamentList1Based struct and its global instance. Update Choice registrations to use the single dynamic_filament_list for wall, sparse_infill and solid_infill filaments, and remove the extra update call for the removed instance. This consolidates filament choice handling and removes duplicated logic in Plater.cpp. * move it * fix objects * Update Config.hpp * Update profiles
This commit is contained in:
@@ -4021,10 +4021,10 @@ void PrintConfigDef::init_fff_params()
|
||||
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||
def->label = L("Infill");
|
||||
def->category = L("Extruders");
|
||||
def->tooltip = L("Filament to print internal sparse infill.");
|
||||
def->min = 1;
|
||||
def->tooltip = L("Filament to print internal sparse infill.\n\"Default\" uses the active object/part filament.");
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInt(1));
|
||||
def->set_default_value(new ConfigOptionInt(0));
|
||||
|
||||
def = this->add("sparse_infill_line_width", coFloatOrPercent);
|
||||
def->label = L("Sparse infill");
|
||||
@@ -4901,10 +4901,10 @@ void PrintConfigDef::init_fff_params()
|
||||
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||
def->label = L("Walls");
|
||||
def->category = L("Extruders");
|
||||
def->tooltip = L("Filament to print walls.");
|
||||
def->min = 1;
|
||||
def->tooltip = L("Filament to print walls.\n\"Default\" uses the active object/part filament.");
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInt(1));
|
||||
def->set_default_value(new ConfigOptionInt(0));
|
||||
|
||||
def = this->add("inner_wall_line_width", coFloatOrPercent);
|
||||
def->label = L("Inner wall");
|
||||
@@ -5662,10 +5662,10 @@ void PrintConfigDef::init_fff_params()
|
||||
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||
def->label = L("Solid infill");
|
||||
def->category = L("Extruders");
|
||||
def->tooltip = L("Filament to print solid infill.");
|
||||
def->min = 1;
|
||||
def->tooltip = L("Filament to print solid infill.\n\"Default\" uses the active object/part filament.");
|
||||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInt(1));
|
||||
def->set_default_value(new ConfigOptionInt(0));
|
||||
|
||||
def = this->add("internal_solid_infill_line_width", coFloatOrPercent);
|
||||
def->label = L("Internal solid infill");
|
||||
@@ -6041,7 +6041,7 @@ void PrintConfigDef::init_fff_params()
|
||||
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||
def->label = L("Support/raft base");
|
||||
def->category = L("Support");
|
||||
def->tooltip = L("Filament to print support base and raft. \"Default\" means no specific filament for support and current filament is used.");
|
||||
def->tooltip = L("Filament to print support base and raft.\n\"Default\" means no specific filament for support and current filament is used.");
|
||||
def->min = 0;
|
||||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionInt(0));
|
||||
@@ -6076,7 +6076,7 @@ void PrintConfigDef::init_fff_params()
|
||||
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||
def->label = L("Support/raft interface");
|
||||
def->category = L("Support");
|
||||
def->tooltip = L("Filament to print support interface. \"Default\" means no specific filament for support interface and current filament is used.");
|
||||
def->tooltip = L("Filament to print support interface.\n\"Default\" means no specific filament for support interface and current filament is used.");
|
||||
def->min = 0;
|
||||
// BBS
|
||||
def->mode = comSimple;
|
||||
@@ -8348,9 +8348,9 @@ void DynamicPrintConfig::normalize_fdm(int used_filaments)
|
||||
int extruder = this->option("extruder")->getInt();
|
||||
this->erase("extruder");
|
||||
if (extruder != 0) {
|
||||
if (!this->has("sparse_infill_filament"))
|
||||
if (!this->has("sparse_infill_filament") || this->option("sparse_infill_filament")->getInt() == 0)
|
||||
this->option("sparse_infill_filament", true)->setInt(extruder);
|
||||
if (!this->has("wall_filament"))
|
||||
if (!this->has("wall_filament") || this->option("wall_filament")->getInt() == 0)
|
||||
this->option("wall_filament", true)->setInt(extruder);
|
||||
// Don't propagate the current extruder to support.
|
||||
// For non-soluble supports, the default "0" extruder means to use the active extruder,
|
||||
@@ -8362,8 +8362,11 @@ void DynamicPrintConfig::normalize_fdm(int used_filaments)
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->has("solid_infill_filament") && this->has("sparse_infill_filament"))
|
||||
this->option("solid_infill_filament", true)->setInt(this->option("sparse_infill_filament")->getInt());
|
||||
if (this->has("sparse_infill_filament")) {
|
||||
int sparse_infill_filament = this->option("sparse_infill_filament")->getInt();
|
||||
if (sparse_infill_filament > 0 && (!this->has("solid_infill_filament") || this->option("solid_infill_filament")->getInt() == 0))
|
||||
this->option("solid_infill_filament", true)->setInt(sparse_infill_filament);
|
||||
}
|
||||
|
||||
if (this->has("spiral_mode") && this->opt<ConfigOptionBool>("spiral_mode", true)->value) {
|
||||
{
|
||||
@@ -8421,9 +8424,9 @@ void DynamicPrintConfig::normalize_fdm_1()
|
||||
int extruder = this->option("extruder")->getInt();
|
||||
this->erase("extruder");
|
||||
if (extruder != 0) {
|
||||
if (!this->has("sparse_infill_filament"))
|
||||
if (!this->has("sparse_infill_filament") || this->option("sparse_infill_filament")->getInt() == 0)
|
||||
this->option("sparse_infill_filament", true)->setInt(extruder);
|
||||
if (!this->has("wall_filament"))
|
||||
if (!this->has("wall_filament") || this->option("wall_filament")->getInt() == 0)
|
||||
this->option("wall_filament", true)->setInt(extruder);
|
||||
// Don't propagate the current extruder to support.
|
||||
// For non-soluble supports, the default "0" extruder means to use the active extruder,
|
||||
@@ -8435,8 +8438,11 @@ void DynamicPrintConfig::normalize_fdm_1()
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->has("solid_infill_filament") && this->has("sparse_infill_filament"))
|
||||
this->option("solid_infill_filament", true)->setInt(this->option("sparse_infill_filament")->getInt());
|
||||
if (this->has("sparse_infill_filament")) {
|
||||
int sparse_infill_filament = this->option("sparse_infill_filament")->getInt();
|
||||
if (sparse_infill_filament > 0 && (!this->has("solid_infill_filament") || this->option("solid_infill_filament")->getInt() == 0))
|
||||
this->option("solid_infill_filament", true)->setInt(sparse_infill_filament);
|
||||
}
|
||||
|
||||
if (this->has("spiral_mode") && this->opt<ConfigOptionBool>("spiral_mode", true)->value) {
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user