ENH:add "flip cut plane" function

jira: none
code is from PrusaSlicer,thans for PrusaSlicer and YuSanka
commit b40473be51fd1050fa4d7b2c3297230758085d46
Author: YuSanka <yusanka@gmail.com>
Date:   Thu Feb 9 08:52:07 2023 +0100
    CutGizmo: Improvements to identify Upper/Lower parts_count

Change-Id: I08974894777c5d8ab267ec6e23ae5c8fd9c27757
This commit is contained in:
zhou.xu 2024-09-24 15:28:18 +08:00 committed by Lane.Wei
parent 2e13d55a6e
commit 2f716f4b40
2 changed files with 20 additions and 0 deletions

View File

@ -1649,6 +1649,23 @@ void GLGizmoAdvancedCut::process_contours()
toggle_model_objects_visibility();
}
void GLGizmoAdvancedCut::render_flip_plane_button(bool disable_pred /*=false*/)
{
ImGui::SameLine();
if (m_hover_id == c_plate_move_id)
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetColorU32(ImGuiCol_ButtonHovered));
m_imgui->disabled_begin(disable_pred);
if (m_imgui->button(_L("Flip cut plane")))
flip_cut_plane();
m_imgui->disabled_end();
if (m_hover_id == c_plate_move_id)
ImGui::PopStyleColor();
}
void GLGizmoAdvancedCut::toggle_model_objects_visibility(bool show_in_3d)
{
if (m_part_selection && m_part_selection->valid() && show_in_3d == false && (m_is_dragging == false || m_connectors_editing)) // BBL
@ -2169,6 +2186,8 @@ void GLGizmoAdvancedCut::render_connectors_input_window(float x, float y, float
reset_connectors();
m_imgui->disabled_end();
render_flip_plane_button(m_connectors_editing && connectors.empty());
m_imgui->text(_L("Type"));
ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(0.00f, 0.00f, 0.00f, 1.00f));
bool type_changed = render_connect_type_radio_button(CutConnectorType::Plug);

View File

@ -312,6 +312,7 @@ private:
bool has_valid_groove() const;
bool has_valid_contour() const;
void reset_cut_by_contours();
void render_flip_plane_button(bool disable_pred = false);
void process_contours();
void toggle_model_objects_visibility(bool show_in_3d = false);
void deal_connector_pos_by_type(Vec3d &pos, float &height, CutConnectorType, CutConnectorStyle, bool looking_forward, bool is_edit, const Vec3d &clp_normal);