Merge branch 'fs_dir_per_glyph_SPE-1597' into fs_svg

This commit is contained in:
Filip Sykala - NTB T15p 2023-06-13 14:34:33 +02:00
commit 36bb7cfe9b
24 changed files with 142 additions and 67 deletions

View File

@ -17011,7 +17011,7 @@ msgstr "Přenést vybraná nastavení do nově zvoleného přednastavení."
#: src/slic3r/GUI/UnsavedChangesDialog.cpp:1626
msgid "Transfer values from left to right"
msgstr "Přenést hodnoty zprava doleva"
msgstr "Přenést hodnoty zleva doprava"
#: src/slic3r/GUI/GUI_ObjectManipulation.cpp:678
msgid "Translate"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,4 +1,5 @@
min_slic3r_version = 2.6.0-alpha0
1.0.3 Updated compatible printer condition.
1.0.2 Updated compatible printer conditions.
1.0.1 Added Prusament PETG Carbon Fiber, Fiberthree F3 PA-GF30 Pro.
1.0.0 Initial

View File

@ -2,7 +2,7 @@
[vendor]
name = Templates
config_version = 1.0.2
config_version = 1.0.3
config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Templates/
templates_profile = 1
@ -11,7 +11,7 @@ templates_profile = 1
[filament:*common*]
cooling = 1
compatible_printers =
compatible_printers_condition = printer_notes!~/.*PRINTER_VENDOR_TRILAB.*/ and printer_notes!~/.*PRINTER_MODEL_MK4IS.*/
compatible_printers_condition = printer_notes!~/.*PRINTER_VENDOR_TRILAB.*/ and printer_notes!~/.*PRINTER_MODEL_MK4IS.*/ and ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and num_extruders>1)
end_filament_gcode = "; Filament-specific end gcode"
extrusion_multiplier = 1
filament_loading_speed = 14

View File

