diff --git a/src/GUI/misc_ui.cpp b/src/GUI/misc_ui.cpp index c585117b9..ee1aaeb9d 100644 --- a/src/GUI/misc_ui.cpp +++ b/src/GUI/misc_ui.cpp @@ -1,10 +1,12 @@ #include "misc_ui.hpp" #include #include +#include #include #include + namespace Slic3r { namespace GUI { @@ -110,5 +112,22 @@ sub show_error { } */ +std::vector open_model(wxWindow* parent, const Settings& settings, wxWindow* top) { + auto dialog {new wxFileDialog((parent != nullptr ? parent : top), _("Choose one or more files") + wxString(" (STL/OBJ/AMF/3MF):"), ".", "", + "", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)}; + if (dialog->ShowModal() != wxID_OK) { + dialog->Destroy(); + return std::vector(); + } + std::vector tmp; + wxArrayString tmpout; + dialog->GetPaths(tmpout); + for (const auto& i : tmpout) { + tmp.push_back(i); + } + dialog->Destroy(); + return tmp; +} + }} // namespace Slic3r::GUI diff --git a/src/GUI/misc_ui.hpp b/src/GUI/misc_ui.hpp index d40ab729c..d56c52219 100644 --- a/src/GUI/misc_ui.hpp +++ b/src/GUI/misc_ui.hpp @@ -9,6 +9,8 @@ #include #include +#include "Settings.hpp" + #include "Log.hpp" /// Common static (that is, free-standing) functions, not part of an object hierarchy. @@ -98,6 +100,8 @@ sub CallAfter { wxString decode_path(const wxString& in); wxString encode_path(const wxString& in); +std::vector open_model(wxWindow* parent, const Settings& settings, wxWindow* top); + }} // namespace Slic3r::GUI #endif // MISC_UI_HPP