mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
2f24971601
10 changed files with 100 additions and 30 deletions
|
|
@ -608,7 +608,7 @@ static void generic_exception_handle()
|
|||
std::terminate();
|
||||
throw;
|
||||
} catch (const std::exception& ex) {
|
||||
wxLogError("Internal error: %s", ex.what());
|
||||
wxLogError(format_wxstr(_L("Internal error: %1%"), ex.what()));
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what();
|
||||
throw;
|
||||
}
|
||||
|
|
@ -1138,7 +1138,7 @@ void GUI_App::UpdateDlgDarkUI(wxDialog* dlg, bool just_buttons_update/* = false*
|
|||
void GUI_App::UpdateDVCDarkUI(wxDataViewCtrl* dvc, bool highlited/* = false*/)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
UpdateDarkUI(dvc, highlited);
|
||||
UpdateDarkUI(dvc, highlited ? dark_mode() : false);
|
||||
wxItemAttr attr(dark_mode() ? m_color_highlight_default : m_color_label_default,
|
||||
m_color_window_default,
|
||||
m_normal_font);
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ wxMenu* MenuFactory::append_submenu_add_generic(wxMenu* menu, ModelVolumeType ty
|
|||
[type, item](wxCommandEvent&) { obj_list()->load_generic_subobject(item, type); }, "", menu);
|
||||
}
|
||||
|
||||
if (wxGetApp().get_mode() == comExpert && type != ModelVolumeType::INVALID) {
|
||||
if (wxGetApp().get_mode() == comExpert) {
|
||||
sub_menu->AppendSeparator();
|
||||
append_menu_item(sub_menu, wxID_ANY, _L("Gallery"), "",
|
||||
[type](wxCommandEvent&) { obj_list()->load_subobject(type, true); }, "", menu);
|
||||
|
|
|
|||
|
|
@ -1358,6 +1358,11 @@ bool ObjectList::is_instance_or_object_selected()
|
|||
|
||||
void ObjectList::load_subobject(ModelVolumeType type, bool from_galery/* = false*/)
|
||||
{
|
||||
if (type == ModelVolumeType::INVALID && from_galery) {
|
||||
load_shape_object_from_gallery();
|
||||
return;
|
||||
}
|
||||
|
||||
wxDataViewItem item = GetSelection();
|
||||
// we can add volumes for Object or Instance
|
||||
if (!item || !(m_objects_model->GetItemType(item)&(itObject|itInstance)))
|
||||
|
|
@ -1663,6 +1668,39 @@ void ObjectList::load_shape_object(const std::string& type_name)
|
|||
#endif // ENABLE_PROJECT_DIRTY_STATE
|
||||
}
|
||||
|
||||
void ObjectList::load_shape_object_from_gallery()
|
||||
{
|
||||
if (wxGetApp().plater()->canvas3D()->get_selection().get_object_idx() != -1)
|
||||
return;// Add nothing if something is selected on 3DScene
|
||||
|
||||
wxArrayString input_files;
|
||||
GalleryDialog gallery_dlg(this);
|
||||
if (gallery_dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
gallery_dlg.get_input_files(input_files);
|
||||
if (input_files.IsEmpty())
|
||||
return;
|
||||
|
||||
std::vector<boost::filesystem::path> paths;
|
||||
for (const auto& file : input_files)
|
||||
paths.push_back(into_path(file));
|
||||
|
||||
assert(!paths.empty());
|
||||
wxString snapshot_label = (paths.size() == 1 ? _L("Add Shape") : _L("Add Shapes")) + ": " +
|
||||
wxString::FromUTF8(paths.front().filename().string().c_str());
|
||||
for (size_t i = 1; i < paths.size(); ++i)
|
||||
snapshot_label += ", " + wxString::FromUTF8(paths[i].filename().string().c_str());
|
||||
|
||||
take_snapshot(snapshot_label);
|
||||
#if ENABLE_PROJECT_DIRTY_STATE
|
||||
std::vector<size_t> res = wxGetApp().plater()->load_files(paths, true, false);
|
||||
if (!res.empty())
|
||||
wxGetApp().mainframe->update_title();
|
||||
#else
|
||||
load_files(paths, true, false);
|
||||
#endif // ENABLE_PROJECT_DIRTY_STATE
|
||||
}
|
||||
|
||||
void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name, bool center)
|
||||
{
|
||||
// Add mesh to model as a new object
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ public:
|
|||
void load_modifier(ModelObject& model_object, std::vector<ModelVolume*>& added_volumes, ModelVolumeType type, bool from_galery = false);
|
||||
void load_generic_subobject(const std::string& type_name, const ModelVolumeType type);
|
||||
void load_shape_object(const std::string &type_name);
|
||||
void load_shape_object_from_gallery();
|
||||
void load_mesh_object(const TriangleMesh &mesh, const wxString &name, bool center = true);
|
||||
void del_object(const int obj_idx);
|
||||
void del_subobject_item(wxDataViewItem& item);
|
||||
|
|
|
|||
|
|
@ -219,11 +219,6 @@ static fs::path get_dir(bool sys_dir)
|
|||
return fs::absolute(fs::path(data_dir()) / "shapes").make_preferred();
|
||||
}
|
||||
|
||||
static bool custom_exists()
|
||||
{
|
||||
return fs::exists(get_dir(false));
|
||||
}
|
||||
|
||||
static std::string get_dir_path(bool sys_dir)
|
||||
{
|
||||
fs::path dir = get_dir(sys_dir);
|
||||
|
|
@ -299,6 +294,9 @@ void GalleryDialog::load_label_icon_list()
|
|||
auto add_files_from_gallery = [](std::vector<Item>& items, bool sys_dir, std::string& dir_path)
|
||||
{
|
||||
fs::path dir = get_dir(sys_dir);
|
||||
if (!fs::exists(dir))
|
||||
return;
|
||||
|
||||
dir_path = get_dir_path(sys_dir);
|
||||
|
||||
std::vector<std::string> sorted_names;
|
||||
|
|
@ -319,8 +317,7 @@ void GalleryDialog::load_label_icon_list()
|
|||
std::string m_sys_dir_path, m_cust_dir_path;
|
||||
std::vector<Item> list_items;
|
||||
add_files_from_gallery(list_items, true, m_sys_dir_path);
|
||||
if (custom_exists())
|
||||
add_files_from_gallery(list_items, false, m_cust_dir_path);
|
||||
add_files_from_gallery(list_items, false, m_cust_dir_path);
|
||||
|
||||
// Make an image list containing large icons
|
||||
|
||||
|
|
|
|||
|
|
@ -3005,6 +3005,7 @@ void TabPrinter::update()
|
|||
m_presets->get_edited_preset().printer_technology() == ptFFF ? update_fff() : update_sla();
|
||||
m_update_cnt--;
|
||||
|
||||
update_description_lines();
|
||||
Layout();
|
||||
|
||||
if (m_update_cnt == 0)
|
||||
|
|
@ -4290,6 +4291,9 @@ void TabSLAMaterial::update()
|
|||
if (m_preset_bundle->printers.get_selected_preset().printer_technology() == ptFFF)
|
||||
return;
|
||||
|
||||
update_description_lines();
|
||||
Layout();
|
||||
|
||||
// #ys_FIXME. Just a template for this function
|
||||
// m_update_cnt++;
|
||||
// ! something to update
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue