Blend mixed slots in the machine-send and AMS-sync thumbnails

This commit is contained in:
SoftFever
2026-08-23 13:37:14 +08:00
parent d27766aff0
commit 9985688b5b
6 changed files with 256 additions and 2 deletions

View File

@@ -30,6 +30,7 @@
#include "DeviceCore/DevManager.h"
#include "DeviceCore/DevMapping.h"
#include "DeviceCore/DevStorage.h"
#include "FilamentBitmapUtils.hpp"
using namespace Slic3r;
using namespace Slic3r::GUI;
@@ -2943,6 +2944,20 @@ void SyncAmsInfoDialog::clone_thumbnail_data()
iter++;
}
}
// Expand color arrays to cover mixed (virtual) slots and compute their blended colors
const auto& cfg = wxGetApp().preset_bundle->project_config;
size_t total = 0;
if (auto* opt = cfg.option<ConfigOptionBools>("filament_is_mixed"))
total = opt->values.size();
size_t target = std::max(total, m_cur_colors_in_thumbnail.size());
if (m_cur_colors_in_thumbnail.size() < target)
m_cur_colors_in_thumbnail.resize(target);
if (m_preview_colors_in_thumbnail.size() < target)
m_preview_colors_in_thumbnail.resize(target);
recompute_mixed_slot_colors(m_preview_colors_in_thumbnail, cfg);
recompute_mixed_slot_colors(m_cur_colors_in_thumbnail, cfg);
// copy data
auto &data = m_cur_input_thumbnail_data;
m_preview_thumbnail_data.reset();
@@ -3131,6 +3146,10 @@ void SyncAmsInfoDialog::change_default_normal(int old_filament_id, wxColour temp
return;
}
}
// Recompute mixed slot colors after physical slot color change
const auto& cfg = wxGetApp().preset_bundle->project_config;
recompute_mixed_slot_colors(m_cur_colors_in_thumbnail, cfg);
ThumbnailData &data = m_cur_input_thumbnail_data;
ThumbnailData &no_light_data = m_cur_no_light_thumbnail_data;
if (data.width > 0 && data.height > 0 && data.width == no_light_data.width && data.height == no_light_data.height) {