Some fixes after preceding merge. Moved mmu_segmented_region_max_width

from PrintConfig to PrintObjectConfig.
This commit is contained in:
Vojtech Bubnik 2021-05-26 16:14:52 +02:00
parent 980ca195f5
commit 409e1c5cc8
6 changed files with 16 additions and 24 deletions

View File

@ -2075,43 +2075,34 @@ bool model_volume_list_changed(const ModelObject &model_object_old, const ModelO
}); });
} }
bool model_custom_supports_data_changed(const ModelObject& mo, const ModelObject& mo_new) { bool model_custom_supports_data_changed(const ModelObject& mo, const ModelObject& mo_new)
{
assert(! model_volume_list_changed(mo, mo_new, ModelVolumeType::MODEL_PART)); assert(! model_volume_list_changed(mo, mo_new, ModelVolumeType::MODEL_PART));
// FIXME Lukas H.: Because of adding another mesh modifiers when slicing, then assert triggered and possible crash. It requires changing the integration of MMU segmentation. for (size_t i = 0; i < mo.volumes.size(); ++ i)
// assert(mo.volumes.size() == mo_new.volumes.size());
// for (size_t i=0; i<mo.volumes.size(); ++i) {
for (size_t i=0; i<std::min(mo.volumes.size(), mo_new.volumes.size()); ++i) {
if (! mo_new.volumes[i]->supported_facets.timestamp_matches(mo.volumes[i]->supported_facets)) if (! mo_new.volumes[i]->supported_facets.timestamp_matches(mo.volumes[i]->supported_facets))
return true; return true;
}
return false; return false;
} }
bool model_custom_seam_data_changed(const ModelObject& mo, const ModelObject& mo_new) { bool model_custom_seam_data_changed(const ModelObject& mo, const ModelObject& mo_new)
{
assert(! model_volume_list_changed(mo, mo_new, ModelVolumeType::MODEL_PART)); assert(! model_volume_list_changed(mo, mo_new, ModelVolumeType::MODEL_PART));
// FIXME Lukas H.: Because of adding another mesh modifiers when slicing, then assert triggered and possible crash. It requires changing the integration of MMU segmentation. for (size_t i = 0; i < mo.volumes.size(); ++ i)
// assert(mo.volumes.size() == mo_new.volumes.size());
// for (size_t i=0; i<mo.volumes.size(); ++i) {
for (size_t i=0; i<std::min(mo.volumes.size(), mo_new.volumes.size()); ++i) {
if (! mo_new.volumes[i]->seam_facets.timestamp_matches(mo.volumes[i]->seam_facets)) if (! mo_new.volumes[i]->seam_facets.timestamp_matches(mo.volumes[i]->seam_facets))
return true; return true;
}
return false; return false;
} }
bool model_mmu_segmentation_data_changed(const ModelObject& mo, const ModelObject& mo_new) { bool model_mmu_segmentation_data_changed(const ModelObject& mo, const ModelObject& mo_new)
{
assert(! model_volume_list_changed(mo, mo_new, ModelVolumeType::MODEL_PART)); assert(! model_volume_list_changed(mo, mo_new, ModelVolumeType::MODEL_PART));
// FIXME Lukas H.: Because of adding another mesh modifiers when slicing, then assert triggered and possible crash. It requires changing the integration of MMU segmentation. for (size_t i = 0; i < mo.volumes.size(); ++ i)
// assert(mo.volumes.size() == mo_new.volumes.size());
// for (size_t i=0; i<mo.volumes.size(); ++i) {
for (size_t i=0; i<std::min(mo.volumes.size(), mo_new.volumes.size()); ++i) {
if (! mo_new.volumes[i]->mmu_segmentation_facets.timestamp_matches(mo.volumes[i]->mmu_segmentation_facets)) if (! mo_new.volumes[i]->mmu_segmentation_facets.timestamp_matches(mo.volumes[i]->mmu_segmentation_facets))
return true; return true;
}
return false; return false;
} }
extern bool model_has_multi_part_objects(const Model &model) bool model_has_multi_part_objects(const Model &model)
{ {
for (const ModelObject *model_object : model.objects) for (const ModelObject *model_object : model.objects)
if (model_object->volumes.size() != 1 || ! model_object->volumes.front()->is_model_part()) if (model_object->volumes.size() != 1 || ! model_object->volumes.front()->is_model_part())
@ -2119,7 +2110,7 @@ extern bool model_has_multi_part_objects(const Model &model)
return false; return false;
} }
extern bool model_has_advanced_features(const Model &model) bool model_has_advanced_features(const Model &model)
{ {
auto config_is_advanced = [](const ModelConfig &config) { auto config_is_advanced = [](const ModelConfig &config) {
return ! (config.empty() || (config.size() == 1 && config.cbegin()->first == "extruder")); return ! (config.empty() || (config.size() == 1 && config.cbegin()->first == "extruder"));

View File

@ -1511,7 +1511,7 @@ std::vector<std::vector<std::pair<ExPolygon, size_t>>> multi_material_segmentati
} }
}); // end of parallel_for }); // end of parallel_for
if (auto w = print_object.print()->config().mmu_segmented_region_max_width; w > 0.f) if (auto w = print_object.config().mmu_segmented_region_max_width; w > 0.f)
cut_segmented_layers(input_expolygons, segmented_regions, float(-scale_(w))); cut_segmented_layers(input_expolygons, segmented_regions, float(-scale_(w)));
// return segmented_regions; // return segmented_regions;

