WIP: Pad quick-menu
This commit is contained in:
parent
92e1649606
commit
b8bfe001c0
@ -556,14 +556,21 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
|
|||||||
Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT);
|
Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT);
|
||||||
if (!tab) return;
|
if (!tab) return;
|
||||||
|
|
||||||
if (opt_key == "pad_enable") {
|
DynamicPrintConfig new_conf = *config_sla;
|
||||||
tab->set_value(opt_key, value);
|
if (opt_key == "pad") {
|
||||||
tab->update();
|
const wxString& selection = boost::any_cast<wxString>(value);
|
||||||
|
|
||||||
|
const bool pad_enable = selection == _("None") ? false : true;
|
||||||
|
new_conf.set_key_value("pad_enable", new ConfigOptionBool(pad_enable));
|
||||||
|
|
||||||
|
if (selection == _("Below object"))
|
||||||
|
new_conf.set_key_value("pad_zero_elevation", new ConfigOptionBool(false));
|
||||||
|
else if (selection == _("Around object"))
|
||||||
|
new_conf.set_key_value("pad_zero_elevation", new ConfigOptionBool(true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(opt_key == "support");
|
assert(opt_key == "support");
|
||||||
DynamicPrintConfig new_conf = *config_sla;
|
|
||||||
const wxString& selection = boost::any_cast<wxString>(value);
|
const wxString& selection = boost::any_cast<wxString>(value);
|
||||||
|
|
||||||
const bool supports_enable = selection == _("None") ? false : true;
|
const bool supports_enable = selection == _("None") ? false : true;
|
||||||
@ -573,10 +580,9 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
|
|||||||
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false));
|
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false));
|
||||||
else if (selection == _("Support on build plate only"))
|
else if (selection == _("Support on build plate only"))
|
||||||
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true));
|
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true));
|
||||||
|
|
||||||
tab->load_config(new_conf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tab->load_config(new_conf);
|
||||||
tab->update_dirty();
|
tab->update_dirty();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -594,9 +600,19 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
|
|||||||
|
|
||||||
line = Line{ "", "" };
|
line = Line{ "", "" };
|
||||||
|
|
||||||
option = m_og_sla->get_option("pad_enable");
|
ConfigOptionDef pad_def;
|
||||||
option.opt.sidetext = " ";
|
pad_def.label = L("Pad");
|
||||||
|
pad_def.type = coStrings;
|
||||||
|
pad_def.gui_type = "select_open";
|
||||||
|
pad_def.tooltip = L("Select what kind of pad do you need");
|
||||||
|
pad_def.enum_labels.push_back(L("None"));
|
||||||
|
pad_def.enum_labels.push_back(L("Below object"));
|
||||||
|
pad_def.enum_labels.push_back(L("Around object"));
|
||||||
|
pad_def.set_default_value(new ConfigOptionStrings{ "Below object" });
|
||||||
|
option = Option(pad_def, "pad");
|
||||||
|
option.opt.full_width = true;
|
||||||
line.append_option(option);
|
line.append_option(option);
|
||||||
|
line.append_widget(empty_widget);
|
||||||
|
|
||||||
m_og_sla->append_line(line);
|
m_og_sla->append_line(line);
|
||||||
|
|
||||||
@ -842,7 +858,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||||||
p->plater->export_gcode();
|
p->plater->export_gcode();
|
||||||
else
|
else
|
||||||
p->plater->reslice();
|
p->plater->reslice();
|
||||||
p->plater->select_view_3D("Preview");
|
p->plater->select_view_3D("Preview");
|
||||||
});
|
});
|
||||||
p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); });
|
p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); });
|
||||||
}
|
}
|
||||||
@ -902,7 +918,7 @@ void Sidebar::update_all_preset_comboboxes()
|
|||||||
|
|
||||||
void Sidebar::update_presets(Preset::Type preset_type)
|
void Sidebar::update_presets(Preset::Type preset_type)
|
||||||
{
|
{
|
||||||
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
|
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
|
||||||
const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
|
const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
|
||||||
|
|
||||||
switch (preset_type) {
|
switch (preset_type) {
|
||||||
@ -926,23 +942,23 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Preset::TYPE_PRINT:
|
case Preset::TYPE_PRINT:
|
||||||
preset_bundle.prints.update_platter_ui(p->combo_print);
|
preset_bundle.prints.update_platter_ui(p->combo_print);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Preset::TYPE_SLA_PRINT:
|
case Preset::TYPE_SLA_PRINT:
|
||||||
preset_bundle.sla_prints.update_platter_ui(p->combo_sla_print);
|
preset_bundle.sla_prints.update_platter_ui(p->combo_sla_print);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Preset::TYPE_SLA_MATERIAL:
|
case Preset::TYPE_SLA_MATERIAL:
|
||||||
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
|
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Preset::TYPE_PRINTER:
|
case Preset::TYPE_PRINTER:
|
||||||
{
|
{
|
||||||
update_all_preset_comboboxes();
|
update_all_preset_comboboxes();
|
||||||
p->show_preset_comboboxes();
|
p->show_preset_comboboxes();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@ -960,7 +976,7 @@ void Sidebar::update_reslice_btn_tooltip() const
|
|||||||
{
|
{
|
||||||
wxString tooltip = wxString("Slice") + " [" + GUI::shortkey_ctrl_prefix() + "R]";
|
wxString tooltip = wxString("Slice") + " [" + GUI::shortkey_ctrl_prefix() + "R]";
|
||||||
if (m_mode != comSimple)
|
if (m_mode != comSimple)
|
||||||
tooltip += wxString("\n") + _(L("Hold Shift to Slice & Export G-code"));
|
tooltip += wxString("\n") + _(L("Hold Shift to Slice & Export G-code"));
|
||||||
p->btn_reslice->SetToolTip(tooltip);
|
p->btn_reslice->SetToolTip(tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1241,7 +1257,7 @@ std::vector<PresetComboBox*>& Sidebar::combos_filament()
|
|||||||
class PlaterDropTarget : public wxFileDropTarget
|
class PlaterDropTarget : public wxFileDropTarget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlaterDropTarget(Plater *plater) : plater(plater) { this->SetDefaultAction(wxDragCopy); }
|
PlaterDropTarget(Plater *plater) : plater(plater) { this->SetDefaultAction(wxDragCopy); }
|
||||||
|
|
||||||
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames);
|
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames);
|
||||||
|
|
||||||
@ -1265,22 +1281,22 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString snapshot_label;
|
wxString snapshot_label;
|
||||||
assert(! paths.empty());
|
assert(! paths.empty());
|
||||||
if (paths.size() == 1) {
|
if (paths.size() == 1) {
|
||||||
snapshot_label = _(L("Load File"));
|
snapshot_label = _(L("Load File"));
|
||||||
snapshot_label += ": ";
|
snapshot_label += ": ";
|
||||||
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
||||||
} else {
|
} else {
|
||||||
snapshot_label = _(L("Load Files"));
|
snapshot_label = _(L("Load Files"));
|
||||||
snapshot_label += ": ";
|
snapshot_label += ": ";
|
||||||
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
||||||
for (size_t i = 1; i < paths.size(); ++ i) {
|
for (size_t i = 1; i < paths.size(); ++ i) {
|
||||||
snapshot_label += ", ";
|
snapshot_label += ", ";
|
||||||
snapshot_label += wxString::FromUTF8(paths[i].filename().string().c_str());
|
snapshot_label += wxString::FromUTF8(paths[i].filename().string().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Plater::TakeSnapshot snapshot(plater, snapshot_label);
|
Plater::TakeSnapshot snapshot(plater, snapshot_label);
|
||||||
|
|
||||||
// FIXME: when drag and drop is done on a .3mf or a .amf file we should clear the plater for consistence with the open project command
|
// FIXME: when drag and drop is done on a .3mf or a .amf file we should clear the plater for consistence with the open project command
|
||||||
// (the following call to plater->load_files() will load the config data, if present)
|
// (the following call to plater->load_files() will load the config data, if present)
|
||||||
@ -1331,7 +1347,7 @@ struct Plater::priv
|
|||||||
// Data
|
// Data
|
||||||
Slic3r::DynamicPrintConfig *config; // FIXME: leak?
|
Slic3r::DynamicPrintConfig *config; // FIXME: leak?
|
||||||
Slic3r::Print fff_print;
|
Slic3r::Print fff_print;
|
||||||
Slic3r::SLAPrint sla_print;
|
Slic3r::SLAPrint sla_print;
|
||||||
Slic3r::Model model;
|
Slic3r::Model model;
|
||||||
PrinterTechnology printer_technology = ptFFF;
|
PrinterTechnology printer_technology = ptFFF;
|
||||||
Slic3r::GCodePreviewData gcode_preview_data;
|
Slic3r::GCodePreviewData gcode_preview_data;
|
||||||
@ -1786,8 +1802,8 @@ struct Plater::priv
|
|||||||
void enter_gizmos_stack();
|
void enter_gizmos_stack();
|
||||||
void leave_gizmos_stack();
|
void leave_gizmos_stack();
|
||||||
|
|
||||||
void take_snapshot(const std::string& snapshot_name);
|
void take_snapshot(const std::string& snapshot_name);
|
||||||
void take_snapshot(const wxString& snapshot_name) { this->take_snapshot(std::string(snapshot_name.ToUTF8().data())); }
|
void take_snapshot(const wxString& snapshot_name) { this->take_snapshot(std::string(snapshot_name.ToUTF8().data())); }
|
||||||
int get_active_snapshot_index();
|
int get_active_snapshot_index();
|
||||||
|
|
||||||
void undo();
|
void undo();
|
||||||
@ -1820,8 +1836,8 @@ struct Plater::priv
|
|||||||
unsigned int update_background_process(bool force_validation = false);
|
unsigned int update_background_process(bool force_validation = false);
|
||||||
// Restart background processing thread based on a bitmask of UpdateBackgroundProcessReturnState.
|
// Restart background processing thread based on a bitmask of UpdateBackgroundProcessReturnState.
|
||||||
bool restart_background_process(unsigned int state);
|
bool restart_background_process(unsigned int state);
|
||||||
// returns bit mask of UpdateBackgroundProcessReturnState
|
// returns bit mask of UpdateBackgroundProcessReturnState
|
||||||
unsigned int update_restart_background_process(bool force_scene_update, bool force_preview_update);
|
unsigned int update_restart_background_process(bool force_scene_update, bool force_preview_update);
|
||||||
void export_gcode(fs::path output_path, PrintHostJob upload_job);
|
void export_gcode(fs::path output_path, PrintHostJob upload_job);
|
||||||
void reload_from_disk();
|
void reload_from_disk();
|
||||||
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
|
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
|
||||||
@ -1887,7 +1903,7 @@ private:
|
|||||||
|
|
||||||
void update_fff_scene();
|
void update_fff_scene();
|
||||||
void update_sla_scene();
|
void update_sla_scene();
|
||||||
void undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator it_snapshot);
|
void undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator it_snapshot);
|
||||||
void update_after_undo_redo(bool temp_snapshot_was_taken = false);
|
void update_after_undo_redo(bool temp_snapshot_was_taken = false);
|
||||||
|
|
||||||
// path to project file stored with no extension
|
// path to project file stored with no extension
|
||||||
@ -1929,14 +1945,14 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
, view_toolbar(GLToolbar::Radio, "View")
|
, view_toolbar(GLToolbar::Radio, "View")
|
||||||
, m_project_filename(wxEmptyString)
|
, m_project_filename(wxEmptyString)
|
||||||
{
|
{
|
||||||
this->q->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
this->q->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
|
|
||||||
background_process.set_fff_print(&fff_print);
|
background_process.set_fff_print(&fff_print);
|
||||||
background_process.set_sla_print(&sla_print);
|
background_process.set_sla_print(&sla_print);
|
||||||
background_process.set_gcode_preview_data(&gcode_preview_data);
|
background_process.set_gcode_preview_data(&gcode_preview_data);
|
||||||
background_process.set_slicing_completed_event(EVT_SLICING_COMPLETED);
|
background_process.set_slicing_completed_event(EVT_SLICING_COMPLETED);
|
||||||
background_process.set_finished_event(EVT_PROCESS_COMPLETED);
|
background_process.set_finished_event(EVT_PROCESS_COMPLETED);
|
||||||
// Default printer technology for default config.
|
// Default printer technology for default config.
|
||||||
background_process.select_technology(this->printer_technology);
|
background_process.select_technology(this->printer_technology);
|
||||||
// Register progress callback from the Print class to the Platter.
|
// Register progress callback from the Print class to the Platter.
|
||||||
|
|
||||||
@ -2053,7 +2069,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
camera.set_type(get_config("use_perspective_camera"));
|
camera.set_type(get_config("use_perspective_camera"));
|
||||||
|
|
||||||
// Initialize the Undo / Redo stack with a first snapshot.
|
// Initialize the Undo / Redo stack with a first snapshot.
|
||||||
this->take_snapshot(_(L("New Project")));
|
this->take_snapshot(_(L("New Project")));
|
||||||
}
|
}
|
||||||
|
|
||||||
Plater::priv::~priv()
|
Plater::priv::~priv()
|
||||||
@ -2080,7 +2096,7 @@ void Plater::priv::update(bool force_full_scene_refresh, bool force_background_p
|
|||||||
// pulls the correct data.
|
// pulls the correct data.
|
||||||
update_status = this->update_background_process(false);
|
update_status = this->update_background_process(false);
|
||||||
this->view3D->reload_scene(false, force_full_scene_refresh);
|
this->view3D->reload_scene(false, force_full_scene_refresh);
|
||||||
this->preview->reload_print();
|
this->preview->reload_print();
|
||||||
if (this->printer_technology == ptSLA)
|
if (this->printer_technology == ptSLA)
|
||||||
this->restart_background_process(update_status);
|
this->restart_background_process(update_status);
|
||||||
else
|
else
|
||||||
@ -2198,7 +2214,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||||||
model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, false);
|
model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, false);
|
||||||
if (load_config && !config_loaded.empty()) {
|
if (load_config && !config_loaded.empty()) {
|
||||||
// Based on the printer technology field found in the loaded config, select the base for the config,
|
// Based on the printer technology field found in the loaded config, select the base for the config,
|
||||||
PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
|
PrinterTechnology printer_technology = Preset::printer_technology(config_loaded);
|
||||||
|
|
||||||
// We can't to load SLA project if there is at least one multi-part object on the bed
|
// We can't to load SLA project if there is at least one multi-part object on the bed
|
||||||
if (printer_technology == ptSLA)
|
if (printer_technology == ptSLA)
|
||||||
@ -2215,7 +2231,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.apply(printer_technology == ptFFF ?
|
config.apply(printer_technology == ptFFF ?
|
||||||
static_cast<const ConfigBase&>(FullPrintConfig::defaults()) :
|
static_cast<const ConfigBase&>(FullPrintConfig::defaults()) :
|
||||||
static_cast<const ConfigBase&>(SLAFullPrintConfig::defaults()));
|
static_cast<const ConfigBase&>(SLAFullPrintConfig::defaults()));
|
||||||
// and place the loaded config over the base.
|
// and place the loaded config over the base.
|
||||||
@ -2379,7 +2395,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||||||
if (max_ratio > 10000) {
|
if (max_ratio > 10000) {
|
||||||
// the size of the object is too big -> this could lead to overflow when moving to clipper coordinates,
|
// the size of the object is too big -> this could lead to overflow when moving to clipper coordinates,
|
||||||
// so scale down the mesh
|
// so scale down the mesh
|
||||||
double inv = 1. / max_ratio;
|
double inv = 1. / max_ratio;
|
||||||
object->scale_mesh_after_creation(Vec3d(inv, inv, inv));
|
object->scale_mesh_after_creation(Vec3d(inv, inv, inv));
|
||||||
object->origin_translation = Vec3d::Zero();
|
object->origin_translation = Vec3d::Zero();
|
||||||
object->center_around_origin();
|
object->center_around_origin();
|
||||||
@ -2589,10 +2605,10 @@ void Plater::priv::remove(size_t obj_idx)
|
|||||||
|
|
||||||
void Plater::priv::delete_object_from_model(size_t obj_idx)
|
void Plater::priv::delete_object_from_model(size_t obj_idx)
|
||||||
{
|
{
|
||||||
wxString snapshot_label = _(L("Delete Object"));
|
wxString snapshot_label = _(L("Delete Object"));
|
||||||
if (! model.objects[obj_idx]->name.empty())
|
if (! model.objects[obj_idx]->name.empty())
|
||||||
snapshot_label += ": " + wxString::FromUTF8(model.objects[obj_idx]->name.c_str());
|
snapshot_label += ": " + wxString::FromUTF8(model.objects[obj_idx]->name.c_str());
|
||||||
Plater::TakeSnapshot snapshot(q, snapshot_label);
|
Plater::TakeSnapshot snapshot(q, snapshot_label);
|
||||||
model.delete_object(obj_idx);
|
model.delete_object(obj_idx);
|
||||||
update();
|
update();
|
||||||
object_list_changed();
|
object_list_changed();
|
||||||
@ -2600,7 +2616,7 @@ void Plater::priv::delete_object_from_model(size_t obj_idx)
|
|||||||
|
|
||||||
void Plater::priv::reset()
|
void Plater::priv::reset()
|
||||||
{
|
{
|
||||||
Plater::TakeSnapshot snapshot(q, _(L("Reset Project")));
|
Plater::TakeSnapshot snapshot(q, _(L("Reset Project")));
|
||||||
|
|
||||||
set_project_filename(wxEmptyString);
|
set_project_filename(wxEmptyString);
|
||||||
|
|
||||||
@ -2793,7 +2809,7 @@ void Plater::priv::split_object()
|
|||||||
Slic3r::GUI::warning_catcher(q, _(L("The selected object couldn't be split because it contains only one part.")));
|
Slic3r::GUI::warning_catcher(q, _(L("The selected object couldn't be split because it contains only one part.")));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Plater::TakeSnapshot snapshot(q, _(L("Split to Objects")));
|
Plater::TakeSnapshot snapshot(q, _(L("Split to Objects")));
|
||||||
|
|
||||||
unsigned int counter = 1;
|
unsigned int counter = 1;
|
||||||
for (ModelObject* m : new_objects)
|
for (ModelObject* m : new_objects)
|
||||||
@ -2869,21 +2885,21 @@ unsigned int Plater::priv::update_background_process(bool force_validation)
|
|||||||
this->sidebar->show_sliced_info_sizer(false);
|
this->sidebar->show_sliced_info_sizer(false);
|
||||||
// Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
|
// Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
|
||||||
// Otherwise they will be just refreshed.
|
// Otherwise they will be just refreshed.
|
||||||
if (this->preview != nullptr)
|
if (this->preview != nullptr)
|
||||||
// If the preview is not visible, the following line just invalidates the preview,
|
// If the preview is not visible, the following line just invalidates the preview,
|
||||||
// but the G-code paths or SLA preview are calculated first once the preview is made visible.
|
// but the G-code paths or SLA preview are calculated first once the preview is made visible.
|
||||||
this->preview->reload_print();
|
this->preview->reload_print();
|
||||||
// In FDM mode, we need to reload the 3D scene because of the wipe tower preview box.
|
// In FDM mode, we need to reload the 3D scene because of the wipe tower preview box.
|
||||||
// In SLA mode, we need to reload the 3D scene every time to show the support structures.
|
// In SLA mode, we need to reload the 3D scene every time to show the support structures.
|
||||||
if (this->printer_technology == ptSLA || (this->printer_technology == ptFFF && this->config->opt_bool("wipe_tower")))
|
if (this->printer_technology == ptSLA || (this->printer_technology == ptFFF && this->config->opt_bool("wipe_tower")))
|
||||||
return_state |= UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE;
|
return_state |= UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((invalidated != Print::APPLY_STATUS_UNCHANGED || force_validation) && ! this->background_process.empty()) {
|
if ((invalidated != Print::APPLY_STATUS_UNCHANGED || force_validation) && ! this->background_process.empty()) {
|
||||||
// The state of the Print changed, and it is non-zero. Let's validate it and give the user feedback on errors.
|
// The state of the Print changed, and it is non-zero. Let's validate it and give the user feedback on errors.
|
||||||
std::string err = this->background_process.validate();
|
std::string err = this->background_process.validate();
|
||||||
if (err.empty()) {
|
if (err.empty()) {
|
||||||
if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->background_processing_enabled())
|
if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->background_processing_enabled())
|
||||||
return_state |= UPDATE_BACKGROUND_PROCESS_RESTART;
|
return_state |= UPDATE_BACKGROUND_PROCESS_RESTART;
|
||||||
} else {
|
} else {
|
||||||
// The print is not valid.
|
// The print is not valid.
|
||||||
@ -2905,12 +2921,12 @@ unsigned int Plater::priv::update_background_process(bool force_validation)
|
|||||||
|
|
||||||
if (invalidated != Print::APPLY_STATUS_UNCHANGED && was_running && ! this->background_process.running() &&
|
if (invalidated != Print::APPLY_STATUS_UNCHANGED && was_running && ! this->background_process.running() &&
|
||||||
(return_state & UPDATE_BACKGROUND_PROCESS_RESTART) == 0) {
|
(return_state & UPDATE_BACKGROUND_PROCESS_RESTART) == 0) {
|
||||||
// The background processing was killed and it will not be restarted.
|
// The background processing was killed and it will not be restarted.
|
||||||
wxCommandEvent evt(EVT_PROCESS_COMPLETED);
|
wxCommandEvent evt(EVT_PROCESS_COMPLETED);
|
||||||
evt.SetInt(-1);
|
evt.SetInt(-1);
|
||||||
// Post the "canceled" callback message, so that it will be processed after any possible pending status bar update messages.
|
// Post the "canceled" callback message, so that it will be processed after any possible pending status bar update messages.
|
||||||
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, evt.Clone());
|
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, evt.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((return_state & UPDATE_BACKGROUND_PROCESS_INVALID) != 0)
|
if ((return_state & UPDATE_BACKGROUND_PROCESS_INVALID) != 0)
|
||||||
{
|
{
|
||||||
@ -2954,9 +2970,9 @@ bool Plater::priv::restart_background_process(unsigned int state)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! this->background_process.empty() &&
|
if ( ! this->background_process.empty() &&
|
||||||
(state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) == 0 &&
|
(state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) == 0 &&
|
||||||
( ((state & UPDATE_BACKGROUND_PROCESS_FORCE_RESTART) != 0 && ! this->background_process.finished()) ||
|
( ((state & UPDATE_BACKGROUND_PROCESS_FORCE_RESTART) != 0 && ! this->background_process.finished()) ||
|
||||||
(state & UPDATE_BACKGROUND_PROCESS_FORCE_EXPORT) != 0 ||
|
(state & UPDATE_BACKGROUND_PROCESS_FORCE_EXPORT) != 0 ||
|
||||||
(state & UPDATE_BACKGROUND_PROCESS_RESTART) != 0 ) ) {
|
(state & UPDATE_BACKGROUND_PROCESS_RESTART) != 0 ) ) {
|
||||||
// The print is valid and it can be started.
|
// The print is valid and it can be started.
|
||||||
@ -3012,7 +3028,7 @@ unsigned int Plater::priv::update_restart_background_process(bool force_update_s
|
|||||||
if (force_update_preview)
|
if (force_update_preview)
|
||||||
this->preview->reload_print();
|
this->preview->reload_print();
|
||||||
this->restart_background_process(state);
|
this->restart_background_process(state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::update_fff_scene()
|
void Plater::priv::update_fff_scene()
|
||||||
@ -3020,7 +3036,7 @@ void Plater::priv::update_fff_scene()
|
|||||||
if (this->preview != nullptr)
|
if (this->preview != nullptr)
|
||||||
this->preview->reload_print();
|
this->preview->reload_print();
|
||||||
// In case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth:
|
// In case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth:
|
||||||
view3D->reload_scene(true);
|
view3D->reload_scene(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::update_sla_scene()
|
void Plater::priv::update_sla_scene()
|
||||||
@ -3033,7 +3049,7 @@ void Plater::priv::update_sla_scene()
|
|||||||
|
|
||||||
void Plater::priv::reload_from_disk()
|
void Plater::priv::reload_from_disk()
|
||||||
{
|
{
|
||||||
Plater::TakeSnapshot snapshot(q, _(L("Reload from Disk")));
|
Plater::TakeSnapshot snapshot(q, _(L("Reload from Disk")));
|
||||||
|
|
||||||
const auto &selection = get_selection();
|
const auto &selection = get_selection();
|
||||||
const auto obj_orig_idx = selection.get_object_idx();
|
const auto obj_orig_idx = selection.get_object_idx();
|
||||||
@ -3069,7 +3085,7 @@ void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* =
|
|||||||
if (obj_idx < 0)
|
if (obj_idx < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(q, _(L("Fix Throught NetFabb")));
|
Plater::TakeSnapshot snapshot(q, _(L("Fix Throught NetFabb")));
|
||||||
|
|
||||||
fix_model_by_win10_sdk_gui(*model.objects[obj_idx], vol_idx);
|
fix_model_by_win10_sdk_gui(*model.objects[obj_idx], vol_idx);
|
||||||
this->update();
|
this->update();
|
||||||
@ -3243,7 +3259,7 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
|
|||||||
this->statusbar()->stop_busy();
|
this->statusbar()->stop_busy();
|
||||||
|
|
||||||
const bool canceled = evt.GetInt() < 0;
|
const bool canceled = evt.GetInt() < 0;
|
||||||
const bool error = evt.GetInt() == 0;
|
const bool error = evt.GetInt() == 0;
|
||||||
const bool success = evt.GetInt() > 0;
|
const bool success = evt.GetInt() > 0;
|
||||||
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
|
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
|
||||||
this->background_process.reset_export();
|
this->background_process.reset_export();
|
||||||
@ -3255,8 +3271,8 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
|
|||||||
show_error(q, message);
|
show_error(q, message);
|
||||||
this->statusbar()->set_status_text(message);
|
this->statusbar()->set_status_text(message);
|
||||||
}
|
}
|
||||||
if (canceled)
|
if (canceled)
|
||||||
this->statusbar()->set_status_text(_(L("Cancelled")));
|
this->statusbar()->set_status_text(_(L("Cancelled")));
|
||||||
|
|
||||||
this->sidebar->show_sliced_info_sizer(success);
|
this->sidebar->show_sliced_info_sizer(success);
|
||||||
|
|
||||||
@ -3719,39 +3735,39 @@ void Plater::priv::show_action_buttons(const bool is_ready_to_slice) const
|
|||||||
if (wxGetApp().app_config->get("background_processing") == "1")
|
if (wxGetApp().app_config->get("background_processing") == "1")
|
||||||
{
|
{
|
||||||
if (sidebar->show_reslice(false) |
|
if (sidebar->show_reslice(false) |
|
||||||
sidebar->show_export(true) |
|
sidebar->show_export(true) |
|
||||||
sidebar->show_send(send_gcode_shown))
|
sidebar->show_send(send_gcode_shown))
|
||||||
sidebar->Layout();
|
sidebar->Layout();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sidebar->show_reslice(is_ready_to_slice) |
|
if (sidebar->show_reslice(is_ready_to_slice) |
|
||||||
sidebar->show_export(!is_ready_to_slice) |
|
sidebar->show_export(!is_ready_to_slice) |
|
||||||
sidebar->show_send(send_gcode_shown && !is_ready_to_slice))
|
sidebar->show_send(send_gcode_shown && !is_ready_to_slice))
|
||||||
sidebar->Layout();
|
sidebar->Layout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::enter_gizmos_stack()
|
void Plater::priv::enter_gizmos_stack()
|
||||||
{
|
{
|
||||||
assert(m_undo_redo_stack_active == &m_undo_redo_stack_main);
|
assert(m_undo_redo_stack_active == &m_undo_redo_stack_main);
|
||||||
if (m_undo_redo_stack_active == &m_undo_redo_stack_main) {
|
if (m_undo_redo_stack_active == &m_undo_redo_stack_main) {
|
||||||
m_undo_redo_stack_active = &m_undo_redo_stack_gizmos;
|
m_undo_redo_stack_active = &m_undo_redo_stack_gizmos;
|
||||||
assert(m_undo_redo_stack_active->empty());
|
assert(m_undo_redo_stack_active->empty());
|
||||||
// Take the initial snapshot of the gizmos.
|
// Take the initial snapshot of the gizmos.
|
||||||
// Not localized on purpose, the text will never be shown to the user.
|
// Not localized on purpose, the text will never be shown to the user.
|
||||||
this->take_snapshot(std::string("Gizmos-Initial"));
|
this->take_snapshot(std::string("Gizmos-Initial"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::leave_gizmos_stack()
|
void Plater::priv::leave_gizmos_stack()
|
||||||
{
|
{
|
||||||
assert(m_undo_redo_stack_active == &m_undo_redo_stack_gizmos);
|
assert(m_undo_redo_stack_active == &m_undo_redo_stack_gizmos);
|
||||||
if (m_undo_redo_stack_active == &m_undo_redo_stack_gizmos) {
|
if (m_undo_redo_stack_active == &m_undo_redo_stack_gizmos) {
|
||||||
assert(! m_undo_redo_stack_active->empty());
|
assert(! m_undo_redo_stack_active->empty());
|
||||||
m_undo_redo_stack_active->clear();
|
m_undo_redo_stack_active->clear();
|
||||||
m_undo_redo_stack_active = &m_undo_redo_stack_main;
|
m_undo_redo_stack_active = &m_undo_redo_stack_main;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Plater::priv::get_active_snapshot_index()
|
int Plater::priv::get_active_snapshot_index()
|
||||||
@ -3770,7 +3786,7 @@ void Plater::priv::take_snapshot(const std::string& snapshot_name)
|
|||||||
UndoRedo::SnapshotData snapshot_data;
|
UndoRedo::SnapshotData snapshot_data;
|
||||||
snapshot_data.printer_technology = this->printer_technology;
|
snapshot_data.printer_technology = this->printer_technology;
|
||||||
if (this->view3D->is_layers_editing_enabled())
|
if (this->view3D->is_layers_editing_enabled())
|
||||||
snapshot_data.flags |= UndoRedo::SnapshotData::VARIABLE_LAYER_EDITING_ACTIVE;
|
snapshot_data.flags |= UndoRedo::SnapshotData::VARIABLE_LAYER_EDITING_ACTIVE;
|
||||||
if (this->sidebar->obj_list()->is_selected(itSettings)) {
|
if (this->sidebar->obj_list()->is_selected(itSettings)) {
|
||||||
snapshot_data.flags |= UndoRedo::SnapshotData::SELECTED_SETTINGS_ON_SIDEBAR;
|
snapshot_data.flags |= UndoRedo::SnapshotData::SELECTED_SETTINGS_ON_SIDEBAR;
|
||||||
snapshot_data.layer_range_idx = this->sidebar->obj_list()->get_selected_layers_range_idx();
|
snapshot_data.layer_range_idx = this->sidebar->obj_list()->get_selected_layers_range_idx();
|
||||||
@ -3792,46 +3808,46 @@ void Plater::priv::take_snapshot(const std::string& snapshot_name)
|
|||||||
this->undo_redo_stack().release_least_recently_used();
|
this->undo_redo_stack().release_least_recently_used();
|
||||||
// Save the last active preset name of a particular printer technology.
|
// Save the last active preset name of a particular printer technology.
|
||||||
((this->printer_technology == ptFFF) ? m_last_fff_printer_profile_name : m_last_sla_printer_profile_name) = wxGetApp().preset_bundle->printers.get_selected_preset_name();
|
((this->printer_technology == ptFFF) ? m_last_fff_printer_profile_name : m_last_sla_printer_profile_name) = wxGetApp().preset_bundle->printers.get_selected_preset_name();
|
||||||
BOOST_LOG_TRIVIAL(info) << "Undo / Redo snapshot taken: " << snapshot_name << ", Undo / Redo stack memory: " << Slic3r::format_memsize_MB(this->undo_redo_stack().memsize()) << log_memory_info();
|
BOOST_LOG_TRIVIAL(info) << "Undo / Redo snapshot taken: " << snapshot_name << ", Undo / Redo stack memory: " << Slic3r::format_memsize_MB(this->undo_redo_stack().memsize()) << log_memory_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::undo()
|
void Plater::priv::undo()
|
||||||
{
|
{
|
||||||
const std::vector<UndoRedo::Snapshot> &snapshots = this->undo_redo_stack().snapshots();
|
const std::vector<UndoRedo::Snapshot> &snapshots = this->undo_redo_stack().snapshots();
|
||||||
auto it_current = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(this->undo_redo_stack().active_snapshot_time()));
|
auto it_current = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(this->undo_redo_stack().active_snapshot_time()));
|
||||||
if (-- it_current != snapshots.begin())
|
if (-- it_current != snapshots.begin())
|
||||||
this->undo_redo_to(it_current);
|
this->undo_redo_to(it_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::redo()
|
void Plater::priv::redo()
|
||||||
{
|
{
|
||||||
const std::vector<UndoRedo::Snapshot> &snapshots = this->undo_redo_stack().snapshots();
|
const std::vector<UndoRedo::Snapshot> &snapshots = this->undo_redo_stack().snapshots();
|
||||||
auto it_current = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(this->undo_redo_stack().active_snapshot_time()));
|
auto it_current = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(this->undo_redo_stack().active_snapshot_time()));
|
||||||
if (++ it_current != snapshots.end())
|
if (++ it_current != snapshots.end())
|
||||||
this->undo_redo_to(it_current);
|
this->undo_redo_to(it_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::undo_redo_to(size_t time_to_load)
|
void Plater::priv::undo_redo_to(size_t time_to_load)
|
||||||
{
|
{
|
||||||
const std::vector<UndoRedo::Snapshot> &snapshots = this->undo_redo_stack().snapshots();
|
const std::vector<UndoRedo::Snapshot> &snapshots = this->undo_redo_stack().snapshots();
|
||||||
auto it_current = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(time_to_load));
|
auto it_current = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(time_to_load));
|
||||||
assert(it_current != snapshots.end());
|
assert(it_current != snapshots.end());
|
||||||
this->undo_redo_to(it_current);
|
this->undo_redo_to(it_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator it_snapshot)
|
void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator it_snapshot)
|
||||||
{
|
{
|
||||||
bool temp_snapshot_was_taken = this->undo_redo_stack().temp_snapshot_active();
|
bool temp_snapshot_was_taken = this->undo_redo_stack().temp_snapshot_active();
|
||||||
PrinterTechnology new_printer_technology = it_snapshot->snapshot_data.printer_technology;
|
PrinterTechnology new_printer_technology = it_snapshot->snapshot_data.printer_technology;
|
||||||
bool printer_technology_changed = this->printer_technology != new_printer_technology;
|
bool printer_technology_changed = this->printer_technology != new_printer_technology;
|
||||||
if (printer_technology_changed) {
|
if (printer_technology_changed) {
|
||||||
// Switching the printer technology when jumping forwards / backwards in time. Switch to the last active printer profile of the other type.
|
// Switching the printer technology when jumping forwards / backwards in time. Switch to the last active printer profile of the other type.
|
||||||
std::string s_pt = (it_snapshot->snapshot_data.printer_technology == ptFFF) ? "FFF" : "SLA";
|
std::string s_pt = (it_snapshot->snapshot_data.printer_technology == ptFFF) ? "FFF" : "SLA";
|
||||||
if (! wxGetApp().check_unsaved_changes(from_u8((boost::format(_utf8(
|
if (! wxGetApp().check_unsaved_changes(from_u8((boost::format(_utf8(
|
||||||
L("%1% printer was active at the time the target Undo / Redo snapshot was taken. Switching to %1% printer requires reloading of %1% presets."))) % s_pt).str())))
|
L("%1% printer was active at the time the target Undo / Redo snapshot was taken. Switching to %1% printer requires reloading of %1% presets."))) % s_pt).str())))
|
||||||
// Don't switch the profiles.
|
// Don't switch the profiles.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Save the last active preset name of a particular printer technology.
|
// Save the last active preset name of a particular printer technology.
|
||||||
((this->printer_technology == ptFFF) ? m_last_fff_printer_profile_name : m_last_sla_printer_profile_name) = wxGetApp().preset_bundle->printers.get_selected_preset_name();
|
((this->printer_technology == ptFFF) ? m_last_fff_printer_profile_name : m_last_sla_printer_profile_name) = wxGetApp().preset_bundle->printers.get_selected_preset_name();
|
||||||
//FIXME updating the Wipe tower config values at the ModelWipeTower from the Print config.
|
//FIXME updating the Wipe tower config values at the ModelWipeTower from the Print config.
|
||||||
@ -3844,12 +3860,12 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
|
|||||||
const int layer_range_idx = it_snapshot->snapshot_data.layer_range_idx;
|
const int layer_range_idx = it_snapshot->snapshot_data.layer_range_idx;
|
||||||
// Flags made of Snapshot::Flags enum values.
|
// Flags made of Snapshot::Flags enum values.
|
||||||
unsigned int new_flags = it_snapshot->snapshot_data.flags;
|
unsigned int new_flags = it_snapshot->snapshot_data.flags;
|
||||||
UndoRedo::SnapshotData top_snapshot_data;
|
UndoRedo::SnapshotData top_snapshot_data;
|
||||||
top_snapshot_data.printer_technology = this->printer_technology;
|
top_snapshot_data.printer_technology = this->printer_technology;
|
||||||
if (this->view3D->is_layers_editing_enabled())
|
if (this->view3D->is_layers_editing_enabled())
|
||||||
top_snapshot_data.flags |= UndoRedo::SnapshotData::VARIABLE_LAYER_EDITING_ACTIVE;
|
top_snapshot_data.flags |= UndoRedo::SnapshotData::VARIABLE_LAYER_EDITING_ACTIVE;
|
||||||
if (this->sidebar->obj_list()->is_selected(itSettings)) {
|
if (this->sidebar->obj_list()->is_selected(itSettings)) {
|
||||||
top_snapshot_data.flags |= UndoRedo::SnapshotData::SELECTED_SETTINGS_ON_SIDEBAR;
|
top_snapshot_data.flags |= UndoRedo::SnapshotData::SELECTED_SETTINGS_ON_SIDEBAR;
|
||||||
top_snapshot_data.layer_range_idx = this->sidebar->obj_list()->get_selected_layers_range_idx();
|
top_snapshot_data.layer_range_idx = this->sidebar->obj_list()->get_selected_layers_range_idx();
|
||||||
}
|
}
|
||||||
else if (this->sidebar->obj_list()->is_selected(itLayer)) {
|
else if (this->sidebar->obj_list()->is_selected(itLayer)) {
|
||||||
@ -3858,26 +3874,26 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
|
|||||||
}
|
}
|
||||||
else if (this->sidebar->obj_list()->is_selected(itLayerRoot))
|
else if (this->sidebar->obj_list()->is_selected(itLayerRoot))
|
||||||
top_snapshot_data.flags |= UndoRedo::SnapshotData::SELECTED_LAYERROOT_ON_SIDEBAR;
|
top_snapshot_data.flags |= UndoRedo::SnapshotData::SELECTED_LAYERROOT_ON_SIDEBAR;
|
||||||
bool new_variable_layer_editing_active = (new_flags & UndoRedo::SnapshotData::VARIABLE_LAYER_EDITING_ACTIVE) != 0;
|
bool new_variable_layer_editing_active = (new_flags & UndoRedo::SnapshotData::VARIABLE_LAYER_EDITING_ACTIVE) != 0;
|
||||||
bool new_selected_settings_on_sidebar = (new_flags & UndoRedo::SnapshotData::SELECTED_SETTINGS_ON_SIDEBAR) != 0;
|
bool new_selected_settings_on_sidebar = (new_flags & UndoRedo::SnapshotData::SELECTED_SETTINGS_ON_SIDEBAR) != 0;
|
||||||
bool new_selected_layer_on_sidebar = (new_flags & UndoRedo::SnapshotData::SELECTED_LAYER_ON_SIDEBAR) != 0;
|
bool new_selected_layer_on_sidebar = (new_flags & UndoRedo::SnapshotData::SELECTED_LAYER_ON_SIDEBAR) != 0;
|
||||||
bool new_selected_layerroot_on_sidebar = (new_flags & UndoRedo::SnapshotData::SELECTED_LAYERROOT_ON_SIDEBAR) != 0;
|
bool new_selected_layerroot_on_sidebar = (new_flags & UndoRedo::SnapshotData::SELECTED_LAYERROOT_ON_SIDEBAR) != 0;
|
||||||
|
|
||||||
// Disable layer editing before the Undo / Redo jump.
|
// Disable layer editing before the Undo / Redo jump.
|
||||||
if (!new_variable_layer_editing_active && view3D->is_layers_editing_enabled())
|
if (!new_variable_layer_editing_active && view3D->is_layers_editing_enabled())
|
||||||
view3D->get_canvas3d()->force_main_toolbar_left_action(view3D->get_canvas3d()->get_main_toolbar_item_id("layersediting"));
|
view3D->get_canvas3d()->force_main_toolbar_left_action(view3D->get_canvas3d()->get_main_toolbar_item_id("layersediting"));
|
||||||
// Do the jump in time.
|
// Do the jump in time.
|
||||||
if (it_snapshot->timestamp < this->undo_redo_stack().active_snapshot_time() ?
|
if (it_snapshot->timestamp < this->undo_redo_stack().active_snapshot_time() ?
|
||||||
this->undo_redo_stack().undo(model, this->view3D->get_canvas3d()->get_selection(), this->view3D->get_canvas3d()->get_gizmos_manager(), top_snapshot_data, it_snapshot->timestamp) :
|
this->undo_redo_stack().undo(model, this->view3D->get_canvas3d()->get_selection(), this->view3D->get_canvas3d()->get_gizmos_manager(), top_snapshot_data, it_snapshot->timestamp) :
|
||||||
this->undo_redo_stack().redo(model, this->view3D->get_canvas3d()->get_gizmos_manager(), it_snapshot->timestamp)) {
|
this->undo_redo_stack().redo(model, this->view3D->get_canvas3d()->get_gizmos_manager(), it_snapshot->timestamp)) {
|
||||||
if (printer_technology_changed) {
|
if (printer_technology_changed) {
|
||||||
// Switch to the other printer technology. Switch to the last printer active for that particular technology.
|
// Switch to the other printer technology. Switch to the last printer active for that particular technology.
|
||||||
AppConfig *app_config = wxGetApp().app_config;
|
AppConfig *app_config = wxGetApp().app_config;
|
||||||
app_config->set("presets", "printer", (new_printer_technology == ptFFF) ? m_last_fff_printer_profile_name : m_last_sla_printer_profile_name);
|
app_config->set("presets", "printer", (new_printer_technology == ptFFF) ? m_last_fff_printer_profile_name : m_last_sla_printer_profile_name);
|
||||||
wxGetApp().preset_bundle->load_presets(*app_config);
|
wxGetApp().preset_bundle->load_presets(*app_config);
|
||||||
// Load the currently selected preset into the GUI, update the preset selection box.
|
// Load the currently selected preset into the GUI, update the preset selection box.
|
||||||
// This also switches the printer technology based on the printer technology of the active printer profile.
|
// This also switches the printer technology based on the printer technology of the active printer profile.
|
||||||
wxGetApp().load_current_presets();
|
wxGetApp().load_current_presets();
|
||||||
}
|
}
|
||||||
//FIXME updating the Print config from the Wipe tower config values at the ModelWipeTower.
|
//FIXME updating the Print config from the Wipe tower config values at the ModelWipeTower.
|
||||||
// This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config.
|
// This is a workaround until we refactor the Wipe Tower position / orientation to live solely inside the Model, not in the Print config.
|
||||||
@ -3904,37 +3920,37 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
|
|||||||
this->sidebar->obj_list()->set_selected_layers_range_idx(layer_range_idx);
|
this->sidebar->obj_list()->set_selected_layers_range_idx(layer_range_idx);
|
||||||
|
|
||||||
this->update_after_undo_redo(temp_snapshot_was_taken);
|
this->update_after_undo_redo(temp_snapshot_was_taken);
|
||||||
// Enable layer editing after the Undo / Redo jump.
|
// Enable layer editing after the Undo / Redo jump.
|
||||||
if (! view3D->is_layers_editing_enabled() && this->layers_height_allowed() && new_variable_layer_editing_active)
|
if (! view3D->is_layers_editing_enabled() && this->layers_height_allowed() && new_variable_layer_editing_active)
|
||||||
view3D->get_canvas3d()->force_main_toolbar_left_action(view3D->get_canvas3d()->get_main_toolbar_item_id("layersediting"));
|
view3D->get_canvas3d()->force_main_toolbar_left_action(view3D->get_canvas3d()->get_main_toolbar_item_id("layersediting"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::update_after_undo_redo(bool /* temp_snapshot_was_taken */)
|
void Plater::priv::update_after_undo_redo(bool /* temp_snapshot_was_taken */)
|
||||||
{
|
{
|
||||||
this->view3D->get_canvas3d()->get_selection().clear();
|
this->view3D->get_canvas3d()->get_selection().clear();
|
||||||
// Update volumes from the deserializd model, always stop / update the background processing (for both the SLA and FFF technologies).
|
// Update volumes from the deserializd model, always stop / update the background processing (for both the SLA and FFF technologies).
|
||||||
this->update(false, true);
|
this->update(false, true);
|
||||||
// Release old snapshots if the memory allocated is excessive. This may remove the top most snapshot if jumping to the very first snapshot.
|
// Release old snapshots if the memory allocated is excessive. This may remove the top most snapshot if jumping to the very first snapshot.
|
||||||
//if (temp_snapshot_was_taken)
|
//if (temp_snapshot_was_taken)
|
||||||
// Release the old snapshots always, as it may have happened, that some of the triangle meshes got deserialized from the snapshot, while some
|
// Release the old snapshots always, as it may have happened, that some of the triangle meshes got deserialized from the snapshot, while some
|
||||||
// triangle meshes may have gotten released from the scene or the background processing, therefore now being calculated into the Undo / Redo stack size.
|
// triangle meshes may have gotten released from the scene or the background processing, therefore now being calculated into the Undo / Redo stack size.
|
||||||
this->undo_redo_stack().release_least_recently_used();
|
this->undo_redo_stack().release_least_recently_used();
|
||||||
//YS_FIXME update obj_list from the deserialized model (maybe store ObjectIDs into the tree?) (no selections at this point of time)
|
//YS_FIXME update obj_list from the deserialized model (maybe store ObjectIDs into the tree?) (no selections at this point of time)
|
||||||
this->view3D->get_canvas3d()->get_selection().set_deserialized(GUI::Selection::EMode(this->undo_redo_stack().selection_deserialized().mode), this->undo_redo_stack().selection_deserialized().volumes_and_instances);
|
this->view3D->get_canvas3d()->get_selection().set_deserialized(GUI::Selection::EMode(this->undo_redo_stack().selection_deserialized().mode), this->undo_redo_stack().selection_deserialized().volumes_and_instances);
|
||||||
this->view3D->get_canvas3d()->get_gizmos_manager().update_after_undo_redo();
|
this->view3D->get_canvas3d()->get_gizmos_manager().update_after_undo_redo();
|
||||||
|
|
||||||
wxGetApp().obj_list()->update_after_undo_redo();
|
wxGetApp().obj_list()->update_after_undo_redo();
|
||||||
|
|
||||||
if (wxGetApp().get_mode() == comSimple && model_has_advanced_features(this->model)) {
|
if (wxGetApp().get_mode() == comSimple && model_has_advanced_features(this->model)) {
|
||||||
// If the user jumped to a snapshot that require user interface with advanced features, switch to the advanced mode without asking.
|
// If the user jumped to a snapshot that require user interface with advanced features, switch to the advanced mode without asking.
|
||||||
// There is a little risk of surprising the user, as he already must have had the advanced or expert mode active for such a snapshot to be taken.
|
// There is a little risk of surprising the user, as he already must have had the advanced or expert mode active for such a snapshot to be taken.
|
||||||
Slic3r::GUI::wxGetApp().save_mode(comAdvanced);
|
Slic3r::GUI::wxGetApp().save_mode(comAdvanced);
|
||||||
view3D->set_as_dirty();
|
view3D->set_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME what about the state of the manipulators?
|
//FIXME what about the state of the manipulators?
|
||||||
//FIXME what about the focus? Cursor in the side panel?
|
//FIXME what about the focus? Cursor in the side panel?
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Undo / Redo snapshot reloaded. Undo / Redo stack memory: " << Slic3r::format_memsize_MB(this->undo_redo_stack().memsize()) << log_memory_info();
|
BOOST_LOG_TRIVIAL(info) << "Undo / Redo snapshot reloaded. Undo / Redo stack memory: " << Slic3r::format_memsize_MB(this->undo_redo_stack().memsize()) << log_memory_info();
|
||||||
}
|
}
|
||||||
@ -4010,23 +4026,23 @@ void Plater::add_model()
|
|||||||
for (const auto &file : input_files)
|
for (const auto &file : input_files)
|
||||||
paths.push_back(into_path(file));
|
paths.push_back(into_path(file));
|
||||||
|
|
||||||
wxString snapshot_label;
|
wxString snapshot_label;
|
||||||
assert(! paths.empty());
|
assert(! paths.empty());
|
||||||
if (paths.size() == 1) {
|
if (paths.size() == 1) {
|
||||||
snapshot_label = _(L("Import Object"));
|
snapshot_label = _(L("Import Object"));
|
||||||
snapshot_label += ": ";
|
snapshot_label += ": ";
|
||||||
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
||||||
} else {
|
} else {
|
||||||
snapshot_label = _(L("Import Objects"));
|
snapshot_label = _(L("Import Objects"));
|
||||||
snapshot_label += ": ";
|
snapshot_label += ": ";
|
||||||
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
snapshot_label += wxString::FromUTF8(paths.front().filename().string().c_str());
|
||||||
for (size_t i = 1; i < paths.size(); ++ i) {
|
for (size_t i = 1; i < paths.size(); ++ i) {
|
||||||
snapshot_label += ", ";
|
snapshot_label += ", ";
|
||||||
snapshot_label += wxString::FromUTF8(paths[i].filename().string().c_str());
|
snapshot_label += wxString::FromUTF8(paths[i].filename().string().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(this, snapshot_label);
|
Plater::TakeSnapshot snapshot(this, snapshot_label);
|
||||||
load_files(paths, true, false);
|
load_files(paths, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4072,7 +4088,7 @@ void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
|||||||
void Plater::reset() { p->reset(); }
|
void Plater::reset() { p->reset(); }
|
||||||
void Plater::reset_with_confirm()
|
void Plater::reset_with_confirm()
|
||||||
{
|
{
|
||||||
if (wxMessageDialog((wxWindow*)this, _(L("All objects will be removed, continue ?")), wxString(SLIC3R_APP_NAME) + " - " + _(L("Delete all")), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal() == wxID_YES)
|
if (wxMessageDialog((wxWindow*)this, _(L("All objects will be removed, continue ?")), wxString(SLIC3R_APP_NAME) + " - " + _(L("Delete all")), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal() == wxID_YES)
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4080,7 +4096,7 @@ void Plater::delete_object_from_model(size_t obj_idx) { p->delete_object_from_mo
|
|||||||
|
|
||||||
void Plater::remove_selected()
|
void Plater::remove_selected()
|
||||||
{
|
{
|
||||||
Plater::TakeSnapshot snapshot(this, _(L("Delete Selected Objects")));
|
Plater::TakeSnapshot snapshot(this, _(L("Delete Selected Objects")));
|
||||||
this->p->view3D->delete_selected();
|
this->p->view3D->delete_selected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4088,7 +4104,7 @@ void Plater::increase_instances(size_t num)
|
|||||||
{
|
{
|
||||||
if (! can_increase_instances()) { return; }
|
if (! can_increase_instances()) { return; }
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(this, _(L("Increase Instances")));
|
Plater::TakeSnapshot snapshot(this, _(L("Increase Instances")));
|
||||||
|
|
||||||
int obj_idx = p->get_selected_object_idx();
|
int obj_idx = p->get_selected_object_idx();
|
||||||
|
|
||||||
@ -4124,7 +4140,7 @@ void Plater::decrease_instances(size_t num)
|
|||||||
{
|
{
|
||||||
if (! can_decrease_instances()) { return; }
|
if (! can_decrease_instances()) { return; }
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(this, _(L("Decrease Instances")));
|
Plater::TakeSnapshot snapshot(this, _(L("Decrease Instances")));
|
||||||
|
|
||||||
int obj_idx = p->get_selected_object_idx();
|
int obj_idx = p->get_selected_object_idx();
|
||||||
|
|
||||||
@ -4160,7 +4176,7 @@ void Plater::set_number_of_copies(/*size_t num*/)
|
|||||||
if (num < 0)
|
if (num < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(this, wxString::Format(_(L("Set numbers of copies to %d")), num));
|
Plater::TakeSnapshot snapshot(this, wxString::Format(_(L("Set numbers of copies to %d")), num));
|
||||||
|
|
||||||
int diff = (int)num - (int)model_object->instances.size();
|
int diff = (int)num - (int)model_object->instances.size();
|
||||||
if (diff > 0)
|
if (diff > 0)
|
||||||
@ -4190,7 +4206,7 @@ void Plater::cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_uppe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(this, _(L("Cut by Plane")));
|
Plater::TakeSnapshot snapshot(this, _(L("Cut by Plane")));
|
||||||
|
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
const auto new_objects = object->cut(instance_idx, z, keep_upper, keep_lower, rotate_lower);
|
const auto new_objects = object->cut(instance_idx, z, keep_upper, keep_lower, rotate_lower);
|
||||||
@ -4208,11 +4224,11 @@ void Plater::export_gcode()
|
|||||||
// This function is useful for generating file names to be processed by legacy firmwares.
|
// This function is useful for generating file names to be processed by legacy firmwares.
|
||||||
fs::path default_output_file;
|
fs::path default_output_file;
|
||||||
try {
|
try {
|
||||||
// Update the background processing, so that the placeholder parser will get the correct values for the ouput file template.
|
// Update the background processing, so that the placeholder parser will get the correct values for the ouput file template.
|
||||||
// Also if there is something wrong with the current configuration, a pop-up dialog will be shown and the export will not be performed.
|
// Also if there is something wrong with the current configuration, a pop-up dialog will be shown and the export will not be performed.
|
||||||
unsigned int state = this->p->update_restart_background_process(false, false);
|
unsigned int state = this->p->update_restart_background_process(false, false);
|
||||||
if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID)
|
if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID)
|
||||||
return;
|
return;
|
||||||
default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf")));
|
default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf")));
|
||||||
}
|
}
|
||||||
catch (const std::exception &ex) {
|
catch (const std::exception &ex) {
|
||||||
@ -4446,10 +4462,10 @@ void Plater::reslice_SLA_supports(const ModelObject &object)
|
|||||||
task.single_model_object = object.id();
|
task.single_model_object = object.id();
|
||||||
// If the background processing is not enabled, calculate supports just for the single instance.
|
// If the background processing is not enabled, calculate supports just for the single instance.
|
||||||
// Otherwise calculate everything, but start with the provided object.
|
// Otherwise calculate everything, but start with the provided object.
|
||||||
if (!this->p->background_processing_enabled()) {
|
if (!this->p->background_processing_enabled()) {
|
||||||
task.single_model_instance_only = true;
|
task.single_model_instance_only = true;
|
||||||
task.to_object_step = slaposBasePool;
|
task.to_object_step = slaposBasePool;
|
||||||
}
|
}
|
||||||
this->p->background_process.set_task(task);
|
this->p->background_process.set_task(task);
|
||||||
// and let the background processing start.
|
// and let the background processing start.
|
||||||
this->p->restart_background_process(state | priv::UPDATE_BACKGROUND_PROCESS_FORCE_RESTART);
|
this->p->restart_background_process(state | priv::UPDATE_BACKGROUND_PROCESS_FORCE_RESTART);
|
||||||
@ -4465,11 +4481,11 @@ void Plater::send_gcode()
|
|||||||
// Obtain default output path
|
// Obtain default output path
|
||||||
fs::path default_output_file;
|
fs::path default_output_file;
|
||||||
try {
|
try {
|
||||||
// Update the background processing, so that the placeholder parser will get the correct values for the ouput file template.
|
// Update the background processing, so that the placeholder parser will get the correct values for the ouput file template.
|
||||||
// Also if there is something wrong with the current configuration, a pop-up dialog will be shown and the export will not be performed.
|
// Also if there is something wrong with the current configuration, a pop-up dialog will be shown and the export will not be performed.
|
||||||
unsigned int state = this->p->update_restart_background_process(false, false);
|
unsigned int state = this->p->update_restart_background_process(false, false);
|
||||||
if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID)
|
if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID)
|
||||||
return;
|
return;
|
||||||
default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf")));
|
default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf")));
|
||||||
}
|
}
|
||||||
catch (const std::exception &ex) {
|
catch (const std::exception &ex) {
|
||||||
@ -4634,10 +4650,10 @@ void Plater::on_activate()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (! this->p->delayed_error_message.empty()) {
|
if (! this->p->delayed_error_message.empty()) {
|
||||||
std::string msg = std::move(this->p->delayed_error_message);
|
std::string msg = std::move(this->p->delayed_error_message);
|
||||||
this->p->delayed_error_message.clear();
|
this->p->delayed_error_message.clear();
|
||||||
GUI::show_error(this, msg);
|
GUI::show_error(this, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Plater::get_project_filename(const wxString& extension) const
|
wxString Plater::get_project_filename(const wxString& extension) const
|
||||||
|
Loading…
Reference in New Issue
Block a user