diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index f18e4e0255..68f7f7e2d8 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -242,8 +242,8 @@ ConfigDef::merge(const ConfigDef &other) } bool -ConfigBase::has(const t_config_option_key &opt_key) { - return (this->option(opt_key, false) != NULL); +ConfigBase::has(const t_config_option_key &opt_key) const { + return this->option(opt_key) != NULL; } void @@ -272,21 +272,18 @@ ConfigBase::apply_only(const ConfigBase &other, const t_config_option_keys &opt_ } bool -ConfigBase::equals(ConfigBase &other) { +ConfigBase::equals(const ConfigBase &other) const { return this->diff(other).empty(); } // this will *ignore* options not present in both configs t_config_option_keys -ConfigBase::diff(ConfigBase &other) { +ConfigBase::diff(const ConfigBase &other) const { t_config_option_keys diff; - t_config_option_keys my_keys = this->keys(); - for (t_config_option_keys::const_iterator opt_key = my_keys.begin(); opt_key != my_keys.end(); ++opt_key) { - if (other.has(*opt_key) && other.serialize(*opt_key) != this->serialize(*opt_key)) { - diff.push_back(*opt_key); - } - } + for (const t_config_option_key &opt_key : this->keys()) + if (other.has(opt_key) && other.serialize(opt_key) != this->serialize(opt_key)) + diff.push_back(opt_key); return diff; } @@ -391,6 +388,25 @@ ConfigBase::option(const t_config_option_key &opt_key, bool create) { return this->optptr(opt_key, create); } +/* +template +T* +ConfigBase::opt(const t_config_option_key &opt_key, bool create) { + return dynamic_cast(this->option(opt_key, create)); +} +template ConfigOptionInt* ConfigBase::opt(const t_config_option_key &opt_key, bool create); +template ConfigOptionBool* ConfigBase::opt(const t_config_option_key &opt_key, bool create); +template ConfigOptionBools* ConfigBase::opt(const t_config_option_key &opt_key, bool create); +template ConfigOptionPercent* ConfigBase::opt(const t_config_option_key &opt_key, bool create); + + +template +const T* +ConfigBase::opt(const t_config_option_key &opt_key) const { + return dynamic_cast(this->option(opt_key)); +} +*/ + void ConfigBase::load(const std::string &file) { @@ -504,16 +520,6 @@ DynamicConfig::optptr(const t_config_option_key &opt_key, bool create) { return this->options[opt_key]; } -template -T* -DynamicConfig::opt(const t_config_option_key &opt_key, bool create) { - return dynamic_cast(this->option(opt_key, create)); -} -template ConfigOptionInt* DynamicConfig::opt(const t_config_option_key &opt_key, bool create); -template ConfigOptionBool* DynamicConfig::opt(const t_config_option_key &opt_key, bool create); -template ConfigOptionBools* DynamicConfig::opt(const t_config_option_key &opt_key, bool create); -template ConfigOptionPercent* DynamicConfig::opt(const t_config_option_key &opt_key, bool create); - t_config_option_keys DynamicConfig::keys() const { t_config_option_keys keys; diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp index 41d3cc668e..39e8f2f68d 100644 --- a/xs/src/libslic3r/Config.hpp +++ b/xs/src/libslic3r/Config.hpp @@ -644,15 +644,21 @@ class ConfigBase ConfigBase() : def(NULL) {}; ConfigBase(const ConfigDef* def) : def(def) {}; virtual ~ConfigBase() {}; - bool has(const t_config_option_key &opt_key); + bool has(const t_config_option_key &opt_key) const; const ConfigOption* option(const t_config_option_key &opt_key) const; ConfigOption* option(const t_config_option_key &opt_key, bool create = false); + template T* opt(const t_config_option_key &opt_key, bool create = false) { + return dynamic_cast(this->option(opt_key, create)); + }; + template const T* opt(const t_config_option_key &opt_key) const { + return dynamic_cast(this->option(opt_key)); + }; virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) = 0; virtual t_config_option_keys keys() const = 0; void apply(const ConfigBase &other, bool ignore_nonexistent = false); void apply_only(const ConfigBase &other, const t_config_option_keys &opt_keys, bool ignore_nonexistent = false); - bool equals(ConfigBase &other); - t_config_option_keys diff(ConfigBase &other); + bool equals(const ConfigBase &other) const; + t_config_option_keys diff(const ConfigBase &other) const; std::string serialize(const t_config_option_key &opt_key) const; virtual bool set_deserialize(t_config_option_key opt_key, std::string str, bool append = false); double get_abs_value(const t_config_option_key &opt_key) const; @@ -673,7 +679,6 @@ class DynamicConfig : public virtual ConfigBase DynamicConfig& operator= (DynamicConfig other); void swap(DynamicConfig &other); virtual ~DynamicConfig(); - template T* opt(const t_config_option_key &opt_key, bool create = false); virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false); t_config_option_keys keys() const; void erase(const t_config_option_key &opt_key); diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index 807d58b45e..35f6e13e4f 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -147,92 +147,95 @@ Print::delete_region(size_t idx) } bool -Print::invalidate_state_by_config_options(const std::vector &opt_keys) +Print::invalidate_state_by_config(const PrintConfigBase &config) { + const t_config_option_keys diff = this->config.diff(config); + std::set steps; std::set osteps; + bool all = false; // this method only accepts PrintConfig option keys - for (std::vector::const_iterator opt_key = opt_keys.begin(); opt_key != opt_keys.end(); ++opt_key) { - if (*opt_key == "skirts" - || *opt_key == "skirt_height" - || *opt_key == "skirt_distance" - || *opt_key == "min_skirt_length" - || *opt_key == "ooze_prevention") { + for (const t_config_option_key &opt_key : diff) { + if (opt_key == "skirts" + || opt_key == "skirt_height" + || opt_key == "skirt_distance" + || opt_key == "min_skirt_length" + || opt_key == "ooze_prevention") { steps.insert(psSkirt); - } else if (*opt_key == "brim_width" - || *opt_key == "interior_brim_width" - || *opt_key == "brim_connections_width") { + } else if (opt_key == "brim_width" + || opt_key == "interior_brim_width" + || opt_key == "brim_connections_width") { steps.insert(psBrim); steps.insert(psSkirt); - } else if (*opt_key == "nozzle_diameter" - || *opt_key == "resolution" - || *opt_key == "z_steps_per_mm") { + } else if (opt_key == "nozzle_diameter" + || opt_key == "resolution" + || opt_key == "z_steps_per_mm") { osteps.insert(posSlice); - } else if (*opt_key == "avoid_crossing_perimeters" - || *opt_key == "bed_shape" - || *opt_key == "bed_temperature" - || *opt_key == "bridge_acceleration" - || *opt_key == "bridge_fan_speed" - || *opt_key == "complete_objects" - || *opt_key == "cooling" - || *opt_key == "default_acceleration" - || *opt_key == "disable_fan_first_layers" - || *opt_key == "duplicate_distance" - || *opt_key == "end_gcode" - || *opt_key == "extruder_clearance_height" - || *opt_key == "extruder_clearance_radius" - || *opt_key == "extruder_offset" - || *opt_key == "extrusion_axis" - || *opt_key == "extrusion_multiplier" - || *opt_key == "fan_always_on" - || *opt_key == "fan_below_layer_time" - || *opt_key == "filament_colour" - || *opt_key == "filament_diameter" - || *opt_key == "first_layer_acceleration" - || *opt_key == "first_layer_bed_temperature" - || *opt_key == "first_layer_speed" - || *opt_key == "first_layer_temperature" - || *opt_key == "gcode_arcs" - || *opt_key == "gcode_comments" - || *opt_key == "gcode_flavor" - || *opt_key == "infill_acceleration" - || *opt_key == "infill_first" - || *opt_key == "layer_gcode" - || *opt_key == "min_fan_speed" - || *opt_key == "max_fan_speed" - || *opt_key == "min_print_speed" - || *opt_key == "notes" - || *opt_key == "only_retract_when_crossing_perimeters" - || *opt_key == "output_filename_format" - || *opt_key == "perimeter_acceleration" - || *opt_key == "post_process" - || *opt_key == "pressure_advance" - || *opt_key == "retract_before_travel" - || *opt_key == "retract_layer_change" - || *opt_key == "retract_length" - || *opt_key == "retract_length_toolchange" - || *opt_key == "retract_lift" - || *opt_key == "retract_lift_above" - || *opt_key == "retract_lift_below" - || *opt_key == "retract_restart_extra" - || *opt_key == "retract_restart_extra_toolchange" - || *opt_key == "retract_speed" - || *opt_key == "slowdown_below_layer_time" - || *opt_key == "spiral_vase" - || *opt_key == "standby_temperature_delta" - || *opt_key == "start_gcode" - || *opt_key == "temperature" - || *opt_key == "threads" - || *opt_key == "toolchange_gcode" - || *opt_key == "travel_speed" - || *opt_key == "use_firmware_retraction" - || *opt_key == "use_relative_e_distances" - || *opt_key == "vibration_limit" - || *opt_key == "wipe" - || *opt_key == "z_offset") { + } else if (opt_key == "avoid_crossing_perimeters" + || opt_key == "bed_shape" + || opt_key == "bed_temperature" + || opt_key == "bridge_acceleration" + || opt_key == "bridge_fan_speed" + || opt_key == "complete_objects" + || opt_key == "cooling" + || opt_key == "default_acceleration" + || opt_key == "disable_fan_first_layers" + || opt_key == "duplicate_distance" + || opt_key == "end_gcode" + || opt_key == "extruder_clearance_height" + || opt_key == "extruder_clearance_radius" + || opt_key == "extruder_offset" + || opt_key == "extrusion_axis" + || opt_key == "extrusion_multiplier" + || opt_key == "fan_always_on" + || opt_key == "fan_below_layer_time" + || opt_key == "filament_colour" + || opt_key == "filament_diameter" + || opt_key == "first_layer_acceleration" + || opt_key == "first_layer_bed_temperature" + || opt_key == "first_layer_speed" + || opt_key == "first_layer_temperature" + || opt_key == "gcode_arcs" + || opt_key == "gcode_comments" + || opt_key == "gcode_flavor" + || opt_key == "infill_acceleration" + || opt_key == "infill_first" + || opt_key == "layer_gcode" + || opt_key == "min_fan_speed" + || opt_key == "max_fan_speed" + || opt_key == "min_print_speed" + || opt_key == "notes" + || opt_key == "only_retract_when_crossing_perimeters" + || opt_key == "output_filename_format" + || opt_key == "perimeter_acceleration" + || opt_key == "post_process" + || opt_key == "pressure_advance" + || opt_key == "retract_before_travel" + || opt_key == "retract_layer_change" + || opt_key == "retract_length" + || opt_key == "retract_length_toolchange" + || opt_key == "retract_lift" + || opt_key == "retract_lift_above" + || opt_key == "retract_lift_below" + || opt_key == "retract_restart_extra" + || opt_key == "retract_restart_extra_toolchange" + || opt_key == "retract_speed" + || opt_key == "slowdown_below_layer_time" + || opt_key == "spiral_vase" + || opt_key == "standby_temperature_delta" + || opt_key == "start_gcode" + || opt_key == "temperature" + || opt_key == "threads" + || opt_key == "toolchange_gcode" + || opt_key == "travel_speed" + || opt_key == "use_firmware_retraction" + || opt_key == "use_relative_e_distances" + || opt_key == "vibration_limit" + || opt_key == "wipe" + || opt_key == "z_offset") { // these options only affect G-code export, so nothing to invalidate - } else if (*opt_key == "first_layer_extrusion_width") { + } else if (opt_key == "first_layer_extrusion_width") { osteps.insert(posPerimeters); osteps.insert(posInfill); osteps.insert(posSupportMaterial); @@ -240,18 +243,31 @@ Print::invalidate_state_by_config_options(const std::vector steps.insert(psBrim); } else { // for legacy, if we can't handle this option let's invalidate all steps - return this->invalidate_all_steps(); + all = true; + break; } } + if (!diff.empty()) + this->config.apply(config, true); + bool invalidated = false; - for (std::set::const_iterator step = steps.begin(); step != steps.end(); ++step) { - if (this->invalidate_step(*step)) invalidated = true; - } - for (std::set::const_iterator ostep = osteps.begin(); ostep != osteps.end(); ++ostep) { - FOREACH_OBJECT(this, object) { - if ((*object)->invalidate_step(*ostep)) invalidated = true; - } + if (all) { + if (this->invalidate_all_steps()) + invalidated = true; + + for (PrintObject* object : this->objects) + if (object->invalidate_all_steps()) + invalidated = true; + } else { + for (const PrintStep &step : steps) + if (this->invalidate_step(step)) + invalidated = true; + + for (const PrintObjectStep &ostep : osteps) + for (PrintObject* object : this->objects) + if (object->invalidate_step(ostep)) + invalidated = true; } return invalidated; @@ -481,20 +497,12 @@ Print::apply_config(DynamicPrintConfig config) // apply variables to placeholder parser this->placeholder_parser.apply_config(config); - bool invalidated = false; - // handle changes to print config - t_config_option_keys print_diff = this->config.diff(config); - if (!print_diff.empty()) { - this->config.apply(config, true); - - if (this->invalidate_state_by_config_options(print_diff)) - invalidated = true; - } + bool invalidated = this->invalidate_state_by_config(config); // handle changes to object config defaults this->default_object_config.apply(config, true); - FOREACH_OBJECT(this, obj_ptr) { + for (PrintObject* object : this->objects) { // we don't assume that config contains a full ObjectConfig, // so we base it on the current print-wise default PrintObjectConfig new_config = this->default_object_config; @@ -502,19 +510,14 @@ Print::apply_config(DynamicPrintConfig config) // we override the new config with object-specific options { - DynamicPrintConfig model_object_config = (*obj_ptr)->model_object()->config; + DynamicPrintConfig model_object_config = object->model_object()->config; model_object_config.normalize(); new_config.apply(model_object_config, true); } // check whether the new config is different from the current one - t_config_option_keys diff = (*obj_ptr)->config.diff(new_config); - if (!diff.empty()) { - (*obj_ptr)->config.apply(new_config, true); - - if ((*obj_ptr)->invalidate_state_by_config_options(diff)) - invalidated = true; - } + if (object->invalidate_state_by_config(new_config)) + invalidated = true; } // handle changes to regions config defaults @@ -563,14 +566,8 @@ Print::apply_config(DynamicPrintConfig config) // if we're here and the new region config is different from the old // one, we need to apply the new config and invalidate all objects // (possible optimization: only invalidate objects using this region) - t_config_option_keys region_config_diff = region->config.diff(new_config); - if (!region_config_diff.empty()) { - region->config.apply(new_config); - FOREACH_OBJECT(this, o) { - if ((*o)->invalidate_state_by_config_options(region_config_diff)) - invalidated = true; - } - } + if (region->invalidate_state_by_config(new_config)) + invalidated = true; } } other_region_configs.insert(other_region_configs.end(), this_region_configs.begin(), this_region_configs.end()); diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index 18fc760ef6..5e050ccd7f 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -55,6 +55,7 @@ class PrintRegion Print* print(); Flow flow(FlowRole role, double layer_height, bool bridge, bool first_layer, double width, const PrintObject &object) const; + bool invalidate_state_by_config(const PrintConfigBase &config); private: Print* _print; @@ -132,7 +133,7 @@ class PrintObject void delete_support_layer(int idx); // methods for handling state - bool invalidate_state_by_config_options(const std::vector &opt_keys); + bool invalidate_state_by_config(const PrintConfigBase &config); bool invalidate_step(PrintObjectStep step); bool invalidate_all_steps(); @@ -196,7 +197,7 @@ class Print PrintRegion* add_region(); // methods for handling state - bool invalidate_state_by_config_options(const std::vector &opt_keys); + bool invalidate_state_by_config(const PrintConfigBase &config); bool invalidate_step(PrintStep step); bool invalidate_all_steps(); bool step_done(PrintObjectStep step) const; diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index 0e752849f9..5e841b637d 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -212,90 +212,63 @@ PrintObject::delete_support_layer(int idx) } bool -PrintObject::invalidate_state_by_config_options(const std::vector &opt_keys) +PrintObject::invalidate_state_by_config(const PrintConfigBase &config) { + const t_config_option_keys diff = this->config.diff(config); + std::set steps; + bool all = false; // this method only accepts PrintObjectConfig and PrintRegionConfig option keys - for (std::vector::const_iterator opt_key = opt_keys.begin(); opt_key != opt_keys.end(); ++opt_key) { - if (*opt_key == "perimeters" - || *opt_key == "extra_perimeters" - || *opt_key == "gap_fill_speed" - || *opt_key == "overhangs" - || *opt_key == "first_layer_extrusion_width" - || *opt_key == "perimeter_extrusion_width" - || *opt_key == "thin_walls" - || *opt_key == "external_perimeters_first") { - steps.insert(posPerimeters); - } else if (*opt_key == "layer_height" - || *opt_key == "first_layer_height" - || *opt_key == "xy_size_compensation" - || *opt_key == "raft_layers") { + for (const t_config_option_key &opt_key : diff) { + if (opt_key == "layer_height" + || opt_key == "first_layer_height" + || opt_key == "xy_size_compensation" + || opt_key == "raft_layers") { + steps.insert(posSlice); + } else if (opt_key == "support_material_contact_distance") { steps.insert(posSlice); - } else if (*opt_key == "support_material" - || *opt_key == "support_material_angle" - || *opt_key == "support_material_extruder" - || *opt_key == "support_material_extrusion_width" - || *opt_key == "support_material_interface_layers" - || *opt_key == "support_material_interface_extruder" - || *opt_key == "support_material_interface_spacing" - || *opt_key == "support_material_interface_speed" - || *opt_key == "support_material_buildplate_only" - || *opt_key == "support_material_pattern" - || *opt_key == "support_material_spacing" - || *opt_key == "support_material_threshold" - || *opt_key == "dont_support_bridges" - || *opt_key == "first_layer_extrusion_width") { - steps.insert(posSupportMaterial); - } else if (*opt_key == "interface_shells" - || *opt_key == "infill_only_where_needed" - || *opt_key == "infill_every_layers" - || *opt_key == "solid_infill_every_layers" - || *opt_key == "bottom_solid_layers" - || *opt_key == "top_solid_layers" - || *opt_key == "solid_infill_below_area" - || *opt_key == "infill_extruder" - || *opt_key == "solid_infill_extruder" - || *opt_key == "infill_extrusion_width") { - steps.insert(posPrepareInfill); - } else if (*opt_key == "top_infill_pattern" - || *opt_key == "bottom_infill_pattern" - || *opt_key == "fill_angle" - || *opt_key == "fill_pattern" - || *opt_key == "top_infill_extrusion_width" - || *opt_key == "first_layer_extrusion_width" - || *opt_key == "infill_overlap") { - steps.insert(posInfill); - } else if (*opt_key == "fill_density" - || *opt_key == "solid_infill_extrusion_width") { - steps.insert(posPerimeters); - steps.insert(posPrepareInfill); - } else if (*opt_key == "external_perimeter_extrusion_width" - || *opt_key == "perimeter_extruder") { steps.insert(posPerimeters); steps.insert(posSupportMaterial); - } else if (*opt_key == "bridge_flow_ratio") { + } else if (opt_key == "support_material") { steps.insert(posPerimeters); - steps.insert(posInfill); - } else if (*opt_key == "seam_position" - || *opt_key == "support_material_speed" - || *opt_key == "bridge_speed" - || *opt_key == "external_perimeter_speed" - || *opt_key == "infill_speed" - || *opt_key == "perimeter_speed" - || *opt_key == "small_perimeter_speed" - || *opt_key == "solid_infill_speed" - || *opt_key == "top_solid_infill_speed") { + steps.insert(posSupportMaterial); + } else if (opt_key == "support_material_angle" + || opt_key == "support_material_extruder" + || opt_key == "support_material_extrusion_width" + || opt_key == "support_material_interface_layers" + || opt_key == "support_material_interface_extruder" + || opt_key == "support_material_interface_spacing" + || opt_key == "support_material_interface_speed" + || opt_key == "support_material_buildplate_only" + || opt_key == "support_material_pattern" + || opt_key == "support_material_spacing" + || opt_key == "support_material_threshold" + || opt_key == "dont_support_bridges") { + steps.insert(posSupportMaterial); + } else if (opt_key == "interface_shells" + || opt_key == "infill_only_where_needed") { + steps.insert(posPrepareInfill); + } else if (opt_key == "seam_position" + || opt_key == "support_material_speed") { // these options only affect G-code export, so nothing to invalidate } else { // for legacy, if we can't handle this option let's invalidate all steps - return this->invalidate_all_steps(); + all = true; + break; } } + if (!diff.empty()) + this->config.apply(config, true); + bool invalidated = false; - for (std::set::const_iterator step = steps.begin(); step != steps.end(); ++step) { - if (this->invalidate_step(*step)) invalidated = true; + if (all) { + invalidated = this->invalidate_all_steps(); + } else { + for (const PrintObjectStep &step : steps) + if (this->invalidate_step(step)) + invalidated = true; } return invalidated; diff --git a/xs/src/libslic3r/PrintRegion.cpp b/xs/src/libslic3r/PrintRegion.cpp index e6ef456bc4..cb4e7fa2ea 100644 --- a/xs/src/libslic3r/PrintRegion.cpp +++ b/xs/src/libslic3r/PrintRegion.cpp @@ -65,4 +65,91 @@ PrintRegion::flow(FlowRole role, double layer_height, bool bridge, bool first_la return Flow::new_from_config_width(role, config_width, nozzle_diameter, layer_height, bridge ? (float)this->config.bridge_flow_ratio : 0.0); } +bool +PrintRegion::invalidate_state_by_config(const PrintConfigBase &config) +{ + const t_config_option_keys diff = this->config.diff(config); + + std::set steps; + bool all = false; + + for (const t_config_option_key &opt_key : diff) { + if (opt_key == "perimeters" + || opt_key == "extra_perimeters" + || opt_key == "gap_fill_speed" + || opt_key == "overhangs" + || opt_key == "first_layer_extrusion_width" + || opt_key == "perimeter_extrusion_width" + || opt_key == "thin_walls" + || opt_key == "external_perimeters_first") { + steps.insert(posPerimeters); + } else if (opt_key == "first_layer_extrusion_width") { + steps.insert(posSupportMaterial); + } else if (opt_key == "infill_every_layers" + || opt_key == "solid_infill_every_layers" + || opt_key == "bottom_solid_layers" + || opt_key == "top_solid_layers" + || opt_key == "solid_infill_below_area" + || opt_key == "infill_extruder" + || opt_key == "solid_infill_extruder" + || opt_key == "infill_extrusion_width") { + steps.insert(posPrepareInfill); + } else if (opt_key == "top_infill_pattern" + || opt_key == "bottom_infill_pattern" + || opt_key == "fill_angle" + || opt_key == "fill_pattern" + || opt_key == "top_infill_extrusion_width" + || opt_key == "first_layer_extrusion_width" + || opt_key == "infill_overlap") { + steps.insert(posInfill); + } else if (opt_key == "solid_infill_extrusion_width") { + steps.insert(posPerimeters); + steps.insert(posPrepareInfill); + } else if (opt_key == "fill_density") { + const float &cur_value = config.opt("fill_density")->value; + const float &new_value = this->config.fill_density.value; + if ((cur_value == 0) != (new_value == 0)) + steps.insert(posPerimeters); + + steps.insert(posPrepareInfill); + } else if (opt_key == "external_perimeter_extrusion_width" + || opt_key == "perimeter_extruder") { + steps.insert(posPerimeters); + steps.insert(posSupportMaterial); + } else if (opt_key == "bridge_flow_ratio") { + steps.insert(posPerimeters); + steps.insert(posInfill); + } else if (opt_key == "bridge_speed" + || opt_key == "external_perimeter_speed" + || opt_key == "infill_speed" + || opt_key == "perimeter_speed" + || opt_key == "small_perimeter_speed" + || opt_key == "solid_infill_speed" + || opt_key == "top_solid_infill_speed") { + // these options only affect G-code export, so nothing to invalidate + } else { + // for legacy, if we can't handle this option let's invalidate all steps + all = true; + break; + } + } + + if (!diff.empty()) + this->config.apply(config, true); + + bool invalidated = false; + if (all) { + for (PrintObject* object : this->print()->objects) + if (object->invalidate_all_steps()) + invalidated = true; + } else { + for (const PrintObjectStep &step : steps) + for (PrintObject* object : this->print()->objects) + if (object->invalidate_step(step)) + invalidated = true; + } + + return invalidated; +} + } diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index e9a4c1a6d0..59169b3250 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -114,7 +114,6 @@ _constant() Ref add_support_layer(int id, coordf_t height, coordf_t print_z); void delete_support_layer(int idx); - bool invalidate_state_by_config_options(std::vector opt_keys); bool invalidate_step(PrintObjectStep step); bool invalidate_all_steps(); bool step_done(PrintObjectStep step) @@ -190,7 +189,6 @@ _constant() size_t region_count() %code%{ RETVAL = THIS->regions.size(); %}; - bool invalidate_state_by_config_options(std::vector opt_keys); bool invalidate_step(PrintStep step); bool invalidate_all_steps(); bool step_done(PrintStep step)