mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
More camera tweaks (#2473)
* fix camera regressions * Handle multiple plates
This commit is contained in:
parent
0037a5cc2d
commit
bbfb9d77fa
2 changed files with 28 additions and 5 deletions
|
@ -1508,12 +1508,19 @@ void GLCanvas3D::refresh_camera_scene_box()
|
||||||
wxGetApp().plater()->get_camera().set_scene_box(scene_bounding_box());
|
wxGetApp().plater()->get_camera().set_scene_box(scene_bounding_box());
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBoxf3 GLCanvas3D::volumes_bounding_box() const
|
BoundingBoxf3 GLCanvas3D::volumes_bounding_box(bool current_plate_only) const
|
||||||
{
|
{
|
||||||
BoundingBoxf3 bb;
|
BoundingBoxf3 bb;
|
||||||
for (const GLVolume* volume : m_volumes.volumes) {
|
PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
||||||
if (!m_apply_zoom_to_volumes_filter || ((volume != nullptr) && volume->zoom_to_volumes))
|
|
||||||
bb.merge(volume->transformed_bounding_box());
|
for (const GLVolume *volume : m_volumes.volumes) {
|
||||||
|
if (!m_apply_zoom_to_volumes_filter || ((volume != nullptr) && volume->zoom_to_volumes)) {
|
||||||
|
const auto plate_bb = plate->get_bounding_box();
|
||||||
|
const auto v_bb = volume->transformed_bounding_box();
|
||||||
|
if (!plate_bb.overlap(v_bb))
|
||||||
|
continue;
|
||||||
|
bb.merge(v_bb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
@ -4219,6 +4226,22 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
}
|
}
|
||||||
camera.rotate_on_sphere_with_target(rot.x(), rot.y(), rotate_limit, m_rotation_center);
|
camera.rotate_on_sphere_with_target(rot.x(), rot.y(), rotate_limit, m_rotation_center);
|
||||||
} else {
|
} else {
|
||||||
|
Vec3d rotate_target = Vec3d::Zero();
|
||||||
|
if (m_canvas_type == ECanvasType::CanvasPreview) {
|
||||||
|
PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
|
||||||
|
if (plate)
|
||||||
|
rotate_target = plate->get_bounding_box().center();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!m_selection.is_empty())
|
||||||
|
rotate_target = m_selection.get_bounding_box().center();
|
||||||
|
else
|
||||||
|
rotate_target = volumes_bounding_box(true).center();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rotate_target.isZero())
|
||||||
|
camera.rotate_on_sphere_with_target(rot.x(), rot.y(), rotate_limit, rotate_target);
|
||||||
|
else
|
||||||
camera.rotate_on_sphere(rot.x(), rot.y(), rotate_limit);
|
camera.rotate_on_sphere(rot.x(), rot.y(), rotate_limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -786,7 +786,7 @@ public:
|
||||||
|
|
||||||
void refresh_camera_scene_box();
|
void refresh_camera_scene_box();
|
||||||
|
|
||||||
BoundingBoxf3 volumes_bounding_box() const;
|
BoundingBoxf3 volumes_bounding_box(bool current_plate_only = false) const;
|
||||||
BoundingBoxf3 scene_bounding_box() const;
|
BoundingBoxf3 scene_bounding_box() const;
|
||||||
BoundingBoxf3 plate_scene_bounding_box(int plate_idx) const;
|
BoundingBoxf3 plate_scene_bounding_box(int plate_idx) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue