FIX: fix a plate state not correct issue

JIRA: no-jira
the object and instance states lost after undo

Change-Id: I527df9a7d426d994501a4ed5bbb198c7bbac810b
This commit is contained in:
lane.wei 2023-11-03 16:41:42 +08:00 committed by Lane.Wei
parent 19cee75e48
commit c2ee03cebf
2 changed files with 7 additions and 7 deletions

View File

@ -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<bool>& 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)
{

View File

@ -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; }