Copilot review fixes & upstream code interaction fix (#34)

* first pass at review issue 8
* delete detritus
* fix build compile error due to upstream changes
This commit is contained in:
Joseph Robertson
2026-05-27 21:53:04 -05:00
committed by GitHub
parent 0f75d6bc4e
commit 2dc4900292
5 changed files with 29 additions and 17 deletions

View File

@@ -1,7 +0,0 @@
{
"error_string": "Success.",
"export_time": 0,
"plate_index": 0,
"prepare_time": 0,
"return_code": 0
}

View File

@@ -589,6 +589,14 @@ private:
double m_belt_min_z { 0.0 };
// Belt printer: XY correction from global pre-slice mode, applied to G-code origin.
Vec2d m_belt_global_xy_correction { Vec2d::Zero() };
// Belt printer: exact belt_floor_z_shift computed during posSlice from a
// vertex-level scan of the post-transform mesh. Cached separately from
// m_slicing_params so that rebuilding m_slicing_params on a non-belt-affecting
// invalidation (e.g. support config change) doesn't replace the exact value
// with the bbox approximation seeded by create_from_config(). Cleared when
// posSlice is invalidated.
double m_belt_floor_z_shift_cached { 0.0 };
bool m_belt_floor_z_shift_cache_valid { false };
public:
double belt_global_z_offset() const { return m_belt_global_z_offset; }
double belt_min_z() const { return m_belt_min_z; }

View File

@@ -1461,15 +1461,16 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
invalidated |= this->invalidate_steps({ posPerimeters, posPrepareInfill, posInfill, posIroning, posContouring, posSupportMaterial, posSimplifyPath, posSimplifyInfill });
invalidated |= m_print->invalidate_steps({ psSkirtBrim });
m_slicing_params.valid = false;
// The exact belt_floor_z_shift is recomputed when slice() runs again.
m_belt_floor_z_shift_cache_valid = false;
} else if (step == posSupportMaterial) {
invalidated |= this->invalidate_steps({ posSimplifySupportPath });
invalidated |= m_print->invalidate_steps({ psSkirtBrim });
// NOTE: do NOT set m_slicing_params.valid = false here.
// belt_floor_z_shift is patched to an exact value during posSlice
// (PrintObjectSlice.cpp, after slice_volumes). Invalidating slicing
// params here causes update_slicing_parameters() to overwrite that
// exact value with a bounding-box approximation, while posSlice does
// not re-run to correct it — breaking belt support clipping.
// SlicingParameters depend on support config (enable_support /
// raft_layers / enforce_support_layers feed min/max layer height in
// Slicing.cpp), so invalidate them here. The vertex-scan
// belt_floor_z_shift is preserved via m_belt_floor_z_shift_cached.
m_slicing_params.valid = false;
}
// Wipe tower depends on the ordering of extruders, which in turn depends on everything.
@@ -1487,6 +1488,7 @@ bool PrintObject::invalidate_all_steps()
bool result = Inherited::invalidate_all_steps() | m_print->invalidate_all_steps();
// Then reset some of the depending values.
m_slicing_params.valid = false;
m_belt_floor_z_shift_cache_valid = false;
return result;
}
@@ -3654,6 +3656,11 @@ void PrintObject::update_slicing_parameters()
m_slicing_params.belt_floor_shear_factor = belt_floor.shear_factor;
m_slicing_params.belt_floor_from_axis = belt_floor.from_axis;
m_slicing_params.belt_floor_z_shift = belt_floor.z_shift;
// Prefer the vertex-scan z_shift over the bbox approximation when
// slice() has already produced one (e.g. this rebuild was triggered
// by a support-config change, which doesn't move the belt floor).
if (m_belt_floor_z_shift_cache_valid)
m_slicing_params.belt_floor_z_shift = m_belt_floor_z_shift_cached;
}
}

View File

@@ -1164,6 +1164,13 @@ void PrintObject::slice()
<< " center_offset=(" << unscale<double>(m_center_offset.x())
<< ", " << unscale<double>(m_center_offset.y()) << ")";
}
// Cache the final patched belt_floor_z_shift so a later support-only
// invalidation can rebuild m_slicing_params without losing this exact
// (vertex-scan-derived) value. update_slicing_parameters() will
// restore it after create_from_config() seeds the bbox approximation.
m_belt_floor_z_shift_cached = m_slicing_params.belt_floor_z_shift;
m_belt_floor_z_shift_cache_valid = true;
}
}

View File

@@ -1117,10 +1117,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type,
shader->set_uniform("print_volume.type", -1);
}
bool enable_support;
int support_threshold_angle = get_selection_support_threshold_angle(enable_support);
float normal_z = -::cos(Geometry::deg2rad((float) support_threshold_angle));
const float normal_z = get_selection_support_normal_z();
// Compute up direction accounting for build plate tilt
Vec3f up_direction = Vec3f::UnitZ();