ENH: enhance filament group alogrithm

1. Try to merge filaments before grouping
2. Set max match num for machine filamnet in match mode

jira:STUDIO-10392

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I2451d838e07ee02f493fda4dc702f3d13b2ad37b
(cherry picked from commit d15fc37ff2fa048e38a0b132bb3ae525ff666fab)
This commit is contained in:
xun.zhang
2025-02-13 21:23:47 +08:00
committed by Noisyfox
parent 1384226447
commit 229ef8884f
6 changed files with 132 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
#include "FilamentGroupUtils.hpp"
#include <sstream>
namespace Slic3r
{
@@ -45,6 +45,20 @@ namespace FilamentGroupUtils
return r != other.r || g != other.g || b != other.b || a != other.a;
}
std::string Color::to_hex_str(bool include_alpha) const {
std::ostringstream oss;
oss << "#" << std::hex << std::setfill('0')
<< std::setw(2) << static_cast<int>(r)
<< std::setw(2) << static_cast<int>(g)
<< std::setw(2) << static_cast<int>(b);
if (include_alpha) {
oss << std::setw(2) << static_cast<int>(a);
}
return oss.str();
}
bool MachineFilamentInfo::operator<(const MachineFilamentInfo& other) const
{
if (color != other.color) return color < other.color;