From c2ee03cebf711c7cfdc19cae4ce245f3e41b869d Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 3 Nov 2023 16:41:42 +0800 Subject: [PATCH] FIX: fix a plate state not correct issue JIRA: no-jira the object and instance states lost after undo Change-Id: I527df9a7d426d994501a4ed5bbb198c7bbac810b --- src/slic3r/GUI/PartPlate.cpp | 10 +++++----- src/slic3r/GUI/PartPlate.hpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index e977eec36..d97532039 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1771,7 +1771,7 @@ void PartPlate::clear(bool clear_sliced_result) /* size and position related functions*/ //set position and size -void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, int height, bool with_instance_move) +void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, int height, bool with_instance_move, bool do_clear) { bool size_changed = false; //size changed means the machine changed bool pos_changed = false; @@ -1825,7 +1825,7 @@ void PartPlate::set_pos_and_size(Vec3d& origin, int width, int depth, int height object->invalidate_bounding_box(); } } - else + else if (do_clear) { clear(); } @@ -3862,7 +3862,7 @@ void PartPlateList::update_plate_cols() return; } -void PartPlateList::update_all_plates_pos_and_size(bool adjust_position, bool with_unprintable_move, bool switch_plate_type) +void PartPlateList::update_all_plates_pos_and_size(bool adjust_position, bool with_unprintable_move, bool switch_plate_type, bool do_clear) { Vec3d origin1, origin2; for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i) @@ -3872,7 +3872,7 @@ void PartPlateList::update_all_plates_pos_and_size(bool adjust_position, bool wi //compute origin1 for PartPlate origin1 = compute_origin(i, m_plate_cols); - plate->set_pos_and_size(origin1, m_plate_width, m_plate_depth, m_plate_height, adjust_position); + plate->set_pos_and_size(origin1, m_plate_width, m_plate_depth, m_plate_height, adjust_position, do_clear); // set default wipe pos when switch plate if (switch_plate_type && m_plater && plate->get_used_extruders().size() <= 0) { @@ -4913,7 +4913,7 @@ int PartPlateList::rebuild_plates_after_deserialize(std::vector& previous_ BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": plates count %1%") % m_plate_list.size(); update_plate_cols(); - update_all_plates_pos_and_size(false, false); + update_all_plates_pos_and_size(false, false, false, false); set_shapes(m_shape, m_exclude_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i) { diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index 774ec7143..cef1ed319 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -294,7 +294,7 @@ public: Vec3d get_center_origin(); /* size and position related functions*/ //set position and size - void set_pos_and_size(Vec3d& origin, int width, int depth, int height, bool with_instance_move); + void set_pos_and_size(Vec3d& origin, int width, int depth, int height, bool with_instance_move, bool do_clear = true); // BBS Vec2d get_size() const { return Vec2d(m_width, m_depth); } @@ -709,7 +709,7 @@ public: //update the plate cols due to plate count change void update_plate_cols(); - void update_all_plates_pos_and_size(bool adjust_position = true, bool with_unprintable_move = true, bool switch_plate_type = false); + void update_all_plates_pos_and_size(bool adjust_position = true, bool with_unprintable_move = true, bool switch_plate_type = false, bool do_clear = true); //get the plate cols int get_plate_cols() { return m_plate_cols; }