mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 19:02:10 +00:00
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:
@@ -1573,31 +1573,31 @@ std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode) const
|
||||
plate_extruders.push_back(glb_support_extr);
|
||||
}
|
||||
|
||||
int obj_wall_extr = 1;
|
||||
int obj_wall_extr = 0;
|
||||
const ConfigOption* wall_opt = mo->config.option("wall_filament");
|
||||
if (wall_opt != nullptr)
|
||||
obj_wall_extr = wall_opt->getInt();
|
||||
if (obj_wall_extr != 1)
|
||||
if (obj_wall_extr != 0)
|
||||
plate_extruders.push_back(obj_wall_extr);
|
||||
else if (glb_wall_extr != 1)
|
||||
else if (glb_wall_extr != 0)
|
||||
plate_extruders.push_back(glb_wall_extr);
|
||||
|
||||
int obj_sparse_infill_extr = 1;
|
||||
int obj_sparse_infill_extr = 0;
|
||||
const ConfigOption* sparse_infill_opt = mo->config.option("sparse_infill_filament");
|
||||
if (sparse_infill_opt != nullptr)
|
||||
obj_sparse_infill_extr = sparse_infill_opt->getInt();
|
||||
if (obj_sparse_infill_extr != 1)
|
||||
if (obj_sparse_infill_extr != 0)
|
||||
plate_extruders.push_back(obj_sparse_infill_extr);
|
||||
else if (glb_sparse_infill_extr != 1)
|
||||
else if (glb_sparse_infill_extr != 0)
|
||||
plate_extruders.push_back(glb_sparse_infill_extr);
|
||||
|
||||
int obj_solid_infill_extr = 1;
|
||||
int obj_solid_infill_extr = 0;
|
||||
const ConfigOption* solid_infill_opt = mo->config.option("solid_infill_filament");
|
||||
if (solid_infill_opt != nullptr)
|
||||
obj_solid_infill_extr = solid_infill_opt->getInt();
|
||||
if (obj_solid_infill_extr != 1)
|
||||
if (obj_solid_infill_extr != 0)
|
||||
plate_extruders.push_back(obj_solid_infill_extr);
|
||||
else if (glb_solid_infill_extr != 1)
|
||||
else if (glb_solid_infill_extr != 0)
|
||||
plate_extruders.push_back(glb_solid_infill_extr);
|
||||
|
||||
}
|
||||
@@ -1695,31 +1695,31 @@ std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D
|
||||
else if (glb_support_extr != 0)
|
||||
plate_extruders.push_back(glb_support_extr);
|
||||
|
||||
int obj_wall_extr = 1;
|
||||
int obj_wall_extr = 0;
|
||||
const ConfigOption* wall_opt = object->config.option("wall_filament");
|
||||
if (wall_opt != nullptr)
|
||||
obj_wall_extr = wall_opt->getInt();
|
||||
if (obj_wall_extr != 1)
|
||||
if (obj_wall_extr != 0)
|
||||
plate_extruders.push_back(obj_wall_extr);
|
||||
else if (glb_wall_extr != 1)
|
||||
else if (glb_wall_extr != 0)
|
||||
plate_extruders.push_back(glb_wall_extr);
|
||||
|
||||
int obj_sparse_infill_extr = 1;
|
||||
int obj_sparse_infill_extr = 0;
|
||||
const ConfigOption* sparse_infill_opt = object->config.option("sparse_infill_filament");
|
||||
if (sparse_infill_opt != nullptr)
|
||||
obj_sparse_infill_extr = sparse_infill_opt->getInt();
|
||||
if (obj_sparse_infill_extr != 1)
|
||||
if (obj_sparse_infill_extr != 0)
|
||||
plate_extruders.push_back(obj_sparse_infill_extr);
|
||||
else if (glb_sparse_infill_extr != 1)
|
||||
else if (glb_sparse_infill_extr != 0)
|
||||
plate_extruders.push_back(glb_sparse_infill_extr);
|
||||
|
||||
int obj_solid_infill_extr = 1;
|
||||
int obj_solid_infill_extr = 0;
|
||||
const ConfigOption* solid_infill_opt = object->config.option("solid_infill_filament");
|
||||
if (solid_infill_opt != nullptr)
|
||||
obj_solid_infill_extr = solid_infill_opt->getInt();
|
||||
if (obj_solid_infill_extr != 1)
|
||||
if (obj_solid_infill_extr != 0)
|
||||
plate_extruders.push_back(obj_solid_infill_extr);
|
||||
else if (glb_solid_infill_extr != 1)
|
||||
else if (glb_solid_infill_extr != 0)
|
||||
plate_extruders.push_back(glb_solid_infill_extr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user