Update sublayer option check. Add validation warning for gradient mixed filament without sublayer mixing

This commit is contained in:
SoftFever
2026-08-24 15:30:02 +08:00
parent 2b1499a087
commit e342698d8e
3 changed files with 82 additions and 24 deletions

View File

@@ -1328,6 +1328,19 @@ StringObjectException Print::validate(std::vector<StringObjectException> *warnin
if (extruders.empty())
return { L("No extrusions under current settings.") };
// Orca: a gradient mixed filament only renders its gradient with "Mixed color sublayer" on;
// without it ToolOrdering::resolve_mixed_filaments prints one whole component per layer and
// the gradient is dropped silently. extruders() already covers painting, height ranges,
// per-feature filament ids and supports, and still lists mixed slots under their own id here.
if (!m_config.enable_mixed_color_sublayer.value) {
const auto &is_mixed = m_config.filament_is_mixed.values;
const auto &gradient = m_config.filament_mixed_gradient.values;
if (std::any_of(extruders.begin(), extruders.end(), [&](unsigned int e) {
return e < is_mixed.size() && is_mixed[e] && e < gradient.size() && gradient[e]; }))
warn(L("A gradient mixed filament is used, but 'Mixed color sublayer' is disabled. The gradient will not be printed."),
"enable_mixed_color_sublayer");
}
if (nozzles < 2 && extruders.size() > 1) {
auto ret = check_multi_filament_valid(*this);
if (!ret.string.empty())