mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
dynamic list
This commit is contained in:
parent
c2320e03a5
commit
8ff7b0fac2
3 changed files with 72 additions and 11 deletions
|
@ -2715,6 +2715,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("sparse_infill_filament", coInt);
|
def = this->add("sparse_infill_filament", coInt);
|
||||||
|
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||||
def->label = L("Infill");
|
def->label = L("Infill");
|
||||||
def->category = L("Extruders");
|
def->category = L("Extruders");
|
||||||
def->tooltip = L("Filament to print internal sparse infill.");
|
def->tooltip = L("Filament to print internal sparse infill.");
|
||||||
|
@ -3390,9 +3391,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionBool(true));
|
def->set_default_value(new ConfigOptionBool(true));
|
||||||
|
|
||||||
def = this->add("wall_filament", coInt);
|
def = this->add("wall_filament", coInt);
|
||||||
//def->label = L("Walls");
|
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||||
//def->category = L("Extruders");
|
|
||||||
//def->tooltip = L("Filament to print walls");
|
|
||||||
def->label = "Walls";
|
def->label = "Walls";
|
||||||
def->category = "Extruders";
|
def->category = "Extruders";
|
||||||
def->tooltip = "Filament to print walls";
|
def->tooltip = "Filament to print walls";
|
||||||
|
@ -3983,9 +3982,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionFloat(15));
|
def->set_default_value(new ConfigOptionFloat(15));
|
||||||
|
|
||||||
def = this->add("solid_infill_filament", coInt);
|
def = this->add("solid_infill_filament", coInt);
|
||||||
//def->label = L("Solid infill");
|
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||||
//def->category = L("Extruders");
|
|
||||||
//def->tooltip = L("Filament to print solid infill");
|
|
||||||
def->label = "Solid infill";
|
def->label = "Solid infill";
|
||||||
def->category = "Extruders";
|
def->category = "Extruders";
|
||||||
def->tooltip = "Filament to print solid infill";
|
def->tooltip = "Filament to print solid infill";
|
||||||
|
@ -4913,6 +4910,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionFloat(90.));
|
def->set_default_value(new ConfigOptionFloat(90.));
|
||||||
|
|
||||||
def = this->add("wipe_tower_filament", coInt);
|
def = this->add("wipe_tower_filament", coInt);
|
||||||
|
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
|
||||||
def->label = L("Wipe tower");
|
def->label = L("Wipe tower");
|
||||||
def->category = L("Extruders");
|
def->category = L("Extruders");
|
||||||
def->tooltip = L("The extruder to use when printing perimeter of the wipe tower. "
|
def->tooltip = L("The extruder to use when printing perimeter of the wipe tower. "
|
||||||
|
|
|
@ -545,7 +545,7 @@ std::vector<int> get_min_flush_volumes(const DynamicPrintConfig& full_config)
|
||||||
|
|
||||||
// Sidebar / public
|
// Sidebar / public
|
||||||
|
|
||||||
static struct DynamicFilamentList : DynamicList
|
struct DynamicFilamentList : DynamicList
|
||||||
{
|
{
|
||||||
std::vector<std::pair<wxString, wxBitmap *>> items;
|
std::vector<std::pair<wxString, wxBitmap *>> items;
|
||||||
|
|
||||||
|
@ -590,13 +590,69 @@ static struct DynamicFilamentList : DynamicList
|
||||||
}
|
}
|
||||||
DynamicList::update();
|
DynamicList::update();
|
||||||
}
|
}
|
||||||
} dynamic_filament_list;
|
};
|
||||||
|
|
||||||
|
struct DynamicFilamentList1Based : DynamicFilamentList
|
||||||
|
{
|
||||||
|
void apply_on(Choice *c) override
|
||||||
|
{
|
||||||
|
if (items.empty())
|
||||||
|
update(true);
|
||||||
|
auto cb = dynamic_cast<ComboBox *>(c->window);
|
||||||
|
auto n = cb->GetSelection();
|
||||||
|
cb->Clear();
|
||||||
|
for (auto i : items) {
|
||||||
|
cb->Append(i.first, *i.second);
|
||||||
|
}
|
||||||
|
if (n < cb->GetCount())
|
||||||
|
cb->SetSelection(n);
|
||||||
|
}
|
||||||
|
wxString get_value(int index) override
|
||||||
|
{
|
||||||
|
wxString str;
|
||||||
|
str << index+1;
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
int index_of(wxString value) override
|
||||||
|
{
|
||||||
|
long n = 0;
|
||||||
|
if(!value.ToLong(&n))
|
||||||
|
return -1;
|
||||||
|
--n;
|
||||||
|
return (n >= 0 && n <= items.size()) ? int(n) : -1;
|
||||||
|
}
|
||||||
|
void update(bool force = false)
|
||||||
|
{
|
||||||
|
items.clear();
|
||||||
|
if (!force && m_choices.empty())
|
||||||
|
return;
|
||||||
|
auto icons = get_extruder_color_icons(true);
|
||||||
|
auto presets = wxGetApp().preset_bundle->filament_presets;
|
||||||
|
for (int i = 0; i < presets.size(); ++i) {
|
||||||
|
wxString str;
|
||||||
|
std::string type;
|
||||||
|
wxGetApp().preset_bundle->filaments.find_preset(presets[i])->get_filament_type(type);
|
||||||
|
str << type;
|
||||||
|
items.push_back({str, icons[i]});
|
||||||
|
}
|
||||||
|
DynamicList::update();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static DynamicFilamentList dynamic_filament_list;
|
||||||
|
static DynamicFilamentList1Based dynamic_filament_list_1_based;
|
||||||
|
|
||||||
Sidebar::Sidebar(Plater *parent)
|
Sidebar::Sidebar(Plater *parent)
|
||||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(42 * wxGetApp().em_unit(), -1)), p(new priv(parent))
|
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(42 * wxGetApp().em_unit(), -1)), p(new priv(parent))
|
||||||
{
|
{
|
||||||
Choice::register_dynamic_list("support_filament", &dynamic_filament_list);
|
Choice::register_dynamic_list("support_filament", &dynamic_filament_list);
|
||||||
Choice::register_dynamic_list("support_interface_filament", &dynamic_filament_list);
|
Choice::register_dynamic_list("support_interface_filament", &dynamic_filament_list);
|
||||||
|
Choice::register_dynamic_list("wall_filament", &dynamic_filament_list_1_based);
|
||||||
|
Choice::register_dynamic_list("sparse_infill_filament", &dynamic_filament_list_1_based);
|
||||||
|
Choice::register_dynamic_list("solid_infill_filament", &dynamic_filament_list_1_based);
|
||||||
|
Choice::register_dynamic_list("wipe_tower_filament", &dynamic_filament_list);
|
||||||
|
|
||||||
p->scrolled = new wxPanel(this);
|
p->scrolled = new wxPanel(this);
|
||||||
// p->scrolled->SetScrollbars(0, 100, 1, 2); // ys_DELETE_after_testing. pixelsPerUnitY = 100
|
// p->scrolled->SetScrollbars(0, 100, 1, 2); // ys_DELETE_after_testing. pixelsPerUnitY = 100
|
||||||
|
|
|
@ -1431,9 +1431,16 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||||
m_config->set_key_value("pellet_flow_coefficient", new ConfigOptionFloats{double_value});
|
m_config->set_key_value("pellet_flow_coefficient", new ConfigOptionFloats{double_value});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto bSEMM = m_config->opt_bool("single_extruder_multi_material");
|
||||||
|
|
||||||
|
if (opt_key == "single_extruder_multi_material" ){
|
||||||
|
wxGetApp().sidebar().show_add_del_filament_button(bSEMM);
|
||||||
|
wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(opt_key == "purge_in_prime_tower")
|
||||||
|
wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
|
||||||
|
|
||||||
if (opt_key == "single_extruder_multi_material" )
|
|
||||||
wxGetApp().sidebar().show_add_del_filament_button(m_config->opt_bool("single_extruder_multi_material"));
|
|
||||||
|
|
||||||
if (opt_key == "enable_prime_tower") {
|
if (opt_key == "enable_prime_tower") {
|
||||||
auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
auto timelapse_type = m_config->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||||
|
@ -1647,7 +1654,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||||
|
|
||||||
|
|
||||||
//Orca: sync filament num if it's a multi tool printer
|
//Orca: sync filament num if it's a multi tool printer
|
||||||
if (opt_key == "extruders_count" && !m_config->opt_bool("single_extruder_multi_material")){
|
if (opt_key == "extruders_count" && !bSEMM){
|
||||||
auto num_extruder = boost::any_cast<size_t>(value);
|
auto num_extruder = boost::any_cast<size_t>(value);
|
||||||
wxColour new_col = Plater::get_next_color_for_filament();
|
wxColour new_col = Plater::get_next_color_for_filament();
|
||||||
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
std::string new_color = new_col.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue