mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
update to latest version
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "Plater.hpp"
|
||||
#include "slic3r/GUI/Jobs/UIThreadWorker.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
@@ -1803,6 +1804,8 @@ struct Plater::priv
|
||||
bool init_view_toolbar();
|
||||
bool init_collapse_toolbar();
|
||||
|
||||
void set_preview_layers_slider_values_range(int bottom, int top);
|
||||
|
||||
void update_preview_moves_slider();
|
||||
void enable_preview_moves_slider(bool enable);
|
||||
|
||||
@@ -2017,7 +2020,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",
|
||||
@@ -3438,7 +3441,7 @@ bool Plater::priv::restart_background_process(unsigned int state)
|
||||
void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_removable_media, PrintHostJob upload_job)
|
||||
{
|
||||
wxCHECK_RET(!(output_path.empty() && upload_job.empty()), "export_gcode: output_path and upload_job empty");
|
||||
|
||||
|
||||
if (model.objects.empty())
|
||||
return;
|
||||
|
||||
@@ -4114,11 +4117,42 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
||||
// Avoid a race condition
|
||||
return;
|
||||
}
|
||||
|
||||
// this->statusbar()->set_progress(evt.status.percent);
|
||||
// this->statusbar()->set_status_text(_(evt.status.text) + wxString::FromUTF8("…"));
|
||||
notification_manager->set_slicing_progress_percentage(evt.status.text, (float)evt.status.percent / 100.0f);
|
||||
}
|
||||
|
||||
// Check template filaments and add warning
|
||||
// This is more convinient to do here than in slicing backend, so it happens on "Slicing complete".
|
||||
if (evt.status.percent >= 100 && this->printer_technology == ptFFF) {
|
||||
size_t templ_cnt = 0;
|
||||
const auto& preset_bundle = wxGetApp().preset_bundle;
|
||||
std::string names;
|
||||
for (const auto& extruder_filaments : preset_bundle->extruders_filaments) {
|
||||
const Preset* preset = extruder_filaments.get_selected_preset();
|
||||
if (preset && preset->vendor && preset->vendor->templates_profile) {
|
||||
names += "\n" + preset->name;
|
||||
templ_cnt++;
|
||||
}
|
||||
}
|
||||
if (templ_cnt > 0) {
|
||||
const std::string message_notif = GUI::format("%1%\n%2%\n\n%3%\n\n%4% "
|
||||
, _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt)
|
||||
, names
|
||||
, _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.")
|
||||
,_u8L("More info at"));
|
||||
// warning dialog proccessing cuts text at first '/n' - pass the text without new lines (and without filament names).
|
||||
const std::string message_dial = GUI::format("%1% %2% %3%"
|
||||
, _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt)
|
||||
, _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.")
|
||||
, "<a href=https://help.prusa3d.com/article/template-filaments_467599>https://help.prusa3d.com/</a>"
|
||||
);
|
||||
BOOST_LOG_TRIVIAL(warning) << message_notif;
|
||||
notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0, "https://help.prusa3d.com/",
|
||||
[](wxEvtHandler* evnthndlr) { wxGetApp().open_browser_with_warning_dialog("https://help.prusa3d.com/article/template-filaments_467599"); return false; }
|
||||
);
|
||||
add_warning({ PrintStateBase::WarningLevel::CRITICAL, true, message_dial, 0}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (evt.status.flags & (PrintBase::SlicingStatus::RELOAD_SCENE | PrintBase::SlicingStatus::RELOAD_SLA_SUPPORT_POINTS)) {
|
||||
switch (this->printer_technology) {
|
||||
case ptFFF:
|
||||
@@ -4254,9 +4288,9 @@ bool Plater::priv::warnings_dialog()
|
||||
else
|
||||
text += it.first.message;
|
||||
}
|
||||
//text += "\n\nDo you still wish to export?";
|
||||
//wxMessageDialog msg_wingow(this->q, from_u8(text), wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), wxOK);
|
||||
MessageDialog msg_wingow(this->q, from_u8(text), wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), wxOK);
|
||||
//MessageDialog msg_wingow(this->q, from_u8(text), wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), wxOK);
|
||||
// Changed to InfoDialog so it can show hyperlinks
|
||||
InfoDialog msg_wingow(this->q, format_wxstr("%1% %2%", SLIC3R_APP_NAME, _L("generated warnings")), from_u8(text), true);
|
||||
const auto res = msg_wingow.ShowModal();
|
||||
return res == wxID_OK;
|
||||
|
||||
@@ -4667,6 +4701,11 @@ bool Plater::priv::init_collapse_toolbar()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Plater::priv::set_preview_layers_slider_values_range(int bottom, int top)
|
||||
{
|
||||
preview->set_layers_slider_values_range(bottom, top);
|
||||
}
|
||||
|
||||
void Plater::priv::update_preview_moves_slider()
|
||||
{
|
||||
preview->update_moves_slider();
|
||||
@@ -5328,8 +5367,9 @@ void Plater::import_zip_archive()
|
||||
if (input_file.empty())
|
||||
return;
|
||||
|
||||
fs::path path = into_path(input_file);
|
||||
preview_zip_archive(path);
|
||||
wxArrayString arr;
|
||||
arr.Add(input_file);
|
||||
load_files(arr, false);
|
||||
}
|
||||
|
||||
void Plater::import_sl1_archive()
|
||||
@@ -6125,7 +6165,7 @@ void Plater::increase_instances(size_t num, int obj_idx, int inst_idx)
|
||||
if (const auto obj_idxs = get_selection().get_object_idxs(); !obj_idxs.empty()) {
|
||||
// we need a copy made here because the selection changes at every call of increase_instances()
|
||||
const Selection::ObjectIdxsToInstanceIdxsMap content = p->get_selection().get_content();
|
||||
for (const size_t& obj_id : obj_idxs) {
|
||||
for (const unsigned int obj_id : obj_idxs) {
|
||||
if (auto obj_it = content.find(int(obj_id)); obj_it != content.end())
|
||||
increase_instances(1, int(obj_id), *obj_it->second.rbegin());
|
||||
}
|
||||
@@ -6346,7 +6386,9 @@ void Plater::cut(size_t obj_idx, const ModelObjectPtrs& new_objects)
|
||||
for (size_t i = 0; i < new_objects.size(); ++i)
|
||||
selection.add_object((unsigned int)(last_id - i), i == 0);
|
||||
|
||||
arrange();
|
||||
UIThreadWorker w;
|
||||
replace_job(w, std::make_unique<ArrangeJob>(ArrangeJob::SelectionOnly));
|
||||
w.process_events();
|
||||
}
|
||||
|
||||
void Plater::export_gcode(bool prefer_removable)
|
||||
@@ -6401,9 +6443,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
|
||||
);
|
||||
@@ -6501,7 +6545,7 @@ void Plater::export_stl_obj(bool extended, bool selection_only)
|
||||
|
||||
const SLAPrintObject *object = this->p->sla_print.get_print_object_by_model_object_id(mo.id());
|
||||
|
||||
if (auto m = object->get_mesh_to_print(); !m || m->empty())
|
||||
if (!object || !object->get_mesh_to_print() || object->get_mesh_to_print()->empty())
|
||||
mesh = mesh_to_export_fff(mo, instance_id);
|
||||
else {
|
||||
const Transform3d mesh_trafo_inv = object->trafo().inverse();
|
||||
@@ -6663,11 +6707,14 @@ bool Plater::export_3mf(const boost::filesystem::path& output_path)
|
||||
if (ret) {
|
||||
// Success
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("3MF file exported to %s"), path));
|
||||
BOOST_LOG_TRIVIAL(info) << "3MF file exported to " << path;
|
||||
p->set_project_filename(path);
|
||||
}
|
||||
else {
|
||||
// Failure
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("Error exporting 3MF file %s"), path));
|
||||
const wxString what = GUI::format_wxstr("%1%: %2%", _L("Unable to save file") , path_u8);
|
||||
show_error(this, what);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -7231,7 +7278,11 @@ void Plater::arrange()
|
||||
if (p->can_arrange()) {
|
||||
auto &w = get_ui_job_worker();
|
||||
p->take_snapshot(_L("Arrange"));
|
||||
replace_job(w, std::make_unique<ArrangeJob>());
|
||||
|
||||
auto mode = wxGetKeyState(WXK_SHIFT) ? ArrangeJob::SelectionOnly :
|
||||
ArrangeJob::Full;
|
||||
|
||||
replace_job(w, std::make_unique<ArrangeJob>(mode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7541,6 +7592,11 @@ GLToolbar& Plater::get_collapse_toolbar()
|
||||
return p->collapse_toolbar;
|
||||
}
|
||||
|
||||
void Plater::set_preview_layers_slider_values_range(int bottom, int top)
|
||||
{
|
||||
p->set_preview_layers_slider_values_range(bottom, top);
|
||||
}
|
||||
|
||||
void Plater::update_preview_moves_slider()
|
||||
{
|
||||
p->update_preview_moves_slider();
|
||||
@@ -7708,7 +7764,7 @@ PlaterAfterLoadAutoArrange::PlaterAfterLoadAutoArrange()
|
||||
Plater* plater = wxGetApp().plater();
|
||||
m_enabled = plater->model().objects.empty() &&
|
||||
plater->printer_technology() == ptFFF &&
|
||||
plater->fff_print().config().printer_model.value == "XL";
|
||||
is_XL_printer(plater->fff_print().config());
|
||||
}
|
||||
|
||||
PlaterAfterLoadAutoArrange::~PlaterAfterLoadAutoArrange()
|
||||
|
||||
Reference in New Issue
Block a user