@ -468,11 +468,8 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
f->print_config = &this->object()->print()->config();
f->print_object_config = &this->object()->config();
if (surface_fill.params.pattern == ipLightning) {
auto *lf = dynamic_cast<FillLightning::Filler*>(f.get());
lf->generator = lightning_generator;
lf->num_raft_layers = this->object()->slicing_parameters().raft_layers();
}
if (surface_fill.params.pattern == ipLightning)
dynamic_cast<FillLightning::Filler*>(f.get())->generator = lightning_generator;
if (surface_fill.params.pattern == ipEnsuring) {
auto *fill_ensuring = dynamic_cast<FillEnsuring *>(f.get());
@ -649,18 +646,15 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc
// Create the filler object.
std::unique_ptr<Fill> f = std::unique_ptr<Fill>(Fill::new_from_type(surface_fill.params.pattern));
f->set_bounding_box(bbox);
f->layer_id = this->id();
f->layer_id = this->id() - this->object()->get_layer(0)->id(); // We need to subtract raft layers.
f->z = this->print_z;
f->angle = surface_fill.params.angle;
f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree;
f->print_config = &this->object()->print()->config();
f->print_object_config = &this->object()->config();
if (surface_fill.params.pattern == ipLightning) {
auto *lf = dynamic_cast<FillLightning::Filler *>(f.get());
lf->generator = lightning_generator;
lf->num_raft_layers = this->object()->slicing_parameters().raft_layers();
}
if (surface_fill.params.pattern == ipLightning)
dynamic_cast<FillLightning::Filler *>(f.get())->generator = lightning_generator;
// calculate flow spacing for infill pattern generation
double link_max_length = 0.;

View File

@ -13,7 +13,7 @@ void Filler::_fill_surface_single(
ExPolygon expolygon,
Polylines &polylines_out)
{
const Layer &layer = generator->getTreesForLayer(this->layer_id - this->num_raft_layers);
const Layer &layer = generator->getTreesForLayer(this->layer_id);
Polylines fill_lines = layer.convertToLines(to_polygons(expolygon), scaled<coord_t>(0.5 * this->spacing - this->overlap));
if (params.dont_connect() || fill_lines.size() <= 1) {

View File

@ -22,7 +22,6 @@ public:
~Filler() override = default;
Generator *generator { nullptr };
size_t num_raft_layers { 0 };
protected:
Fill* clone() const override { return new Filler(*this); }

View File

@ -11,20 +11,17 @@
namespace Slic3r {
static std::mutex arch_mtx;
class Registry {
static std::unique_ptr<Registry> registry;
std::set<ArchiveEntry> entries;
public:
Registry ()
{
entries = {
{
"SL1", // id
L("SL1 archive format"), // description
L("SL1 archive"), // description
"sl1", // main extension
{"sl1s", "zip"}, // extension aliases
@ -38,22 +35,14 @@ public:
},
{
"SL1SVG",
L("SL1SVG archive files"),
L("SL1 SVG archive"),
"sl1_svg",
{},
{"zip"},
[] (const auto &cfg) { return std::make_unique<SL1_SVGArchive>(cfg); },
[] (const std::string &fname, SLAImportQuality quality, const ProgrFn &progr) {
return std::make_unique<SL1_SVGReader>(fname, quality, progr);
}
},
{
"SL2",
"",
"sl1_svg",
{},
[] (const auto &cfg) { return std::make_unique<SL1_SVGArchive>(cfg); },
nullptr
},
anycubic_sla_format("pwmo", "Photon Mono"),
anycubic_sla_format("pwmx", "Photon Mono X"),
anycubic_sla_format("pwms", "Photon Mono SE"),
@ -85,28 +74,26 @@ public:
};
}
static Registry& get_instance()
public:
static const Registry& get_instance()
{
if (!registry)
registry = std::make_unique<Registry>();
registry.reset(new Registry());
return *registry;
}
static std::set<ArchiveEntry>& get()
static const std::set<ArchiveEntry>& get()
{
return get_instance().entries;
}
std::set<ArchiveEntry>& get_entries() { return entries; }
};
std::unique_ptr<Registry> Registry::registry = nullptr;
std::set<ArchiveEntry> registered_sla_archives()
const std::set<ArchiveEntry>& registered_sla_archives()
{
std::lock_guard lk{arch_mtx};
return Registry::get();
}
@ -123,8 +110,6 @@ std::vector<std::string> get_extensions(const ArchiveEntry &entry)
ArchiveWriterFactory get_writer_factory(const char *formatid)
{
std::lock_guard lk{arch_mtx};
ArchiveWriterFactory ret;
auto entry = Registry::get().find(ArchiveEntry{formatid});
if (entry != Registry::get().end())
@ -135,7 +120,6 @@ ArchiveWriterFactory get_writer_factory(const char *formatid)
ArchiveReaderFactory get_reader_factory(const char *formatid)
{
std::lock_guard lk{arch_mtx};
ArchiveReaderFactory ret;
auto entry = Registry::get().find(ArchiveEntry{formatid});
@ -145,4 +129,28 @@ ArchiveReaderFactory get_reader_factory(const char *formatid)
return ret;
}
const char *get_default_extension(const char *formatid)
{
static constexpr const char *Empty = "";
const char * ret = Empty;
auto entry = Registry::get().find(ArchiveEntry{formatid});
if (entry != Registry::get().end())
ret = entry->ext;
return ret;
}
const ArchiveEntry * get_archive_entry(const char *formatid)
{
const ArchiveEntry *ret = nullptr;
auto entry = Registry::get().find(ArchiveEntry{formatid});
if (entry != Registry::get().end())
ret = &(*entry);
return ret;
}
} // namespace Slic3r::sla

View File

@ -48,9 +48,9 @@ struct ArchiveEntry {
: id{formatid}
, desc{description}
, ext{extension}
, ext_aliases{extaliases}
, wrfactoryfn{wrfn}
, rdfactoryfn{rdfn}
, ext_aliases{extaliases}
{}
bool operator <(const ArchiveEntry &other) const
@ -61,8 +61,10 @@ struct ArchiveEntry {
std::vector<std::string> get_extensions(const ArchiveEntry &entry);
std::set<ArchiveEntry> registered_sla_archives();
const std::set<ArchiveEntry>& registered_sla_archives();
const ArchiveEntry * get_archive_entry(const char *formatid);
const char * get_default_extension(const char *formatid);
ArchiveWriterFactory get_writer_factory(const char *formatid);
ArchiveReaderFactory get_reader_factory(const char *formatid);

View File

@ -1296,8 +1296,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
this->placeholder_parser().set("first_layer_print_min", new ConfigOptionFloats({ bbox.min.x(), bbox.min.y() }));
this->placeholder_parser().set("first_layer_print_max", new ConfigOptionFloats({ bbox.max.x(), bbox.max.y() }));
this->placeholder_parser().set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() }));
std::vector<unsigned char> is_extruder_used(print.config().nozzle_diameter.size(), 0);
this->placeholder_parser().set("num_extruders", int(print.config().nozzle_diameter.values.size()));
// PlaceholderParser currently substitues non-existent vector values with the zero'th value, which is harmful in the case of "is_extruder_used[]"
// as Slicer may lie about availability of such non-existent extruder.
// We rather sacrifice 256B of memory before we change the behavior of the PlaceholderParser, which should really only fill in the non-existent
// vector elements for filament parameters.
std::vector<unsigned char> is_extruder_used(std::max(size_t(255), print.config().nozzle_diameter.size()), 0);
for (unsigned int extruder_id : tool_ordering.all_extruders())
is_extruder_used[extruder_id] = true;
this->placeholder_parser().set("is_extruder_used", new ConfigOptionBools(is_extruder_used));

View File

@ -243,9 +243,10 @@ bool GCodeReader::GCodeLine::has_value(char axis, float &value) const
if (c == nullptr)
return false;
// Try to parse the numeric value.
char *pend = nullptr;
double v = strtod(++ c, &pend);
if (pend != nullptr && is_end_of_word(*pend)) {
double v = 0.;
const char* end = m_raw.c_str() + m_raw.size();
auto [pend, ec] = fast_float::from_chars(++c, end, v);
if (pend != c && is_end_of_word(*pend)) {
// The axis value has been parsed correctly.
value = float(v);
return true;

View File

@ -1090,6 +1090,7 @@ namespace client
static void scalar_variable_assign_scalar(const MyContext *ctx, OptWithPos &lhs, const expr &rhs)
{
assert(! ctx->skipping());
assert(lhs.opt->is_scalar());
check_writable(ctx, lhs);
ConfigOption *wropt = const_cast<ConfigOption*>(lhs.opt);
@ -1121,6 +1122,7 @@ namespace client
static void vector_variable_element_assign_scalar(const MyContext *ctx, OptWithPos &lhs, const expr &rhs)
{
assert(! ctx->skipping());
assert(lhs.opt->is_vector());
check_writable(ctx, lhs);
if (! lhs.has_index())
@ -1158,6 +1160,7 @@ namespace client
static void vector_variable_assign_expr_with_count(const MyContext *ctx, OptWithPos &lhs, const expr &rhs_count, const expr &rhs_value)
{
assert(! ctx->skipping());
size_t count = evaluate_count(rhs_count);
auto *opt = const_cast<ConfigOption*>(lhs.opt);
switch (lhs.opt->type()) {

View File

@ -1541,6 +1541,7 @@ std::string Print::output_filename(const std::string &filename_base) const
// These values will be just propagated into the output file name.
DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders();
config.set_key_value("num_extruders", new ConfigOptionInt((int)m_config.nozzle_diameter.size()));
config.set_key_value("default_output_extension", new ConfigOptionString(".gcode"));
return this->PrintBase::output_filename(m_config.output_filename_format.value, ".gcode", filename_base, &config);
}

View File

@ -1983,7 +1983,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("You can use all configuration options as variables inside this template. "
"For example: [layer_height], [fill_density] etc. You can also use [timestamp], "
"[year], [month], [day], [hour], [minute], [second], [version], [input_filename], "
"[input_filename_base].");
"[input_filename_base], [default_output_extension].");
def->full_width = true;
def->mode = comExpert;
def->set_default_value(new ConfigOptionString("[input_filename_base].gcode"));
@ -4982,21 +4982,21 @@ std::string get_sla_suptree_prefix(const DynamicPrintConfig &config)
return slatree;
}
static bool is_XL_printer(const std::string& printer_model)
static bool is_XL_printer(const std::string& printer_notes)
{
static constexpr const char *ALIGN_ONLY_FOR = "XL";
return boost::algorithm::contains(printer_model, ALIGN_ONLY_FOR);
return boost::algorithm::contains(printer_notes, "PRINTER_VENDOR_PRUSA3D")
&& boost::algorithm::contains(printer_notes, "PRINTER_MODEL_XL");
}
bool is_XL_printer(const DynamicPrintConfig &cfg)
{
auto *printer_model = cfg.opt<ConfigOptionString>("printer_model");
return printer_model && is_XL_printer(printer_model->value);
auto *printer_notes = cfg.opt<ConfigOptionString>("printer_notes");
return printer_notes && is_XL_printer(printer_notes->value);
}
bool is_XL_printer(const PrintConfig &cfg)
{
return is_XL_printer(cfg.printer_model.value);
return is_XL_printer(cfg.printer_notes.value);
}
} // namespace Slic3r

View File

@ -4,6 +4,8 @@
#include "CSGMesh/PerformCSGMeshBooleans.hpp"
#include "format.hpp"
#include "Format/SLAArchiveFormatRegistry.hpp"
#include "Geometry.hpp"
#include "Thread.hpp"
@ -522,6 +524,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig con
#endif /* _DEBUG */
m_full_print_config = std::move(config);
return static_cast<ApplyStatus>(apply_status);
}
@ -531,7 +534,16 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig con
std::string SLAPrint::output_filename(const std::string &filename_base) const
{
DynamicConfig config = this->finished() ? this->print_statistics().config() : this->print_statistics().placeholders();
return this->PrintBase::output_filename(m_print_config.output_filename_format.value, ".sl1", filename_base, &config);
std::string default_ext = get_default_extension(m_printer_config.sla_archive_format.value.c_str());
if (default_ext.empty())
default_ext = "sl1";
default_ext.insert(default_ext.begin(), '.');
config.set_key_value("default_output_extension",
new ConfigOptionString(default_ext));
return this->PrintBase::output_filename(m_print_config.output_filename_format.value, default_ext, filename_base, &config);
}
std::string SLAPrint::validate(std::vector<std::string>*) const

View File

@ -7525,6 +7525,7 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
wxGetApp().CallAfter([obj_idx, layer_id]() {
wxGetApp().plater()->set_preview_layers_slider_values_range(0, layer_id - 1);
wxGetApp().plater()->select_view_3D("3D");
wxGetApp().plater()->canvas3D()->reset_all_gizmos();
wxGetApp().plater()->canvas3D()->get_selection().add_object(obj_idx, true);
wxGetApp().obj_list()->update_selections();
});

View File

@ -54,6 +54,7 @@
#include "libslic3r/Model.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Color.hpp"
#include "libslic3r/Format/SLAArchiveFormatRegistry.hpp"
#include "GUI.hpp"
#include "GUI_Utils.hpp"
@ -490,15 +491,13 @@ static const FileWildcards file_wildcards_by_type[FT_SIZE] = {
/* FT_TEX */ { "Texture"sv, { ".png"sv, ".svg"sv } },
/* FT_SL1 */ { "Masked SLA files"sv, { ".sl1"sv, ".sl1s"sv, ".pwmx"sv } },
/* FT_SL1 (deprecated, overriden by sla_wildcards) */ { "Masked SLA files"sv, { ".sl1"sv, ".sl1s"sv, ".pwmx"sv } },
/* FT_ZIP */ { "Zip files"sv, { ".zip"sv } },
};
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxString file_wildcards(FileType file_type)
static wxString file_wildcards(const FileWildcards& data)
{
const FileWildcards& data = file_wildcards_by_type[file_type];
std::string title;
std::string mask;
@ -532,6 +531,14 @@ wxString file_wildcards(FileType file_type)
return ret;
}
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxString file_wildcards(FileType file_type)
{
const FileWildcards& data = file_wildcards_by_type[file_type];
return file_wildcards(data);
}
#else
// This function produces a Win32 file dialog file template mask to be consumed by wxWidgets on all platforms.
// The function accepts a custom extension parameter. If the parameter is provided, the custom extension
@ -590,6 +597,34 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
}
#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxString sla_wildcards(const char *formatid)
{
const ArchiveEntry *entry = get_archive_entry(formatid);
wxString ret;
if (entry) {
FileWildcards wc;
std::string tr_title = I18N::translate_utf8(entry->desc);
tr_title = GUI::format(_u8L("%s files"), tr_title);
wc.title = tr_title;
std::vector<std::string> exts = get_extensions(*entry);
wc.file_extensions.reserve(exts.size());
for (std::string &ext : exts) {
ext.insert(ext.begin(), '.');
wc.file_extensions.emplace_back(ext);
}
ret = file_wildcards(wc);
}
if (ret.empty())
ret = file_wildcards(FT_SL1);
return ret;
}
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
#ifdef WIN32
@ -924,9 +959,9 @@ void GUI_App::init_app_config()
{
// Profiles for the alpha are stored into the PrusaSlicer-alpha directory to not mix with the current release.
// SetAppName(SLIC3R_APP_KEY);
SetAppName(SLIC3R_APP_KEY);
// SetAppName(SLIC3R_APP_KEY "-alpha");
SetAppName(SLIC3R_APP_KEY "-beta");
// SetAppName(SLIC3R_APP_KEY "-beta");
// SetAppDisplayName(SLIC3R_APP_NAME);

View File

@ -84,6 +84,8 @@ extern wxString file_wildcards(FileType file_type);
extern wxString file_wildcards(FileType file_type, const std::string &custom_extension = std::string{});
#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxString sla_wildcards(const char *formatid);
enum ConfigMenuIDs {
ConfigMenuWizard,
ConfigMenuSnapshots,

View File

@ -4369,7 +4369,8 @@ void ObjectList::update_and_show_object_settings_item()
const wxDataViewItem item = GetSelection();
if (!item) return;
const wxDataViewItem& obj_item = m_objects_model->IsSettingsItem(item) ? m_objects_model->GetParent(item) : item;
// To get object item use GetTopParent(item). This function guarantees return of item with itObject type
const wxDataViewItem obj_item = m_objects_model->GetTopParent(item);
select_item([this, obj_item](){ return add_settings_item(obj_item, &get_item_config(obj_item).get()); });
}

View File

@ -2043,7 +2043,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"bed_shape", "bed_custom_texture", "bed_custom_model", "complete_objects", "duplicate_distance", "extruder_clearance_radius", "skirts", "skirt_distance",
"brim_width", "brim_separation", "brim_type", "variable_layer_height", "nozzle_diameter", "single_extruder_multi_material",
"wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extruder",
"extruder_colour", "filament_colour", "material_colour", "max_print_height", "printer_model", "printer_technology",
"extruder_colour", "filament_colour", "material_colour", "max_print_height", "printer_model", "printer_notes", "printer_technology",
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
"layer_height", "first_layer_height", "min_layer_height", "max_layer_height",
"brim_width", "perimeters", "perimeter_extruder", "fill_density", "infill_extruder", "top_solid_layers",
@ -6409,9 +6409,11 @@ void Plater::export_gcode(bool prefer_removable)
start_dir,
from_path(default_output_file.filename()),
#if ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1),
printer_technology() == ptFFF ? GUI::file_wildcards(FT_GCODE) :
GUI::sla_wildcards(p->sla_print.printer_config().sla_archive_format.value.c_str()),
#else
GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1, ext),
printer_technology() == ptFFF ? GUI::file_wildcards(FT_GCODE, ext) :
GUI::sla_wildcards(p->sla_print.printer_config().sla_archive_format.value.c_str()),
#endif // ENABLE_ALTERNATIVE_FILE_WILDCARDS_GENERATOR
wxFD_SAVE | wxFD_OVERWRITE_PROMPT
);

View File

@ -2267,6 +2267,14 @@ void TabFilament::msw_rescale()
Tab::msw_rescale();
}
void TabFilament::sys_color_changed()
{
m_extruders_cb->Clear();
update_extruder_combobox();
Tab::sys_color_changed();
}
void TabFilament::load_current_preset()
{
assert(m_active_extruder >= 0 && m_active_extruder < m_preset_bundle->extruders_filaments.size());

View File

@ -462,6 +462,7 @@ public:
void update() override;
void clear_pages() override;
void msw_rescale() override;
void sys_color_changed() override;
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptFFF; }
void load_current_preset() override;

View File

@ -3,7 +3,7 @@
set(SLIC3R_APP_NAME "PrusaSlicer")
set(SLIC3R_APP_KEY "PrusaSlicer")
set(SLIC3R_VERSION "2.6.0-beta4")
set(SLIC3R_VERSION "2.6.0-rc1")
set(SLIC3R_BUILD_ID "PrusaSlicer-${SLIC3R_VERSION}+UNKNOWN")
set(SLIC3R_RC_VERSION "2,6,0,0")
set(SLIC3R_RC_VERSION_DOTS "2.6.0.0")