120 Commits

Author SHA1 Message Date
Vojtech Bubnik
827fb8356e Config layer: Refactored handling of open enums 2023-09-05 09:42:36 +02:00
Vojtech Bubnik
8dad25efc4 Merge branch 'master' into master_262 2023-09-04 14:44:32 +02:00
ps_copyright
f32859c302 final copyright headers 2023-09-01 14:49:07 +02:00
enricoturri1966
81b137eb06 Merge branch 'master' of https://github.com/Prusa-Development/PrusaSlicerPrivate into et_spe1784_binary_gcode 2023-08-22 08:37:47 +02:00
Vojtech Bubnik
ae8684a4a4 Added handle_legacy_composite() callback to configuration layer
to support conversion of multiple configuration keys into one
or multiple other configuration keys.
2023-08-21 17:45:15 +02:00
enricoturri1966
eb8d01888d Added import of config from binary gcode files 2023-08-04 12:35:40 +02:00
YuSanka
cde530901a Follow up e3a868202d3e5aa6c843bb579886fab3c0e60c4a - fixed assert 2023-04-26 10:26:27 +02:00
Lukas Matena
1fbbaaae9b Fixed several warnings 2023-03-07 14:47:25 +01:00
Vojtech Bubnik
978f5c8b47 Merge remote-tracking branch 'remotes/origin/master' into vb_ensurovani 2023-02-17 15:20:47 +01:00
YuSanka
8b3ff9b9c4 Fix std::optional value() build error on older macOS SDK
For old macOS (pre 10.14), std::optional does not have .value() method, so the code is using operator*() instead.
2023-02-09 09:08:58 +01:00
YuSanka
917c9ad47b Follow-up to 299b01d
Add select_close GUIType and process it
+ Field::Choice: Fix a check of m_opt.enum_def existence
+ Fixed OSX build
2023-02-09 09:08:58 +01:00
Vojtech Bubnik
d58c8b1bbd Refactor of ConfigDef / ConfigOptionDef / PrintConfigDef /
Field and other UI elements to handle enums in a generic way.
Needs a review by @yusanka
2023-02-09 09:08:58 +01:00
Vojtech Bubnik
001358cbba Merge remote-tracking branch 'remotes/origin/master' into vb_ensurovani 2023-02-02 09:53:14 +01:00
Lukas Matena
a7eda7cc8e Fixed is_nil(size_t) when checking out-of-range element:
the behaviour should math get_at, which returns first element
in case the index is out of range.
2023-01-26 21:29:56 +01:00
Lukas Matena
24a91d7420 Fixed is_nil(size_t) when checking out-of-range element 2023-01-26 07:28:37 +01:00
Vojtech Bubnik
1a5533d571 PlaceholderParser:
1) Implemented access to coEnum values, they are returned as strings.
2) Fixed some possible memory leaks.
3) Fixed some possible union type punning issues.
2023-01-04 13:38:18 +01:00
Vojtech Bubnik
62771bf9c1 Fixed compilation issues and warnings. 2023-01-03 12:57:58 +01:00
YuSanka
f04545f1e6 Implemented a support of the coFloatsOrPercents values on settings tabs 2022-12-14 14:49:20 +01:00
Vojtech Bubnik
009fe1cab4 New method ConfigOptionDef::set_enum_values() to initialize enum
names / values for UI combo boxes using an initializer list of pairs
of values.
2022-10-12 14:12:07 +02:00
YuSanka
16675a42a9 Follow-up f277bc80c2 - Added missed include 2022-08-30 11:10:42 +02:00
YuSanka
f277bc80c2 ConfigOptionDef: min/max values type are changed from INT to FLOAT. 2022-08-30 10:33:52 +02:00
Vojtech Bubnik
d4b8d4d0f3 Further Perl unit test porting to C++ and Perl interface reduction:
Ported cooling, gap fill, thin walls and polyline unit tests.
2022-05-05 17:57:57 +02:00
Vojtech Bubnik
33b2478b69 Ported Infill unit tests from Perl to C++. 2022-05-02 14:34:50 +02:00
YuSanka
a248490507 Fix for #7905 - Segfault when changing printer after loading 3mf with a different printer set
Update searcher only before open one of next dialogs : SearchDialog, UnsavedChangesDialog or DiffPresetDialog.
But only Search dialog respects to the mode of PrusaSlicer
2022-04-11 12:09:30 +02:00
Lukas Matena
5c616c5931 Sync to 2.4.1-beta1 2022-02-01 14:16:13 +01:00
Lukas Matena
ebb9041041 Merge branch 'master' into stable - no conflicts fixed 2022-02-01 14:15:18 +01:00
Vojtech Bubnik
a591d9e9fe Implemented new placeholders for output file name:
1) "initial_filament_type", "printing_filament_types" - really useful
   for multi-material prints

