From 0162f5f75a92ee179ade738aadefb0f05ef54f14 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Mon, 5 Jun 2023 15:02:15 +0800 Subject: [PATCH] FIX: the insert custom gcode icon is not correct after sync ams STUDIO-3053 Change-Id: Ia98f18481cba7fc080f7153d6da253403c5db494 --- src/slic3r/GUI/GUI_Utils.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index 147f51970..10e2a6f94 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -52,6 +52,15 @@ static std::array decode_color_to_float_array(const std::string color) ret[j] = float(digit1 * 16 + digit2) / 255.0f; } } + else if (color.size() == 9 && color.front() == '#') { + for (size_t j = 0; j < 4; ++j) { + int digit1 = hex_to_int(*c++); + int digit2 = hex_to_int(*c++); + if (digit1 == -1 || digit2 == -1) break; + + ret[j] = float(digit1 * 16 + digit2) / 255.0f; + } + } return ret; }