Add option for hiding / showing gridlines (#10545)

Might be useful who want to use custom grid line system with textures. or a clean look

### PROBLEM / SCENARIOS
• Custom made textures overlapping with grid system. so it might be confusing for user if want to use specific markings
• User may found its a distracting item and wants a clean look

### SOLUTION
added to view menu
<img width="477" height="434" alt="Screenshot-20251230192707" src="https://github.com/user-attachments/assets/e298d9b2-5f8f-4e33-af22-ea7c84c9b5b8" />

added to canvas menu
<img width="278" height="297" alt="Screenshot-20251230192717" src="https://github.com/user-attachments/assets/a9952408-a361-4e64-ad9a-72e2480c74cf" />

Clean look without gridlines
<img width="1669" height="1157" alt="Screenshot-20250827144140" src="https://github.com/user-attachments/assets/9229f330-9543-4d39-a8fc-01deb9b61336" />

<img width="1669" height="1157" alt="Screenshot-20250827144212" src="https://github.com/user-attachments/assets/ab3848fb-74d7-4618-8bc7-0cdff10a3804" />


Few Examples with custom made textures / markings without gridlines
<img width="1669" height="1157" alt="Screenshot-20250827140008" src="https://github.com/user-attachments/assets/5d7b17ab-e97a-489c-9e4d-99157a37b6b7" />

<img width="1669" height="1157" alt="Screenshot-20250827141904" src="https://github.com/user-attachments/assets/a7e0f360-a85a-489d-9bc2-39286984643a" />
This commit is contained in:
yw4z
2026-02-28 19:19:04 +03:00
committed by GitHub
parent 60a63c63eb
commit 095b5116ac
5 changed files with 22 additions and 2 deletions

View File

@@ -251,6 +251,9 @@ void AppConfig::set_defaults()
if (get("show_3d_navigator").empty())
set_bool("show_3d_navigator", true);
if (get("show_plate_gridlines").empty())
set_bool("show_plate_gridlines", true);
if (get("show_outline").empty())
set_bool("show_outline", false);

View File

@@ -8637,7 +8637,13 @@ void GLCanvas3D::_render_canvas_toolbar()
[this]{toggle_world_axes_visibility(false);}
);
// will add an option for gridlines in here
create_menu_item( "Gridlines",
m_canvas_type != ECanvasType::CanvasAssembleView, // not work on assembly
wxGetApp().show_plate_gridlines(),
[this]{wxGetApp().toggle_show_plate_gridlines();}
);
ImGui::Separator();
create_menu_item( "Labels",
m_canvas_type == ECanvasType::CanvasView3D, // work only on prepare

View File

@@ -362,6 +362,9 @@ public:
bool show_3d_navigator() const { return app_config->get_bool("show_3d_navigator"); }
void toggle_show_3d_navigator() const { app_config->set_bool("show_3d_navigator", !show_3d_navigator()); }
bool show_plate_gridlines() const { return app_config->get_bool("show_plate_gridlines"); }
void toggle_show_plate_gridlines() const { app_config->set_bool("show_plate_gridlines", !show_plate_gridlines()); }
bool show_canvas_zoom_button() const { return app_config->get_bool("show_canvas_zoom_button"); }
void toggle_canvas_zoom_button() const { app_config->set_bool("show_canvas_zoom_button", !show_canvas_zoom_button()); }

View File

@@ -2825,6 +2825,14 @@ void MainFrame::init_menubar_as_editor()
this, [this]() { return m_tabpanel->GetSelection() == TabPosition::tp3DEditor || m_tabpanel->GetSelection() == TabPosition::tpPreview; },
[this]() { return wxGetApp().show_3d_navigator(); }, this);
append_menu_check_item(viewMenu, wxID_ANY, _L("Show Gridlines"), _L("Show Glidlines on plate"),
[this](wxCommandEvent&) {
wxGetApp().toggle_show_plate_gridlines();
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
}, this,
[this]() { return m_tabpanel->GetSelection() == TabPosition::tp3DEditor || m_tabpanel->GetSelection() == TabPosition::tpPreview; },
[this]() { return wxGetApp().show_plate_gridlines(); }, this);
append_menu_item(
viewMenu, wxID_ANY, _L("Reset Window Layout"), _L("Reset to default window layout"),
[this](wxCommandEvent&) { m_plater->reset_window_layout(); }, "", this,

View File

@@ -3241,7 +3241,7 @@ void PartPlate::render(const Transform3d& view_matrix, const Transform3d& projec
shader->stop_using();
}
if (show_grid)
if (wxGetApp().show_plate_gridlines() && show_grid)
render_grid(bottom);
if (!bottom && m_selected && !force_background_color) {