View File

@ -216,8 +216,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
osteps.emplace_back(posSupportMaterial); osteps.emplace_back(posSupportMaterial);
steps.emplace_back(psSkirt); steps.emplace_back(psSkirt);
steps.emplace_back(psBrim); steps.emplace_back(psBrim);
} else if (opt_key == "mmu_segmented_region_max_width") {
invalidated |= this->invalidate_all_steps();
} else { } else {
// for legacy, if we can't handle this option let's invalidate all steps // for legacy, if we can't handle this option let's invalidate all steps
//FIXME invalidate all steps of all objects as well? //FIXME invalidate all steps of all objects as well?

View File

@ -72,6 +72,8 @@ static inline void model_volume_list_copy_configs(ModelObject &model_object_dst,
mv_dst.supported_facets.assign(mv_src.supported_facets); mv_dst.supported_facets.assign(mv_src.supported_facets);
assert(mv_dst.seam_facets.id() == mv_src.seam_facets.id()); assert(mv_dst.seam_facets.id() == mv_src.seam_facets.id());
mv_dst.seam_facets.assign(mv_src.seam_facets); mv_dst.seam_facets.assign(mv_src.seam_facets);
assert(mv_dst.mmu_segmentation_facets.id() == mv_src.mmu_segmentation_facets.id());
mv_dst.mmu_segmentation_facets.assign(mv_src.mmu_segmentation_facets);
//FIXME what to do with the materials? //FIXME what to do with the materials?
// mv_dst.m_material_id = mv_src.m_material_id; // mv_dst.m_material_id = mv_src.m_material_id;
++ i_src; ++ i_src;

View File

@ -443,6 +443,7 @@ PRINT_CONFIG_CLASS_DEFINE(
// Force the generation of solid shells between adjacent materials/volumes. // Force the generation of solid shells between adjacent materials/volumes.
((ConfigOptionBool, interface_shells)) ((ConfigOptionBool, interface_shells))
((ConfigOptionFloat, layer_height)) ((ConfigOptionFloat, layer_height))
((ConfigOptionFloat, mmu_segmented_region_max_width))
((ConfigOptionFloat, raft_contact_distance)) ((ConfigOptionFloat, raft_contact_distance))
((ConfigOptionFloat, raft_expansion)) ((ConfigOptionFloat, raft_expansion))
((ConfigOptionPercent, raft_first_layer_density)) ((ConfigOptionPercent, raft_first_layer_density))
@ -699,7 +700,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, max_print_height)) ((ConfigOptionFloat, max_print_height))
((ConfigOptionFloats, min_print_speed)) ((ConfigOptionFloats, min_print_speed))
((ConfigOptionFloat, min_skirt_length)) ((ConfigOptionFloat, min_skirt_length))
((ConfigOptionFloat, mmu_segmented_region_max_width))
((ConfigOptionString, notes)) ((ConfigOptionString, notes))
((ConfigOptionFloats, nozzle_diameter)) ((ConfigOptionFloats, nozzle_diameter))
((ConfigOptionBool, only_retract_when_crossing_perimeters)) ((ConfigOptionBool, only_retract_when_crossing_perimeters))

View File

@ -523,6 +523,7 @@ bool PrintObject::invalidate_state_by_config_options(
} else if ( } else if (
opt_key == "layer_height" opt_key == "layer_height"
|| opt_key == "first_layer_height" || opt_key == "first_layer_height"
|| opt_key == "mmu_segmented_region_max_width"
|| opt_key == "raft_layers" || opt_key == "raft_layers"
|| opt_key == "raft_contact_distance" || opt_key == "raft_contact_distance"
|| opt_key == "slice_closing_radius") { || opt_key == "slice_closing_radius") {