mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 04:08:02 -06:00
Subgroup presets by page
This commit is contained in:
parent
7297997837
commit
7f1f94d531
2 changed files with 34 additions and 17 deletions
|
@ -207,33 +207,49 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name)
|
||||||
|
|
||||||
wxDataViewItem EditGCodeDialog::add_presets_placeholders()
|
wxDataViewItem EditGCodeDialog::add_presets_placeholders()
|
||||||
{
|
{
|
||||||
auto get_set_from_vec = [](const std::vector<std::string>&vec) {
|
|
||||||
return std::set<std::string>(vec.begin(), vec.end());
|
|
||||||
};
|
|
||||||
|
|
||||||
const bool is_fff = wxGetApp().plater()->printer_technology() == ptFFF;
|
const bool is_fff = wxGetApp().plater()->printer_technology() == ptFFF;
|
||||||
const std::set<std::string> print_options = get_set_from_vec(is_fff ? Preset::print_options() : Preset::sla_print_options());
|
|
||||||
const std::set<std::string> material_options = get_set_from_vec(is_fff ? Preset::filament_options() : Preset::sla_material_options());
|
|
||||||
const std::set<std::string> printer_options = get_set_from_vec(is_fff ? Preset::printer_options() : Preset::sla_printer_options());
|
|
||||||
|
|
||||||
const auto&full_config = wxGetApp().preset_bundle->full_config();
|
const auto&full_config = wxGetApp().preset_bundle->full_config();
|
||||||
|
const auto& tab_list = wxGetApp().tabs_list;
|
||||||
|
|
||||||
|
Tab* tab_print;
|
||||||
|
Tab* tab_filament;
|
||||||
|
Tab* tab_printer;
|
||||||
|
for (const auto tab : tab_list) {
|
||||||
|
if (tab->m_type == Preset::TYPE_PRINT)
|
||||||
|
tab_print = tab;
|
||||||
|
else if (tab->m_type == Preset::TYPE_FILAMENT)
|
||||||
|
tab_filament = tab;
|
||||||
|
else if (tab->m_type == Preset::TYPE_PRINTER)
|
||||||
|
tab_printer = tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Orca: create subgroups from the pages of the tabs
|
||||||
|
auto init_from_tab = [this, full_config](wxDataViewItem parent, Tab* tab){
|
||||||
|
for (const auto& page : tab->m_pages) {
|
||||||
|
wxDataViewItem subgroup = m_params_list->AppendSubGroup(parent, page->title(), "empty");
|
||||||
|
std::vector<std::string> opt_keys;
|
||||||
|
for (const auto& optgroup : page->m_optgroups)
|
||||||
|
for (const auto& opt : optgroup->opt_map())
|
||||||
|
opt_keys.push_back(opt.first);
|
||||||
|
|
||||||
|
std::sort(opt_keys.begin(), opt_keys.end());
|
||||||
|
for (const auto& opt_key : opt_keys)
|
||||||
|
if (const ConfigOption* optptr = full_config.optptr(opt_key))
|
||||||
|
m_params_list->AppendParam(subgroup, optptr->is_scalar() ? ParamType::Scalar : ParamType::Vector, opt_key);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
wxDataViewItem group = m_params_list->AppendGroup(_L("Presets"), "cog");
|
wxDataViewItem group = m_params_list->AppendGroup(_L("Presets"), "cog");
|
||||||
|
|
||||||
wxDataViewItem print = m_params_list->AppendSubGroup(group, _L("Print settings"), "cog");
|
wxDataViewItem print = m_params_list->AppendSubGroup(group, _L("Print settings"), "cog");
|
||||||
for (const auto&opt : print_options)
|
init_from_tab(print, tab_print);
|
||||||
if (const ConfigOption *optptr = full_config.optptr(opt))
|
|
||||||
m_params_list->AppendParam(print, optptr->is_scalar() ? ParamType::Scalar : ParamType::Vector, opt);
|
|
||||||
|
|
||||||
wxDataViewItem material = m_params_list->AppendSubGroup(group, _(is_fff ? L("Filament settings") : L("SLA Materials settings")), is_fff ? "filament" : "resin");
|
wxDataViewItem material = m_params_list->AppendSubGroup(group, _(is_fff ? L("Filament settings") : L("SLA Materials settings")), is_fff ? "filament" : "resin");
|
||||||
for (const auto&opt : material_options)
|
init_from_tab(material, tab_filament);
|
||||||
if (const ConfigOption *optptr = full_config.optptr(opt))
|
|
||||||
m_params_list->AppendParam(material, optptr->is_scalar() ? ParamType::Scalar : ParamType::FilamentVector, opt);
|
|
||||||
|
|
||||||
wxDataViewItem printer = m_params_list->AppendSubGroup(group, _L("Printer settings"), is_fff ? "printer" : "sla_printer");
|
wxDataViewItem printer = m_params_list->AppendSubGroup(group, _L("Printer settings"), is_fff ? "printer" : "sla_printer");
|
||||||
for (const auto&opt : printer_options)
|
init_from_tab(printer, tab_printer);
|
||||||
if (const ConfigOption *optptr = full_config.optptr(opt))
|
|
||||||
m_params_list->AppendParam(printer, optptr->is_scalar() ? ParamType::Scalar : ParamType::Vector, opt);
|
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
|
@ -434,6 +434,7 @@ protected:
|
||||||
|
|
||||||
ConfigManipulation m_config_manipulation;
|
ConfigManipulation m_config_manipulation;
|
||||||
ConfigManipulation get_config_manipulation();
|
ConfigManipulation get_config_manipulation();
|
||||||
|
friend class EditGCodeDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabPrint : public Tab
|
class TabPrint : public Tab
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue