Paint up to 32

This commit is contained in:
Ian Bassi
2026-05-29 20:37:07 -03:00
parent 1ecedd3187
commit c858360ee6
3 changed files with 21 additions and 9 deletions

View File

@@ -1861,8 +1861,6 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
std::array<bool, static_cast<size_t>(EnforcerBlockerType::ExtruderMax) + 1> used_facet_states{};
for (const ModelVolume *volume : volumes) {
const std::vector<bool> &volume_used_facet_states = volume->mmu_segmentation_facets.get_data().used_states;
assert(volume_used_facet_states.size() == used_facet_states.size());
for (size_t state_idx = 0; state_idx < std::min(volume_used_facet_states.size(), used_facet_states.size()); ++state_idx)
used_facet_states[state_idx] |= volume_used_facet_states[state_idx];
}

View File

@@ -17,7 +17,8 @@ enum class EnforcerBlockerType : int8_t {
BLOCKER = 2,
// For the fuzzy skin, we use just two values (NONE and FUZZY_SKIN).
FUZZY_SKIN = ENFORCER,
// Maximum is 15. The value is serialized in TriangleSelector into 6 bits using a 2 bit prefix code.
// Extruder states use compact nibble encoding with extended fallback in TriangleSelector serialization.
// Values above 16 are supported as long as they fit in EnforcerBlockerType (int8_t).
Extruder1 = ENFORCER,
Extruder2 = BLOCKER,
Extruder3,
@@ -34,7 +35,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
};
// Type alias for the state mapping array to improve code readability

View File

@@ -72,11 +72,8 @@ public:
void data_changed(bool is_serializing) override;
// TriangleSelector::serialization/deserialization has a limit to store 19 different states.
// EXTRUDER_LIMIT + 1 states are used to storing the painting because also uncolored triangles are stored.
// When increasing EXTRUDER_LIMIT, it needs to ensure that TriangleSelector::serialization/deserialization
// will be also extended to support additional states, requiring at least one state to remain free out of 19 states.
static const constexpr size_t EXTRUDERS_LIMIT = 16;
// Keep the paint gizmo limit aligned with TriangleSelector state capacity.
static const constexpr size_t EXTRUDERS_LIMIT = static_cast<size_t>(EnforcerBlockerType::ExtruderMax);
const float get_cursor_radius_min() const override { return CursorRadiusMin; }