Skip to content

Commit

Permalink
Gcode editor: show all extruder-indices fields
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Aug 1, 2024
1 parent 5ea305e commit 905a049
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10819,6 +10819,7 @@ OtherPresetsConfigDef::OtherPresetsConfigDef()
def->label = L("Filament preset name");
def->tooltip = L("Names of the filament presets used for slicing. The variable is a vector "
"containing one name for each extruder.");
def->is_vector_extruder = true;

def = this->add("printer_preset", coString);
def->label = L("Printer preset name");
Expand Down
20 changes: 15 additions & 5 deletions src/slic3r/GUI/EditGCodeDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,17 @@ std::string EditGCodeDialog::get_edited_gcode() const

static ParamType get_type(const std::string& opt_key, const ConfigOptionDef& opt_def)
{
return opt_def.is_scalar() ? ParamType::Scalar : ParamType::Vector;
return opt_def.is_scalar() ? ParamType::Scalar : opt_def.is_vector_extruder ? ParamType::FilamentVector : ParamType::Vector;
}

static ParamType get_type(const ConfigOption *optptr) {
if (optptr->is_scalar()) {
return ParamType::Scalar;
} else {
assert(dynamic_cast<const ConfigOptionVectorBase *>(optptr));
return static_cast<const ConfigOptionVectorBase *>(optptr)->is_extruder_size() ? ParamType::FilamentVector :
ParamType::Vector;
}
}

void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name)
Expand Down Expand Up @@ -256,17 +266,17 @@ wxDataViewItem EditGCodeDialog::add_presets_placeholders()
wxDataViewItem print = m_params_list->AppendSubGroup(group, _L("Print settings"), "cog");
for (const auto&opt : print_options)
if (const ConfigOption *optptr = full_config.optptr(opt))
m_params_list->AppendParam(print, optptr->is_scalar() ? ParamType::Scalar : ParamType::Vector, opt);
m_params_list->AppendParam(print, get_type(optptr), opt);

wxDataViewItem material = m_params_list->AppendSubGroup(group, _(is_fff ? L("Filament settings") : L("SLA Materials settings")), is_fff ? "spool" : "resin");
for (const auto&opt : material_options)
if (const ConfigOption *optptr = full_config.optptr(opt))
m_params_list->AppendParam(material, optptr->is_scalar() ? ParamType::Scalar : ParamType::FilamentVector, opt);
m_params_list->AppendParam(material, get_type(optptr), opt);

wxDataViewItem printer = m_params_list->AppendSubGroup(group, _L("Printer settings"), is_fff ? "printer" : "sla_printer");
for (const auto&opt : printer_options)
for (const auto &opt : printer_options)
if (const ConfigOption *optptr = full_config.optptr(opt))
m_params_list->AppendParam(printer, optptr->is_scalar() ? ParamType::Scalar : ParamType::Vector, opt);
m_params_list->AppendParam(printer, get_type(optptr), opt);

return group;
}
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/EditGCodeDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ enum class ParamType {
Undef,
Scalar,
Vector,
FilamentVector,
FilamentVector, // == ExtruderVector
};

// On all of 3 different platforms Bitmap+Text icon column looks different
Expand Down

0 comments on commit 905a049

Please sign in to comment.