Skip to content

Commit

Permalink
Merge branch 'prusa3d:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleStrike authored Dec 20, 2024
2 parents 318741b + 5c7888b commit af5b26c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/libslic3r/MultiMaterialSegmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,8 @@ static void update_color_changes_using_color_projection_ranges(std::vector<Color
static std::vector<ColorPolygons> slice_model_volume_with_color(const ModelVolume &model_volume,
const std::function<ModelVolumeFacetsInfo(const ModelVolume &)> &extract_facets_info,
const std::vector<float> &layer_zs,
const PrintObject &print_object)
const PrintObject &print_object,
const size_t num_facets_states)
{
const ModelVolumeFacetsInfo facets_info = extract_facets_info(model_volume);

Expand Down Expand Up @@ -1638,6 +1639,15 @@ static std::vector<ColorPolygons> slice_model_volume_with_color(const ModelVolum
}
}

// Replace any non-existing painted color with the default (TriangleStateType::NONE).
for (ColorPolygons &color_polygons : color_polygons_per_layer) {
for (ColorPolygon &color_polygon : color_polygons) {
std::replace_if(color_polygon.colors.begin(), color_polygon.colors.end(),
[&num_facets_states](const uint8_t color) { return color >= num_facets_states; },
static_cast<uint8_t>(TriangleStateType::NONE));
}
}

return color_polygons_per_layer;
}

Expand Down Expand Up @@ -1694,7 +1704,7 @@ std::vector<std::vector<ExPolygons>> segmentation_by_painting(const PrintObject
BOOST_LOG_TRIVIAL(debug) << "Print object segmentation - Slicing painted triangles - Begin";
const std::vector<float> layer_zs = get_print_object_layers_zs(layers);
for (const ModelVolume *mv : print_object.model_object()->volumes) {
std::vector<ColorPolygons> color_polygons_per_layer = slice_model_volume_with_color(*mv, extract_facets_info, layer_zs, print_object);
std::vector<ColorPolygons> color_polygons_per_layer = slice_model_volume_with_color(*mv, extract_facets_info, layer_zs, print_object, num_facets_states);

tbb::parallel_for(tbb::blocked_range<size_t>(0, num_layers), [&color_polygons_per_layer, &color_polygons_lines_layers, &throw_on_cancel_callback](const tbb::blocked_range<size_t> &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {
Expand Down Expand Up @@ -1791,6 +1801,9 @@ std::vector<std::vector<ExPolygons>> segmentation_by_painting(const PrintObject
throw_on_cancel_callback();

std::vector<ColorProjectionLines> &input_polygons_projection_lines = input_polygons_projection_lines_layers[layer_idx];
if (input_polygons_projection_lines.empty()) {
continue;
}

if constexpr (MM_SEGMENTATION_DEBUG_COLOR_RANGES) {
export_color_projection_lines_color_ranges_to_svg(debug_out_path("mm-color-ranges-%d.svg", layer_idx), input_polygons_projection_lines, input_expolygons[layer_idx]);
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/Config/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cctype>

#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/directory.hpp>
#include <boost/nowide/fstream.hpp>

#include "libslic3r/libslic3r.h"
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/3DBed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void Bed3D::render_default(bool bottom, bool picking, bool show_texture, const T
glsafe(::glEnable(GL_BLEND));
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));

const bool has_model = !m_model.model.get_filename().empty();
const bool has_model = !m_model.model.get_filename().empty() && ! m_models_overlap;
if (!has_model && !bottom) {
// draw background
glsafe(::glDepthMask(GL_FALSE));
Expand Down
2 changes: 1 addition & 1 deletion version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

set(SLIC3R_APP_NAME "PrusaSlicer")
set(SLIC3R_APP_KEY "PrusaSlicer")
set(SLIC3R_VERSION "2.9.0-rc1")
set(SLIC3R_VERSION "2.9.0")
set(SLIC3R_BUILD_ID "PrusaSlicer-${SLIC3R_VERSION}+UNKNOWN")
set(SLIC3R_RC_VERSION "2,9,0,0")
set(SLIC3R_RC_VERSION_DOTS "2.9.0.0")

0 comments on commit af5b26c

Please sign in to comment.