Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-12-04 19:56:49 +0300
committerbubnikv <bubnikv@gmail.com>2018-12-04 19:56:49 +0300
commitc586ca4ae0542a0ac48798ee9da7cddf92fd0834 (patch)
tree174353a033ff279eccbac290a32cc1c6fce24312 /src/slic3r/GUI/Preset.hpp
parent129c35b71438162ae5a0c7a335dd464af118c26e (diff)
Implemented compatible_printer / compatible_printer_condition
for filaments and SLA materials. Fixed compatible_printers / compatible_prints dialog to show system profiles as well.
Diffstat (limited to 'src/slic3r/GUI/Preset.hpp')
-rw-r--r--src/slic3r/GUI/Preset.hpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/slic3r/GUI/Preset.hpp b/src/slic3r/GUI/Preset.hpp
index fc459d8dd..96230ad2b 100644
--- a/src/slic3r/GUI/Preset.hpp
+++ b/src/slic3r/GUI/Preset.hpp
@@ -6,8 +6,8 @@
#include <boost/filesystem/path.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
-#include "../../libslic3r/libslic3r.h"
-#include "../../libslic3r/PrintConfig.hpp"
+#include "libslic3r/libslic3r.h"
+#include "libslic3r/PrintConfig.hpp"
#include "slic3r/Utils/Semver.hpp"
class wxBitmap;
@@ -136,6 +136,7 @@ public:
void set_dirty(bool dirty = true) { this->is_dirty = dirty; }
void reset_dirty() { this->is_dirty = false; }
+ bool is_compatible_with_print(const Preset &active_print) const;
bool is_compatible_with_printer(const Preset &active_printer, const DynamicPrintConfig *extra_config) const;
bool is_compatible_with_printer(const Preset &active_printer) const;
@@ -144,17 +145,28 @@ public:
std::string& inherits() { return Preset::inherits(this->config); }
const std::string& inherits() const { return Preset::inherits(const_cast<Preset*>(this)->config); }
+ // Returns the "compatible_prints_condition".
+ static std::string& compatible_prints_condition(DynamicPrintConfig &cfg) { return cfg.option<ConfigOptionString>("compatible_prints_condition", true)->value; }
+ std::string& compatible_prints_condition() {
+ assert(this->type == TYPE_FILAMENT || this->type == TYPE_SLA_MATERIAL);
+ return Preset::compatible_prints_condition(this->config);
+ }
+ const std::string& compatible_prints_condition() const { return const_cast<Preset*>(this)->compatible_prints_condition(); }
+
// Returns the "compatible_printers_condition".
static std::string& compatible_printers_condition(DynamicPrintConfig &cfg) { return cfg.option<ConfigOptionString>("compatible_printers_condition", true)->value; }
- std::string& compatible_printers_condition() { return Preset::compatible_printers_condition(this->config); }
- const std::string& compatible_printers_condition() const { return Preset::compatible_printers_condition(const_cast<Preset*>(this)->config); }
+ std::string& compatible_printers_condition() {
+ assert(this->type == TYPE_PRINT || this->type == TYPE_SLA_PRINT || this->type == TYPE_FILAMENT || this->type == TYPE_SLA_MATERIAL);
+ return Preset::compatible_printers_condition(this->config);
+ }
+ const std::string& compatible_printers_condition() const { return const_cast<Preset*>(this)->compatible_printers_condition(); }
static PrinterTechnology& printer_technology(DynamicPrintConfig &cfg) { return cfg.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology", true)->value; }
PrinterTechnology& printer_technology() { return Preset::printer_technology(this->config); }
const PrinterTechnology& printer_technology() const { return Preset::printer_technology(const_cast<Preset*>(this)->config); }
// Mark this preset as compatible if it is compatible with active_printer.
- bool update_compatible_with_printer(const Preset &active_printer, const DynamicPrintConfig *extra_config);
+ bool update_compatible(const Preset &active_printer, const DynamicPrintConfig *extra_config, const Preset *active_print = nullptr);
// Set is_visible according to application config
void set_visible_from_appconfig(const AppConfig &app_config);
@@ -333,14 +345,14 @@ public:
// For Print / Filament presets, disable those, which are not compatible with the printer.
template<typename PreferedCondition>
- void update_compatible_with_printer(const Preset &active_printer, bool select_other_if_incompatible, PreferedCondition prefered_condition)
+ void update_compatible(const Preset &active_printer, const Preset *active_print, bool select_other_if_incompatible, PreferedCondition prefered_condition)
{
- if (this->update_compatible_with_printer_internal(active_printer, select_other_if_incompatible) == (size_t)-1)
+ 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_with_printer(const Preset &active_printer, bool select_other_if_incompatible)
- { this->update_compatible_with_printer(active_printer, select_other_if_incompatible, [](const std::string&){return true;}); }
+ void update_compatible(const Preset &active_printer, const Preset *active_print, bool 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;}); }
@@ -408,7 +420,7 @@ private:
std::deque<Preset>::const_iterator find_preset_internal(const std::string &name) const
{ return const_cast<PresetCollection*>(this)->find_preset_internal(name); }
- size_t update_compatible_with_printer_internal(const Preset &active_printer, bool unselect_if_incompatible);
+ size_t update_compatible_internal(const Preset &active_printer, const Preset *active_print, bool unselect_if_incompatible);
static std::vector<std::string> dirty_options(const Preset *edited, const Preset *reference, const bool is_printer_type = false);