the two other are not so useful, they may become useful once
the output file name template will support not yet defined
vector variables:
2) "initial_tool", "initial_extruder" - zero based index of first extruder
3) "num_printing_extruders" - number of printing extruders.

Fixes Filename incorrect when exporting G-Code with MMU. Always refers filament type in extruder 1 #5300
Fixes Export Filename nicht richtig #7673
Fixes wrong filename - always Filament in from the first extruder #7684
2022-01-10 17:57:03 +01:00
enricoturri1966
ef059404b3 Tech ENABLE_FIX_SUPERSLICER_GCODE_IMPORT set as default 2021-11-30 12:01:22 +01:00
YuSanka
1aaa4845c5 Partially ported https://github.com/supermerill/SuperSlicer/commit/ff195fc9(Add max_literal to setting def, to set the threshold for popup warning for float% fields) from @SuperSlicer
(related to https://github.com/prusa3d/PrusaSlicer/issues/2829#issuecomment-955606863)
2021-11-16 13:44:48 +01:00
enricoturri1966
7ca9024fca #7008 - GCodeViewer - Fixed loading of gcodes generated by SuperSlicer 2021-09-27 11:22:36 +02:00
Vojtech Bubnik
1d6ade1d9c Optimization of ConfigBase::equals() to not create intermediate
list of modified options.

Optimization of DynamicConfig::equals(), ::diff(), ::equal()
to iterate over the two compared std::map trees instead of
first generating a list of keys and then searching for each key
in the respective map.

Optimization of PresetCollection::current_is_dirty() and ::saved_is_dirty()
to call DynamicConfig::equals() instead of ::diff().
2021-08-23 10:47:47 +02:00
Vojtech Bubnik
add67d769a Fix of 2.3.2 regression in configuration layer (reading of nullable
boolean vectors)
Fix of Filament overrides on saved 3MF MMU profiles are broken #6711
2021-08-13 13:53:09 +02:00
bubnikv
16104587ac Improvement in the subtitution information dialog. 2021-08-13 13:49:43 +02:00
bubnikv
26822347ed Forward compatibility, parameter susbtitution: Substitute vector values
(extruder specific) with their default, if the default
is a single value vector.
Show the "Physical Printers" label in the substitution window.
2021-08-13 13:48:28 +02:00
bubnikv
3a0b71deed Configuration compatibility - implemented substitution and reporting for vectors
of bools (including the nullable bools).
2021-08-13 13:48:12 +02:00
bubnikv
c7691ec95e Forward compatibility - config substitutions:
1) Verify whether a value looks like an enum
2) Always report substitution of an enum with a boolean.
2021-08-13 13:43:33 +02:00
Vojtech Bubnik
965c2f2c55 Improved error reporting when importing various configuration files:
1) Slic3r::RuntimeError was replaced with ConfigurationError,
   all exceptions thrown by the configuration layer are derived
   from ConfigurationError.
2) When parsing configuration files, ConfigurationError is catched and
   rethrown extended with the file name being parsed.
2021-08-13 13:37:24 +02:00
Vojtech Bubnik
856da036eb Fixed loading of system presets with incompatible system profile keys
before the "reconfigure" dialog is shown.

Replaced boost::filesystem::copy_file() with Slic3r::copy_file()
in config snapshot loading code.
2021-08-13 13:34:40 +02:00
Vojtech Bubnik
e947a29fc8 Follow-up to 7c01ddf996f4b8ca6d7e71c001e7650b3bf14609
1) Starting with this commit, configuration block exported into G-code
   is delimited by "; prusaslicer_config = begin" and "; prusaslicer_config = end".
   These delimiters look like any other key / value configuration pairs
   on purpose to be compatible with older PrusaSlicer config parsing from G-code.
2) Config parser from G-code newly searches for "; generated by ..."
   comment over the complete G-code, thus it is compatible with various
   post processing scripts extending the G-code at the start.
3) Config parser from G-code parses PrusaSlicer version from
   the "; generated by PrusaSlicer ...." header and if the G-code was
   generated by PrusaSlicer 2.4.0-alpha0 and newer, it expects that
   the G-code already contains the "; prusaslicer_config = begin / end"
   tags and it relies on these tags to extract configuration.
4) A new simple and robust parser was written for reading project configuration
   from 3MF / AMF, while a heuristic parser to read config from G-code located
   at the end of the G-code file was used before.
