Refactor of ConfigDef / ConfigOptionDef / PrintConfigDef /

Field and other UI elements to handle enums in a generic way.
Needs a review by @yusanka
This commit is contained in:
Vojtech Bubnik 2023-02-01 15:31:10 +01:00 committed by YuSanka
parent a1b0188e3a
commit d58c8b1bbd
14 changed files with 627 additions and 586 deletions
src/libslic3r

View file

@ -243,6 +243,7 @@ PrintConfigDef::PrintConfigDef()
assign_printer_technology_to_unknown(this->options, ptFFF);
this->init_sla_params();
assign_printer_technology_to_unknown(this->options, ptSLA);
this->finalize();
}
void PrintConfigDef::init_common_params()
@ -252,9 +253,7 @@ void PrintConfigDef::init_common_params()
def = this->add("printer_technology", coEnum);
def->label = L("Printer technology");
def->tooltip = L("Printer technology");
def->enum_keys_map = &ConfigOptionEnum<PrinterTechnology>::get_enum_values();
def->enum_values.push_back("FFF");
def->enum_values.push_back("SLA");
def->set_enum<PrinterTechnology>({ "FFF", "SLA" });
def->set_default_value(new ConfigOptionEnum<PrinterTechnology>(ptFFF));
def = this->add("bed_shape", coPoints);
@ -293,10 +292,7 @@ void PrintConfigDef::init_common_params()
def->label = L("Format of G-code thumbnails");
def->tooltip = L("Format of G-code thumbnails: PNG for best quality, JPG for smallest size, QOI for low memory firmware");
def->mode = comExpert;
def->enum_keys_map = &ConfigOptionEnum<GCodeThumbnailsFormat>::get_enum_values();
def->enum_values.push_back("PNG");
def->enum_values.push_back("JPG");
def->enum_values.push_back("QOI");
def->set_enum<GCodeThumbnailsFormat>({ "PNG", "JPG", "QOI" });
def->set_default_value(new ConfigOptionEnum<GCodeThumbnailsFormat>(GCodeThumbnailsFormat::PNG));
def = this->add("layer_height", coFloat);
@ -338,7 +334,7 @@ void PrintConfigDef::init_common_params()
def = this->add("printhost_port", coString);
def->label = L("Printer");
def->tooltip = L("Name of the printer");
def->gui_type = ConfigOptionDef::GUIType::select_open;
// def->gui_type = ConfigOptionDef::GUIType::select_open;
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionString(""));
@ -385,11 +381,10 @@ void PrintConfigDef::init_common_params()
def = this->add("printhost_authorization_type", coEnum);
def->label = L("Authorization Type");
// def->tooltip = L("");
def->enum_keys_map = &ConfigOptionEnum<AuthorizationType>::get_enum_values();
def->enum_values.push_back("key");
def->enum_values.push_back("user");
def->enum_labels.push_back(L("API key"));
def->enum_labels.push_back(L("HTTP digest"));
def->set_enum<AuthorizationType>({
{ "key", L("API key") },
{ "user", L("HTTP digest") }
});
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionEnum<AuthorizationType>(atKeyPassword));
@ -585,15 +580,12 @@ void PrintConfigDef::init_fff_params()
def->label = L("Brim type");
def->category = L("Skirt and brim");
def->tooltip = L("The places where the brim will be printed around each object on the first layer.");
def->enum_keys_map = &ConfigOptionEnum<BrimType>::get_enum_values();
def->enum_values.emplace_back("no_brim");
def->enum_values.emplace_back("outer_only");
def->enum_values.emplace_back("inner_only");
def->enum_values.emplace_back("outer_and_inner");
def->enum_labels.emplace_back(L("No brim"));
def->enum_labels.emplace_back(L("Outer brim only"));
def->enum_labels.emplace_back(L("Inner brim only"));
def->enum_labels.emplace_back(L("Outer and inner brim"));
def->set_enum<BrimType>({
{ "no_brim", L("No brim") },
{ "outer_only", L("Outer brim only") },
{ "inner_only", L("Inner brim only") },
{ "outer_and_inner", L("Outer and inner brim") }
});
def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<BrimType>(btOuterOnly));
@ -774,8 +766,7 @@ void PrintConfigDef::init_fff_params()
def->category = L("Infill");
def->tooltip = L("Fill pattern for top infill. This only affects the top visible layer, and not its adjacent solid shells.");
def->cli = "top-fill-pattern|external-fill-pattern|solid-fill-pattern";
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->set_enum_values({
def->set_enum<InfillPattern>({
{ "rectilinear", L("Rectilinear") },
{ "monotonic", L("Monotonic") },
{ "monotoniclines", L("Monotonic Lines") },
@ -795,9 +786,7 @@ void PrintConfigDef::init_fff_params()
def->category = L("Infill");
def->tooltip = L("Fill pattern for bottom infill. This only affects the bottom external visible layer, and not its adjacent solid shells.");
def->cli = "bottom-fill-pattern|external-fill-pattern|solid-fill-pattern";
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->enum_values = def_top_fill_pattern->enum_values;
def->enum_labels = def_top_fill_pattern->enum_labels;
def->enum_def = Slic3r::clonable_ptr<Slic3r::ConfigOptionEnumDef>(def_top_fill_pattern->enum_def->clone());
def->aliases = def_top_fill_pattern->aliases;
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipMonotonic));
@ -851,18 +840,13 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(false));
def = this->add("extruder", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Extruder");
def->category = L("Extruders");
def->tooltip = L("The extruder to use (unless more specific extruder settings are specified). "
"This value overrides perimeter and infill extruders, but not the support extruders.");
def->min = 0; // 0 = inherit defaults
def->enum_labels.push_back(L("default")); // override label for item 0
def->enum_labels.push_back("1");
def->enum_labels.push_back("2");
def->enum_labels.push_back("3");
def->enum_labels.push_back("4");
def->enum_labels.push_back("5");
def->set_enum_labels(ConfigOptionDef::GUIType::i_enum_open,
{ L("default"), "1", "2", "3", "4", "5" }); // override label for item 0
def = this->add("extruder_clearance_height", coFloat);
def->label = L("Height");
@ -1096,29 +1080,29 @@ void PrintConfigDef::init_fff_params()
def = this->add("filament_type", coStrings);
def->label = L("Filament type");
def->tooltip = L("The filament material type for use in custom G-codes.");
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->gui_flags = "show_value";
def->enum_values.push_back("PLA");
def->enum_values.push_back("PET");
def->enum_values.push_back("ABS");
def->enum_values.push_back("ASA");
def->enum_values.push_back("FLEX");
def->enum_values.push_back("HIPS");
def->enum_values.push_back("EDGE");
def->enum_values.push_back("NGEN");
def->enum_values.push_back("PA");
def->enum_values.push_back("NYLON");
def->enum_values.push_back("PVA");
def->enum_values.push_back("PC");
def->enum_values.push_back("PP");
def->enum_values.push_back("PEI");
def->enum_values.push_back("PEEK");
def->enum_values.push_back("PEKK");
def->enum_values.push_back("POM");
def->enum_values.push_back("PSU");
def->enum_values.push_back("PVDF");
def->enum_values.push_back("SCAFF");
def->set_enum_values(ConfigOptionDef::GUIType::select_open, {
"PLA",
"PET",
"ABS",
"ASA",
"FLEX",
"HIPS",
"EDGE",
"NGEN",
"PA",
"NYLON",
"PVA",
"PC",
"PP",
"PEI",
"PEEK",
"PEKK",
"POM",
"PSU",
"PVDF",
"SCAFF"
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionStrings { "PLA" });
@ -1166,7 +1150,6 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(45));
def = this->add("fill_density", coPercent);
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->gui_flags = "show_value";
def->label = L("Fill density");
def->category = L("Infill");
@ -1174,75 +1157,47 @@ void PrintConfigDef::init_fff_params()
def->sidetext = L("%");
def->min = 0;
def->max = 100;
def->enum_values.push_back("0");
def->enum_values.push_back("5");
def->enum_values.push_back("10");
def->enum_values.push_back("15");
def->enum_values.push_back("20");
def->enum_values.push_back("25");
def->enum_values.push_back("30");
def->enum_values.push_back("40");
def->enum_values.push_back("50");
def->enum_values.push_back("60");
def->enum_values.push_back("70");
def->enum_values.push_back("80");
def->enum_values.push_back("90");
def->enum_values.push_back("100");
def->enum_labels.push_back("0%");
def->enum_labels.push_back("5%");
def->enum_labels.push_back("10%");
def->enum_labels.push_back("15%");
def->enum_labels.push_back("20%");
def->enum_labels.push_back("25%");
def->enum_labels.push_back("30%");
def->enum_labels.push_back("40%");
def->enum_labels.push_back("50%");
def->enum_labels.push_back("60%");
def->enum_labels.push_back("70%");
def->enum_labels.push_back("80%");
def->enum_labels.push_back("90%");
def->enum_labels.push_back("100%");
def->set_enum_values(ConfigOptionDef::GUIType::f_enum_open, {
{ "0", "0%" },
{ "5", "5%" },
{ "10", "10%" },
{ "15", "15%" },
{ "20", "20%" },
{ "25", "25%" },
{ "30", "30%" },
{ "40", "40%" },
{ "50", "50%" },
{ "60", "60%" },
{ "70", "70%" },
{ "80", "80%" },
{ "90", "90%" },
{ "100", "100%" }
});
def->set_default_value(new ConfigOptionPercent(20));
def = this->add("fill_pattern", coEnum);
def->label = L("Fill pattern");
def->category = L("Infill");
def->tooltip = L("Fill pattern for general low-density infill.");
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->enum_values.push_back("rectilinear");
def->enum_values.push_back("alignedrectilinear");
def->enum_values.push_back("grid");
def->enum_values.push_back("triangles");
def->enum_values.push_back("stars");
def->enum_values.push_back("cubic");
def->enum_values.push_back("line");
def->enum_values.push_back("concentric");
def->enum_values.push_back("honeycomb");
def->enum_values.push_back("3dhoneycomb");
def->enum_values.push_back("gyroid");
def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral");
def->enum_values.push_back("adaptivecubic");
def->enum_values.push_back("supportcubic");
def->enum_values.push_back("lightning");
def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back(L("Aligned Rectilinear"));
def->enum_labels.push_back(L("Grid"));
def->enum_labels.push_back(L("Triangles"));
def->enum_labels.push_back(L("Stars"));
def->enum_labels.push_back(L("Cubic"));
def->enum_labels.push_back(L("Line"));
def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back(L("Honeycomb"));
def->enum_labels.push_back(L("3D Honeycomb"));
def->enum_labels.push_back(L("Gyroid"));
def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back(L("Archimedean Chords"));
def->enum_labels.push_back(L("Octagram Spiral"));
def->enum_labels.push_back(L("Adaptive Cubic"));
def->enum_labels.push_back(L("Support Cubic"));
def->enum_labels.push_back(L("Lightning"));
def->set_enum<InfillPattern>({
{ "rectilinear", L("Rectilinear") },
{ "alignedrectilinear", L("Aligned Rectilinear") },
{ "grid", L("Grid") },
{ "triangles", L("Triangles")},
{ "stars", L("Stars")},
{ "cubic", L("Cubic")},
{ "line", L("Line")},
{ "concentric", L("Concentric")},
{ "honeycomb", L("Honeycomb")},
{ "3dhoneycomb", L("3D Honeycomb")},
{ "gyroid", L("Gyroid")},
{ "hilbertcurve", L("Hilbert Curve")},
{ "archimedeanchords", L("Archimedean Chords")},
{ "octagramspiral", L("Octagram Spiral")},
{ "adaptivecubic", L("Adaptive Cubic")},
{ "supportcubic", L("Support Cubic")},
{ "lightning", L("Lightning")}
});
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipStars));
def = this->add("first_layer_acceleration", coFloat);
@ -1343,14 +1298,11 @@ void PrintConfigDef::init_fff_params()
def->label = L("Fuzzy Skin");
def->category = L("Fuzzy Skin");
def->tooltip = L("Fuzzy skin type.");
def->enum_keys_map = &ConfigOptionEnum<FuzzySkinType>::get_enum_values();
def->enum_values.push_back("none");
def->enum_values.push_back("external");
def->enum_values.push_back("all");
def->enum_labels.push_back(L("None"));
def->enum_labels.push_back(L("Outside walls"));
def->enum_labels.push_back(L("All walls"));
def->set_enum<FuzzySkinType>({
{ "none", L("None") },
{ "external", L("Outside walls") },
{ "all", L("All walls") }
});
def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<FuzzySkinType>(FuzzySkinType::None));
@ -1404,31 +1356,20 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Some G/M-code commands, including temperature control and others, are not universal. "
"Set this option to your printer's firmware to get a compatible output. "
"The \"No extrusion\" flavor prevents PrusaSlicer from exporting any extrusion value at all.");
def->enum_keys_map = &ConfigOptionEnum<GCodeFlavor>::get_enum_values();
def->enum_values.push_back("reprap");
def->enum_values.push_back("reprapfirmware");
def->enum_values.push_back("repetier");
def->enum_values.push_back("teacup");
def->enum_values.push_back("makerware");
def->enum_values.push_back("marlin");
def->enum_values.push_back("marlin2");
def->enum_values.push_back("sailfish");
def->enum_values.push_back("mach3");
def->enum_values.push_back("machinekit");
def->enum_values.push_back("smoothie");
def->enum_values.push_back("no-extrusion");
def->enum_labels.push_back("RepRap/Sprinter");
def->enum_labels.push_back("RepRapFirmware");
def->enum_labels.push_back("Repetier");
def->enum_labels.push_back("Teacup");
def->enum_labels.push_back("MakerWare (MakerBot)");
def->enum_labels.push_back("Marlin (legacy)");
def->enum_labels.push_back("Marlin 2");
def->enum_labels.push_back("Sailfish (MakerBot)");
def->enum_labels.push_back("Mach3/LinuxCNC");
def->enum_labels.push_back("Machinekit");
def->enum_labels.push_back("Smoothie");
def->enum_labels.push_back(L("No extrusion"));
def->set_enum<GCodeFlavor>({
{ "reprap", "RepRap/Sprinter" },
{ "reprapfirmware", "RepRapFirmware" },
{ "repetier", "Repetier" },
{ "teacup", "Teacup" },
{ "makerware", "MakerWare (MakerBot)" },
{ "marlin", "Marlin (legacy)" },
{ "marlin2", "Marlin 2" },
{ "sailfish", "Sailfish (MakerBot)" },
{ "mach3", "Mach3/LinuxCNC" },
{ "machinekit", "Machinekit" },
{ "smoothie", "Smoothie" },
{ "no-extrusion", L("No extrusion") }
});
def->mode = comExpert;
def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfRepRapSprinter));
@ -1486,19 +1427,14 @@ void PrintConfigDef::init_fff_params()
def->sidetext = L("mm or %");
def->ratio_over = "infill_extrusion_width";
def->max_literal = 1000;
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->enum_values.push_back("0");
def->enum_values.push_back("1");
def->enum_values.push_back("2");
def->enum_values.push_back("5");
def->enum_values.push_back("10");
def->enum_values.push_back("1000");
def->enum_labels.push_back(L("0 (no open anchors)"));
def->enum_labels.push_back(L("1 mm"));
def->enum_labels.push_back(L("2 mm"));
def->enum_labels.push_back(L("5 mm"));
def->enum_labels.push_back(L("10 mm"));
def->enum_labels.push_back(L("1000 (unlimited)"));
def->set_enum_values(ConfigOptionDef::GUIType::f_enum_open, {
{ "0", L("0 (no open anchors)") },
{ "1", L("1 mm") },
{ "2", L("2 mm") },
{ "5", L("5 mm") },
{ "10", L("10 mm") },
{ "1000", L("1000 (unlimited)") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(600, true));
@ -1514,14 +1450,14 @@ void PrintConfigDef::init_fff_params()
def->sidetext = def_infill_anchor_min->sidetext;
def->ratio_over = def_infill_anchor_min->ratio_over;
def->max_literal = def_infill_anchor_min->max_literal;
def->gui_type = def_infill_anchor_min->gui_type;
def->enum_values = def_infill_anchor_min->enum_values;
def->enum_labels.push_back(L("0 (not anchored)"));
def->enum_labels.push_back(L("1 mm"));
def->enum_labels.push_back(L("2 mm"));
def->enum_labels.push_back(L("5 mm"));
def->enum_labels.push_back(L("10 mm"));
def->enum_labels.push_back(L("1000 (unlimited)"));
def->set_enum_values(ConfigOptionDef::GUIType::f_enum_open, {
{ "0", L("0 (not anchored)") },
{ "1", L("1 mm") },
{ "2", L("2 mm") },
{ "5", L("5 mm") },
{ "10", L("10 mm") },
{ "1000", L("1000 (unlimited)") }
});
def->mode = def_infill_anchor_min->mode;
def->set_default_value(new ConfigOptionFloatOrPercent(50, false));
@ -1625,13 +1561,11 @@ void PrintConfigDef::init_fff_params()
def->label = L("Ironing Type");
def->category = L("Ironing");
def->tooltip = L("Ironing Type");
def->enum_keys_map = &ConfigOptionEnum<IroningType>::get_enum_values();
def->enum_values.push_back("top");
def->enum_values.push_back("topmost");
def->enum_values.push_back("solid");
def->enum_labels.push_back(L("All top surfaces"));
def->enum_labels.push_back(L("Topmost surface only"));
def->enum_labels.push_back(L("All solid surfaces"));
def->set_enum<IroningType>({
{ "top", L("All top surfaces") },
{ "topmost", L("Topmost surface only") },
{ "solid", L("All solid surfaces") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<IroningType>(IroningType::TopSurfaces));
@ -1695,13 +1629,11 @@ void PrintConfigDef::init_fff_params()
def->full_label = L("Purpose of Machine Limits");
def->category = L("Machine limits");
def->tooltip = L("How to apply the Machine Limits");
def->enum_keys_map = &ConfigOptionEnum<MachineLimitsUsage>::get_enum_values();
def->enum_values.push_back("emit_to_gcode");
def->enum_values.push_back("time_estimate_only");
def->enum_values.push_back("ignore");
def->enum_labels.push_back(L("Emit to G-code"));
def->enum_labels.push_back(L("Use for time estimate"));
def->enum_labels.push_back(L("Ignore"));
def->set_enum<MachineLimitsUsage>({
{ "emit_to_gcode", L("Emit to G-code") },
{ "time_estimate_only", L("Use for time estimate") },
{ "ignore", L("Ignore") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<MachineLimitsUsage>(MachineLimitsUsage::TimeEstimateOnly));
@ -1947,23 +1879,16 @@ void PrintConfigDef::init_fff_params()
def->label = L("Host Type");
def->tooltip = L("Slic3r can upload G-code files to a printer host. This field must contain "
"the kind of the host.");
def->enum_keys_map = &ConfigOptionEnum<PrintHostType>::get_enum_values();
def->enum_values.push_back("prusalink");
def->enum_values.push_back("prusaconnect");
def->enum_values.push_back("octoprint");
def->enum_values.push_back("duet");
def->enum_values.push_back("flashair");
def->enum_values.push_back("astrobox");
def->enum_values.push_back("repetier");
def->enum_values.push_back("mks");
def->enum_labels.push_back("PrusaLink");
def->enum_labels.push_back("PrusaConnect");
def->enum_labels.push_back("OctoPrint");
def->enum_labels.push_back("Duet");
def->enum_labels.push_back("FlashAir");
def->enum_labels.push_back("AstroBox");
def->enum_labels.push_back("Repetier");
def->enum_labels.push_back("MKS");
def->set_enum<PrintHostType>({
{ "prusalink", "PrusaLink" },
{ "prusaconnect", "PrusaConnect" },
{ "octoprint", "OctoPrint" },
{ "duet", "Duet" },
{ "flashair", "FlashAir" },
{ "astrobox", "AstroBox" },
{ "repetier", "Repetier" },
{ "mks", "MKS" }
});
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htPrusaLink));
@ -2296,15 +2221,12 @@ void PrintConfigDef::init_fff_params()
def->label = L("Seam position");
def->category = L("Layers and Perimeters");
def->tooltip = L("Position of perimeters starting points.");
def->enum_keys_map = &ConfigOptionEnum<SeamPosition>::get_enum_values();
def->enum_values.push_back("random");
def->enum_values.push_back("nearest");
def->enum_values.push_back("aligned");
def->enum_values.push_back("rear");
def->enum_labels.push_back(L("Random"));
def->enum_labels.push_back(L("Nearest"));
def->enum_labels.push_back(L("Aligned"));
def->enum_labels.push_back(L("Rear"));
def->set_enum<SeamPosition>({
{ "random", L("Random") },
{ "nearest", L("Nearest") },
{ "aligned", L("Aligned") },
{ "rear", L("Rear") }
});
def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<SeamPosition>(spAligned));
@ -2356,13 +2278,11 @@ void PrintConfigDef::init_fff_params()
"Enabled = skirt is as tall as the highest printed object.\n"
"Limited = skirt is as tall as specified by skirt_height.\n"
"This is useful to protect an ABS or ASA print from warping and detaching from print bed due to wind draft.");
def->enum_keys_map = &ConfigOptionEnum<DraftShield>::get_enum_values();
def->enum_values.push_back("disabled");
def->enum_values.push_back("limited");
def->enum_values.push_back("enabled");
def->enum_labels.push_back(L("Disabled"));
def->enum_labels.push_back(L("Limited"));
def->enum_labels.push_back(L("Enabled"));
def->set_enum<DraftShield>({
{ "disabled", L("Disabled") },
{ "limited", L("Limited") },
{ "enabled", L("Enabled") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<DraftShield>(dsDisabled));
@ -2579,13 +2499,11 @@ void PrintConfigDef::init_fff_params()
def->label = L("Slicing Mode");
def->category = L("Advanced");
def->tooltip = L("Use \"Even-odd\" for 3DLabPrint airplane models. Use \"Close holes\" to close all holes in the model.");
def->enum_keys_map = &ConfigOptionEnum<SlicingMode>::get_enum_values();
def->enum_values.push_back("regular");
def->enum_values.push_back("even_odd");
def->enum_values.push_back("close_holes");
def->enum_labels.push_back(L("Regular"));
def->enum_labels.push_back(L("Even-odd"));
def->enum_labels.push_back(L("Close holes"));
def->set_enum<SlicingMode>({
{ "regular", L("Regular") },
{ "even_odd", L("Even-odd") },
{ "close_holes", L("Close holes") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<SlicingMode>(SlicingMode::Regular));
@ -2634,7 +2552,6 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionBool(false));
def = this->add("support_material_contact_distance", coFloat);
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->label = L("Top contact Z distance");
def->category = L("Support material");
def->tooltip = L("The vertical distance between object and support material interface. "
@ -2642,30 +2559,27 @@ void PrintConfigDef::init_fff_params()
"for the first object layer.");
def->sidetext = L("mm");
// def->min = 0;
def->enum_values.push_back("0");
def->enum_values.push_back("0.1");
def->enum_values.push_back("0.2");
def->enum_labels.push_back(L("0 (soluble)"));
def->enum_labels.push_back(L("0.1 (detachable)"));
def->enum_labels.push_back(L("0.2 (detachable)"));
def->set_enum_values(ConfigOptionDef::GUIType::f_enum_open, {
{ "0", L("0 (soluble)") },
{ "0.1", L("0.1 (detachable)") },
{ "0.2", L("0.2 (detachable)") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.2));
def = this->add("support_material_bottom_contact_distance", coFloat);
def->gui_type = ConfigOptionDef::GUIType::f_enum_open;
def->label = L("Bottom contact Z distance");
def->category = L("Support material");
def->tooltip = L("The vertical distance between the object top surface and the support material interface. "
"If set to zero, support_material_contact_distance will be used for both top and bottom contact Z distances.");
def->sidetext = L("mm");
// def->min = 0;
def->enum_values.push_back("0");
def->enum_values.push_back("0.1");
def->enum_values.push_back("0.2");
//TRN To be shown in Print Settings "Bottom contact Z distance". Have to be as short as possible
def->enum_labels.push_back(L("Same as top"));
def->enum_labels.push_back("0.1");
def->enum_labels.push_back("0.2");
def->set_enum_values(ConfigOptionDef::GUIType::f_enum_open, {
{ "0", L("Same as top") },
{ "0.1", "0.1" },
{ "0.2", "0.2" }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
@ -2720,36 +2634,35 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionInt(1));
auto support_material_interface_layers = def = this->add("support_material_interface_layers", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Top interface layers");
def->category = L("Support material");
def->tooltip = L("Number of interface layers to insert between the object(s) and support material.");
def->sidetext = L("layers");
def->min = 0;
def->enum_values.push_back("0");
def->enum_values.push_back("1");
def->enum_values.push_back("2");
def->enum_values.push_back("3");
def->enum_labels.push_back(L("0 (off)"));
def->enum_labels.push_back(L("1 (light)"));
def->enum_labels.push_back(L("2 (default)"));
def->enum_labels.push_back(L("3 (heavy)"));
def->set_enum_values(ConfigOptionDef::GUIType::i_enum_open, {
{ "0", L("0 (off)") },
{ "1", L("1 (light)") },
{ "2", L("2 (default)") },
{ "3", L("3 (heavy)") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInt(3));
def = this->add("support_material_bottom_interface_layers", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Bottom interface layers");
def->category = L("Support material");
def->tooltip = L("Number of interface layers to insert between the object(s) and support material. "
"Set to -1 to use support_material_interface_layers");
def->sidetext = L("layers");
def->min = -1;
def->enum_values.push_back("-1");
append(def->enum_values, support_material_interface_layers->enum_values);
//TRN To be shown in Print Settings "Bottom interface layers". Have to be as short as possible
def->enum_labels.push_back(L("Same as top"));
append(def->enum_labels, support_material_interface_layers->enum_labels);
def->set_enum_values(ConfigOptionDef::GUIType::i_enum_open, {
{ "-1", L("Same as top") },
{ "0", L("0 (off)") },
{ "1", L("1 (light)") },
{ "2", L("2 (default)") },
{ "3", L("3 (heavy)") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInt(-1));
@ -2787,13 +2700,11 @@ void PrintConfigDef::init_fff_params()
def->label = L("Pattern");
def->category = L("Support material");
def->tooltip = L("Pattern used to generate support material.");
def->enum_keys_map = &ConfigOptionEnum<SupportMaterialPattern>::get_enum_values();
def->enum_values.push_back("rectilinear");
def->enum_values.push_back("rectilinear-grid");
def->enum_values.push_back("honeycomb");
def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back(L("Rectilinear grid"));
def->enum_labels.push_back(L("Honeycomb"));
def->set_enum<SupportMaterialPattern>({
{ "rectilinear", L("Rectilinear") },
{ "rectilinear-grid", L("Rectilinear grid") },
{ "honeycomb", L("Honeycomb") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<SupportMaterialPattern>(smpRectilinear));
@ -2803,13 +2714,11 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Pattern used to generate support material interface. "
"Default pattern for non-soluble support interface is Rectilinear, "
"while default pattern for soluble support interface is Concentric.");
def->enum_keys_map = &ConfigOptionEnum<SupportMaterialInterfacePattern>::get_enum_values();
def->enum_values.push_back("auto");
def->enum_values.push_back("rectilinear");
def->enum_values.push_back("concentric");
def->enum_labels.push_back(L("Default"));
def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back(L("Concentric"));
def->set_enum<SupportMaterialInterfacePattern>({
{ "auto", L("Default") },
{ "rectilinear", L("Rectilinear") },
{ "concentric", L("Concentric") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<SupportMaterialInterfacePattern>(smipRectilinear));
@ -2837,8 +2746,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Style and shape of the support towers. Projecting the supports into a regular grid "
"will create more stable supports, while snug support towers will save material and reduce "
"object scarring.");
def->enum_keys_map = &ConfigOptionEnum<SupportMaterialStyle>::get_enum_values();
def->set_enum_values({
def->set_enum<SupportMaterialStyle>({
{ "grid", L("Grid") },
{ "snug", L("Snug") },
{ "organic", L("Organic") }
@ -3207,11 +3115,10 @@ void PrintConfigDef::init_fff_params()
"very thin areas is used gap-fill. "
"Arachne engine produces perimeters with variable extrusion width. "
"This setting also affects the Concentric infill.");
def->enum_keys_map = &ConfigOptionEnum<PerimeterGeneratorType>::get_enum_values();
def->enum_values.push_back("classic");
def->enum_values.push_back("arachne");
def->enum_labels.push_back(L("Classic"));
def->enum_labels.push_back(L("Arachne"));
def->set_enum<PerimeterGeneratorType>({
{ "classic", L("Classic") },
{ "arachne", L("Arachne") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<PerimeterGeneratorType>(PerimeterGeneratorType::Arachne));
@ -3434,13 +3341,9 @@ void PrintConfigDef::init_sla_support_params(const std::string &prefix)
" Can be zig-zag, cross (double zig-zag) or dynamic which"
" will automatically switch between the first two depending"
" on the distance of the two pillars.");
def->enum_keys_map = &ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values();
def->enum_keys_map = &ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values();
def->enum_values = ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_names();
def->enum_labels = ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_names();
def->enum_labels[0] = L("Zig-Zag");
def->enum_labels[1] = L("Cross");
def->enum_labels[2] = L("Dynamic");
def->set_enum<SLAPillarConnectionMode>(
ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_names(),
{ L("Zig-Zag"), L("Cross"), L("Dynamic") });
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum(SLAPillarConnectionMode::dynamic));
@ -3602,11 +3505,10 @@ void PrintConfigDef::init_sla_params()
def->tooltip = L("Set the actual LCD display orientation inside the SLA printer."
" Portrait mode will flip the meaning of display width and height parameters"
" and the output images will be rotated by 90 degrees.");
def->enum_keys_map = &ConfigOptionEnum<SLADisplayOrientation>::get_enum_values();
def->enum_values.push_back("landscape");
def->enum_values.push_back("portrait");
def->enum_labels.push_back(L("Landscape"));
def->enum_labels.push_back(L("Portrait"));
def->set_enum<SLADisplayOrientation>({
{ "landscape", L("Landscape") },
{ "portrait", L("Portrait") }
});
def->mode = comExpert;
def->set_default_value(new ConfigOptionEnum<SLADisplayOrientation>(sladoPortrait));
@ -3718,13 +3620,9 @@ void PrintConfigDef::init_sla_params()
def = this->add("material_type", coString);
def->label = L("SLA material type");
def->tooltip = L("SLA material type");
def->gui_type = ConfigOptionDef::GUIType::f_enum_open; // TODO: ???
def->gui_flags = "show_value";
def->enum_values.push_back("Tough");
def->enum_values.push_back("Flexible");
def->enum_values.push_back("Casting");
def->enum_values.push_back("Dental");
def->enum_values.push_back("Heat-resistant");
def->set_enum_values(ConfigOptionDef::GUIType::select_open,
{ "Tough", "Flexible", "Casting", "Dental", "Heat-resistant" });
def->set_default_value(new ConfigOptionString("Tough"));
def = this->add("initial_layer_height", coFloat);
@ -3898,12 +3796,10 @@ void PrintConfigDef::init_sla_params()
def = this->add("support_tree_type", coEnum);
def->label = L("Support tree type");
def->tooltip = L("Support tree building strategy");
def->enum_keys_map = &ConfigOptionEnum<sla::SupportTreeType>::get_enum_values();
def->enum_values = ConfigOptionEnum<sla::SupportTreeType>::get_enum_names();
def->enum_labels = ConfigOptionEnum<sla::SupportTreeType>::get_enum_names();
def->enum_labels[0] = L("Default");
def->enum_labels[1] = L("Branching (experimental)");
// TODO: def->enum_labels[2] = L("Organic");
def->set_enum<sla::SupportTreeType>(
ConfigOptionEnum<sla::SupportTreeType>::get_enum_names(),
{ L("Default"), L("Branching (experimental)") });
// TODO: def->enum_def->labels[2] = L("Organic");
def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum(sla::SupportTreeType::Default));
@ -4107,13 +4003,11 @@ void PrintConfigDef::init_sla_params()
def->tooltip = L(
"A slower printing profile might be necessary when using materials with higher viscosity "
"or with some hollowed parts. It slows down the tilt movement and adds a delay before exposure.");
def->enum_keys_map = &ConfigOptionEnum<SLAMaterialSpeed>::get_enum_values();
def->enum_values.push_back("slow");
def->enum_values.push_back("fast");
def->enum_values.push_back("high_viscosity");
def->enum_labels.push_back(L("Slow"));
def->enum_labels.push_back(L("Fast"));
def->enum_labels.push_back(L("High viscosity"));
def->set_enum<SLAMaterialSpeed>({
{ "slow", L("Slow") },
{ "fast", L("Fast") },
{ "high_viscosity", L("High viscosity") }
});
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<SLAMaterialSpeed>(slamsFast));
@ -4126,7 +4020,7 @@ void PrintConfigDef::init_sla_params()
def->label = L("SLA output precision");
def->tooltip = L("Minimum resolution in nanometers");
def->sidetext = L("mm");
def->min = SCALING_FACTOR;
def->min = float(SCALING_FACTOR);
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.001));
}
@ -4794,13 +4688,11 @@ CLIMiscConfigDef::CLIMiscConfigDef()
def->tooltip = L("This version of PrusaSlicer may not understand configurations produced by the newest PrusaSlicer versions. "
"For example, newer PrusaSlicer may extend the list of supported firmware flavors. One may decide to "
"bail out or to substitute an unknown value with a default silently or verbosely.");
def->enum_keys_map = &ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>::get_enum_values();
def->enum_values.push_back("disable");
def->enum_values.push_back("enable");
def->enum_values.push_back("enable_silent");
def->enum_labels.push_back(L("Bail out on unknown configuration values"));
def->enum_labels.push_back(L("Enable reading unknown configuration values by verbosely substituting them with defaults."));
def->enum_labels.push_back(L("Enable reading unknown configuration values by silently substituting them with defaults."));
def->set_enum<ForwardCompatibilitySubstitutionRule>({
{ "disable", L("Bail out on unknown configuration values") },
{ "enable", L("Enable reading unknown configuration values by verbosely substituting them with defaults.") },
{ "enable_silent", L("Enable reading unknown configuration values by silently substituting them with defaults.") }
});
def->set_default_value(new ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>(ForwardCompatibilitySubstitutionRule::Enable));
def = this->add("load", coStrings);