Cut small improvements:

* Disable revert icon if cut_plane position wasn't changed
* Hide CutGizmo for Simple mode.
* Fixed update of bounding box after changing scale during Z axis
This commit is contained in:
YuSanka 2022-10-17 16:59:40 +02:00
parent 13e4e85e3d
commit 5922bf2910
2 changed files with 11 additions and 1 deletions

View file

@ -968,6 +968,11 @@ bool GLGizmoCut3D::on_is_activable() const
return m_parent.get_selection().is_single_full_instance();
}
bool GLGizmoCut3D::on_is_selectable() const
{
return wxGetApp().get_mode() != comSimple;
}
Vec3d GLGizmoCut3D::mouse_position_in_local_plane(Axis axis, const Linef3& mouse_ray) const
{
double half_pi = 0.5 * PI;
@ -1194,7 +1199,7 @@ BoundingBoxf3 GLGizmoCut3D::transformed_bounding_box(bool revert_move /*= false*
bool GLGizmoCut3D::update_bb()
{
const BoundingBoxf3 box = bounding_box();
if (m_max_pos != box.max && m_min_pos != box.min) {
if (m_max_pos != box.max || m_min_pos != box.min) {
m_max_pos = box.max;
m_min_pos = box.min;
m_bb_center = box.center();
@ -1501,8 +1506,12 @@ void GLGizmoCut3D::render_cut_plane_input_window(CutConnectors &connectors)
ImGui::SameLine(m_label_width);
render_move_center_input(Z);
ImGui::SameLine();
const bool is_cut_plane_init = m_rotation_m.isApprox(Transform3d::Identity()) && bounding_box().center() == m_plane_center;
m_imgui->disabled_begin(is_cut_plane_init);
if (render_reset_button("cut_plane", _u8L("Reset cutting plane")))
reset_cut_plane();
m_imgui->disabled_end();
if (wxGetApp().plater()->printer_technology() == ptFFF) {
m_imgui->disabled_begin(!m_keep_upper || !m_keep_lower);

View file

@ -171,6 +171,7 @@ protected:
CommonGizmosDataID on_get_requirements() const override;
void on_set_hover_id() override;
bool on_is_activable() const override;
bool on_is_selectable() const override;
Vec3d mouse_position_in_local_plane(Axis axis, const Linef3&mouse_ray) const;
void dragging_grabber_z(const GLGizmoBase::UpdateData &data);
void dragging_grabber_xy(const GLGizmoBase::UpdateData &data);