diff --git a/src/slic3r/GUI/DesignCanvas.cpp b/src/slic3r/GUI/DesignCanvas.cpp index af3d37ebbf..f736564b63 100644 --- a/src/slic3r/GUI/DesignCanvas.cpp +++ b/src/slic3r/GUI/DesignCanvas.cpp @@ -414,6 +414,14 @@ void DesignCanvas::refresh_bed() m_bed.set_shape(bed_shape_opt->values, printable_height, {}, {}, "", false); // mainline added extruder_areas/heights params } +void DesignCanvas::set_show_bed(bool b) +{ + if (!m_canvas) return; + if (m_canvas->get_show_bed() == b) return; // no repaint for a no-op toggle + m_canvas->set_show_bed(b); + request_repaint(); +} + bool DesignCanvas::is_sketching() const { return m_sketch_tool.is_active(); } void DesignCanvas::cancel_sketch() diff --git a/src/slic3r/GUI/DesignCanvas.hpp b/src/slic3r/GUI/DesignCanvas.hpp index 666b559abe..71af55056c 100644 --- a/src/slic3r/GUI/DesignCanvas.hpp +++ b/src/slic3r/GUI/DesignCanvas.hpp @@ -58,6 +58,7 @@ public: void finish_sketch(); bool is_sketching() const; void refresh_bed(); // re-sync the bed to the current printer (call on tab activation) + void set_show_bed(bool b); // view option: draw the printer bed + plate grid, or not void cancel_sketch(); void set_on_sketch_commit(std::function cb); void set_on_sketch_entities_commit( diff --git a/src/slic3r/GUI/DesignPanel.cpp b/src/slic3r/GUI/DesignPanel.cpp index 63e2af8930..53b4f1c9ce 100644 --- a/src/slic3r/GUI/DesignPanel.cpp +++ b/src/slic3r/GUI/DesignPanel.cpp @@ -752,8 +752,11 @@ DesignPanel::DesignPanel(wxWindow* parent) // Placement — operations that MOVE a body without changing its shape. Transform and // Mirror place one body directly; a Mate places one body relative to another. They were // in Dress-up (fillet/draft/shell) and Datum, which mixed shape-finishing and reference - // geometry with rigid-body placement. "place" was already an empty slot in the bar order. - feat_dropdown("place", "design_move", _L("Placement (transform / mirror / mate)"), { + // geometry with rigid-body placement. + // Own slot id: "place" is taken by the Place-on-Face button, and put() formats slot + // item 0 as the control and every later item as its chevron, so sharing a slot would + // bottom-align this drawer's button like a chevron. + feat_dropdown("placement", "design_move", _L("Placement (transform / mirror / mate)"), { {"design_move", _L("Transform"), _L("Move and/or rotate an existing body"), [this] { if (m_doc.bodies.empty()) { @@ -1248,6 +1251,23 @@ DesignPanel::DesignPanel(wxWindow* parent) b_export->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { on_export_step(); }); add_doc(b_export); + // View option, not a document action: hide the printer bed to model without it. Lives in + // this row because it must stay reachable with no tool open — a card would come and go. + m_show_bed = new CheckBox(m_toolbar); + m_show_bed->SetValue(true); // bed visible by default, as the tab opens today + m_show_bed->SetToolTip(_L("Show the printer bed and its plate grid")); + // wxEVT_TOGGLEBUTTON, NOT wxEVT_CHECKBOX: Orca's CheckBox derives from + // wxBitmapToggleButton (Widgets/CheckBox.hpp), so a wxEVT_CHECKBOX handler never fires. + // Read the control rather than the event so the state cannot disagree with the glyph. + m_show_bed->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e) { + if (m_viewport) m_viewport->set_show_bed(m_show_bed->GetValue()); + e.Skip(); + }); + auto* bed_lbl = new wxStaticText(m_toolbar, wxID_ANY, _L("Bed")); + bed_lbl->SetForegroundColour(dp_sec_text()); + m_tb_doc->Add(m_show_bed, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 6); + m_tb_doc->Add(bed_lbl, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 4); + // These act on bodies / the view, so they ride in the feature group, in the slots // the user assigned them (9, 11bis, 16). auto* b_place = doc_btn("toolbar_flatten", _L("Place on Face (F) — lay the picked face on the bed"), @@ -1286,7 +1306,7 @@ DesignPanel::DesignPanel(wxWindow* parent) }; put("sketch"); put("constrain"); // 7, 7bis add_sep(m_tb_feature); - put("material"); put("place"); put("plane"); // 8, 9, 10 + put("material"); put("place"); put("placement"); put("plane"); // 8, 9, 9bis, 10 put("dressup"); put("section"); // 11, 11bis put("hole"); put("boolean"); put("cut"); // 12, 13, 14 put("surface"); put("color"); put("flip"); // 14bis, 15, 16 diff --git a/src/slic3r/GUI/DesignPanel.hpp b/src/slic3r/GUI/DesignPanel.hpp index effece13b1..505e79e47f 100644 --- a/src/slic3r/GUI/DesignPanel.hpp +++ b/src/slic3r/GUI/DesignPanel.hpp @@ -255,6 +255,7 @@ private: void push_polygon_params(); wxSizer* m_tb_commit{nullptr}; // far-right Commit to Plate, beside Confirm/Cancel wxSizer* m_tb_doc{nullptr}; // toolbar document/view actions (new, commit, export, section, place) + CheckBox* m_show_bed{nullptr}; // view option: draw the printer bed + plate grid, or not wxSizer* m_box_move{nullptr}; // Move/Rotate numeric options (distance, axis, angle) wxSizer* m_box_polygon{nullptr}; // Polygon tool options (sides / circumscribed) wxSizer* m_box_sketch{nullptr}; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 450379e432..bbff72cf38 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2076,9 +2076,11 @@ void GLCanvas3D::render(bool only_init) /* view3D render*/ int hover_id = (m_hover_plate_idxs.size() > 0)?m_hover_plate_idxs.front():-1; if (m_canvas_type == ECanvasType::CanvasView3D) { - if (!no_partplate) + // m_show_bed gates the plate list too: hiding the bed but leaving its grid and outline + // floating would read as a rendering fault rather than a deliberate view option. + if (!no_partplate && m_show_bed) _render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), m_show_world_axes); - if (!no_partplate) //BBS: add outline logic + if (!no_partplate && m_show_bed) //BBS: add outline logic _render_platelist(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), only_current, only_body, hover_id, true, show_grid); //BBS: add outline logic diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 1e5d264d50..1177a0c481 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -551,6 +551,9 @@ private: // SnapOrca Design: render the world-axis triad at the bed centre (= modeling origin) instead of // the bed corner. Default false preserves the main editor's corner triad. bool m_axes_at_bed_center{false}; + // SnapOrca Design: draw the printer bed and its plate grid at all. Default true, so the + // main editor is untouched; the Design tab lets the user hide it to model without a bed. + bool m_show_bed{true}; #ifdef SLIC3R_CAD DesignSketchTool* m_design_sketch_tool{nullptr}; #endif @@ -900,6 +903,8 @@ public: void enable_collapse_toolbar(bool enable); void enable_plate_chrome(bool enable); void set_axes_at_bed_center(bool b) { m_axes_at_bed_center = b; } + void set_show_bed(bool b) { m_show_bed = b; } + bool get_show_bed() const { return m_show_bed; } #ifdef SLIC3R_CAD void set_design_sketch_tool(DesignSketchTool* tool) { m_design_sketch_tool = tool; } DesignSketchTool* get_design_sketch_tool() const { return m_design_sketch_tool; }