From 74456d083079cc4025c7d7d68507d6a0152e97f6 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 19 Sep 2023 12:36:39 +0200 Subject: [PATCH] Don't use auto when the type is not 'near'. Done as part of CURA-11019 --- src/FffGcodeWriter.cpp | 16 ++++++++-------- src/FffPolygonGenerator.cpp | 10 +++++----- src/LayerPlan.cpp | 4 ++-- src/TreeSupport.cpp | 4 ++-- src/bridge.cpp | 2 +- src/settings/PathConfigStorage.cpp | 2 +- src/sliceDataStorage.cpp | 8 ++++---- src/support.cpp | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index 0d6ea404fd..d5cbd83648 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -106,7 +106,7 @@ void FffGcodeWriter::writeGCode(SliceDataStorage& storage, TimeKeeper& time_keep } size_t total_layers = 0; - for (auto& mesh_ptr : storage.meshes) + for (std::shared_ptr& mesh_ptr : storage.meshes) { auto& mesh = *mesh_ptr; size_t mesh_layer_num = mesh.layers.size(); @@ -270,7 +270,7 @@ void FffGcodeWriter::findLayerSeamsForSpiralize(SliceDataStorage& storage, size_ const std::vector& mesh_order = mesh_order_per_extruder[extruder_nr]; for (unsigned int mesh_idx : mesh_order) { - auto& mesh = *storage.meshes[mesh_idx]; + SliceMeshStorage& mesh = *storage.meshes[mesh_idx]; // if this mesh has layer data for this layer process it if (! done_this_layer && mesh.layers.size() > layer_nr) { @@ -372,7 +372,7 @@ void FffGcodeWriter::setConfigRetractionAndWipe(SliceDataStorage& storage) ExtruderTrain& train = scene.extruders[extruder_index]; retractionAndWipeConfigFromSettings(train.settings, &storage.retraction_wipe_config_per_extruder[extruder_index]); } - for (auto& mesh : storage.meshes) + for (std::shared_ptr& mesh : storage.meshes) { retractionAndWipeConfigFromSettings(mesh->settings, &mesh->retraction_wipe_config); } @@ -916,7 +916,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, LayerIn { z = storage.meshes[0]->layers[layer_nr].printZ; // stub default // find printZ of first actual printed mesh - for (const auto& mesh_ptr : storage.meshes) + for (const std::shared_ptr& mesh_ptr : storage.meshes) { const auto& mesh = *mesh_ptr; if (layer_nr >= static_cast(mesh.layers.size()) || mesh.settings.get("support_mesh") || mesh.settings.get("anti_overhang_mesh") @@ -953,7 +953,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, LayerIn } coord_t max_inner_wall_width = 0; - for (const auto& mesh_ptr : storage.meshes) + for (const std::shared_ptr& mesh_ptr : storage.meshes) { const auto& mesh = *mesh_ptr; coord_t mesh_inner_wall_width = mesh.settings.get((mesh.settings.get("wall_line_count") > 1) ? "wall_line_width_x" : "wall_line_width_0"); @@ -1025,7 +1025,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, LayerIn const std::vector& mesh_order = mesh_order_per_extruder[extruder_nr]; for (size_t mesh_idx : mesh_order) { - const auto& mesh = storage.meshes[mesh_idx]; + const std::shared_ptr& mesh = storage.meshes[mesh_idx]; const MeshPathConfigs& mesh_config = gcode_layer.configs_storage.mesh_configs[mesh_idx]; if (mesh->settings.get("magic_mesh_surface_mode") == ESurfaceMode::SURFACE && extruder_nr @@ -1385,7 +1385,7 @@ std::vector FffGcodeWriter::calculateMeshOrder(const SliceDataStorage& s std::vector::iterator mesh_group = Application::getInstance().current_slice->scene.current_mesh_group; for (unsigned int mesh_idx = 0; mesh_idx < storage.meshes.size(); mesh_idx++) { - const auto& mesh = *storage.meshes[mesh_idx]; + const SliceMeshStorage& mesh = *storage.meshes[mesh_idx]; if (mesh.getExtruderIsUsed(extruder_nr)) { const Mesh& mesh_data = mesh_group->meshes[mesh_idx]; @@ -2263,7 +2263,7 @@ bool FffGcodeWriter::processInsets( Polygons outlines_below; AABB boundaryBox(part.outline); - for (const auto& mesh_ptr : storage.meshes) + for (const std::shared_ptr& mesh_ptr : storage.meshes) { const auto& m = *mesh_ptr; if (m.isPrinted()) diff --git a/src/FffPolygonGenerator.cpp b/src/FffPolygonGenerator.cpp index edd5e48d6e..daff0196eb 100644 --- a/src/FffPolygonGenerator.cpp +++ b/src/FffPolygonGenerator.cpp @@ -276,7 +276,7 @@ bool FffPolygonGenerator::sliceModel(MeshGroup* meshgroup, TimeKeeper& timeKeepe // always make a new SliceMeshStorage, so that they have the same ordering / indexing as meshgroup.meshes storage.meshes.push_back(std::make_shared(&meshgroup->meshes[meshIdx], slicer->layers.size())); // new mesh in storage had settings from the Mesh - auto& meshStorage = *storage.meshes.back(); + SliceMeshStorage& meshStorage = *storage.meshes.back(); // only create layer parts for normal meshes const bool is_support_modifier = AreaSupport::handleSupportModifierMesh(storage, mesh.settings, slicer); @@ -347,7 +347,7 @@ void FffPolygonGenerator::slices2polygons(SliceDataStorage& storage, TimeKeeper& // compute layer count and remove first empty layers // there is no separate progress stage for removeEmptyFisrtLayer (TODO) unsigned int slice_layer_count = 0; - for (auto& mesh_ptr : storage.meshes) + for (std::shared_ptr& mesh_ptr : storage.meshes) { auto& mesh = *mesh_ptr; if (! mesh.settings.get("infill_mesh") && ! mesh.settings.get("anti_overhang_mesh")) @@ -433,7 +433,7 @@ void FffPolygonGenerator::slices2polygons(SliceDataStorage& storage, TimeKeeper& spdlog::debug("Meshes post-processing"); // meshes post processing - for (auto& mesh : storage.meshes) + for (std::shared_ptr& mesh : storage.meshes) { processDerivedWallsSkinInfill(*mesh); } @@ -742,7 +742,7 @@ bool FffPolygonGenerator::isEmptyLayer(SliceDataStorage& storage, const LayerInd return false; } } - for (auto& mesh_ptr : storage.meshes) + for (std::shared_ptr& mesh_ptr : storage.meshes) { auto& mesh = *mesh_ptr; if (layer_idx >= mesh.layers.size()) @@ -855,7 +855,7 @@ void FffPolygonGenerator::computePrintHeightStatistics(SliceDataStorage& storage max_print_height_per_extruder.resize(extruder_count, -(raft_layers + 1)); // Initialize all as -1 (or lower in case of raft). { // compute max_object_height_per_extruder // Height of the meshes themselves. - for (auto& mesh_ptr : storage.meshes) + for (std::shared_ptr& mesh_ptr : storage.meshes) { auto& mesh = *mesh_ptr; if (mesh.settings.get("anti_overhang_mesh") || mesh.settings.get("support_mesh")) diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index b7d24b1b11..530ba6b63b 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -159,7 +159,7 @@ Polygons LayerPlan::computeCombBoundary(const CombBoundary boundary_type) } else { - for (const auto& mesh_ptr : storage.meshes) + for (const std::shared_ptr& mesh_ptr : storage.meshes) { const auto& mesh = *mesh_ptr; const SliceLayer& layer = mesh.layers[static_cast(layer_nr)]; @@ -1188,7 +1188,7 @@ void LayerPlan::addLinesByOptimizer( if (layer_nr >= 0) { // determine how much the skin/infill lines overlap the combing boundary - for (const auto& mesh : storage.meshes) + for (const std::shared_ptr& mesh : storage.meshes) { const coord_t overlap = std::max(mesh->settings.get("skin_overlap_mm"), mesh->settings.get("infill_overlap_mm")); if (overlap > dist) diff --git a/src/TreeSupport.cpp b/src/TreeSupport.cpp index 9cc4c7d404..c226588ebe 100644 --- a/src/TreeSupport.cpp +++ b/src/TreeSupport.cpp @@ -39,7 +39,7 @@ TreeSupport::TreeSupport(const SliceDataStorage& storage) { size_t largest_printed_mesh_idx = 0; - for (const auto& mesh_ptr : storage.meshes) + for (const std::shared_ptr& mesh_ptr : storage.meshes) { const auto& mesh = *mesh_ptr; TreeSupportSettings::some_model_contains_thick_roof |= mesh.settings.get("support_roof_height") >= 2 * mesh.settings.get("layer_height"); @@ -52,7 +52,7 @@ TreeSupport::TreeSupport(const SliceDataStorage& storage) // Only one setting object is needed per group, as different settings in the same group may only occur in the tip, which uses the original settings objects from the meshes. for (auto [mesh_idx, mesh_ptr] : storage.meshes | ranges::views::enumerate) { - auto& mesh = *mesh_ptr; + SliceMeshStorage& mesh = *mesh_ptr; const bool non_supportable_mesh = mesh.settings.get("infill_mesh") || mesh.settings.get("anti_overhang_mesh") || mesh.settings.get("support_mesh"); if (mesh.settings.get("support_structure") != ESupportStructure::TREE || ! mesh.settings.get("support_enable") || non_supportable_mesh) { diff --git a/src/bridge.cpp b/src/bridge.cpp index 06ddbb6080..75e42889e2 100644 --- a/src/bridge.cpp +++ b/src/bridge.cpp @@ -32,7 +32,7 @@ int bridgeAngle( const Ratio sparse_infill_max_density = settings.get("bridge_sparse_infill_max_density"); // include parts from all meshes - for (const auto& mesh_ptr : storage.meshes) + for (const std::shared_ptr& mesh_ptr : storage.meshes) { const auto& mesh = *mesh_ptr; if (mesh.isPrinted()) diff --git a/src/settings/PathConfigStorage.cpp b/src/settings/PathConfigStorage.cpp index 467b130f5c..f6e6d1b703 100644 --- a/src/settings/PathConfigStorage.cpp +++ b/src/settings/PathConfigStorage.cpp @@ -124,7 +124,7 @@ PathConfigStorage::PathConfigStorage(const SliceDataStorage& storage, const Laye } mesh_configs.reserve(storage.meshes.size()); - for (const auto& mesh_storage : storage.meshes) + for (const std::shared_ptr& mesh_storage : storage.meshes) { mesh_configs.emplace_back(*mesh_storage, layer_thickness, layer_nr, line_width_factor_per_extruder); } diff --git a/src/sliceDataStorage.cpp b/src/sliceDataStorage.cpp index c890783f8c..4533fbb8be 100644 --- a/src/sliceDataStorage.cpp +++ b/src/sliceDataStorage.cpp @@ -300,7 +300,7 @@ Polygons Polygons total; if (layer_nr >= 0) { - for (const auto& mesh : meshes) + for (const std::shared_ptr& mesh : meshes) { if (mesh->settings.get("infill_mesh") || mesh->settings.get("anti_overhang_mesh") || (extruder_nr != -1 && extruder_nr != int(mesh->settings.get("wall_0_extruder_nr").extruder_nr))) @@ -381,7 +381,7 @@ std::vector SliceDataStorage::getExtrudersUsed() const // support // support is presupposed to be present... - for (const auto& mesh : meshes) + for (const std::shared_ptr& mesh : meshes) { if (mesh->settings.get("support_enable") || mesh->settings.get("support_mesh")) { @@ -399,7 +399,7 @@ std::vector SliceDataStorage::getExtrudersUsed() const } // all meshes are presupposed to actually have content - for (const auto& mesh : meshes) + for (const std::shared_ptr& mesh : meshes) { for (unsigned int extruder_nr = 0; extruder_nr < ret.size(); extruder_nr++) { @@ -508,7 +508,7 @@ std::vector SliceDataStorage::getExtrudersUsed(const LayerIndex layer_nr) if (include_models) { - for (const auto& mesh : meshes) + for (const std::shared_ptr& mesh : meshes) { for (unsigned int extruder_nr = 0; extruder_nr < ret.size(); extruder_nr++) { diff --git a/src/support.cpp b/src/support.cpp index a55d21b53f..188f2b486d 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -599,7 +599,7 @@ Polygons AreaSupport::join(const SliceDataStorage& storage, const Polygons& supp void AreaSupport::generateOverhangAreas(SliceDataStorage& storage) { - for (auto& mesh_ptr : storage.meshes) + for (std::shared_ptr& mesh_ptr : storage.meshes) { auto& mesh = *mesh_ptr; if (mesh.settings.get("infill_mesh") || mesh.settings.get("anti_overhang_mesh"))