ENH: only allow setting height when cut plane is horizontal

Jira: STUDIO-1819
Change-Id: I04d258949cbf98a59f7313d714430f361bb2c4a9
(cherry picked from commit 2ffa8430b819cfffe20f4c7734125a3aabd33202)
This commit is contained in:
Arthur 2023-01-11 12:03:08 +08:00 committed by Lane.Wei
parent 2800c97165
commit 18366df5d0

View file

@ -497,6 +497,9 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
double height = m_height; double height = m_height;
ImGui::PushItemWidth(caption_size); ImGui::PushItemWidth(caption_size);
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
// only allow setting height when cut plane is horizontal
Vec3d plane_normal = get_plane_normal();
m_imgui->disabled_begin(std::abs(plane_normal(0)) > EPSILON || std::abs(plane_normal(1)) > EPSILON);
m_imgui->text(_L("Height") + " "); m_imgui->text(_L("Height") + " ");
ImGui::SameLine(caption_size + 1 * space_size); ImGui::SameLine(caption_size + 1 * space_size);
ImGui::PushItemWidth(3 * unit_size + 2 * space_size); ImGui::PushItemWidth(3 * unit_size + 2 * space_size);
@ -513,6 +516,7 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
m_buffered_height = height; m_buffered_height = height;
} }
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
m_imgui->disabled_end();
ImGui::Separator(); ImGui::Separator();
// Part selection // Part selection
m_imgui->bbl_checkbox(_L("Keep upper part"), m_keep_upper); m_imgui->bbl_checkbox(_L("Keep upper part"), m_keep_upper);