mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
Various changes in handling of profile compatiblilities
and the "show incompatible profiles" option. It was not able to select the incompatible Print profile, which is possible now. (see Cannot select incompatible printer profile #3715) When the Printer profile derived from the Prusa3D system profile was active or a system Prusa3D profile was active, and when the Print profile with the removed "inherits" field was active (or any other profile derived from the "-- default --" profile was active), then the filament selector offered just the profiles with the removed "inherits" field (or any other profile derived from the "-- default--") profile. This behavior has been now changed, so that in this scenario the Filament selector will offer the Prusa3D vendor profiles compatible with the active Print and Printer profile as well as the user profiles. Slicer was also changed to keep an incompatible preset selected at its respective tab if its respective "Red flag" is enabled. For example, if an incompatible Print preset is selected and a Printer profile is switched to another one which is not compatible with the active Print preset that was red already, the active Print preset is not switched if the Print "Red flag" is active. However, if the Print profile was compatible before the Printer profile is switched and now the Print profile becomes incompatible, another compatible Print profile is selected. A likely bug in wxWidgets was worked around when switching a Print preset on Plater, if the last item in the Print preset was active and incompatible, and another Print preset was selected by the user. On Windows, an CBN_EDITCHANGE is sent just after combo box selection change event and the CBN_EDITCHANGE holds an index of the combo box item, which will be removed by the 1st event, therefore leading to an assert in wxWidgets on CBN_EDITCHANGE. The workaround is to disable processing of CBN_EDITCHANGE on Windows for the Plater preset selection combo boxes.
This commit is contained in:
parent
f053869b56
commit
b4d0d9610e
9 changed files with 79 additions and 44 deletions
|
@ -247,10 +247,19 @@ protected:
|
|||
static std::string remove_suffix_modified(const std::string &name);
|
||||
};
|
||||
|
||||
bool is_compatible_with_print (const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_print);
|
||||
bool is_compatible_with_print (const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_print, const PresetWithVendorProfile &active_printer);
|
||||
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config);
|
||||
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer);
|
||||
|
||||
enum class PresetSelectCompatibleType {
|
||||
// Never select a compatible preset if the newly selected profile is not compatible.
|
||||
Never,
|
||||
// Only select a compatible preset if the active profile used to be compatible, but it is no more.
|
||||
OnlyIfWasCompatible,
|
||||
// Always select a compatible preset if the active profile is no more compatible.
|
||||
Always
|
||||
};
|
||||
|
||||
// Collections of presets of the same type (one of the Print, Filament or Printer type).
|
||||
class PresetCollection
|
||||
{
|
||||
|
@ -412,13 +421,13 @@ public:
|
|||
|
||||
// For Print / Filament presets, disable those, which are not compatible with the printer.
|
||||
template<typename PreferedCondition>
|
||||
void update_compatible(const PresetWithVendorProfile &active_printer, const PresetWithVendorProfile *active_print, bool select_other_if_incompatible, PreferedCondition prefered_condition)
|
||||
void update_compatible(const PresetWithVendorProfile &active_printer, const PresetWithVendorProfile *active_print, PresetSelectCompatibleType select_other_if_incompatible, PreferedCondition prefered_condition)
|
||||
{
|
||||
if (this->update_compatible_internal(active_printer, active_print, select_other_if_incompatible) == (size_t)-1)
|
||||
// Find some other compatible preset, or the "-- default --" preset.
|
||||
this->select_preset(this->first_compatible_idx(prefered_condition));
|
||||
}
|
||||
void update_compatible(const PresetWithVendorProfile &active_printer, const PresetWithVendorProfile *active_print, bool select_other_if_incompatible)
|
||||
void update_compatible(const PresetWithVendorProfile &active_printer, const PresetWithVendorProfile *active_print, PresetSelectCompatibleType select_other_if_incompatible)
|
||||
{ this->update_compatible(active_printer, active_print, select_other_if_incompatible, [](const std::string&){return true;}); }
|
||||
|
||||
size_t num_visible() const { return std::count_if(m_presets.begin(), m_presets.end(), [](const Preset &preset){return preset.is_visible;}); }
|
||||
|
@ -515,7 +524,7 @@ private:
|
|||
std::deque<Preset>::const_iterator find_preset_renamed(const std::string &name) const
|
||||
{ return const_cast<PresetCollection*>(this)->find_preset_renamed(name); }
|
||||
|
||||
size_t update_compatible_internal(const PresetWithVendorProfile &active_printer, const PresetWithVendorProfile *active_print, bool unselect_if_incompatible);
|
||||
size_t update_compatible_internal(const PresetWithVendorProfile &active_printer, const PresetWithVendorProfile *active_print, PresetSelectCompatibleType unselect_if_incompatible);
|
||||
|
||||
static std::vector<std::string> dirty_options(const Preset *edited, const Preset *reference, const bool is_printer_type = false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue