Fix wrong plate y possition after switching profiles with different bed size (#7923)

* FIX:update custom_texture when new_shape=false

Jira: STUDIO-5287
Change-Id: I3add95f9f9345c14a48cc7467513d1b3ce95f4c9
(cherry picked from commit 9ce7de10f4)

* FIX: correct the bed model to the print area origin point

Change-Id: Ieb856dff421d39694966e3c13c519f4ffa3da5c2
(cherry picked from commit 32892514ff)

* Avoid unnecessary copy of `position` parameter

* Merge branch 'main' into bugfox/plater-y
This commit is contained in:
Noisyfox
2025-01-25 11:50:30 +08:00
committed by GitHub
parent 3c3ac1a1cb
commit 4a4f27e599
4 changed files with 7 additions and 11 deletions

View File

@@ -246,7 +246,7 @@ void Bed3D::Axes::render()
//BBS: add part plate logic
bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_height, const std::string& custom_model, bool force_as_custom,
const Vec2d position, bool with_reset)
const Vec2d& position, bool with_reset)
{
/*auto check_texture = [](const std::string& texture) {
boost::system::error_code ec; // so the exists call does not throw (e.g. after a permission problem)
@@ -612,7 +612,7 @@ void Bed3D::render_system(GLCanvas3D& canvas, const Transform3d& view_matrix, co
void Bed3D::update_model_offset()
{
// move the model so that its origin (0.0, 0.0, 0.0) goes into the bed shape center and a bit down to avoid z-fighting with the texture quad
Vec3d shift = m_extended_bounding_box.center();
Vec3d shift = m_build_volume.bounding_volume().center();
shift(2) = -0.03;
Vec3d* model_offset_ptr = const_cast<Vec3d*>(&m_model_offset);
*model_offset_ptr = shift;