fixed an issue that zaa_enabled is redefined in both object and region. move all zaa config to region to keep it consistent

This commit is contained in:
SoftFever
2026-05-01 19:47:00 +08:00
parent 066243afe2
commit 20c3c833df
5 changed files with 28 additions and 17 deletions

View File

@@ -38,7 +38,7 @@ static bool contour_extrusion_path(LayerRegion *region, const sla::IndexedMesh &
Layer *layer = region->layer();
coordf_t mesh_z = layer->print_z + mesh.ground_level();
coordf_t min_z = layer->object()->config().zaa_min_z;
coordf_t min_z = region->region().config().zaa_min_z;
const Points3 &points = path.polyline.points;
double resolution_mm = 0.1;

View File

@@ -1218,7 +1218,10 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
std::unique_ptr<Fill> f = std::unique_ptr<Fill>(Fill::new_from_type(surface_fill.params.pattern));
f->set_bounding_box(bbox);
f->layer_id = this->id();
f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction;
{
const auto &rcfg = m_regions[surface_fill.region_id]->region().config();
f->dont_alternate_fill_direction = rcfg.zaa_enabled && rcfg.zaa_dont_alternate_fill_direction;
}
f->z = this->print_z;
f->angle = surface_fill.params.angle;
f->fixed_angle = surface_fill.params.fixed_angle;
@@ -1419,7 +1422,10 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc
std::unique_ptr<Fill> f = std::unique_ptr<Fill>(Fill::new_from_type(surface_fill.params.pattern));
f->set_bounding_box(bbox);
f->layer_id = this->id() - this->object()->get_layer(0)->id(); // We need to subtract raft layers.
f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction;
{
const auto &rcfg = m_regions[surface_fill.region_id]->region().config();
f->dont_alternate_fill_direction = rcfg.zaa_enabled && rcfg.zaa_dont_alternate_fill_direction;
}
f->z = this->print_z;
f->angle = surface_fill.params.angle;
f->fixed_angle = surface_fill.params.fixed_angle;
@@ -1592,12 +1598,12 @@ void Layer::make_ironing()
std::unique_ptr<Fill> f = std::unique_ptr<Fill>(Fill::new_from_type(f_pattern));
f->set_bounding_box(this->object()->bounding_box());
f->layer_id = this->id();
f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction;
f->z = this->print_z;
f->overlap = 0;
for (size_t i = 0; i < by_extruder.size();) {
// Find span of regions equivalent to the ironing operation.
IroningParams &ironing_params = by_extruder[i];
f->dont_alternate_fill_direction = ironing_params.layerm->region().config().zaa_enabled && ironing_params.layerm->region().config().zaa_dont_alternate_fill_direction;
// Create the filler object.
if( f_pattern != ironing_params.pattern )
{
@@ -1605,7 +1611,6 @@ void Layer::make_ironing()
f = std::unique_ptr<Fill>(Fill::new_from_type(f_pattern));
f->set_bounding_box(this->object()->bounding_box());
f->layer_id = this->id();
f->dont_alternate_fill_direction = this->object()->config().zaa_enabled && this->object()->config().zaa_dont_alternate_fill_direction;
f->z = this->print_z;
f->overlap = 0;
}

View File

@@ -1036,11 +1036,6 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionInt, interlocking_depth))
((ConfigOptionInt, interlocking_boundary_avoidance))
// Z Anti-Aliasing (aka Z Contouring)
((ConfigOptionBool, zaa_enabled))
((ConfigOptionBool, zaa_dont_alternate_fill_direction))
((ConfigOptionFloat, zaa_min_z))
// Orca: internal use only
((ConfigOptionBool, calib_flowrate_topinfill_special_order)) // ORCA: special flag for flow rate calibration
)
@@ -1203,8 +1198,13 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatOrPercent, scarf_joint_speed))
((ConfigOptionFloat, scarf_joint_flow_ratio))
((ConfigOptionPercent, scarf_overhang_threshold))
// Orca: Z Anti-Aliasing (aka Z Contouring)
((ConfigOptionBool, zaa_enabled))((ConfigOptionFloat, zaa_minimize_perimeter_height)))
((ConfigOptionBool, zaa_enabled))
((ConfigOptionBool, zaa_dont_alternate_fill_direction))
((ConfigOptionFloat, zaa_min_z))
((ConfigOptionFloat, zaa_minimize_perimeter_height))
)
PRINT_CONFIG_CLASS_DEFINE(
MachineEnvelopeConfig,

View File

@@ -718,10 +718,6 @@ void PrintObject::ironing()
bool PrintObject::need_z_contouring() const
{
if (this->config().zaa_enabled) {
return true;
}
size_t num_regions = this->num_printing_regions();
for (size_t region_id = 0; region_id < num_regions; region_id++) {
if (this->printing_region(region_id).config().zaa_enabled)

View File

@@ -35,8 +35,18 @@ LayerPtrs new_layers(
coordf_t lo = object_layers[i_layer];
coordf_t hi = object_layers[i_layer + 1];
coordf_t slice_z = 0.5 * (lo + hi);
if (print_object->config().zaa_enabled) {
coordf_t z_offset = print_object->config().zaa_min_z;
bool zaa_active = false;
coordf_t z_offset = 0.0;
size_t num_regions = print_object->num_printing_regions();
for (size_t rid = 0; rid < num_regions; ++rid) {
const auto &rcfg = print_object->printing_region(rid).config();
if (rcfg.zaa_enabled) {
if (!zaa_active || rcfg.zaa_min_z < z_offset)
z_offset = rcfg.zaa_min_z;
zaa_active = true;
}
}
if (zaa_active) {
slice_z = lo + z_offset;
if (slice_z < lo || slice_z > hi) {
throw RuntimeError("Bad min Z value");