mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 11:15:55 +08:00
Follow-up a41dd8eeed50b9bfbb9f37769569f091512d8124 - Added missed updates for transformed bounding box
+ Fixed Arrow Up/Down action. Cut plane is moved during the its own normal instead of during the Z axes
This commit is contained in:
parent
d6c7312181
commit
be74338e53
@ -360,11 +360,12 @@ bool GLGizmoCut3D::on_mouse(const wxMouseEvent &mouse_event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoCut3D::shift_cut_z(double delta)
|
void GLGizmoCut3D::shift_cut(double delta)
|
||||||
{
|
{
|
||||||
Vec3d new_cut_center = m_plane_center;
|
Vec3d starting_vec = m_rotation_m * Vec3d::UnitZ();
|
||||||
new_cut_center[Z] += delta;
|
if (starting_vec.norm() != 0.0)
|
||||||
set_center(new_cut_center, true);
|
starting_vec.normalize();
|
||||||
|
set_center(m_plane_center + starting_vec * delta, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoCut3D::rotate_vec3d_around_plane_center(Vec3d&vec)
|
void GLGizmoCut3D::rotate_vec3d_around_plane_center(Vec3d&vec)
|
||||||
@ -1175,9 +1176,10 @@ void GLGizmoCut3D::dragging_grabber_xy(const GLGizmoBase::UpdateData &data)
|
|||||||
rotation[m_hover_id] = theta;
|
rotation[m_hover_id] = theta;
|
||||||
|
|
||||||
const Transform3d rotation_tmp = m_start_dragging_m * rotation_transform(rotation);
|
const Transform3d rotation_tmp = m_start_dragging_m * rotation_transform(rotation);
|
||||||
if (m_rotation_m.rotation() != rotation_tmp.rotation())
|
const bool update_tbb = m_rotation_m.rotation() != rotation_tmp.rotation();
|
||||||
m_transformed_bounding_box = transformed_bounding_box(m_plane_center);
|
|
||||||
m_rotation_m = rotation_tmp;
|
m_rotation_m = rotation_tmp;
|
||||||
|
if (update_tbb)
|
||||||
|
m_transformed_bounding_box = transformed_bounding_box(m_plane_center);
|
||||||
|
|
||||||
m_angle = theta;
|
m_angle = theta;
|
||||||
while (m_angle > two_pi)
|
while (m_angle > two_pi)
|
||||||
@ -1647,6 +1649,8 @@ void GLGizmoCut3D::set_connectors_editing(bool connectors_editing)
|
|||||||
void GLGizmoCut3D::flip_cut_plane()
|
void GLGizmoCut3D::flip_cut_plane()
|
||||||
{
|
{
|
||||||
m_rotation_m = m_rotation_m * rotation_transform(PI * Vec3d::UnitX());
|
m_rotation_m = m_rotation_m * rotation_transform(PI * Vec3d::UnitX());
|
||||||
|
m_transformed_bounding_box = transformed_bounding_box(m_plane_center);
|
||||||
|
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Flip cut plane"), UndoRedo::SnapshotType::GizmoAction);
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Flip cut plane"), UndoRedo::SnapshotType::GizmoAction);
|
||||||
m_start_dragging_m = m_rotation_m;
|
m_start_dragging_m = m_rotation_m;
|
||||||
|
|
||||||
@ -2303,6 +2307,8 @@ bool GLGizmoCut3D::process_cut_line(SLAGizmoEventType action, const Vec2d& mouse
|
|||||||
m.matrix().block(0, 0, 3, 3) = q.setFromTwoVectors(Vec3d::UnitZ(), cross_dir).toRotationMatrix();
|
m.matrix().block(0, 0, 3, 3) = q.setFromTwoVectors(Vec3d::UnitZ(), cross_dir).toRotationMatrix();
|
||||||
|
|
||||||
m_rotation_m = m;
|
m_rotation_m = m;
|
||||||
|
// update transformed bb
|
||||||
|
m_transformed_bounding_box = transformed_bounding_box(m_plane_center);
|
||||||
m_angle_arc.reset();
|
m_angle_arc.reset();
|
||||||
|
|
||||||
set_center(m_plane_center + cross_dir * (cross_dir.dot(pt - m_plane_center)), true);
|
set_center(m_plane_center + cross_dir * (cross_dir.dot(pt - m_plane_center)), true);
|
||||||
|
@ -187,7 +187,7 @@ public:
|
|||||||
/// <returns>Return True when use the information otherwise False.</returns>
|
/// <returns>Return True when use the information otherwise False.</returns>
|
||||||
bool on_mouse(const wxMouseEvent &mouse_event) override;
|
bool on_mouse(const wxMouseEvent &mouse_event) override;
|
||||||
|
|
||||||
void shift_cut_z(double delta);
|
void shift_cut(double delta);
|
||||||
void rotate_vec3d_around_plane_center(Vec3d&vec);
|
void rotate_vec3d_around_plane_center(Vec3d&vec);
|
||||||
void put_connectors_on_cut_plane(const Vec3d& cp_normal, double cp_offset);
|
void put_connectors_on_cut_plane(const Vec3d& cp_normal, double cp_offset);
|
||||||
void update_clipper();
|
void update_clipper();
|
||||||
|
@ -623,7 +623,7 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
|
|||||||
else if (m_current == Cut) {
|
else if (m_current == Cut) {
|
||||||
auto do_move = [this, &processed](double delta_z) {
|
auto do_move = [this, &processed](double delta_z) {
|
||||||
GLGizmoCut3D* cut = dynamic_cast<GLGizmoCut3D*>(get_current());
|
GLGizmoCut3D* cut = dynamic_cast<GLGizmoCut3D*>(get_current());
|
||||||
cut->shift_cut_z(delta_z);
|
cut->shift_cut(delta_z);
|
||||||
processed = true;
|
processed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user