diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 634093d72..2cc39583b 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -146,11 +146,6 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool this->fill_wipe_tower_partitions(print.config(), object_bottom_z); this->collect_extruder_statistics(prime_multi_material); - - // Assign custom G-code actions from Model::custom_gcode_per_print_z to their respecive layers, - // ignoring the extruder switches, which were processed above, and ignoring color changes for extruders, - // that do not print above their respective print_z. - this->assign_custom_gcodes(print); } void ToolOrdering::initialize_layers(std::vector &zs) diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 4a4ed3964..5e6a26f9d 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -242,11 +242,10 @@ private: struct WipeTowerData { - WipeTowerData(ToolOrdering &tool_ordering) : tool_ordering(tool_ordering) { clear(); } // Following section will be consumed by the GCodeGenerator. // Tool ordering of a non-sequential print has to be known to calculate the wipe tower. // Cache it here, so it does not need to be recalculated during the G-code generation. - ToolOrdering tool_ordering; + ToolOrdering &tool_ordering; // Cache of tool changes per print layer. std::unique_ptr> priming; std::vector> tool_changes; @@ -267,6 +266,14 @@ struct WipeTowerData depth = 0.f; brim_width = 0.f; } + +private: + // Only allow the WipeTowerData to be instantiated internally by Print, + // as this WipeTowerData shares reference to Print::m_tool_ordering. + friend class Print; + WipeTowerData(ToolOrdering &tool_ordering) : tool_ordering(tool_ordering) { clear(); } + WipeTowerData(const WipeTowerData & /* rhs */) = delete; + WipeTowerData &operator=(const WipeTowerData & /* rhs */) = delete; }; struct PrintStatistics