Name the Design canvas flag after its role, not the axes it once moved

This commit is contained in:
SoftFever
2026-10-06 03:44:15 +08:00
parent c300fa1e8d
commit 34696f5651
3 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ DesignCanvas::DesignCanvas(wxWindow* parent)
m_canvas->enable_plate_chrome(false);
m_canvas->enable_labels(false);
m_canvas->enable_sinking_contours(false); // they would be sliced from the plater's meshes
m_canvas->set_axes_at_bed_center(true); // triad at bed centre = modeling origin
m_canvas->set_design_canvas(true); // home-position bed, triad and CAD grid at the modeling origin
m_canvas->set_design_sketch_tool(&m_sketch_tool);
m_sketch_tool.on_commit = [this](const SketchProfile& prof, const SketchPlane& pl) {
+5 -5
View File
@@ -2395,7 +2395,7 @@ void GLCanvas3D::_render_scene(const Camera& camera, const Size& cnv_size)
}
else if (gizmo_type == GLGizmosManager::BrimEars && !camera.is_looking_downward())
show_grid = false;
if (m_axes_at_bed_center)
if (m_design_canvas)
// Design tab: the plate grid is generated from the plate's front-left corner, so it
// floats mid-cell under the modeling-origin triad. Suppress it here; a CAD grid centred
// on the origin is rendered in its place (see _render_cad_grid).
@@ -2411,7 +2411,7 @@ void GLCanvas3D::_render_scene(const Camera& camera, const Size& cnv_size)
m_frame_profiler.mark("bed");
if (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);
if (m_axes_at_bed_center && show_bed)
if (m_design_canvas && show_bed)
// Design tab: replace the plate's corner-origin grid with the origin-centred CAD grid.
_render_cad_grid(camera.get_view_matrix(), camera.get_projection_matrix());
m_frame_profiler.mark("plates");
@@ -8254,7 +8254,7 @@ void GLCanvas3D::_render_bed(const Transform3d& view_matrix, const Transform3d&
*/
//bool show_texture = true;
//BBS set axes mode
if (m_axes_at_bed_center) {
if (m_design_canvas) {
// Design tab: triad at the bed centre = modeling origin (set every frame because
// set_shape/set_axes_mode otherwise reset it to the bed corner).
const Vec2d bc = m_bed.build_volume().bed_center();
@@ -8271,7 +8271,7 @@ void GLCanvas3D::_render_platelist(const Transform3d& view_matrix, const Transfo
// Design tab: its bed stays at the printer bed's home whichever plate is current, so the
// current plate's exclude areas are moved from that plate onto it.
PartPlate* curr_plate = plate_list.get_curr_plate();
const Transform3d plate_view_matrix = m_axes_at_bed_center && curr_plate != nullptr ?
const Transform3d plate_view_matrix = m_design_canvas && curr_plate != nullptr ?
Transform3d(view_matrix * Geometry::translation_transform(-curr_plate->get_origin())) : view_matrix;
plate_list.render(plate_view_matrix, projection_matrix, bottom, only_current, only_body, hover_id, render_cali, show_grid, !m_plate_chrome_enabled);
}
@@ -8280,7 +8280,7 @@ BoundingBoxf3 GLCanvas3D::_current_plate_box() const
{
// Design tab: its own bed stands in for the current plate (see _render_platelist).
const BuildVolume& build_volume = m_bed.build_volume();
if (m_axes_at_bed_center && build_volume.valid()) {
if (m_design_canvas && build_volume.valid()) {
// Flat at z = 0 like the plate's own box. Merged, as PartPlate builds it: the min/max
// constructor leaves a flat box undefined.
const BoundingBoxf bb = build_volume.bounding_volume2d();
+8 -6
View File
@@ -604,9 +604,11 @@ private:
GLToolbar* m_collapse_toolbar{nullptr};
std::function<CollapseSide()> m_collapse_side;
bool m_plate_chrome_enabled{true};
// Design tab: 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};
// This canvas is the Design tab's. Its bed stays at the printer bed's home whichever plate is
// current, with the world-axis triad and a CAD grid at the bed centre (= modeling origin) in
// place of the corner triad and the plate grid, and the plate data it reads (exclude areas,
// the current plate's box) moved onto that bed. Default false leaves the editor tabs untouched.
bool m_design_canvas{false};
// Design tab: 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};
@@ -1025,7 +1027,7 @@ public:
// initialized, which loads the toolbar's background.
void set_collapse_toolbar(GLToolbar* toolbar, std::function<CollapseSide()> side);
void enable_plate_chrome(bool enable);
void set_axes_at_bed_center(bool b) { m_axes_at_bed_center = b; }
void set_design_canvas(bool b) { m_design_canvas = b; }
void set_show_bed(bool b) { m_show_bed = b; }
bool get_show_bed() const { return m_show_bed; }
void enable_sinking_contours(bool enable) { m_sinking_contours_enabled = enable; }
@@ -1444,8 +1446,8 @@ private:
// The current plate's box (XY, at z = 0); in the Design tab, its own bed's.
BoundingBoxf3 _current_plate_box() const;
// Design tab: draw the CAD grid (minor 10 mm + major 50 mm) in place of the plate's
// corner-origin grid when the axes sit at the bed centre (modeling origin). Rebuilds its
// GLModels lazily, only when the bed shape changed.
// corner-origin grid, centred on the modeling origin. Rebuilds its GLModels lazily, only
// when the bed shape changed.
void _render_cad_grid(const Transform3d& view_matrix, const Transform3d& projection_matrix);
//BBS: add outline drawing logic
void _render_objects(GLVolumeCollection::ERenderType type, bool with_outline = true);