mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 14:41:58 +08:00
Merge branch 'jb_profile_name_and_version_in_gcode'
This commit is contained in:
commit
463bb083e5
4
deps/+LibBGCode/LibBGCode.cmake
vendored
4
deps/+LibBGCode/LibBGCode.cmake
vendored
@ -1,8 +1,8 @@
|
||||
set(LibBGCode_SOURCE_DIR "" CACHE PATH "Optionally specify local LibBGCode source directory")
|
||||
|
||||
set(_source_dir_line
|
||||
URL https://github.com/prusa3d/libbgcode/archive/b5c57c423c958a78dacae468aeee63ab3d2de947.zip
|
||||
URL_HASH SHA256=ade82ffe9c1a1876c9d4d264948fa146d33d6a9c7cc23f6422fbbdb2949c5d75)
|
||||
URL https://github.com/prusa3d/libbgcode/archive/d33a277a3ce2c0a7f9ba325caac6d730e0f7a412.zip
|
||||
URL_HASH SHA256=0db3b0852df8d3ae32a4283884bc4ad6f1dd4d3c748ed679491f70b1e1d1acd5)
|
||||
|
||||
if (LibBGCode_SOURCE_DIR)
|
||||
set(_source_dir_line "SOURCE_DIR;${LibBGCode_SOURCE_DIR};BUILD_ALWAYS;ON")
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "libslic3r.h"
|
||||
#include "LocalesUtils.hpp"
|
||||
#include "format.hpp"
|
||||
#include "Time.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
@ -950,6 +951,7 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail
|
||||
|
||||
// file data
|
||||
binary_data.file_metadata.raw_data.emplace_back("Producer", std::string(SLIC3R_APP_NAME) + " " + std::string(SLIC3R_VERSION));
|
||||
binary_data.file_metadata.raw_data.emplace_back("Produced on", Utils::utc_timestamp());
|
||||
|
||||
// config data
|
||||
encode_full_config(*m_print, binary_data.slicer_metadata.raw_data);
|
||||
|
@ -491,6 +491,20 @@ void PrintConfigDef::init_common_params()
|
||||
def->cli = ConfigOptionDef::nocli;
|
||||
def->set_default_value(new ConfigOptionEnum<AuthorizationType>(atKeyPassword));
|
||||
|
||||
def = this->add("profile_vendor", coString);
|
||||
def->label = L("Profile vendor");
|
||||
def->tooltip = L("Name of profile vendor");
|
||||
def->mode = comAdvanced;
|
||||
def->cli = ConfigOptionDef::nocli;
|
||||
def->set_default_value(new ConfigOptionString(""));
|
||||
|
||||
def = this->add("profile_version", coString);
|
||||
def->label = L("Profile version");
|
||||
def->tooltip = L("Version of profile");
|
||||
def->mode = comAdvanced;
|
||||
def->cli = ConfigOptionDef::nocli;
|
||||
def->set_default_value(new ConfigOptionString(""));
|
||||
|
||||
// temporary workaround for compatibility with older Slicer
|
||||
{
|
||||
def = this->add("preset_name", coString);
|
||||
|
@ -2106,15 +2106,26 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||
|
||||
const Preset &selected_printer = wxGetApp().preset_bundle->printers.get_selected_preset();
|
||||
std::string printer_model_serialized = full_config.option("printer_model")->serialize();
|
||||
|
||||
const VendorProfile* vendor = nullptr;
|
||||
std::string vendor_repo_prefix;
|
||||
if (selected_printer.vendor) {
|
||||
vendor_repo_prefix = selected_printer.vendor->repo_prefix;
|
||||
vendor = selected_printer.vendor;
|
||||
|
||||
} else if (std::string inherits = selected_printer.inherits(); !inherits.empty()) {
|
||||
const Preset *parent = wxGetApp().preset_bundle->printers.find_preset(inherits);
|
||||
if (parent && parent->vendor) {
|
||||
vendor_repo_prefix = parent->vendor->repo_prefix;
|
||||
}
|
||||
}
|
||||
|
||||
if (vendor) {
|
||||
vendor_repo_prefix = vendor->repo_prefix;
|
||||
// Passing extra info about preset vendor and version, so these can be inserted as metadata to GCode
|
||||
full_config.set("profile_vendor", vendor->name, true);
|
||||
full_config.set("profile_version", vendor->config_version.to_string(), true);
|
||||
}
|
||||
|
||||
if (printer_model_serialized.find(vendor_repo_prefix) == 0) {
|
||||
printer_model_serialized = printer_model_serialized.substr(vendor_repo_prefix.size());
|
||||
boost::trim_left(printer_model_serialized);
|
||||
|
Loading…
x
Reference in New Issue
Block a user