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,
|
Extruder14,
|
||||||
Extruder15,
|
Extruder15,
|
||||||
Extruder16,
|
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 {
|
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.
|
// In case this is leaf, we better save information about its state.
|
||||||
int n = int(tr.get_state());
|
int n = int(tr.get_state());
|
||||||
if (n >= 3) {
|
if (n >= 3) {
|
||||||
assert(n <= 16);
|
data.second.insert(data.second.end(), {true, true});
|
||||||
if (n <= 16) {
|
n -= 3;
|
||||||
// Store "11" plus 4 bits of (n-3).
|
while (n >= 16) {
|
||||||
data.second.insert(data.second.end(), { true, true });
|
data.second.insert(data.second.end(), {true, true, true, true});
|
||||||
n -= 3;
|
n -= 16;
|
||||||
for (size_t bit_idx = 0; bit_idx < 4; ++bit_idx)
|
|
||||||
data.second.push_back(n & (uint64_t(0b0001) << bit_idx));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t bit_idx = 0; bit_idx < 4; ++bit_idx)
|
||||||
|
data.second.push_back(n & (uint64_t(0b0001) << bit_idx));
|
||||||
} else {
|
} else {
|
||||||
// Simple case, compatible with PrusaSlicer 2.3.1 and older for storing paint on supports and seams.
|
// Simple case, compatible with PrusaSlicer 2.3.1 and older for storing paint on supports and seams.
|
||||||
// Store 2 bits of n.
|
// 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;
|
int num_of_children = num_of_split_sides == 0 ? 0 : num_of_split_sides + 1;
|
||||||
bool is_split = num_of_children != 0;
|
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.
|
// 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
|
// BBS
|
||||||
if (state > max_ebt)
|
if (state > max_ebt)
|
||||||
|
|
|
@ -1618,8 +1618,8 @@ void Sidebar::on_filaments_change(size_t num_filaments)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::add_filament() {
|
void Sidebar::add_filament() {
|
||||||
// BBS: limit filament choices to 16
|
// BBS: limit filament choices to ExtruderMax
|
||||||
if (p->combos_filament.size() >= 16) return;
|
if (p->combos_filament.size() >= size_t(EnforcerBlockerType::ExtruderMax)) return;
|
||||||
wxColour new_col = Plater::get_next_color_for_filament();
|
wxColour new_col = Plater::get_next_color_for_filament();
|
||||||
add_custom_filament(new_col);
|
add_custom_filament(new_col);
|
||||||
}
|
}
|
||||||
|
@ -1643,7 +1643,7 @@ void Sidebar::delete_filament() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::add_custom_filament(wxColour new_col) {
|
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;
|
int filament_count = p->combos_filament.size() + 1;
|
||||||
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
||||||
|
|
Loading…
Reference in New Issue