diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index c85303c949..5acc2cf8d3 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -5586,82 +5586,36 @@ PRINT_CONFIG_CACHE_INITIALIZE(( SLAMaterialConfig, SLAPrintConfig, SLAPrintObjectConfig, SLAPrinterConfig, SLAFullPrintConfig)) static int print_config_static_initialized = print_config_static_initializer(); +CLIInputConfigDef::CLIInputConfigDef() +{ + ConfigOptionDef* def; + + def = this->add("load", coStrings); + def->label = L("Load config file"); + def->tooltip = L("Load configuration from the specified file. It can be used more than once to load options from multiple files."); + + def = this->add("printer-profile", coString); + def->label = ("Printer preset name"); + def->tooltip = ("Name of the printer preset used for slicing."); + def->set_default_value(new ConfigOptionString()); + + def = this->add("print-profile", coString); + def->label = ("Print preset name"); + def->tooltip = ("Name of the print preset used for slicing."); + def->set_default_value(new ConfigOptionString()); + + def = this->add("material-profile", coStrings); + def->label = ("Material preset name(s)"); + def->tooltip = ("Name(s) of the material preset(s) used for slicing.\n" + "Could be filaments or sla_material preset name(s) depending on printer tochnology"); + def->set_default_value(new ConfigOptionStrings()); +} + CLIActionsConfigDef::CLIActionsConfigDef() { ConfigOptionDef* def; - // Actions: - def = this->add("export_obj", coBool); - def->label = L("Export OBJ"); - def->tooltip = L("Export the model(s) as OBJ."); - def->set_default_value(new ConfigOptionBool(false)); - -/* - def = this->add("export_svg", coBool); - def->label = L("Export SVG"); - def->tooltip = L("Slice the model and export solid slices as SVG."); - def->set_default_value(new ConfigOptionBool(false)); -*/ - - def = this->add("export_sla", coBool); - def->label = L("Export SLA"); - def->tooltip = L("Slice the model and export SLA printing layers as PNG."); - def->cli = "export-sla|sla"; - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("export_3mf", coBool); - def->label = L("Export 3MF"); - def->tooltip = L("Export the model(s) as 3MF."); - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("export_stl", coBool); - def->label = L("Export STL"); - def->tooltip = L("Export the model(s) as STL."); - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("export_gcode", coBool); - def->label = L("Export G-code"); - def->tooltip = L("Slice the model and export toolpaths as G-code."); - def->cli = "export-gcode|gcode|g"; - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("gcodeviewer", coBool); - def->label = L("G-code viewer"); - def->tooltip = L("Visualize an already sliced and saved G-code"); - def->cli = "gcodeviewer"; - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("opengl-aa", coBool); - def->label = L("Automatic OpenGL antialiasing samples number selection"); - def->tooltip = L("Automatically select the highest number of samples for OpenGL antialiasing."); - def->cli = "opengl-aa"; - def->set_default_value(new ConfigOptionBool(false)); - -#if !SLIC3R_OPENGL_ES - def = this->add("opengl-version", coString); - def->label = L("OpenGL version"); - def->tooltip = L("Select a specific version of OpenGL"); - def->cli = "opengl-version"; - def->set_default_value(new ConfigOptionString()); - - def = this->add("opengl-compatibility", coBool); - def->label = L("OpenGL compatibility profile"); - def->tooltip = L("Enable OpenGL compatibility profile"); - def->cli = "opengl-compatibility"; - def->set_default_value(new ConfigOptionBool(false)); - - def = this->add("opengl-debug", coBool); - def->label = L("OpenGL debug output"); - def->tooltip = L("Activate OpenGL debug output on graphic cards which support it (OpenGL 4.3 or higher)"); - def->cli = "opengl-debug"; - def->set_default_value(new ConfigOptionBool(false)); -#endif // !SLIC3R_OPENGL_ES - - def = this->add("slice", coBool); - def->label = L("Slice"); - def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value."); - def->cli = "slice|s"; - def->set_default_value(new ConfigOptionBool(false)); + // doesn't need any aditional input def = this->add("help", coBool); def->label = L("Help"); @@ -5679,15 +5633,86 @@ CLIActionsConfigDef::CLIActionsConfigDef() def->tooltip = L("Show the full list of SLA print configuration options."); def->set_default_value(new ConfigOptionBool(false)); - def = this->add("info", coBool); - def->label = L("Output Model Info"); - def->tooltip = L("Write information about the model to the console."); + def = this->add("query-printer-models", coBool); + def->label = ("Get list of printer models"); + def->tooltip = ("Get list of installed printer models into JSON.\n" + "Note:\n" + "To print printer models for required technology use 'printer-technology' option with value FFF or SLA. By default printer_technology is FFF.\n" + "To print out JSON into file use 'output' option.\n" + "To specify configuration folder use 'datadir' option."); + + // needs a --printer-profile input + + def = this->add("query-print-filament-profiles", coBool); + def->label = ("Get list of print profiles and filament profiles for the selected printer profile"); + def->tooltip = ("Get list of print profiles and filament profiles for the selected 'printer-profile' into JSON.\n" + "Note:\n" + "To print out JSON into file use 'output' option.\n" + "To specify configuration folder use 'datadir' option."); + + // needs nothing or input just one *.gcode file + + def = this->add("gcodeviewer", coBool); + def->label = L("G-code viewer"); + def->tooltip = L("Visualize an already sliced and saved G-code"); + def->cli = "gcodeviewer"; def->set_default_value(new ConfigOptionBool(false)); + // needs a configuration input + def = this->add("save", coString); def->label = L("Save config file"); def->tooltip = L("Save configuration to the specified file."); def->set_default_value(new ConfigOptionString()); + + // needs a model to process this actions + + def = this->add("info", coBool); + def->label = L("Output Model Info"); + def->tooltip = L("Write information about the model to the console."); + def->set_default_value(new ConfigOptionBool(false)); + + def = this->add("export_obj", coBool); + def->label = L("Export OBJ"); + def->tooltip = L("Export the model(s) as OBJ."); + def->set_default_value(new ConfigOptionBool(false)); + + def = this->add("export_stl", coBool); + def->label = L("Export STL"); + def->tooltip = L("Export the model(s) as STL."); + def->set_default_value(new ConfigOptionBool(false)); + + // needs model and configuration + + def = this->add("export_3mf", coBool); + def->label = L("Export 3MF"); + def->tooltip = L("Export the model(s) as 3MF."); + def->set_default_value(new ConfigOptionBool(false)); + + //! slice/export_sla/export_gcode is the same action + //! May be merged into one action "slice_and_export" + + def = this->add("slice", coBool); + def->label = L("Slice"); +// def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value."); + def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value " + "and export FFF printing toolpaths as G-code or SLA printing layers as PNG."); + def->cli = "slice|s"; + def->set_default_value(new ConfigOptionBool(false)); + + /* looks like redundant actions. "slice" is complitely enough + def = this->add("export_sla", coBool); + def->label = L("Export SLA"); + def->tooltip = L("Slice the model and export SLA printing layers as PNG."); + def->cli = "export-sla|sla"; + def->set_default_value(new ConfigOptionBool(false)); + + def = this->add("export_gcode", coBool); + def->label = L("Export G-code"); + def->tooltip = L("Slice the model and export toolpaths as G-code."); + def->cli = "export-gcode|gcode|g"; + def->set_default_value(new ConfigOptionBool(false)); +*/ } CLITransformConfigDef::CLITransformConfigDef() @@ -5705,23 +5730,6 @@ CLITransformConfigDef::CLITransformConfigDef() def->tooltip = L("Cut model at the given Z."); def->set_default_value(new ConfigOptionFloat(0)); -/* - def = this->add("cut_grid", coFloat); - def->label = L("Cut"); - def->tooltip = L("Cut model in the XY plane into tiles of the specified max size."); - def->set_default_value(new ConfigOptionPoint()); - - def = this->add("cut_x", coFloat); - def->label = L("Cut"); - def->tooltip = L("Cut model at the given X."); - def->set_default_value(new ConfigOptionFloat(0)); - - def = this->add("cut_y", coFloat); - def->label = L("Cut"); - def->tooltip = L("Cut model at the given Y."); - def->set_default_value(new ConfigOptionFloat(0)); -*/ - def = this->add("center", coPoint); def->label = L("Center"); def->tooltip = L("Center the print around the given center."); @@ -5750,10 +5758,6 @@ CLITransformConfigDef::CLITransformConfigDef() def->tooltip = L("Arrange the supplied models in a plate and merge them in a single model in order to perform actions once."); def->cli = "merge|m"; - def = this->add("repair", coBool); - def->label = L("Repair"); - def->tooltip = L("Try to repair any non-manifold meshes (this option is implicitly added whenever we need to slice the model to perform the requested action)."); - def = this->add("rotate", coFloat); def->label = L("Rotate"); def->tooltip = L("Rotation angle around the Z axis in degrees."); @@ -5781,11 +5785,7 @@ CLITransformConfigDef::CLITransformConfigDef() def = this->add("scale_to_fit", coPoint3); def->label = L("Scale to Fit"); def->tooltip = L("Scale to fit the given volume."); - def->set_default_value(new ConfigOptionPoint3(Vec3d(0,0,0))); - - def = this->add("delete-after-load", coString); - def->label = L("Delete files after loading"); - def->tooltip = L("Delete files after loading."); + def->set_default_value(new ConfigOptionPoint3(Vec3d(0, 0, 0))); } CLIMiscConfigDef::CLIMiscConfigDef() @@ -5799,34 +5799,20 @@ CLIMiscConfigDef::CLIMiscConfigDef() def = this->add("config_compatibility", coEnum); def->label = L("Forward-compatibility rule when loading configurations from config files and project files (3MF, AMF)."); 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."); + "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->set_enum({ { "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::Enable)); - def = this->add("load", coStrings); - def->label = L("Load config file"); - def->tooltip = L("Load configuration from the specified file. It can be used more than once to load options from multiple files."); - def = this->add("output", coString); def->label = L("Output File"); def->tooltip = L("The file where the output will be written (if not specified, it will be based on the input file)."); def->cli = "output|o"; - def = this->add("single_instance", coBool); - def->label = L("Single instance mode"); - def->tooltip = L("If enabled, the command line arguments are sent to an existing instance of GUI PrusaSlicer, " - "or an existing PrusaSlicer window is activated. " - "Overrides the \"single_instance\" configuration value from application preferences."); - - def = this->add("single_instance_on_url", coBool); - def->label = "Single instance mode for prusaslicer url"; // Not translated on purpose - for internal use only. - def->tooltip = "Works as single_instance but only if prusaslicer url is present."; - def = this->add("datadir", coString); def->label = L("Data directory"); def->tooltip = L("Load and store settings at the given directory. This is useful for maintaining different profiles or including configurations from a network storage."); @@ -5839,85 +5825,69 @@ CLIMiscConfigDef::CLIMiscConfigDef() def = this->add("loglevel", coInt); def->label = L("Logging level"); def->tooltip = L("Sets logging sensitivity. 0:fatal, 1:error, 2:warning, 3:info, 4:debug, 5:trace\n" - "For example. loglevel=2 logs fatal, error and warning level messages."); + "For example. loglevel=2 logs fatal, error and warning level messages."); def->min = 0; - def = this->add("webdev", coBool); - def->label = "Enable webdev tools"; // Not translated on purpose - for internal use only. - def->tooltip = "Enable webdev tools"; +#ifdef SLIC3R_GUI + def = this->add("opengl-aa", coBool); + def->label = L("Automatic OpenGL antialiasing samples number selection"); + def->tooltip = L("Automatically select the highest number of samples for OpenGL antialiasing."); + def->cli = "opengl-aa"; + def->set_default_value(new ConfigOptionBool(false)); + +#if !SLIC3R_OPENGL_ES + def = this->add("opengl-version", coString); + def->label = L("OpenGL version"); + def->tooltip = L("Select a specific version of OpenGL"); + def->cli = "opengl-version"; + def->set_default_value(new ConfigOptionString()); + + def = this->add("opengl-compatibility", coBool); + def->label = L("OpenGL compatibility profile"); + def->tooltip = L("Enable OpenGL compatibility profile"); + def->cli = "opengl-compatibility"; + def->set_default_value(new ConfigOptionBool(false)); + + def = this->add("opengl-debug", coBool); + def->label = L("OpenGL debug output"); + def->tooltip = L("Activate OpenGL debug output on graphic cards which support it (OpenGL 4.3 or higher)"); + def->cli = "opengl-debug"; + def->set_default_value(new ConfigOptionBool(false)); +#endif // !SLIC3R_OPENGL_ES + + def = this->add("single_instance", coBool); + def->label = L("Single instance mode"); + def->tooltip = L("If enabled, the command line arguments are sent to an existing instance of GUI PrusaSlicer, " + "or an existing PrusaSlicer window is activated. " + "Overrides the \"single_instance\" configuration value from application preferences."); + + def = this->add("delete-after-load", coString); + def->label = L("Delete files after loading"); + def->tooltip = L("Delete files after loading."); #if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(SLIC3R_GUI) def = this->add("sw_renderer", coBool); def->label = L("Render with a software renderer"); def->tooltip = L("Render with a software renderer. The bundled MESA software renderer is loaded instead of the default OpenGL driver."); def->min = 0; -#endif /* _MSC_VER */ +#endif // _MSC_VER - def = this->add("printer-profile", coString); - def->label = ("Printer preset name"); - def->tooltip = ("Name of the printer preset used for slicing."); - def->set_default_value(new ConfigOptionString()); + // for internal use only + def = this->add("webdev", coBool); + def->label = "Enable webdev tools"; // Not translated on purpose - for internal use only. + def->tooltip = "Enable webdev tools"; - def = this->add("print-profile", coString); - def->label = ("Print preset name"); - def->tooltip = ("Name of the print preset used for slicing."); - def->set_default_value(new ConfigOptionString()); + def = this->add("single_instance_on_url", coBool); + def->label = "Single instance mode for prusaslicer url"; // Not translated on purpose - for internal use only. + def->tooltip = "Works as single_instance but only if prusaslicer url is present."; - def = this->add("material-profile", coStrings); - def->label = ("Material preset name(s)"); - def->tooltip = ("Name(s) of the material preset(s) used for slicing.\n" - "Could be filaments or sla_material preset name(s) depending on printer tochnology"); - def->set_default_value(new ConfigOptionStrings()); +#endif // SLIC3R_GUI } -CLIProfilesSharingConfigDef::CLIProfilesSharingConfigDef() -{ - ConfigOptionDef* def; - - // Information from this def will be used just for console output. - // So, don't use L marker to label and tooltips values to avoid extract those phrases to translation. - - def = this->add("query-printer-models", coBool); - def->label = ("Get list of printer models"); - def->tooltip = ("Get list of installed printer models into JSON.\n" - "Note:\n" - "To print printer models for required technology use 'printer-technology' option with value FFF or SLA. By default printer_technology is FFF.\n" - "To print out JSON into file use 'output' option.\n" - "To specify configuration folder use 'datadir' option."); - -/* - def = this->add("query-printer-profiles", coBool); - def->label = ("Get list of printer profiles for the selected printer model and printer variant"); - def->tooltip = ("Get list of printer profiles for the selected 'printer-model' and 'printer-variant' into JSON.\n" - "Note:\n" - "To print out JSON into file use 'output' option.\n" - "To specify configuration folder use 'datadir' option."); -*/ - - def = this->add("query-print-filament-profiles", coBool); - def->label = ("Get list of print profiles and filament profiles for the selected printer profile"); - def->tooltip = ("Get list of print profiles and filament profiles for the selected 'printer-profile' into JSON.\n" - "Note:\n" - "To print out JSON into file use 'output' option.\n" - "To specify configuration folder use 'datadir' option."); -} - -const CLIActionsConfigDef cli_actions_config_def; -const CLITransformConfigDef cli_transform_config_def; -const CLIMiscConfigDef cli_misc_config_def; -const CLIProfilesSharingConfigDef cli_profiles_sharing_config_def; - -DynamicPrintAndCLIConfig::PrintAndCLIConfigDef DynamicPrintAndCLIConfig::s_def; - -void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::string &value) const -{ - if (cli_actions_config_def .options.find(opt_key) == cli_actions_config_def .options.end() && - cli_profiles_sharing_config_def.options.find(opt_key) == cli_profiles_sharing_config_def.options.end() && - cli_transform_config_def.options.find(opt_key) == cli_transform_config_def.options.end() && - cli_misc_config_def .options.find(opt_key) == cli_misc_config_def .options.end()) { - PrintConfigDef::handle_legacy(opt_key, value); - } -} +const CLIInputConfigDef cli_input_config_def; +const CLIActionsConfigDef cli_actions_config_def; +const CLITransformConfigDef cli_transform_config_def; +const CLIMiscConfigDef cli_misc_config_def; // SlicingStatesConfigDefs diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index dac7561bdd..a7dfe1a460 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1341,10 +1341,10 @@ public: CLIMiscConfigDef(); }; -class CLIProfilesSharingConfigDef : public ConfigDef +class CLIInputConfigDef : public ConfigDef { public: - CLIProfilesSharingConfigDef(); + CLIInputConfigDef(); }; typedef std::string t_custom_gcode_key; @@ -1409,7 +1409,7 @@ public: }; extern const CustomGcodeSpecificConfigDef custom_gcode_specific_config_def; -// This class defines the command line options representing actions. +// This class defines the command line options representing actions including options representing profiles sharing commands. extern const CLIActionsConfigDef cli_actions_config_def; // This class defines the command line options representing transforms. @@ -1418,42 +1418,8 @@ extern const CLITransformConfigDef cli_transform_config_def; // This class defines all command line options that are not actions or transforms. extern const CLIMiscConfigDef cli_misc_config_def; -// This class defines the command line options representing profiles sharing commands. -extern const CLIProfilesSharingConfigDef cli_profiles_sharing_config_def; - -class DynamicPrintAndCLIConfig : public DynamicPrintConfig -{ -public: - DynamicPrintAndCLIConfig() {} - DynamicPrintAndCLIConfig(const DynamicPrintAndCLIConfig &other) : DynamicPrintConfig(other) {} - - // Overrides ConfigBase::def(). Static configuration definition. Any value stored into this ConfigBase shall have its definition here. - const ConfigDef* def() const override { return &s_def; } - - // Verify whether the opt_key has not been obsoleted or renamed. - // Both opt_key and value may be modified by handle_legacy(). - // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy(). - // handle_legacy() is called internally by set_deserialize(). - void handle_legacy(t_config_option_key &opt_key, std::string &value) const override; - -private: - class PrintAndCLIConfigDef : public ConfigDef - { - public: - PrintAndCLIConfigDef() { - this->options.insert(print_config_def.options.begin(), print_config_def.options.end()); - this->options.insert(cli_actions_config_def.options.begin(), cli_actions_config_def.options.end()); - this->options.insert(cli_transform_config_def.options.begin(), cli_transform_config_def.options.end()); - this->options.insert(cli_misc_config_def.options.begin(), cli_misc_config_def.options.end()); - this->options.insert(cli_profiles_sharing_config_def.options.begin(), cli_profiles_sharing_config_def.options.end()); - for (const auto &kvp : this->options) - this->by_serialization_key_ordinal[kvp.second.serialization_key_ordinal] = &kvp.second; - } - // Do not release the default values, they are handled by print_config_def & cli_actions_config_def / cli_transform_config_def / cli_misc_config_def. - ~PrintAndCLIConfigDef() { this->options.clear(); } - }; - static PrintAndCLIConfigDef s_def; -}; +// This class defines the command line options representing commands for loading configuration from CLI +extern const CLIInputConfigDef cli_input_config_def; bool is_XL_printer(const DynamicPrintConfig &cfg); bool is_XL_printer(const PrintConfig &cfg);