From 48a93e40fb2499832ea4dd61185c58912f6ef18a Mon Sep 17 00:00:00 2001
From: Vojtech Bubnik <bubnikv@gmail.com>
Date: Thu, 15 Apr 2021 16:29:30 +0200
Subject: [PATCH] After issuing the color change custom G-code, which is most
 likely just M600, reset the internal retract counter, so that a retract will
 happen after the firmware returns from M600 to the initial position.

Fixes "Blobs on print after manual color change #6362"
---
 src/libslic3r/GCode.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index 0e2b1a57f..a79940810 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -1778,6 +1778,10 @@ namespace ProcessLayer
                 else {
                     gcode += gcodegen.placeholder_parser_process("color_change_gcode", config.color_change_gcode, current_extruder_id);
                     gcode += "\n";
+                    //FIXME Tell G-code writer that M600 filled the extruder, thus the G-code writer shall reset the extruder to unretracted state after
+                    // return from M600. Thus the G-code generated by the following line is ignored.
+                    // see GH issue #6362
+                    gcodegen.writer().unretract();
                 }
 	        } 
 	        else {