mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 05:37:52 -06:00
Added gallery to the default shapes
+ ObjectList (MSW specific): Don't change background color for Light color mode
This commit is contained in:
parent
8c23678fa0
commit
b921c8b276
4 changed files with 41 additions and 2 deletions
|
@ -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)))
|
||||
|
@ -1569,6 +1574,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
|
||||
|
|
|
@ -243,6 +243,7 @@ public:
|
|||
void load_part(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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue