mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 14:44:19 -06:00
Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_multivolume_models
This commit is contained in:
commit
bfdd702134
12 changed files with 203 additions and 37 deletions
|
@ -196,6 +196,7 @@ void BackgroundSlicingProcess::thread_proc()
|
|||
} catch (...) {
|
||||
error = "Unknown C++ exception.";
|
||||
}
|
||||
m_print->finalize();
|
||||
lck.lock();
|
||||
m_state = m_print->canceled() ? STATE_CANCELED : STATE_FINISHED;
|
||||
if (m_print->cancel_status() != Print::CANCELED_INTERNAL) {
|
||||
|
@ -362,6 +363,12 @@ Print::ApplyStatus BackgroundSlicingProcess::apply(const Model &model, const Dyn
|
|||
return invalidated;
|
||||
}
|
||||
|
||||
void BackgroundSlicingProcess::set_task(const PrintBase::TaskParams ¶ms)
|
||||
{
|
||||
assert(m_print != nullptr);
|
||||
m_print->set_task(params);
|
||||
}
|
||||
|
||||
// Set the output path of the G-code.
|
||||
void BackgroundSlicingProcess::schedule_export(const std::string &path)
|
||||
{
|
||||
|
|
|
@ -78,6 +78,9 @@ public:
|
|||
// Apply config over the print. Returns false, if the new config values caused any of the already
|
||||
// processed steps to be invalidated, therefore the task will need to be restarted.
|
||||
Print::ApplyStatus apply(const Model &model, const DynamicPrintConfig &config);
|
||||
// After calling the apply() function, set_task() may be called to limit the task to be processed by process().
|
||||
// This is useful for calculating SLA supports for a single object only.
|
||||
void set_task(const PrintBase::TaskParams ¶ms);
|
||||
// After calling apply, the empty() call will report whether there is anything to slice.
|
||||
bool empty() const;
|
||||
// Validate the print. Returns an empty string if valid, returns an error message if invalid.
|
||||
|
@ -94,6 +97,7 @@ public:
|
|||
void reset_export();
|
||||
// Once the G-code export is scheduled, the apply() methods will do nothing.
|
||||
bool is_export_scheduled() const { return ! m_export_path.empty(); }
|
||||
bool is_upload_scheduled() const { return ! m_upload_job.empty(); }
|
||||
|
||||
enum State {
|
||||
// m_thread is not running yet, or it did not reach the STATE_IDLE yet (it does not wait on the condition yet).
|
||||
|
|
|
@ -2039,6 +2039,13 @@ unsigned int Plater::priv::update_background_process(bool force_validation)
|
|||
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, evt.Clone());
|
||||
}
|
||||
|
||||
//FIXME update "Slice Now / Schedule background process"
|
||||
//background_process.is_export_scheduled() - byl zavolan "Export G-code", background processing ma jmeno export souboru
|
||||
//background_process.is_upload_scheduled() - byl zavolan "Send to OctoPrint", jeste nebylo doslajsovano (pak se preda upload fronte a background process zapomene)
|
||||
//background_process.empty() - prazdna plocha
|
||||
// pokud (invalidated != Print::APPLY_STATUS_UNCHANGED) a ! background_process.empty() -> je neco ke slajsovani (povol tlacitko)
|
||||
// pokud (return_state & UPDATE_BACKGROUND_PROCESS_INVALID) != 0 -> doslo k chybe (gray out "Slice now")
|
||||
|
||||
return return_state;
|
||||
}
|
||||
|
||||
|
@ -3016,6 +3023,32 @@ void Plater::reslice()
|
|||
this->p->restart_background_process(state | priv::UPDATE_BACKGROUND_PROCESS_FORCE_RESTART);
|
||||
}
|
||||
|
||||
void Plater::reslice_SLA_supports(const ModelObject &object)
|
||||
{
|
||||
//FIXME Don't reslice if export of G-code or sending to OctoPrint is running.
|
||||
// bitmask of UpdateBackgroundProcessReturnState
|
||||
unsigned int state = this->p->update_background_process(true);
|
||||
if (state & priv::UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE)
|
||||
this->p->view3D->reload_scene(false);
|
||||
|
||||
if (this->p->background_process.empty() || (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID))
|
||||
// Nothing to do on empty input or invalid configuration.
|
||||
return;
|
||||
|
||||
// Limit calculation to the single object only.
|
||||
PrintBase::TaskParams task;
|
||||
task.single_model_object = object.id();
|
||||
// If the background processing is not enabled, calculate supports just for the single instance.
|
||||
// Otherwise calculate everything, but start with the provided object.
|
||||
if (!this->p->background_processing_enabled()) {
|
||||
task.single_model_instance_only = true;
|
||||
task.to_object_step = slaposBasePool;
|
||||
}
|
||||
this->p->background_process.set_task(task);
|
||||
// and let the background processing start.
|
||||
this->p->restart_background_process(state | priv::UPDATE_BACKGROUND_PROCESS_FORCE_RESTART);
|
||||
}
|
||||
|
||||
void Plater::send_gcode()
|
||||
{
|
||||
if (p->model.objects.empty()) { return; }
|
||||
|
|
|
@ -22,6 +22,7 @@ class wxString;
|
|||
namespace Slic3r {
|
||||
|
||||
class Model;
|
||||
class ModelObject;
|
||||
class Print;
|
||||
class SLAPrint;
|
||||
|
||||
|
@ -148,6 +149,7 @@ public:
|
|||
void export_amf();
|
||||
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
|
||||
void reslice();
|
||||
void reslice_SLA_supports(const ModelObject &object);
|
||||
void changed_object(int obj_idx);
|
||||
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
|
||||
void send_gcode();
|
||||
|
|
|
@ -669,6 +669,7 @@ void Tab::load_config(const DynamicPrintConfig& config)
|
|||
bool modified = 0;
|
||||
for(auto opt_key : m_config->diff(config)) {
|
||||
m_config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||
m_dirty_options.emplace(opt_key);
|
||||
modified = 1;
|
||||
}
|
||||
if (modified) {
|
||||
|
@ -751,17 +752,7 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value, bo
|
|||
|
||||
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
{
|
||||
wxCommandEvent event(EVT_TAB_VALUE_CHANGED);
|
||||
event.SetEventObject(this);
|
||||
event.SetString(opt_key);
|
||||
if (opt_key == "extruders_count")
|
||||
{
|
||||
int val = boost::any_cast<size_t>(value);
|
||||
event.SetInt(val);
|
||||
}
|
||||
|
||||
wxPostEvent(this, event);
|
||||
|
||||
m_dirty_options.erase(opt_key);
|
||||
|
||||
ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
|
||||
if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable")
|
||||
|
@ -788,6 +779,21 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
update_wiping_button_visibility();
|
||||
|
||||
update();
|
||||
|
||||
// Post event to the Plater after updating of the all dirty options
|
||||
// It helps to avoid needless schedule_background_processing
|
||||
if (update_completed()) {
|
||||
wxCommandEvent event(EVT_TAB_VALUE_CHANGED);
|
||||
event.SetEventObject(this);
|
||||
event.SetString(opt_key);
|
||||
if (opt_key == "extruders_count")
|
||||
{
|
||||
const int val = boost::any_cast<size_t>(value);
|
||||
event.SetInt(val);
|
||||
}
|
||||
|
||||
wxPostEvent(this, event);
|
||||
}
|
||||
}
|
||||
|
||||
// Show/hide the 'purging volumes' button
|
||||
|
@ -1163,8 +1169,8 @@ void TabPrint::update()
|
|||
// KillFocus() for the wxSpinCtrl use CallAfter function. So,
|
||||
// to except the duplicate call of the update() after dialog->ShowModal(),
|
||||
// let check if this process is already started.
|
||||
if (is_msg_dlg_already_exist)
|
||||
return;
|
||||
// if (is_msg_dlg_already_exist) // ! It looks like a fixed problem after start to using of a m_dirty_options
|
||||
// return; // ! TODO Let delete this part of code after a common aplication testing
|
||||
|
||||
Freeze();
|
||||
|
||||
|
@ -1181,7 +1187,7 @@ void TabPrint::update()
|
|||
"- no ensure_vertical_shell_thickness\n"
|
||||
"\nShall I adjust those settings in order to enable Spiral Vase?"));
|
||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
|
||||
is_msg_dlg_already_exist = true;
|
||||
// is_msg_dlg_already_exist = true;
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
if (dialog->ShowModal() == wxID_YES) {
|
||||
new_conf.set_key_value("perimeters", new ConfigOptionInt(1));
|
||||
|
@ -1197,7 +1203,7 @@ void TabPrint::update()
|
|||
}
|
||||
load_config(new_conf);
|
||||
on_value_change("fill_density", fill_density);
|
||||
is_msg_dlg_already_exist = false;
|
||||
// is_msg_dlg_already_exist = false;
|
||||
}
|
||||
|
||||
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
|
||||
|
|
|
@ -204,6 +204,7 @@ protected:
|
|||
void set_type();
|
||||
|
||||
int m_em_unit;
|
||||
std::set<std::string> m_dirty_options = {};
|
||||
|
||||
public:
|
||||
PresetBundle* m_preset_bundle;
|
||||
|
@ -283,6 +284,7 @@ protected:
|
|||
void update_frequently_changed_parameters();
|
||||
void fill_icon_descriptions();
|
||||
void set_tooltips_text();
|
||||
bool update_completed() const { return m_dirty_options.empty(); }
|
||||
};
|
||||
|
||||
class TabPrint : public Tab
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue