Skip to content

Commit

Permalink
Fixed SPE-1014 (Support settings in context menu for modifier)
Browse files Browse the repository at this point in the history
  • Loading branch information
YuSanka committed Sep 2, 2019
1 parent dba5dd3 commit fdb5191
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/slic3r/GUI/GUI_ObjectList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,9 +1071,11 @@ const std::vector<std::string>& ObjectList::get_options_for_bundle(const wxStrin
return empty;
}

static bool improper_category(const std::string& category, const int extruders_cnt)
static bool improper_category(const std::string& category, const int extruders_cnt, const bool is_object_settings = true)
{
return category.empty() || (extruders_cnt == 1 && (category == "Extruders" || category == "Wipe options" ));
return category.empty() ||
extruders_cnt == 1 && (category == "Extruders" || category == "Wipe options" ) ||
!is_object_settings && category == "Support material";
}

void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part)
Expand All @@ -1087,7 +1089,7 @@ void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const
{
auto const opt = config.def()->get(option);
auto category = opt->category;
if (improper_category(category, extruders_cnt))
if (improper_category(category, extruders_cnt, !is_part))
continue;

const std::string& label = !opt->full_label.empty() ? opt->full_label : opt->label;
Expand Down Expand Up @@ -1404,7 +1406,7 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
menu->SetFirstSeparator();

// Add frequently settings
create_freq_settings_popupmenu(menu);
create_freq_settings_popupmenu(menu, sel_vol==nullptr);

if (mode == comAdvanced)
return nullptr;
Expand Down Expand Up @@ -1598,7 +1600,7 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu)
return menu;
}

void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_object_settings/* = true*/)
{
// Add default settings bundles
const SettingsBundle& bundle = printer_technology() == ptFFF ?
Expand All @@ -1607,7 +1609,7 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
const int extruders_cnt = extruders_count();

for (auto& it : bundle) {
if (improper_category(it.first, extruders_cnt))
if (improper_category(it.first, extruders_cnt, is_object_settings))
continue;

append_menu_item(menu, wxID_ANY, _(it.first), "",
Expand Down Expand Up @@ -2262,7 +2264,7 @@ SettingsBundle ObjectList::get_item_settings_bundle(const DynamicPrintConfig* co
for (auto& opt_key : opt_keys)
{
auto category = config->def()->get(opt_key)->category;
if (improper_category(category, extruders_cnt))
if (improper_category(category, extruders_cnt, is_object_settings))
continue;

std::vector< std::string > new_category;
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GUI_ObjectList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class ObjectList : public wxDataViewCtrl
void create_part_popupmenu(wxMenu*menu);
void create_instance_popupmenu(wxMenu*menu);
wxMenu* create_settings_popupmenu(wxMenu *parent_menu);
void create_freq_settings_popupmenu(wxMenu *parent_menu);
void create_freq_settings_popupmenu(wxMenu *parent_menu, const bool is_object_settings = true);

void update_opt_keys(t_config_option_keys& t_optopt_keys, const bool is_object);

Expand Down

0 comments on commit fdb5191

Please sign in to comment.