mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:15:58 +08:00
Fix for #6377 - Prevent 3mf files from overwriting filament/printer settings
+ Ask about action on load of project even if print bed isn't empty
This commit is contained in:
parent
2d55f5761b
commit
c7783a5891
@ -772,8 +772,15 @@ void GUI_App::post_init()
|
||||
this->mainframe->load_config_file(this->init_params->load_configs.back());
|
||||
// If loading a 3MF file, the config is loaded from the last one.
|
||||
if (!this->init_params->input_files.empty()) {
|
||||
#if 1 // #ysFIXME_delete_after_test_of
|
||||
wxArrayString fns;
|
||||
for (const std::string& name : this->init_params->input_files)
|
||||
fns.Add(from_u8(name));
|
||||
if (plater()->load_files(fns) && this->init_params->input_files.size() == 1) {
|
||||
#else
|
||||
const std::vector<size_t> res = this->plater()->load_files(this->init_params->input_files, true, true);
|
||||
if (!res.empty() && this->init_params->input_files.size() == 1) {
|
||||
#endif
|
||||
// Update application titlebar when opening a project file
|
||||
const std::string& filename = this->init_params->input_files.front();
|
||||
if (boost::algorithm::iends_with(filename, ".amf") ||
|
||||
|
@ -6010,7 +6010,9 @@ protected:
|
||||
|
||||
ProjectDropDialog::ProjectDropDialog(const std::string& filename)
|
||||
: DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY,
|
||||
from_u8((boost::format(_utf8(L("%s - Drop project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
||||
// #ysFIXME_delete_after_test_of_6377
|
||||
// from_u8((boost::format(_utf8(L("%s - Drop project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
||||
from_u8((boost::format(_utf8(L("%s - Load project file"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
||||
wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||
{
|
||||
SetFont(wxGetApp().normal_font());
|
||||
@ -6118,7 +6120,7 @@ bool Plater::load_files(const wxArrayString& filenames, bool delete_after_load/*
|
||||
std::string filename = (*it).filename().string();
|
||||
if (boost::algorithm::iends_with(filename, ".3mf") || boost::algorithm::iends_with(filename, ".amf")) {
|
||||
ProjectDropDialog::LoadType load_type = ProjectDropDialog::LoadType::Unknown;
|
||||
if (!model().objects.empty()) {
|
||||
// if (!model().objects.empty()) { // #ysFIXME_delete_after_test_of_6377
|
||||
if ((boost::algorithm::iends_with(filename, ".3mf") && !is_project_3mf(it->string())) ||
|
||||
(boost::algorithm::iends_with(filename, ".amf") && !boost::algorithm::iends_with(filename, ".zip.amf")))
|
||||
load_type = ProjectDropDialog::LoadType::LoadGeometry;
|
||||
@ -6135,9 +6137,11 @@ bool Plater::load_files(const wxArrayString& filenames, bool delete_after_load/*
|
||||
load_type = static_cast<ProjectDropDialog::LoadType>(std::clamp(std::stoi(wxGetApp().app_config->get("drop_project_action")),
|
||||
static_cast<int>(ProjectDropDialog::LoadType::OpenProject), static_cast<int>(ProjectDropDialog::LoadType::LoadConfig)));
|
||||
}
|
||||
/* // #ysFIXME_delete_after_test_of_6377
|
||||
}
|
||||
else
|
||||
load_type = ProjectDropDialog::LoadType::OpenProject;
|
||||
*/
|
||||
|
||||
if (load_type == ProjectDropDialog::LoadType::Unknown)
|
||||
return false;
|
||||
|
@ -322,8 +322,14 @@ void PreferencesDialog::build()
|
||||
m_optgroup_general->append_separator();
|
||||
|
||||
append_bool_option(m_optgroup_general, "show_drop_project_dialog",
|
||||
#if 1 // #ysFIXME_delete_after_test_of_6377
|
||||
L("Show load project dialog"),
|
||||
L("When checked, whenever dragging and dropping a project file on the application or open it from a browser, "
|
||||
"shows a dialog asking to select the action to take on the file to load."),
|
||||
#else
|
||||
L("Show drop project dialog"),
|
||||
L("When checked, whenever dragging and dropping a project file on the application, shows a dialog asking to select the action to take on the file to load."),
|
||||
#endif
|
||||
app_config->get("show_drop_project_dialog") == "1");
|
||||
|
||||
append_bool_option(m_optgroup_general, "single_instance",
|
||||
|
Loading…
x
Reference in New Issue
Block a user