From debbed13d6e2beb31e63299472e529ba70e6fce2 Mon Sep 17 00:00:00 2001 From: Kunlong Ma Date: Wed, 30 Aug 2023 09:50:59 +0800 Subject: [PATCH] FIX:[STUDIO-4108] rename when load STL/STEP JIRA: STUDIO-4108 github: #2325 Change-Id: Ibec16c822c0e8aeb1c064633225c7f500eb6990d --- src/slic3r/GUI/MainFrame.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 4526aac4ce6..183dd6c0c8c 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -637,7 +637,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ if (evt.CmdDown() && evt.GetKeyCode() == 'I') { if (!can_add_models()) return; - if (m_plater) { m_plater->add_model(); } + if (m_plater) { m_plater->add_file(); } return; } evt.Skip(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a0e34f2215f..9744d1966b4 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -9685,7 +9685,12 @@ void Plater::add_file() case LoadFilesType::SingleOther: { Plater::TakeSnapshot snapshot(this, snapshot_label); - if (!load_files(paths, LoadStrategy::LoadModel, false).empty()) { wxGetApp().mainframe->update_title(); } + if (!load_files(paths, LoadStrategy::LoadModel, false).empty()) { + if (get_project_name() == _L("Untitled") && paths.size() > 0) { + p->set_project_filename(wxString::FromUTF8(paths[0].string())); + } + wxGetApp().mainframe->update_title(); + } break; } case LoadFilesType::Multiple3MF: @@ -9701,6 +9706,9 @@ void Plater::add_file() case LoadFilesType::MultipleOther: { Plater::TakeSnapshot snapshot(this, snapshot_label); if (!load_files(paths, LoadStrategy::LoadModel, true).empty()) { + if (get_project_name() == _L("Untitled") && paths.size() > 0) { + p->set_project_filename(wxString::FromUTF8(paths[0].string())); + } wxGetApp().mainframe->update_title(); } break; @@ -9719,7 +9727,7 @@ void Plater::add_file() open_3mf_file(first_file[0]); load_files(tmf_file, LoadStrategy::LoadModel); - if (!load_files(other_file, LoadStrategy::LoadModel, false).empty()) { wxGetApp().mainframe->update_title(); } + if (!load_files(other_file, LoadStrategy::LoadModel, false).empty()) { wxGetApp().mainframe->update_title();} break; default:break; }