NEW: add menu item of per object process

Change-Id: I09c7516903e59e976f582d7efaff33cc3033c820
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-11-17 14:37:01 +08:00 committed by Lane.Wei
parent e50d75026a
commit 2b23e3c119
6 changed files with 37 additions and 7 deletions

View file

@ -979,6 +979,7 @@ void MenuFactory::create_bbl_object_menu()
// Set filament insert menu item here
// Set Printable
wxMenuItem* menu_item_printable = append_menu_item_printable(&m_object_menu);
append_menu_item_per_object_process(&m_object_menu);
// Enter per object parameters
append_menu_item_per_object_settings(&m_object_menu);
m_object_menu.AppendSeparator();
@ -1363,6 +1364,19 @@ void MenuFactory::append_menu_item_center(wxMenu* menu)
}, m_parent);
}
void MenuFactory::append_menu_item_per_object_process(wxMenu* menu)
{
const std::vector<wxString> names = {_L("Edit Object Process"), _L("Edit Object Process")};
append_menu_item(menu, wxID_ANY, names[0], names[1],
[](wxCommandEvent&) {
wxGetApp().obj_list()->switch_to_object_process();
}, "", nullptr,
[]() {
Selection& selection = plater()->canvas3D()->get_selection();
return selection.is_single_full_object() || selection.is_single_full_instance() || selection.is_single_volume();
}, m_parent);
}
void MenuFactory::append_menu_item_per_object_settings(wxMenu* menu)
{
const std::vector<wxString> names = { _L("Edit in Parameter Table"), _L("Edit print parameters for a single object") };

View file

@ -140,6 +140,7 @@ private:
void append_menu_item_clone(wxMenu* menu);
void append_menu_item_simplify(wxMenu* menu);
void append_menu_item_center(wxMenu* menu);
void append_menu_item_per_object_process(wxMenu* menu);
void append_menu_item_per_object_settings(wxMenu* menu);
void append_menu_item_change_filament(wxMenu* menu);
void append_menu_item_set_printable(wxMenu* menu);

View file

@ -1979,7 +1979,18 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
//Show Dialog
if (wxGetApp().app_config->get("do_not_show_modifer_tips").empty()) {
TipsDialog dlg(wxGetApp().mainframe, _L("Add Modifier"));
TipsDialog dlg(wxGetApp().mainframe, _L("Add Modifier"), _L("Switch to per-object setting mode to edit modifier settings."), "do_not_show_modifer_tips");
dlg.ShowModal();
}
}
void ObjectList::switch_to_object_process()
{
wxGetApp().params_panel()->switch_to_object(true);
// Show Dialog
if (wxGetApp().app_config->get("do_not_show_object_process_tips").empty()) {
TipsDialog dlg(wxGetApp().mainframe, _L("Edit Object Process"), _L("Switch to per-object setting mode to edit object process."), "do_not_show_object_process_tips");
dlg.ShowModal();
}
}

View file

@ -282,6 +282,7 @@ public:
void load_shape_object(const std::string &type_name);
void load_mesh_object(const TriangleMesh &mesh, const wxString &name, bool center = true);
// BBS
void switch_to_object_process();
void load_mesh_part(const TriangleMesh& mesh, const wxString& name, bool center = true);
void del_object(const int obj_idx, bool refresh_immediately = true);
void del_subobject_item(wxDataViewItem& item);

View file

@ -22,8 +22,9 @@ namespace Slic3r {
namespace GUI {
TipsDialog::TipsDialog(wxWindow *parent, const wxString &title)
: DPIDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key)
: DPIDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX),
m_app_key(app_key)
{
SetBackgroundColour(*wxWHITE);
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
@ -38,7 +39,7 @@ TipsDialog::TipsDialog(wxWindow *parent, const wxString &title)
m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(20));
m_msg = new wxStaticText(this, wxID_ANY, _L("Switch to per-object setting mode to edit modifier settings."), wxDefaultPosition, wxDefaultSize, 0);
m_msg = new wxStaticText(this, wxID_ANY, description, wxDefaultPosition, wxDefaultSize, 0);
m_msg->Wrap(-1);
m_msg->SetFont(::Label::Body_13);
m_msg->SetForegroundColour(wxColour(107, 107, 107));
@ -51,7 +52,7 @@ TipsDialog::TipsDialog(wxWindow *parent, const wxString &title)
wxBoxSizer *m_sizer_bottom = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *m_sizer_left = new wxBoxSizer(wxHORIZONTAL);
auto dont_show_again = create_item_checkbox(_L("Don't show again"), this, _L("Don't show again"), "do_not_show_modifer_tips");
auto dont_show_again = create_item_checkbox(_L("Don't show again"), this, _L("Don't show again"), "do_not_show_tips");
m_sizer_left->Add(dont_show_again, 1, wxALL, FromDIP(5));
m_sizer_bottom->Add(m_sizer_left, 1, wxEXPAND, FromDIP(5));
@ -119,7 +120,8 @@ void TipsDialog::on_dpi_changed(const wxRect &suggested_rect)
void TipsDialog::on_ok(wxMouseEvent &event)
{
if (m_show_again) {
wxGetApp().app_config->set_bool("do_not_show_modifer_tips", m_show_again);
if (!m_app_key.empty())
wxGetApp().app_config->set_bool(m_app_key, m_show_again);
}
EndModal(wxID_OK);
}

View file

@ -43,9 +43,10 @@ class TipsDialog : public DPIDialog
{
private:
bool m_show_again{false};
std::string m_app_key;
public:
TipsDialog(wxWindow *parent, const wxString &title);
TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key = "");
Button *m_confirm{nullptr};
Button *m_cancel{nullptr};
wxPanel *m_top_line{nullptr};