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 9ce7de10f4a5f1723439fbefea98595fcf678d69)

* 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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;

View file

@ -121,7 +121,7 @@ public:
// as this class does not use it, thus there is no need to update the UI.
// BBS
bool set_shape(const Pointfs& printable_area, const double printable_height, const std::string& custom_model, bool force_as_custom = false,
const Vec2d position = Vec2d::Zero(), bool with_reset = true);
const Vec2d& position = Vec2d::Zero(), bool with_reset = true);
void set_position(Vec2d& position);
void set_axes_mode(bool origin);

View file

@ -692,11 +692,6 @@ public:
m_height_limit_mode = mode;
}
// SoftFever
const std::string& get_logo_texture_filename() const {
return m_logo_texture_filename;
}
int get_curr_plate_index() const { return m_current_plate; }
PartPlate* get_curr_plate() { return m_plate_list[m_current_plate]; }
const PartPlate* get_curr_plate() const { return m_plate_list[m_current_plate]; }

View file

@ -8162,13 +8162,14 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
float prev_height_lid, prev_height_rod;
partplate_list.get_height_limits(prev_height_lid, prev_height_rod);
auto prev_logo = partplate_list.get_logo_texture_filename();
double height_to_lid = config->opt_float("extruder_clearance_height_to_lid");
double height_to_rod = config->opt_float("extruder_clearance_height_to_rod");
auto custom_bed_texture = config->opt_string("bed_custom_texture");
Pointfs prev_exclude_areas = partplate_list.get_exclude_area();
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas) || (prev_logo != custom_bed_texture);
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas);
if (!new_shape && partplate_list.get_logo_texture_filename() != custom_texture) {
partplate_list.update_logo_texture_filename(custom_texture);
}
if (new_shape) {
if (view3D) view3D->bed_shape_changed();
if (preview) preview->bed_shape_changed();