From 9045ff8f0e3a2185a3c3d562bfcbd1a288d680ad Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Wed, 24 Aug 2022 14:03:21 +0200 Subject: [PATCH] WIP TreeSupports: Fixed some compiler warnings --- src/libslic3r/SupportMaterial.cpp | 4 +++- src/libslic3r/SupportMaterial.hpp | 1 - src/libslic3r/TreeModelVolumes.cpp | 9 +++++---- src/libslic3r/TreeModelVolumes.hpp | 2 ++ src/libslic3r/TreeSupport.cpp | 16 ++++++++++------ 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index 0f704c3d6..7082b9f1f 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -396,7 +396,6 @@ SupportParameters::SupportParameters(const PrintObject &object) } PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object, const SlicingParameters &slicing_params) : - m_object (object), m_print_config (&object->print()->config()), m_object_config (&object->config()), m_slicing_params (slicing_params), @@ -795,6 +794,9 @@ public: ) { switch (m_style) { + case smsTree: + assert(false); + [[fallthrough]]; case smsGrid: { #ifdef SUPPORT_USE_AGG_RASTERIZER diff --git a/src/libslic3r/SupportMaterial.hpp b/src/libslic3r/SupportMaterial.hpp index 1e6d12f80..b578adb30 100644 --- a/src/libslic3r/SupportMaterial.hpp +++ b/src/libslic3r/SupportMaterial.hpp @@ -267,7 +267,6 @@ private: */ // Following objects are not owned by SupportMaterial class. - const PrintObject *m_object; const PrintConfig *m_print_config; const PrintObjectConfig *m_object_config; // Pre-calculated parameters shared between the object slicer and the support generator, diff --git a/src/libslic3r/TreeModelVolumes.cpp b/src/libslic3r/TreeModelVolumes.cpp index 55cd66327..59986ff30 100644 --- a/src/libslic3r/TreeModelVolumes.cpp +++ b/src/libslic3r/TreeModelVolumes.cpp @@ -108,8 +108,10 @@ TreeModelVolumes::TreeModelVolumes( const coord_t max_move, const coord_t max_move_slow, size_t current_mesh_idx, double progress_multiplier, double progress_offset, const std::vector& additional_excluded_areas) : // -2 to avoid rounding errors - m_max_move{ std::max(max_move - 2, 0) }, m_max_move_slow{ std::max(max_move_slow - 2, 0) }, - m_progress_multiplier{ progress_multiplier }, m_progress_offset{ progress_offset }, + m_max_move{ std::max(max_move - 2, 0) }, m_max_move_slow{ std::max(max_move_slow - 2, 0) }, +#ifdef SLIC3R_TREESUPPORTS_PROGRESS + m_progress_multiplier{ progress_multiplier }, m_progress_offset{ progress_offset }, +#endif // SLIC3R_TREESUPPORTS_PROGRESS m_machine_border{ calculateMachineBorderCollision(build_volume.polygon()) } { #if 0 @@ -428,7 +430,6 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex if (const std::vector &outlines = m_layer_outlines[outline_idx].second; ! outlines.empty()) { const TreeSupportMeshGroupSettings &settings = m_layer_outlines[outline_idx].first; const coord_t layer_height = settings.layer_height; - const bool support_rests_on_model = ! settings.support_material_buildplate_only; const coord_t z_distance_bottom = settings.support_bottom_distance; const int z_distance_bottom_layers = round_up_divide(z_distance_bottom, layer_height); const int z_distance_top_layers = round_up_divide(settings.support_top_distance, layer_height); @@ -482,7 +483,7 @@ void TreeModelVolumes::calculateCollision(const coord_t radius, const LayerIndex if (calculate_placable) { // Calculating both the collision areas and placable areas. tbb::parallel_for(tbb::blocked_range(std::max(min_layer_last + 1, z_distance_bottom_layers + 1), max_layer_idx + 1), - [&collision_areas_offsetted, &anti_overhang = m_anti_overhang, min_layer_bottom, radius, z_distance_bottom_layers, z_distance_top_layers, last, min_resolution = m_min_resolution, &data_placeable, min_layer_last] + [&collision_areas_offsetted, &anti_overhang = m_anti_overhang, min_layer_bottom, z_distance_bottom_layers, last, min_resolution = m_min_resolution, &data_placeable, min_layer_last] (const tbb::blocked_range& range) { for (LayerIndex layer_idx = range.begin(); layer_idx != range.end(); ++ layer_idx) { LayerIndex layer_idx_below = layer_idx - (z_distance_bottom_layers + 1) - min_layer_bottom; diff --git a/src/libslic3r/TreeModelVolumes.hpp b/src/libslic3r/TreeModelVolumes.hpp index efcdc54ae..0ae72acac 100644 --- a/src/libslic3r/TreeModelVolumes.hpp +++ b/src/libslic3r/TreeModelVolumes.hpp @@ -509,6 +509,7 @@ private: * \brief Does at least one mesh allow support to rest on a model. */ bool m_support_rests_on_model; +#ifdef SLIC3R_TREESUPPORTS_PROGRESS /*! * \brief The progress of the precalculate function for communicating it to the progress bar. */ @@ -523,6 +524,7 @@ private: * Required for the progress bar the behave as expected when areas have to be calculated multiple times */ double m_progress_offset; +#endif // SLIC3R_TREESUPPORTS_PROGRESS /*! * \brief Increase radius in the resulting drawn branches, even if the avoidance does not allow it. Will be cut later to still fit. */ diff --git a/src/libslic3r/TreeSupport.cpp b/src/libslic3r/TreeSupport.cpp index d6280ba37..bddd6f2c4 100644 --- a/src/libslic3r/TreeSupport.cpp +++ b/src/libslic3r/TreeSupport.cpp @@ -226,6 +226,7 @@ static std::vector& to void TreeSupport::createLayerPathing(std::vector>& move_bounds) { - const double data_size_inverse = 1 / double(move_bounds.size()); #ifdef SLIC3R_TREESUPPORTS_PROGRESS + const double data_size_inverse = 1 / double(move_bounds.size()); double progress_total = TREE_PROGRESS_PRECALC_AVO + TREE_PROGRESS_PRECALC_COLL + TREE_PROGRESS_GENERATE_NODES; #endif // SLIC3R_TREESUPPORTS_PROGRESS auto dur_inc = std::chrono::duration_values::zero(); auto dur_merge = std::chrono::duration_values::zero(); - auto dur_inc_recent = std::chrono::duration_values::zero(); - auto dur_merge_recent = std::chrono::duration_values::zero(); - LayerIndex last_merge = move_bounds.size(); bool new_element = false; @@ -2672,7 +2671,12 @@ void TreeSupport::finalizeInterfaceAndSupportAreas( support_roof->polygons = diff(support_roof->polygons, support_layer_storage[layer_idx]); break; //FIXME - #if 0 + #if 1 + case InterfacePreference::INTERFACE_LINES_OVERWRITE_SUPPORT: + case InterfacePreference::SUPPORT_LINES_OVERWRITE_INTERFACE: + assert(false); + [[fallthrough]]; + #else case InterfacePreference::INTERFACE_LINES_OVERWRITE_SUPPORT: { // Hatch the support roof interfaces, offset them by their line width and subtract them from support base. @@ -2790,7 +2794,7 @@ void TreeSupport::drawAreas( auto t_drop = std::chrono::high_resolution_clock::now(); // single threaded combining all dropped down support areas to the right layers. ONLY COPYS DATA! for (coord_t i = 0; i < static_cast(dropped_down_areas.size()); i++) - for (std::pair pair : dropped_down_areas[i]) + for (std::pair &pair : dropped_down_areas[i]) append(support_layer_storage[pair.first], std::move(pair.second)); // single threaded combining all support areas to the right layers. ONLY COPYS DATA!