FIX: support more than 16 extruders
jira: none Change-Id: I169f672b99088b0a0a0132265d958e3239051744
This commit is contained in:
parent
6b09cfee71
commit
e1d1d3e8ca
|
@ -728,7 +728,23 @@ enum class EnforcerBlockerType : int8_t {
|
|||
Extruder14,
|
||||
Extruder15,
|
||||
Extruder16,
|
||||
ExtruderMax = Extruder16
|
||||
Extruder17,
|
||||
Extruder18,
|
||||
Extruder19,
|
||||
Extruder20,
|
||||
Extruder21,
|
||||
Extruder22,
|
||||
Extruder23,
|
||||
Extruder24,
|
||||
Extruder25,
|
||||
Extruder26,
|
||||
Extruder27,
|
||||
Extruder28,
|
||||
Extruder29,
|
||||
Extruder30,
|
||||
Extruder31,
|
||||
Extruder32,
|
||||
ExtruderMax = Extruder32
|
||||
};
|
||||
|
||||
enum class ConversionType : int {
|
||||
|
|
|
@ -1667,14 +1667,15 @@ std::pair<std::vector<std::pair<int, int>>, std::vector<bool>> TriangleSelector:
|
|||
// In case this is leaf, we better save information about its state.
|
||||
int n = int(tr.get_state());
|
||||
if (n >= 3) {
|
||||
assert(n <= 16);
|
||||
if (n <= 16) {
|
||||
// Store "11" plus 4 bits of (n-3).
|
||||
data.second.insert(data.second.end(), { true, true });
|
||||
n -= 3;
|
||||
for (size_t bit_idx = 0; bit_idx < 4; ++bit_idx)
|
||||
data.second.push_back(n & (uint64_t(0b0001) << bit_idx));
|
||||
data.second.insert(data.second.end(), {true, true});
|
||||
n -= 3;
|
||||
while (n >= 16) {
|
||||
data.second.insert(data.second.end(), {true, true, true, true});
|
||||
n -= 16;
|
||||
}
|
||||
|
||||
for (size_t bit_idx = 0; bit_idx < 4; ++bit_idx)
|
||||
data.second.push_back(n & (uint64_t(0b0001) << bit_idx));
|
||||
} else {
|
||||
// Simple case, compatible with PrusaSlicer 2.3.1 and older for storing paint on supports and seams.
|
||||
// Store 2 bits of n.
|
||||
|
@ -1746,7 +1747,21 @@ void TriangleSelector::deserialize(const std::pair<std::vector<std::pair<int, in
|
|||
int num_of_children = num_of_split_sides == 0 ? 0 : num_of_split_sides + 1;
|
||||
bool is_split = num_of_children != 0;
|
||||
// Only valid if not is_split. Value of the second nibble was subtracted by 3, so it is added back.
|
||||
auto state = is_split ? EnforcerBlockerType::NONE : EnforcerBlockerType((code & 0b1100) == 0b1100 ? next_nibble() + 3 : code >> 2);
|
||||
auto state = EnforcerBlockerType::NONE;
|
||||
if (!is_split) {
|
||||
if ((code & 0b1100) == 0b1100){
|
||||
int next_code = next_nibble();
|
||||
int num = 0;
|
||||
while (next_code == 0b1111) {
|
||||
num++;
|
||||
next_code = next_nibble();
|
||||
}
|
||||
state = EnforcerBlockerType(next_code + 16 * num + (code >> 2));
|
||||
}
|
||||
else {
|
||||
state = EnforcerBlockerType(code >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if (state > max_ebt)
|
||||
|
|
|
@ -1618,8 +1618,8 @@ void Sidebar::on_filaments_change(size_t num_filaments)
|
|||
}
|
||||
|
||||
void Sidebar::add_filament() {
|
||||
// BBS: limit filament choices to 16
|
||||
if (p->combos_filament.size() >= 16) return;
|
||||
// BBS: limit filament choices to ExtruderMax
|
||||
if (p->combos_filament.size() >= size_t(EnforcerBlockerType::ExtruderMax)) return;
|
||||
wxColour new_col = Plater::get_next_color_for_filament();
|
||||
add_custom_filament(new_col);
|
||||
}
|
||||
|
@ -1643,7 +1643,7 @@ void Sidebar::delete_filament() {
|
|||
}
|
||||
|
||||
void Sidebar::add_custom_filament(wxColour new_col) {
|
||||
if (p->combos_filament.size() >= 16) return;
|
||||
if (p->combos_filament.size() >= size_t(EnforcerBlockerType::ExtruderMax)) return;
|
||||
|
||||
int filament_count = p->combos_filament.size() + 1;
|
||||
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
||||
|
|
Loading…
Reference in New Issue