mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 14:13:57 -06:00
Fix crash when extruder 16 is used in color painting (#7200)
Fix crash when extruder 16 is used in color painting (SoftFever/OrcaSlicer#7198)
This commit is contained in:
parent
cf6d9c77ff
commit
65157da466
3 changed files with 4 additions and 4 deletions
|
@ -1506,7 +1506,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
num_extruders > 1 &&
|
num_extruders > 1 &&
|
||||||
std::find_if(volumes.begin(), volumes.end(), [](const ModelVolume *v) { return ! v->mmu_segmentation_facets.empty(); }) != volumes.end()) {
|
std::find_if(volumes.begin(), volumes.end(), [](const ModelVolume *v) { return ! v->mmu_segmentation_facets.empty(); }) != volumes.end()) {
|
||||||
|
|
||||||
std::array<bool, static_cast<size_t>(EnforcerBlockerType::ExtruderMax)> used_facet_states{};
|
std::array<bool, static_cast<size_t>(EnforcerBlockerType::ExtruderMax) + 1> used_facet_states{};
|
||||||
for (const ModelVolume *volume : volumes) {
|
for (const ModelVolume *volume : volumes) {
|
||||||
const std::vector<bool> &volume_used_facet_states = volume->mmu_segmentation_facets.get_data().used_states;
|
const std::vector<bool> &volume_used_facet_states = volume->mmu_segmentation_facets.get_data().used_states;
|
||||||
|
|
||||||
|
|
|
@ -1665,7 +1665,7 @@ TriangleSelector::TriangleSplittingData TriangleSelector::serialize() const {
|
||||||
} else {
|
} else {
|
||||||
// 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 < static_cast<size_t>(EnforcerBlockerType::ExtruderMax))
|
if (n <= static_cast<size_t>(EnforcerBlockerType::ExtruderMax))
|
||||||
data.used_states[n] = true;
|
data.used_states[n] = true;
|
||||||
|
|
||||||
if (n >= 3) {
|
if (n >= 3) {
|
||||||
|
|
|
@ -256,7 +256,7 @@ public:
|
||||||
// Bit stream containing splitting information.
|
// Bit stream containing splitting information.
|
||||||
std::vector<bool> bitstream;
|
std::vector<bool> bitstream;
|
||||||
// Array indicating which triangle state types are used (encoded inside bitstream).
|
// Array indicating which triangle state types are used (encoded inside bitstream).
|
||||||
std::vector<bool> used_states { std::vector<bool>(static_cast<size_t>(EnforcerBlockerType::ExtruderMax), false) };
|
std::vector<bool> used_states { std::vector<bool>(static_cast<size_t>(EnforcerBlockerType::ExtruderMax) + 1, false) };
|
||||||
|
|
||||||
TriangleSplittingData() = default;
|
TriangleSplittingData() = default;
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ public:
|
||||||
|
|
||||||
// Reset all used states before they are recomputed based on the bitstream.
|
// Reset all used states before they are recomputed based on the bitstream.
|
||||||
void reset_used_states() {
|
void reset_used_states() {
|
||||||
used_states.resize(static_cast<size_t>(EnforcerBlockerType::ExtruderMax), false);
|
used_states.resize(static_cast<size_t>(EnforcerBlockerType::ExtruderMax) + 1, false);
|
||||||
std::fill(used_states.begin(), used_states.end(), false);
|
std::fill(used_states.begin(), used_states.end(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue