FIX:Unified API across different platforms

jira: STUDIO-9143
Change-Id: Iea5ad33ea498410eca44dd6969b4a8c49cfa59a1
(cherry picked from commit a53d2fa32a34d57111ad6293b46e4e1073ccf6ce)
This commit is contained in:
zhou.xu 2024-11-18 11:49:46 +08:00 committed by Lane.Wei
parent 7665aeb69c
commit 4eb6502c59
2 changed files with 11 additions and 4 deletions

View File

@ -2365,7 +2365,10 @@ void MainFrame::init_menubar_as_editor()
[this](){return can_add_models(); }, this);
#else
append_menu_item(import_menu, wxID_ANY, _L("Import 3MF/STL/STEP/SVG/OBJ/AMF") + dots + "\t" + ctrl + "I", _L("Load a model"),
[this](wxCommandEvent&) { if (m_plater) { m_plater->add_model(); } }, "", nullptr,
[this](wxCommandEvent &) {
if (m_plater) { m_plater->add_file(); }
},
"", nullptr,
[this](){return can_add_models(); }, this);
#endif
append_menu_item(import_menu, wxID_ANY, _L("Import Configs") + dots /*+ "\tCtrl+I"*/, _L("Load configs"),

View File

@ -9433,6 +9433,7 @@ bool Plater::up_to_date(bool saved, bool backup)
void Plater::add_model(bool imperial_units, std::string fname)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " entry";
wxArrayString input_files;
std::vector<fs::path> paths;
@ -10559,10 +10560,12 @@ bool Plater::load_svg(const wxArrayString &filenames, bool from_toolbar_or_file_
{
// When only one .svg file is dropped on scene
if (filenames.size() == 1) {
const wxString &filename = filenames.Last();
const wxString file_extension = filename.substr(filename.length() - 4);
if (file_extension.CmpNoCase(".svg") == 0) {
const wxString &filename = filenames[0];
if (boost::iends_with(filenames[0].ToStdString(), ".svg")) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "," << __FILE__ << filename;
return emboss_svg(filename, from_toolbar_or_file_menu);
} else {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "," << __FILE__ << ",fail:" << filename;
}
}
else {
@ -10873,6 +10876,7 @@ void Plater::add_file()
if (load_svg(input_files,true)) {
return;
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "," << __FILE__ << ","<< "LoadFilesType::SingleOther";
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()));