Thumbnails feature revamp. (#5555)

* Thumbnails feature revamp.
Support generating different size/format combinations
* misc fix

Co-authored-by: Lukas Matena <lukasmatena@seznam.cz>
This commit is contained in:
SoftFever 2024-06-03 21:30:38 +08:00 committed by GitHub
parent 50d00a1d54
commit c083541e0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 1145 additions and 854 deletions

View file

@ -55,6 +55,7 @@
#include "Utils.hpp"
#include "Time.hpp"
#include "PlaceholderParser.hpp"
#include "libslic3r/GCode/Thumbnails.hpp"
using boost::property_tree::ptree;
@ -2637,6 +2638,16 @@ inline t_config_option_keys deep_diff(const ConfigBase &config_this, const Confi
} else if (opt_key == "default_filament_profile") {
// Ignore this field, it is not presented to the user, therefore showing a "modified" flag for this parameter does not help.
// Also the length of this field may differ, which may lead to a crash if the block below is used.
}
else if (opt_key == "thumbnails") {
// "thumbnails" can not contain extensions in old config but they are valid and use PNG extension by default
// So, check if "thumbnails" is really changed
// We will compare full thumbnails instead of exactly config values
auto [thumbnails, er] = GCodeThumbnails::make_and_check_thumbnail_list(config_this);
auto [thumbnails_new, er_new] = GCodeThumbnails::make_and_check_thumbnail_list(config_other);
if (thumbnails != thumbnails_new || er != er_new)
// if those strings are actually the same, erase them from the list of dirty oprions
diff.emplace_back(opt_key);
} else {
switch (other_opt->type()) {
case coInts: add_correct_opts_to_diff<ConfigOptionInts >(opt_key, diff, config_other, config_this); break;