2021-08-12 15:27:46 +02:00
Vojtech Bubnik
7a60e8cb3a Follow-up to 215ee293ae705943e28ab1509f50d03c85dd26a0:
More robust CLI parser.
2021-08-11 09:49:23 +02:00
Vojtech Bubnik
16e41ab819 Fix of 2.3.2 regression in configuration layer (reading of nullable
boolean vectors)
Fix of Filament overrides on saved 3MF MMU profiles are broken #6711
2021-07-14 10:13:52 +02:00
bubnikv
0a2a86dea4 Improvement in the subtitution information dialog. 2021-07-01 16:48:38 +02:00
bubnikv
3782d6a864 Forward compatibility, parameter susbtitution: Substitute vector values
(extruder specific) with their default, if the default
is a single value vector.
Show the "Physical Printers" label in the substitution window.
2021-07-01 08:44:02 +02:00
bubnikv
e7a6323470 Configuration compatibility - implemented substitution and reporting for vectors
of bools (including the nullable bools).
2021-06-30 18:55:43 +02:00
bubnikv
21cbcd876a Forward compatibility - config substitutions:
1) Verify whether a value looks like an enum
2) Always report substitution of an enum with a boolean.
2021-06-30 16:19:06 +02:00
Vojtech Bubnik
745aa3536d Improved error reporting when importing various configuration files:
1) Slic3r::RuntimeError was replaced with ConfigurationError,
   all exceptions thrown by the configuration layer are derived
   from ConfigurationError.
2) When parsing configuration files, ConfigurationError is catched and
   rethrown extended with the file name being parsed.
2021-06-29 15:41:57 +02:00
Vojtech Bubnik
226bf929fb Fixed loading of system presets with incompatible system profile keys
before the "reconfigure" dialog is shown.

Replaced boost::filesystem::copy_file() with Slic3r::copy_file()
in config snapshot loading code.
2021-06-28 17:26:59 +02:00
Vojtech Bubnik
0f3cabb5d9 Support for forward compatibility of configurations, user and system
config bundles, project files (3MFs, AMFs). When loading these files,
the caller may decide whether to substitute some of the configuration
values the current PrusaSlicer version does not understand with
some reasonable default value, and whether to report it. If substitution
is disabled, an exception is being thrown as before this commit.
If substitution is enabled, list of substitutions is returned by the
API to be presented to the user. This allows us to introduce for example
new firmware flavor key in PrusaSlicer 2.4 while letting PrusaSlicer
2.3.2 to fall back to some default and to report it to the user.

When slicing from command line, substutions are performed by default
and reported into the console, however substitutions may be either
disabled or made silent with the new "config-compatibility" command
line option.

Substitute enums and bools only.  Allow booleans to be parsed as
    true: "1", "enabled", "on" case insensitive
    false: "0", "disabled", "off" case insensitive
This will allow us in the future for example to switch the draft_shield
boolean to an enum with the following values: "disabled" / "enabled" / "limited".

Added "enum_bitmask.hpp" - support for type safe sets of options.
See for example PresetBundle::load_configbundle(...
LoadConfigBundleAttributes flags) for an example of intended usage.

WIP: GUI for reporting the list of config substitutions needs to be
implemented by @YuSanka.
2021-06-27 16:57:05 +02:00
Vojtech Bubnik
84b28a25e8 Support for forward compatibility of configurations, user and system
config bundles, project files (3MFs, AMFs). When loading these files,
the caller may decide whether to substitute some of the configuration
values the current PrusaSlicer version does not understand with
some reasonable default value, and whether to report it. If substitution
is disabled, an exception is being thrown as before this commit.
If substitution is enabled, list of substitutions is returned by the
API to be presented to the user. This allows us to introduce for example
new firmware flavor key in PrusaSlicer 2.4 while letting PrusaSlicer
2.3.2 to fall back to some default and to report it to the user.

As a preparation for PrusaSlicer 2.4.0, the new firmware_flavor
"marlinfirmware" (signifying Marlin 2.0 and newer) that is not
supported by 2.3.2 yet will default to "marlin" (signifying legacy
Marlin).

When slicing from command line, substutions are performed by default
and reported into the console, however substitutions may be either
disabled or made silent with the new "config-compatibility" command
line option.

Substitute enums and bools only.  Allow booleans to be parsed as
    true: "1", "enabled", "on" case insensitive
    false: "0", "disabled", "off" case insensitive
This will allow us in the future for example to switch the draft_shield
boolean to an enum with the following values: "disabled" / "enabled" / "limited".

Added "enum_bitmask.hpp" - support for type safe sets of options.
See for example PresetBundle::load_configbundle(...
LoadConfigBundleAttributes flags) for an example of intended usage.

WIP: GUI for reporting the list of config substitutions needs to be
implemented by @YuSanka.
2021-06-27 16:14:16 +02:00
Vojtech Bubnik
0d081c90f0 Merge remote-tracking branch 'remotes/origin/master' into vb_print_regions 2021-05-26 14:38:34 +02:00