ENH:Add button linkage display when gap_area is valid

jira: STUDIO-10042
Change-Id: Ia2b60d735a61cbd2a71a840d3db27e60239c8fcf
This commit is contained in:
zhou.xu 2025-02-05 09:57:58 +08:00 committed by lane.wei
parent 7745c29c51
commit 742efe2e3d
3 changed files with 13 additions and 2 deletions

View File

@ -845,6 +845,13 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
ImGui::SameLine();
if (m_current_tool == ImGui::GapFillIcon) {
m_imgui->disabled_begin(!(TriangleSelectorPatch::exist_gap_area));
ImGui::PushStyleColor(ImGuiCol_Button, m_is_dark_mode ? ImVec4(0 / 255.0, 174 / 255.0, 66 / 255.0, 1.0) : ImVec4(0 / 255.0, 174 / 255.0, 66 / 255.0, 1.0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered,
m_is_dark_mode ? ImVec4(50 / 255.0f, 238 / 255.0f, 61 / 255.0f, 1.00f) : ImVec4(50 / 255.0f, 238 / 255.0f, 61 / 255.0f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive,
m_is_dark_mode ? ImVec4(206 / 255.0f, 206 / 255.0f, 206 / 255.0f, 1.00f) : ImVec4(206 / 255.0f, 206 / 255.0f, 206 / 255.0f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_Text, m_is_dark_mode ? ImVec4(255 / 255.0f, 255 / 255.0f, 255 / 255.0f, 1.00f) : ImVec4(255 / 255.0f, 255 / 255.0f, 255 / 255.0f, 1.00f));
if (m_imgui->button(m_desc.at("perform"))) {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Gap fill", UndoRedo::SnapshotType::GizmoAction);
@ -856,7 +863,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
update_model_object();
m_parent.set_as_dirty();
}
ImGui::PopStyleColor(4);
m_imgui->disabled_end();
ImGui::SameLine();
}

View File

@ -1328,6 +1328,7 @@ bool TrianglePatch::is_fragment() const
}
float TriangleSelectorPatch::gap_area = TriangleSelectorPatch::GapAreaMin;
bool TriangleSelectorPatch::exist_gap_area = false;
void TriangleSelectorPatch::render(ImGuiWrapper* imgui)
{
@ -1359,7 +1360,7 @@ void TriangleSelectorPatch::render(ImGuiWrapper* imgui)
shader->set_uniform("show_wireframe", false);
}
}
TriangleSelectorPatch::exist_gap_area = false;
for (size_t buffer_idx = 0; buffer_idx < m_triangle_patches.size(); ++buffer_idx) {
if (this->has_VBOs(buffer_idx)) {
const TrianglePatch& patch = m_triangle_patches[buffer_idx];
@ -1368,6 +1369,7 @@ void TriangleSelectorPatch::render(ImGuiWrapper* imgui)
size_t color_idx = (size_t)*patch.neighbor_types.begin();
color = m_ebt_colors[color_idx];
color[3] = 0.85;
TriangleSelectorPatch::exist_gap_area = true;
}
else {
size_t color_idx = (size_t)patch.type;

View File

@ -150,6 +150,7 @@ public:
// BBS: fix me
static float gap_area;
static bool exist_gap_area;
protected:
// Release the geometry data, release OpenGL VBOs.