From 633f1b05ec207fa2b04bd80888eeb18ad291dc4d Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Thu, 26 Oct 2023 11:53:23 +0800 Subject: [PATCH] FIX:cancel undo/redo function of plate related geometric parameters Jira: STUDIO-4864 Change-Id: I97dffd03bcdc7988edd09d99e612dbdced072009 --- src/slic3r/GUI/PartPlate.cpp | 11 +++-------- src/slic3r/GUI/PartPlate.hpp | 8 ++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index cd5d5be5b..4e3b285fd 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -3061,14 +3061,8 @@ void PartPlateList::init() Vec3d PartPlateList::compute_origin(int i, int cols) { Vec3d origin; - int row, col; - - row = i / cols; - col = i % cols; - - origin(0) = col * (m_plate_width * (1. + LOGICAL_PART_PLATE_GAP)); - origin(1) = -row * (m_plate_depth * (1. + LOGICAL_PART_PLATE_GAP)); - origin(2) = 0; + Vec2d pos = compute_shape_position(i, cols); + origin = Vec3d(pos.x(), pos.y(), 0); return origin; } @@ -4919,6 +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(true, 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 e17644e18..774ec7143 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -480,7 +480,7 @@ public: std::vector> objects_and_instances; std::vector> instances_outside; - ar(m_plate_index, m_print_index, m_origin, m_width, m_depth, m_height, m_locked, m_selected, m_ready_for_slice, m_slice_result_valid, m_apply_invalid, m_printable, m_tmp_gcode_path, objects_and_instances, instances_outside, m_config, m_name); + ar(m_plate_index, m_print_index, m_locked, m_selected, m_ready_for_slice, m_slice_result_valid, m_apply_invalid, m_printable, m_tmp_gcode_path, objects_and_instances, instances_outside, m_config, m_name); for (std::vector>::iterator it = objects_and_instances.begin(); it != objects_and_instances.end(); ++it) obj_to_instance_set.insert(std::pair(it->first, it->second)); @@ -498,7 +498,7 @@ public: for (std::set>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it) objects_and_instances.emplace_back(it->first, it->second); - ar(m_plate_index, m_print_index, m_origin, m_width, m_depth, m_height, m_locked, m_selected, m_ready_for_slice, m_slice_result_valid, m_apply_invalid, m_printable,m_tmp_gcode_path, objects_and_instances, instances_outside, m_config, m_name); + ar(m_plate_index, m_print_index, m_locked, m_selected, m_ready_for_slice, m_slice_result_valid, m_apply_invalid, m_printable,m_tmp_gcode_path, objects_and_instances, instances_outside, m_config, m_name); } /*template void serialize(Archive& ar) { @@ -825,8 +825,8 @@ public: template void serialize(Archive& ar) { //ar(cereal::base_class(this)); - //Cancel undo/redo for m_shape ,Because the printing area of different models is different, currently if the grid changes, it cannot correspond to the model on the left ui - ar(m_plate_width, m_plate_depth, m_plate_height, m_height_to_lid, m_height_to_rod, m_height_limit_mode, m_plate_count, m_current_plate, m_plate_list, unprintable_plate); + //Cancel undo/redo for m_shape ,m_plate_width, m_plate_depth, m_plate_height,Because the printing area of different models is different, currently if the grid changes, it cannot correspond to the model on the left ui + ar(m_height_to_lid, m_height_to_rod, m_height_limit_mode, m_plate_count, m_current_plate, m_plate_list, unprintable_plate); //ar(m_plate_width, m_plate_depth, m_plate_height, m_plate_count, m_current_plate); }