diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 25741be4ab..27816e2b67 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -821,13 +821,14 @@ void GUI_App::post_init() BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", init with input files, size %1%, input_gcode %2%") %this->init_params->input_files.size() %this->init_params->input_gcode; + + switch_to_3d = true; + const auto first_url = this->init_params->input_files.front(); if (this->init_params->input_files.size() == 1 && is_supported_open_protocol(first_url)) { - switch_to_3d = true; start_download(first_url); m_open_method = "url"; } else { - switch_to_3d = true; if (this->init_params->input_gcode) { mainframe->select_tab(size_t(MainFrame::tp3DEditor)); plater_->select_view_3D("3D"); @@ -904,6 +905,7 @@ void GUI_App::post_init() mainframe->Thaw(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", end load_gl_resources"; } + plater_->trigger_restore_project(1); //#endif diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3af97465f0..757686b14b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5105,14 +5105,19 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) return; } } + try { if (originfile != "") // see bbs_3mf.cpp for lock detail boost::filesystem::remove_all(last); } + catch (...) {} - int skip_confirm = e.GetInt(); - this->q->new_project(skip_confirm, true); - }); + + if (this->q->get_project_filename().IsEmpty() && this->q->is_empty_project()) { + int skip_confirm = e.GetInt(); + this->q->new_project(skip_confirm, true); + } + }); //wxPostEvent(this->q, wxCommandEvent{EVT_RESTORE_PROJECT}); } @@ -15078,6 +15083,9 @@ void Plater::export_toolpaths_to_obj() const p->preview->get_canvas3d()->export_toolpaths_to_obj(into_u8(path).c_str()); } +bool Plater::is_empty_project() { + return model().objects.empty(); +} bool Plater::is_multi_extruder_ams_empty() { std::vector extruder_ams_count_str = p->config->option("extruder_ams_count", true)->values; diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 8137e2bd2d..cca13174bb 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -350,6 +350,7 @@ public: m_exported_file = exported_file; } + bool is_empty_project(); bool is_multi_extruder_ams_empty(); // BBS bool is_new_project_and_check_state() { return m_new_project_and_check_state; }