FIX:[STUDIO-3974] Model reset by plate center when machine switching

jira:STUDIO-3974

Change-Id: I44f5d238a5e7afffc24bbc4359c7ede226d24b4a
This commit is contained in:
Kunlong Ma
2023-08-23 12:12:54 +08:00
committed by Lane.Wei
parent d9de09bba6
commit ab0f9d95fc
7 changed files with 92 additions and 1 deletions

View File

@@ -414,6 +414,22 @@ void Selection::add_curr_plate()
this->set_bounding_boxes_dirty();
}
void Selection::add_object_from_idx(std::vector<int>& object_idxs) {
if (!m_valid)
return;
m_mode = Instance;
clear();
for (int obj_idx = 0; obj_idx < object_idxs.size(); obj_idx++) {
std::vector<unsigned int> volume_idxs = get_volume_idxs_from_object(object_idxs[obj_idx]);
do_add_volumes(volume_idxs);
}
update_type();
this->set_bounding_boxes_dirty();
}
void Selection::remove_curr_plate()
{
if (!m_valid)
@@ -464,6 +480,20 @@ void Selection::center()
return;
}
void Selection::center_plate(const int plate_idx) {
PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_plate(plate_idx);
Vec3d src_pos = this->get_bounding_box().center();
Vec3d tar_pos = plate->get_center_origin();
Vec3d distance = Vec3d(tar_pos.x() - src_pos.x(), tar_pos.y() - src_pos.y(), 0);
this->move_to_center(distance);
wxGetApp().plater()->get_view3D_canvas3D()->do_move(L("Move Object"));
return;
}
//BBS
void Selection::set_printable(bool printable)
{