From 66397a34e518e88e5e7242729c2e7a3e6a14d59d Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Sun, 18 Feb 2024 10:34:24 +0800 Subject: [PATCH] ENH:each Boolean operation has its own warning Jira: STUDIO-6182 Change-Id: Ica5c4c299b6f0fb71ffe9890d3a2f10fa257a4a4 --- src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp | 22 +++++++++++++------- src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp index b232ef329..7a0bd8bf2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp @@ -147,7 +147,9 @@ void GLGizmoMeshBoolean::on_render() void GLGizmoMeshBoolean::on_set_state() { - m_warning_text = ""; + for (size_t i = 0; i < m_warning_texts.size(); i++) { + m_warning_texts[i] = ""; + } if (m_state == EState::On) { m_src.reset(); m_tool.reset(); @@ -318,6 +320,7 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l } bool enable_button = m_src.mv && m_tool.mv; + int index =(int) m_operation_mode; if (m_operation_mode == MeshBooleanOperation::Union) { if (operate_button(_L("Union") + "##btn", enable_button)) { @@ -329,10 +332,10 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l Slic3r::MeshBoolean::mcut::make_boolean(temp_src_mesh, temp_tool_mesh, temp_mesh_resuls, "UNION"); if (temp_mesh_resuls.size() != 0) { generate_new_volume(true, *temp_mesh_resuls.begin()); - m_warning_text = ""; + m_warning_texts[index] = ""; } else { - m_warning_text = warning_text_common; + m_warning_texts[index] = warning_text_common; } } } @@ -347,10 +350,10 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l Slic3r::MeshBoolean::mcut::make_boolean(temp_src_mesh, temp_tool_mesh, temp_mesh_resuls, "A_NOT_B"); if (temp_mesh_resuls.size() != 0) { generate_new_volume(m_diff_delete_input, *temp_mesh_resuls.begin()); - m_warning_text = ""; + m_warning_texts[index] = ""; } else { - m_warning_text = warning_text_common; + m_warning_texts[index] = warning_text_common; } } } @@ -365,14 +368,17 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l Slic3r::MeshBoolean::mcut::make_boolean(temp_src_mesh, temp_tool_mesh, temp_mesh_resuls, "INTERSECTION"); if (temp_mesh_resuls.size() != 0) { generate_new_volume(m_inter_delete_input, *temp_mesh_resuls.begin()); - m_warning_text = ""; + m_warning_texts[index] = ""; } else { - m_warning_text = warning_text_intersection; + m_warning_texts[index] = warning_text_intersection; } } + + } + if (index >= 0 && index < m_warning_texts.size()) { + render_input_window_warning(m_warning_texts[index]); } - render_input_window_warning(m_warning_text); float win_w = ImGui::GetWindowWidth(); if (last_w != win_w || last_y != y) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp index af29fe9f7..b6d305e48 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.hpp @@ -16,7 +16,7 @@ enum class MeshBooleanSelectingState { }; enum class MeshBooleanOperation{ - Undef, + Undef =-1, Union, Difference, Intersection, @@ -77,7 +77,7 @@ private: MeshBooleanSelectingState m_selecting_state; bool m_diff_delete_input = false; bool m_inter_delete_input = false; - std::string m_warning_text; + std::array m_warning_texts; VolumeInfo m_src; VolumeInfo m_tool;