OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::DesignCanvas Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/CAD/DesignCanvas.hpp>

Inheritance diagram for Slic3r::GUI::DesignCanvas:
Collaboration diagram for Slic3r::GUI::DesignCanvas:

Classes

struct  BodyVolume

Public Member Functions

 DesignCanvas (wxWindow *parent)
 ~DesignCanvas () override
void set_bodies (const std::vector< TriangleMesh > *body_meshes, const std::vector< bool > &visible={})
void clear_mesh ()
void set_preview_mesh (const TriangleMesh &mesh)
void clear_preview ()
void fit_view ()
void set_view (const std::string &view_name)
bool zoom_to_box (BoundingBoxf3 box)
BoundingBoxf3 selection_box () const
BoundingBoxf3 faces_box (std::vector< std::pair< int, int > > faces) const
void begin_sketch (const SketchPlane &plane, DesignSketchTool::Mode mode)
void edit_sketch (const std::vector< SketchEntity > &entities, const std::vector< SketchEntityConstraintDef > &constraints, const SketchPlane &plane)
void set_sketch_tool (DesignSketchTool::Mode mode)
void set_sketch_construction (bool c)
bool edit_sketch_selection_value ()
int toggle_sketch_construction_selection ()
bool sketch_is_selecting () const
bool add_sketch_regions (const std::vector< std::vector< std::vector< Vec2d > > > &regions)
void set_sketch_polygon_sides (int n)
void set_sketch_polygon_circumscribed (bool c)
void finish_sketch ()
bool is_sketching () const
void refresh_bed ()
Vec2d bed_center () const
void enter_viewport ()
void leave_viewport ()
void unbind_canvas_event_handlers ()
void reset_canvas_volumes ()
void set_show_bed (bool b)
void set_sidebar_collapse (std::function< CollapseSide()> side, std::function< void()> toggle)
void set_sidebar_collapse_tooltip (const std::string &tooltip)
bool view_normal_to_sketch ()
void cancel_sketch ()
void set_on_sketch_commit (std::function< void(const SketchProfile &, const SketchPlane &)> cb)
void set_on_sketch_entities_commit (std::function< void(const std::vector< SketchEntity > &, const std::vector< SketchEntityConstraintDef > &, const SketchPlane &)> cb)
void set_on_segment_drawn (std::function< void(double, double)> cb)
void set_on_cursor_metrics (std::function< void(double, double, bool)> cb)
void set_on_solve_state (std::function< void(int, bool, bool)> cb)
void set_on_sketch_step (std::function< void(DesignSketchTool::Mode, int, int)> cb)
void apply_segment_length (double len)
void keep_segment_as_drawn ()
void set_on_sketch_selection_changed (std::function< void(int)> cb)
void set_on_sketch_face_selected (std::function< void(int)> cb)
void set_on_display_sketch_selected (std::function< void(int, int, int)> cb)
void set_on_display_sketch_activated (std::function< void(int)> cb)
std::vector< SketchEntity > selected_loop_entities () const
std::vector< std::vector< int > > region_entity_indices (const std::vector< SketchEntity > &ents) const
std::vector< std::vector< int > > region_entity_indices_with_holes (const std::vector< SketchEntity > &ents) const
void clear_loop_pick ()
void clear_solid_pick ()
void set_loop_pick (int feature, int region)
int loop_pick_feature () const
int loop_pick_region () const
void set_escalate_on_repick (bool on)
void set_solid_pick (const std::vector< CadBody > *bodies, const TriangleMesh *mesh, const std::vector< int > *tri_face, const std::vector< int > *tri_body, const std::vector< bool > *visible=nullptr, const std::vector< Transform3d > *xform=nullptr)
void set_on_solid_selection_changed (std::function< void(int, int, int, int)> cb)
void set_on_empty_pick (std::function< void()> cb)
std::vector< int > selected_solid_edges () const
void select_body (int body)
ColorRGBA body_color (int body) const
void begin_move_body (int body, const Vec3d &pivot, const Transform3d &base_xform, double body_radius)
void clear_move_gizmo ()
void set_on_body_move_changed (std::function< void(int, const Transform3d &)> cb)
bool begin_fillet_gizmo (const Vec3d &body_centroid, double radius)
void clear_fillet_gizmo ()
bool filleting () const
void set_on_fillet_radius_changed (std::function< void(double)> cb)
void begin_hole_gizmo (const SketchPlane &plane, double x, double y, double diameter, double depth, bool through)
void set_hole_face_bounds (bool has, double umin, double umax, double vmin, double vmax)
void clear_hole_gizmo ()
bool holing () const
void set_on_hole_changed (std::function< void(double, double, double, double)> cb)
void begin_thread_gizmo (const SketchPlane &plane, double x, double y, double radius, double height)
void clear_thread_gizmo ()
bool threading () const
void set_on_thread_changed (std::function< void(double, double, double, double)> cb)
void begin_shell_gizmo (const Vec3d &face_centroid, const Vec3d &inward_dir, double thickness)
void clear_shell_gizmo ()
bool shelling () const
void set_on_shell_thickness_changed (std::function< void(double)> cb)
void begin_revolve_gizmo (const SketchPlane &plane, const Vec2d &centroid, const Vec3d &axis_origin, const Vec3d &axis_dir, double angle, bool flip)
void clear_revolve_gizmo ()
bool revolving () const
void set_on_revolve_angle_changed (std::function< void(double)> cb)
void set_draft_gizmo (const Vec3d &face_centroid, const Vec3d &face_normal, double angle)
void clear_draft_gizmo ()
bool drafting () const
void set_on_draft_angle_changed (std::function< void(double)> cb)
void set_cut_gizmo (const SketchPlane &plane, double offset, const Vec3d &body_center, double half_extent)
void clear_cut_gizmo ()
bool cutting () const
void set_on_cut_offset_changed (std::function< void(double)> cb)
void begin_pattern_gizmo (const SketchPlane &plane, const Vec3d &body_centroid, bool circular, int count, int dir, double spacing, double angle)
void clear_pattern_gizmo ()
bool patterning () const
void set_on_pattern_changed (std::function< void(double)> cb)
void set_extrude_gizmo (const SketchPlane &plane, const Vec2d &centroid, double depth, double depth2, bool two_sided, bool flip)
void clear_extrude_gizmo ()
void set_on_extrude_depth_changed (std::function< void(double, bool)> cb)
void set_datum_gizmo (const SketchPlane &plane, double usize, double vsize, const Vec3d &base_origin, const Vec3d &base_normal, double offset, bool offset_on)
void clear_datum_gizmo ()
void set_on_datum_size_changed (std::function< void(double, double)> cb)
void set_on_datum_offset_changed (std::function< void(double)> cb)
void set_helix_gizmo (const SketchPlane &plane, double radius, double pitch, double height, double taper, bool left_handed)
void clear_helix_gizmo ()
void set_on_helix_changed (std::function< void(double, double, double)> cb)
void set_rib_gizmo (const SketchPlane &plane, const Vec2d &p0, const Vec2d &p1, double thickness)
void clear_rib_gizmo ()
void set_on_rib_thickness_changed (std::function< void(double)> cb)
void set_base_pick (std::vector< SketchPlane > planes, std::vector< int > bases, std::vector< std::string > labels={})
void clear_base_pick ()
void set_on_datum_base_picked (std::function< void(int)> cb)
void set_selected_base (std::function< int()> cb)
void set_on_sketch_exit (std::function< void()> cb)
void set_on_sketch_exit_refused (std::function< void()> cb)
void set_on_sketch_notice (std::function< void(const std::string &, bool)> cb)
void set_display_sketches (std::vector< DesignSketchTool::DisplaySketch > ds)
void set_highlight_sketches (std::vector< std::pair< int, ColorRGBA > > hl)
void set_datum_planes (std::vector< SketchPlane > planes, std::vector< Vec2d > sizes={})
void set_mate_connectors (std::vector< DesignSketchTool::MateConnectorGlyph > g)
void set_mate_links (std::vector< std::pair< Vec3d, Vec3d > > l)
void set_highlight_faces (const std::vector< std::pair< int, int > > &faces)
void set_status_text (const wxString &text, const wxColour &colour)
void set_operand_bodies (int target_body, int tool_body)
void set_body_translucent (bool on)
void set_xray_focus (int body)
void set_body_hidden (bool on)
void set_on_context_menu (std::function< void(const wxPoint &)> cb)
bool delete_selected_sketch_entities ()
bool inline_busy () const
bool inline_has_focus () const
void inline_commit ()
void inline_cancel ()
void request_sketch_exit ()
bool live_sketch_has_work () const
bool undo_last_sketch_entity ()
bool redo_last_sketch_entity ()
bool can_undo_sketch_entity () const
bool can_redo_sketch_entity () const
void clear_sketch_selection ()
bool toggle_planes ()
bool toggle_axes ()
void set_section_plane (bool on, double z, bool keep_upper=false)
double model_mid_z () const
DesignSketchTool::DimType sketch_dimension_kind () const
double sketch_dimension_current () const
void apply_sketch_dimension (double v)
void open_inline_value (double current, std::function< void(double)> commit, std::function< void()> cancel={})
void set_on_dimension_pick_complete (std::function< void(double)> cb)
DesignSketchTool::DimType pending_dimension_type () const
void set_sketch_dimension_value (double v)
void cancel_sketch_dimension ()
void begin_constrain (const SketchProfile &prof, const SketchPlane &plane)
void end_constrain ()
bool is_constraining () const
bool selected_segment (int &a, int &b) const
void update_constrain_profile (const std::vector< Vec2d > &pts)
void begin_constrain_entities (const std::vector< SketchEntity > &ents, const SketchPlane &plane)
bool is_constraining_entities () const
int sketch_selection_count () const
bool sketch_abort_gesture ()
bool sketch_disarm_tool ()
bool sketch_confirm_pending ()
bool drawing_in_progress () const
bool has_any_selection () const
bool clear_any_selection ()
bool sketch_first_selected_type (SketchEntity::Type &out) const
const std::vector< int > & sketch_selection () const
const std::vector< SketchEntity > & sketch_entities () const
int sketch_constraint_count () const
const std::vector< SketchEntityConstraintDef > & sketch_constraints () const
bool remove_sketch_constraint (int idx)
void set_on_sketch_constraints_changed (std::function< void()> cb)
bool try_add_sketch_constraints (const std::vector< SketchEntityConstraintDef > &defs)
void begin_imported_transform (int feat, const std::vector< std::vector< std::vector< Vec2d > > > &base_regions, const SketchPlane &plane, const Vec2d &offset, double scale_x, double scale_y)
void set_on_imported_transform (std::function< void(int, Vec2d, double, double)> cb)
bool selected_constrain_entities (int &e0, int &e1) const
int selected_constrain_axis () const
bool pick0_point (Vec2d &out) const
void update_constrain_entities (const std::vector< SketchEntity > &ents)
void set_constraint_highlight (std::vector< int > entities)
void set_constraint_glyphs (std::vector< SketchEntityConstraintDef > cons)
DesignSketchTool & mcp_sketch_tool ()
const DesignSketchTool & mcp_sketch_tool () const
void request_repaint ()
void force_repaint ()
void repaint_now ()

Private Member Functions

void reload ()
void swap_camera ()
void rebuild_bodies ()
void sync_selected_faces ()
void set_readout (const std::string &text)
void render_hud ()

Private Attributes

const std::vector< TriangleMesh > * m_body_meshes {nullptr}
const std::vector< int > * m_tri_face {nullptr}
std::vector< std::pair< int, int > > m_lit_faces
std::vector< BodyVolume > m_volumes
bool m_split_pending {false}
std::function< void(int, int, int, int)> m_on_solid_selection_changed
wxGLCanvas * m_canvas_widget {nullptr}
GLCanvas3D * m_canvas {nullptr}
int m_sw_gl {-1}
GLToolbar m_collapse_toolbar {GLToolbar::Normal, "Collapse"}
std::function< void(const wxPoint &)> m_on_context_menu
bool m_ctx_bound {false}
wxPoint m_ctx_press {0, 0}
bool m_ctx_travelled {false}
Bed3D m_bed
Camera m_parked_camera
bool m_camera_swapped {false}
Model m_model
int m_hl_body_target {-1}
int m_hl_body_tool {-1}
bool m_body_translucent {false}
int m_xray_focus {-1}
bool m_body_hidden {false}
std::vector< bool > m_body_visible
const std::vector< CadBody > * m_color_bodies {nullptr}
DesignSketchTool m_sketch_tool
bool m_section_on {false}
std::unique_ptr< SketchInlineEditor > m_inline_editor
std::string m_hud_last
wxString m_status_hud_last
wxColour m_status_hud_colour
std::function< void(const SketchProfile &, const SketchPlane &)> m_on_sketch_commit
std::function< void(const std::vector< SketchEntity > &, const std::vector< SketchEntityConstraintDef > &, const SketchPlane &)> m_on_sketch_entities_commit

Detailed Description


Class Documentation

◆ Slic3r::GUI::DesignCanvas::BodyVolume

struct Slic3r::GUI::DesignCanvas::BodyVolume
Class Members
int body
bool lit

Constructor & Destructor Documentation

◆ DesignCanvas()

Slic3r::GUI::DesignCanvas::DesignCanvas ( wxWindow * parent)
explicit
73 : wxPanel()
74{
75 if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0))
76 return;
77
79 if (m_canvas_widget == nullptr)
80 return;
81
82 m_canvas = new GLCanvas3D(m_canvas_widget, m_bed);
83 m_canvas->set_context(wxGetApp().init_glcontext(*m_canvas_widget));
84 m_canvas->allow_multisample(OpenGLManager::can_multisample());
85 m_canvas->set_config(wxGetApp().plater()->config());
86 m_canvas->set_model(&m_model);
87 // Nothing to slice here, but GLCanvas3D derefs the process unguarded every frame, so it
88 // cannot be null. Borrow the plater's, as the editor canvases do.
89 m_canvas->set_process(&wxGetApp().plater()->background_process());
91 m_canvas->set_studio_lighting(true); // see GLCanvas3D::m_studio_lighting and phong.fs
92
93 m_canvas->enable_picking(false); // viewport face/edge picking is custom (TODO)
94 m_canvas->enable_moving(false);
95 m_canvas->enable_gizmos(false);
96 m_canvas->enable_selection(false); // stock volume selection unused; solid highlight is tree-driven
97 m_canvas->enable_main_toolbar(false);
98 m_canvas->enable_select_plate_toolbar(false);
99 m_canvas->enable_assemble_view_toolbar(false);
100 m_canvas->enable_separator_toolbar(false);
101 m_canvas->enable_collapse_toolbar(false);
102 m_canvas->enable_plate_chrome(false);
103 m_canvas->enable_labels(false);
104 m_canvas->enable_sinking_contours(false); // they would be sliced from the plater's meshes
105 m_canvas->set_design_canvas(true); // home-position bed, triad and CAD grid at the modeling origin
106
107 m_canvas->set_design_sketch_tool(&m_sketch_tool);
108 m_sketch_tool.on_commit = [this](const SketchProfile& prof, const SketchPlane& pl) {
110 if (m_canvas) m_canvas->set_as_dirty();
111 if (m_canvas_widget) m_canvas_widget->Refresh();
112 };
113 m_sketch_tool.on_commit_entities = [this](const std::vector<SketchEntity>& ents,
114 const std::vector<SketchEntityConstraintDef>& cons,
115 const SketchPlane& pl) {
117 if (m_canvas) m_canvas->set_as_dirty();
118 if (m_canvas_widget) m_canvas_widget->Refresh();
119 };
120
121 // Onshape-style in-canvas value editor, floating over the GL canvas. The tool hands
122 // us a screen pixel (device px) + a commit/cancel pair; we convert to logical client
123 // px and wrap the callbacks so each one re-solves and re-renders the viewport.
124 m_inline_editor = std::make_unique<SketchInlineEditor>();
125 // The tool draws it: it owns the frame's ImGui pass and the render scale. Handing it a raw
126 // pointer rather than the unique_ptr keeps the ownership where it was.
127 m_sketch_tool.inline_editor = m_inline_editor.get();
128 // SCHEDULE a paint, do not render one. request_repaint() renders SYNCHRONOUSLY on software
129 // GL, and this callback runs from inside DesignSketchTool::render() — so using it here asks
130 // for a render from within a render. The frames stopped after nine, which is what a
131 // re-entrancy guard giving up looks like. Refresh() posts a paint event instead: the current
132 // frame finishes, the event loop runs (which is where ImGui's queued characters are consumed),
133 // and the next frame starts clean.
134 // MEASUREMENT: does a typed character reach the GL canvas at all? Everything downstream of
135 // this point is known good (ImGui reports want_text=1 and our InputText active), so if these
136 // lines do not appear the character never got past the panel's CHAR_HOOK / the focus chain,
137 // and no amount of work inside the field will help. Skips always: a pure observer.
138 if (m_canvas_widget != nullptr && std::getenv("ORCA_CAD_UXTRACE")) {
139 m_canvas_widget->Bind(wxEVT_CHAR, [](wxKeyEvent& e) {
140 fprintf(stderr, "[UX] canvas_char key=%d\n", e.GetKeyCode());
141 fflush(stderr);
142 e.Skip();
143 });
144 }
145 m_inline_editor->request_frame = [this] {
146 // BOTH halves, and the dirty flag first: GLCanvas3D's paint handler returns without
147 // rendering when the canvas is not marked dirty, so a bare Refresh() posts an event that
148 // draws nothing and the frames still stop. request_repaint() does exactly this pair on
149 // the hardware path; what it must NOT do here is its software path, which renders
150 // synchronously — and this callback runs from inside render().
151 if (m_canvas) m_canvas->set_as_dirty();
152 if (m_canvas_widget) m_canvas_widget->Refresh(false);
153 };
154 m_sketch_tool.on_inline_edit = [this](wxPoint screen_px, double current,
155 const std::string& title,
156 std::function<void(double)> commit,
157 std::function<void()> cancel) {
158 if (!m_inline_editor) { if (cancel) cancel(); return; }
159 // The tool hands us canvas device px and the field is now drawn IN the canvas, so this
160 // is already the coordinate space it wants — no conversion to screen coordinates, and no
161 // window to place there.
162 // Freeze the sketch tool while the field is open so a stray click/move on the GL
163 // canvas can't draw under the field; released on commit or cancel.
164 m_sketch_tool.set_inline_busy(true);
165 // AND PUT THE KEYBOARD ON THE CANVAS. The field is drawn by ImGui, and ImGui is fed from
166 // GLCanvas3D's own key handler, so a key only reaches it if the canvas is the focused
167 // widget. That is a focus move WITHIN one window — the toolkit's business, not the window
168 // manager's, which is the whole point of not being a window any more — but it still has
169 // to be asked for: after a toolbar click or a tree selection the focus is elsewhere in
170 // the panel, and the field would sit there taking nothing.
171 if (m_canvas_widget) m_canvas_widget->SetFocus();
172 m_inline_editor->open(screen_px, current, title,
173 [this, commit](double v) {
174 m_sketch_tool.set_inline_busy(false);
175 if (commit) commit(v);
176 // A refused value re-opens the same field (SketchInlineEditor::refuse).
177 if (m_inline_editor && m_inline_editor->is_open()) m_sketch_tool.set_inline_busy(true);
179 },
180 [this, cancel]() {
181 m_sketch_tool.set_inline_busy(false);
182 if (cancel) cancel();
184 });
185 };
186 // Let the tool force-close the field (keep-as-drawn) — polyline right-click/double-click
187 // ends the chain even while a per-segment value field is open.
188 m_sketch_tool.on_inline_dismiss = [this]() {
189 if (m_inline_editor) m_inline_editor->cancel();
190 };
191 m_sketch_tool.on_inline_commit = [this]() {
192 if (m_inline_editor) m_inline_editor->commit();
193 };
194
195 // The two viewport chips — the active tool's values bottom-right, the status line bottom-left
196 // — are drawn by the canvas itself, in the tool's ImGui pass: they go away with the canvas,
197 // the tab and the window, and never take the keyboard.
198 m_sketch_tool.on_readout = [this](const std::string& s) { set_readout(s); };
199 m_sketch_tool.render_overlays = [this] { render_hud(); };
200
201 refresh_bed();
202
203 // The view this canvas opens on. Built lazily, on the way into the Design tab, so this
204 // is the view the user is looking at right now — moved off the current plate onto the
205 // Design bed, which stays at the printer bed's home whichever plate is current — turned to
206 // the iso view Home returns to, keeping its target and zoom.
207 m_parked_camera = wxGetApp().plater()->get_camera();
208 if (PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate())
209 m_parked_camera.translate_world(-plate->get_origin());
211
212 // Before any of this class's own Binds below: wx calls dynamically bound handlers in
213 // reverse order of binding, and GLCanvas3D swallows several events without skipping them —
214 // wxEVT_RIGHT_UP and wxEVT_ENTER_WINDOW in on_mouse, and wxEVT_SIZE in on_size, which is
215 // just `m_dirty = true;`. For those, whatever is bound LAST is the only handler that runs.
216 // The context menu and the focus-follows-mouse depend on running first, which is only true
217 // while this call stays ahead of them.
218 m_canvas->bind_event_handlers();
219
220 // The Design GL canvas only receives key events (Esc to exit/enter Select, Ctrl+Z undo)
221 // while it holds keyboard focus. Clicking a side-panel button steals focus, after which
222 // Esc/Ctrl+Z silently do nothing until the viewport is clicked again. Restore focus
223 // whenever the pointer enters the viewport (focus-follows-mouse, standard CAD behaviour).
224 m_canvas_widget->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& e) {
225 // …but NOT while an inline value field is open: the field floats over the canvas, so
226 // the smallest pointer jiggle re-enters the viewport and would yank focus off the
227 // field (the "no cursor focus on the number, click to focus" bug).
228 bool take_focus = m_canvas_widget && !m_sketch_tool.inline_busy();
229#if defined(__WXMSW__) && wxUSE_POPUPWIN
230 // …nor while a popup is open. A ribbon dropdown opens over the viewport, and the pointer
231 // crosses the viewport on its way to it: taking focus then reactivates the frame, which
232 // on MSW dismisses the popup under the pointer. GLCanvas3D::on_mouse has the same guard.
233 take_focus = take_focus && !wxCurrentPopupWindow;
234#endif
235 if (take_focus) m_canvas_widget->SetFocus();
236 e.Skip();
237 });
238
239
240 auto* sizer = new wxBoxSizer(wxVERTICAL);
241 sizer->Add(m_canvas_widget, 1, wxEXPAND);
242 SetSizer(sizer);
243 SetMinSize(wxSize(300, 300));
244}
GLCanvas3D * m_canvas
Definition DesignCanvas.hpp:414
wxGLCanvas * m_canvas_widget
Definition DesignCanvas.hpp:413
void render_hud()
Definition DesignCanvas.cpp:1209
Model m_model
Definition DesignCanvas.hpp:430
void request_repaint()
Definition DesignCanvas.cpp:281
std::function< void(const std::vector< SketchEntity > &, const std::vector< SketchEntityConstraintDef > &, const SketchPlane &)> m_on_sketch_entities_commit
Definition DesignCanvas.hpp:460
Bed3D m_bed
Definition DesignCanvas.hpp:424
void refresh_bed()
Definition DesignCanvas.cpp:567
std::unique_ptr< SketchInlineEditor > m_inline_editor
Definition DesignCanvas.hpp:447
std::function< void(const SketchProfile &, const SketchPlane &)> m_on_sketch_commit
Definition DesignCanvas.hpp:457
Camera m_parked_camera
Definition DesignCanvas.hpp:428
void set_readout(const std::string &text)
Definition DesignCanvas.cpp:1194
DesignSketchTool m_sketch_tool
Definition DesignCanvas.hpp:441
@ CanvasView3D
Definition GLCanvas3D.hpp:626
static bool can_multisample()
Definition OpenGLManager.hpp:100
static wxGLCanvas * create_wxglcanvas(wxWindow &parent)
Definition OpenGLManager.cpp:432
wxMouseEvent
Definition CameraPopup.cpp:47
static Plater * plater()
Definition GUI_Factories.cpp:400
static void select_iso_view(Camera &camera)
Definition DesignCanvas.cpp:65

References Slic3r::GUI::OpenGLManager::can_multisample(), Slic3r::GUI::GLCanvas3D::CanvasView3D, Slic3r::GUI::OpenGLManager::create_wxglcanvas(), m_bed, m_canvas, m_canvas_widget, m_inline_editor, m_model, m_on_sketch_commit, m_on_sketch_entities_commit, m_parked_camera, m_sketch_tool, Slic3r::GUI::plater(), refresh_bed(), render_hud(), request_repaint(), Slic3r::GUI::select_iso_view(), set_readout(), and Slic3r::GUI::wxMouseEvent.

Here is the call graph for this function:

◆ ~DesignCanvas()

Slic3r::GUI::DesignCanvas::~DesignCanvas ( )
override
258{
259 delete m_canvas;
260 delete m_canvas_widget;
261}

References m_canvas, and m_canvas_widget.

Member Function Documentation

◆ add_sketch_regions()

bool Slic3r::GUI::DesignCanvas::add_sketch_regions ( const std::vector< std::vector< std::vector< Vec2d > > > & regions)
540{
541 const bool ok = m_sketch_tool.add_imported_regions(regions);
542 if (ok) request_repaint();
543 return ok;
544}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ apply_segment_length()

void Slic3r::GUI::DesignCanvas::apply_segment_length ( double len)
646{
647 m_sketch_tool.apply_segment_length(len);
649}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ apply_sketch_dimension()

void Slic3r::GUI::DesignCanvas::apply_sketch_dimension ( double v)
1434{
1435 m_sketch_tool.apply_dimension(v);
1437}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ bed_center()

Vec2d Slic3r::GUI::DesignCanvas::bed_center ( ) const
inline
98{ return m_bed.build_volume().bed_center(); }

References m_bed.

◆ begin_constrain()

void Slic3r::GUI::DesignCanvas::begin_constrain ( const SketchProfile & prof,
const SketchPlane & plane )
1492{
1493 m_sketch_tool.begin_constrain(prof, plane);
1494 // The overlay must appear immediately (no mouse move to trigger a repaint).
1496}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_constrain_entities()

void Slic3r::GUI::DesignCanvas::begin_constrain_entities ( const std::vector< SketchEntity > & ents,
const SketchPlane & plane )
1534{
1535 m_sketch_tool.begin_constrain_entities(ents, plane);
1537}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_fillet_gizmo()

bool Slic3r::GUI::DesignCanvas::begin_fillet_gizmo ( const Vec3d & body_centroid,
double radius )
764{
765 const bool ok = m_sketch_tool.set_fillet_gizmo(body_centroid, radius);
767 return ok;
768}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_hole_gizmo()

void Slic3r::GUI::DesignCanvas::begin_hole_gizmo ( const SketchPlane & plane,
double x,
double y,
double diameter,
double depth,
bool through )
785{
786 m_sketch_tool.set_hole_gizmo(plane, x, y, diameter, depth, through);
788}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_imported_transform()

void Slic3r::GUI::DesignCanvas::begin_imported_transform ( int feat,
const std::vector< std::vector< std::vector< Vec2d > > > & base_regions,
const SketchPlane & plane,
const Vec2d & offset,
double scale_x,
double scale_y )
1501{
1502 m_sketch_tool.begin_imported_transform(feat, base_regions, plane, offset, scale_x, scale_y);
1504}
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582

References m_sketch_tool, Slic3r::offset(), and request_repaint().

Here is the call graph for this function:

◆ begin_move_body()

void Slic3r::GUI::DesignCanvas::begin_move_body ( int body,
const Vec3d & pivot,
const Transform3d & base_xform,
double body_radius )
747{
748 m_sketch_tool.set_move_gizmo(body, pivot, base_xform, body_radius);
750}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_pattern_gizmo()

void Slic3r::GUI::DesignCanvas::begin_pattern_gizmo ( const SketchPlane & plane,
const Vec3d & body_centroid,
bool circular,
int count,
int dir,
double spacing,
double angle )
908{
909 m_sketch_tool.set_pattern_gizmo(plane, body_centroid, circular, count, dir, spacing, angle);
911}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138

References Slic3r::angle(), count, m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_revolve_gizmo()

void Slic3r::GUI::DesignCanvas::begin_revolve_gizmo ( const SketchPlane & plane,
const Vec2d & centroid,
const Vec3d & axis_origin,
const Vec3d & axis_dir,
double angle,
bool flip )
850{
851 m_sketch_tool.set_revolve_gizmo(plane, centroid, axis_origin, axis_dir, angle, flip);
853}

References Slic3r::angle(), m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_shell_gizmo()

void Slic3r::GUI::DesignCanvas::begin_shell_gizmo ( const Vec3d & face_centroid,
const Vec3d & inward_dir,
double thickness )
830{
831 m_sketch_tool.set_shell_gizmo(face_centroid, inward_dir, thickness);
833}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ begin_sketch()

void Slic3r::GUI::DesignCanvas::begin_sketch ( const SketchPlane & plane,
DesignSketchTool::Mode mode )
497{
498 m_sketch_tool.begin(plane, mode);
499 if (m_canvas) m_canvas->set_as_dirty();
500 if (m_canvas_widget) m_canvas_widget->Refresh();
501}

References m_canvas, m_canvas_widget, and m_sketch_tool.

Referenced by Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_begin().

Here is the caller graph for this function:

◆ begin_thread_gizmo()

void Slic3r::GUI::DesignCanvas::begin_thread_gizmo ( const SketchPlane & plane,
double x,
double y,
double radius,
double height )
810{
811 m_sketch_tool.set_thread_gizmo(plane, x, y, radius, height);
813}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ body_color()

ColorRGBA Slic3r::GUI::DesignCanvas::body_color ( int body) const
738{
739 if (m_color_bodies != nullptr && body >= 0 && body < int(m_color_bodies->size())
740 && (*m_color_bodies)[body].has_color)
741 return (*m_color_bodies)[body].color;
742 return body_palette(body);
743}
const std::vector< CadBody > * m_color_bodies
Definition DesignCanvas.hpp:439
static ColorRGBA body_palette(int body_idx)
Definition DesignCanvas.cpp:267

References Slic3r::GUI::body_palette(), and m_color_bodies.

Referenced by reload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ can_redo_sketch_entity()

bool Slic3r::GUI::DesignCanvas::can_redo_sketch_entity ( ) const
inline
290{ return m_sketch_tool.can_redo_entity(); }

References m_sketch_tool.

◆ can_undo_sketch_entity()

bool Slic3r::GUI::DesignCanvas::can_undo_sketch_entity ( ) const
inline
289{ return m_sketch_tool.can_undo_entity(); }

References m_sketch_tool.

◆ cancel_sketch()

void Slic3r::GUI::DesignCanvas::cancel_sketch ( )
606{
607 m_sketch_tool.cancel();
608 if (m_canvas) m_canvas->set_as_dirty();
609 if (m_canvas_widget) m_canvas_widget->Refresh();
610}

References m_canvas, m_canvas_widget, and m_sketch_tool.

Referenced by Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_cancel().

Here is the caller graph for this function:

◆ cancel_sketch_dimension()

void Slic3r::GUI::DesignCanvas::cancel_sketch_dimension ( )
1486{
1487 m_sketch_tool.cancel_dimension_value();
1489}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_any_selection()

bool Slic3r::GUI::DesignCanvas::clear_any_selection ( )
1596{
1597 if (!has_any_selection()) return false;
1598 // All three, unconditionally: which is live depends on the mode, and Esc at idle means
1599 // "nothing is picked" in any of them. clear_selection() reports through the tool's own
1600 // on_selection_changed; the solid side has no such notification, so the panel refreshes what
1601 // depends on it (see DesignPanel::escape).
1602 m_sketch_tool.clear_selection();
1603 m_sketch_tool.clear_solid_selection();
1604 m_sketch_tool.clear_display_pick();
1605 // clear_solid_selection() is silent by design (recomputes call it while ids are invalid), but
1606 // the panel mirrors the pick to aim Extrude and the dress-up tools. An Esc that cleared the
1607 // highlight without telling the panel would leave those aimed at a body nothing points to.
1608 if (m_sketch_tool.on_solid_selection_changed)
1609 m_sketch_tool.on_solid_selection_changed(0, -1, -1, -1);
1611 return true;
1612}
bool has_any_selection() const
Definition DesignCanvas.cpp:1589

References has_any_selection(), m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_base_pick()

void Slic3r::GUI::DesignCanvas::clear_base_pick ( )
1040{
1041 m_sketch_tool.clear_base_pick();
1043}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_cut_gizmo()

void Slic3r::GUI::DesignCanvas::clear_cut_gizmo ( )
894{
895 m_sketch_tool.clear_cut_gizmo();
897}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_datum_gizmo()

void Slic3r::GUI::DesignCanvas::clear_datum_gizmo ( )
981{
982 m_sketch_tool.clear_datum_gizmo();
984}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_draft_gizmo()

void Slic3r::GUI::DesignCanvas::clear_draft_gizmo ( )
875{
876 m_sketch_tool.clear_draft_gizmo();
878}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_extrude_gizmo()

void Slic3r::GUI::DesignCanvas::clear_extrude_gizmo ( )
962{
963 m_sketch_tool.clear_extrude_gizmo();
965}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_fillet_gizmo()

void Slic3r::GUI::DesignCanvas::clear_fillet_gizmo ( )
771{
772 m_sketch_tool.clear_fillet_gizmo();
774}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_helix_gizmo()

void Slic3r::GUI::DesignCanvas::clear_helix_gizmo ( )
1004{
1005 m_sketch_tool.clear_helix_gizmo();
1007}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_hole_gizmo()

void Slic3r::GUI::DesignCanvas::clear_hole_gizmo ( )
796{
797 m_sketch_tool.clear_hole_gizmo();
799}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_loop_pick()

void Slic3r::GUI::DesignCanvas::clear_loop_pick ( )
693{
694 m_sketch_tool.clear_display_pick();
695}

References m_sketch_tool.

◆ clear_mesh()

void Slic3r::GUI::DesignCanvas::clear_mesh ( )
430{
431 m_body_meshes = nullptr;
432 m_volumes.clear();
433 // No solid, so no edge lines, pick or hover either, as after a rebuild that leaves no body.
434 m_sketch_tool.set_solid_pick(nullptr, nullptr, nullptr, nullptr);
435 if (!m_model.objects.empty()) {
436 m_model.delete_object((size_t)0);
437 reload();
438 }
439}
const std::vector< TriangleMesh > * m_body_meshes
Definition DesignCanvas.hpp:406
void reload()
Definition DesignCanvas.cpp:364
std::vector< BodyVolume > m_volumes
Definition DesignCanvas.hpp:409

References m_body_meshes, m_model, m_sketch_tool, m_volumes, and reload().

Referenced by set_bodies().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_move_gizmo()

void Slic3r::GUI::DesignCanvas::clear_move_gizmo ( )
753{
754 m_sketch_tool.clear_move_gizmo();
756}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_pattern_gizmo()

void Slic3r::GUI::DesignCanvas::clear_pattern_gizmo ( )
914{
915 m_sketch_tool.clear_pattern_gizmo();
917}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_preview()

void Slic3r::GUI::DesignCanvas::clear_preview ( )
455{
456 if (m_model.objects.size() > 1) {
457 m_model.delete_object((size_t)1);
458 reload();
459 }
460}

References m_model, and reload().

Here is the call graph for this function:

◆ clear_revolve_gizmo()

void Slic3r::GUI::DesignCanvas::clear_revolve_gizmo ( )
856{
857 m_sketch_tool.clear_revolve_gizmo();
859}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_rib_gizmo()

void Slic3r::GUI::DesignCanvas::clear_rib_gizmo ( )
1022{
1023 m_sketch_tool.clear_rib_gizmo();
1025}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_shell_gizmo()

void Slic3r::GUI::DesignCanvas::clear_shell_gizmo ( )
836{
837 m_sketch_tool.clear_shell_gizmo();
839}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_sketch_selection()

void Slic3r::GUI::DesignCanvas::clear_sketch_selection ( )
1418{
1419 m_sketch_tool.clear_selection();
1421}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ clear_solid_pick()

void Slic3r::GUI::DesignCanvas::clear_solid_pick ( )
698{
699 m_sketch_tool.clear_solid_selection();
701}
void sync_selected_faces()
Definition DesignCanvas.cpp:1258

References m_sketch_tool, and sync_selected_faces().

Here is the call graph for this function:

◆ clear_thread_gizmo()

void Slic3r::GUI::DesignCanvas::clear_thread_gizmo ( )
816{
817 m_sketch_tool.clear_thread_gizmo();
819}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ cutting()

bool Slic3r::GUI::DesignCanvas::cutting ( ) const
899{ return m_sketch_tool.cutting(); }

References m_sketch_tool.

◆ delete_selected_sketch_entities()

bool Slic3r::GUI::DesignCanvas::delete_selected_sketch_entities ( )
1360{
1361 if (m_sketch_tool.selection().empty()) return false;
1362 m_sketch_tool.delete_selected();
1364 return true;
1365}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ drafting()

bool Slic3r::GUI::DesignCanvas::drafting ( ) const
880{ return m_sketch_tool.drafting(); }

References m_sketch_tool.

◆ drawing_in_progress()

bool Slic3r::GUI::DesignCanvas::drawing_in_progress ( ) const
1585{
1586 return m_sketch_tool.gesture_pending();
1587}

References m_sketch_tool.

◆ edit_sketch()

void Slic3r::GUI::DesignCanvas::edit_sketch ( const std::vector< SketchEntity > & entities,
const std::vector< SketchEntityConstraintDef > & constraints,
const SketchPlane & plane )
506{
507 m_sketch_tool.begin_edit(entities, constraints, plane);
508 if (m_canvas) m_canvas->set_as_dirty();
509 if (m_canvas_widget) m_canvas_widget->Refresh();
510}

References m_canvas, m_canvas_widget, and m_sketch_tool.

◆ edit_sketch_selection_value()

bool Slic3r::GUI::DesignCanvas::edit_sketch_selection_value ( )
525{
526 const bool ok = m_sketch_tool.open_selection_dimension_editor();
527 if (ok) request_repaint();
528 return ok;
529}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ end_constrain()

void Slic3r::GUI::DesignCanvas::end_constrain ( )
1512{
1513 // cancel() clears m_active + the picked-segment/entity indices, so the
1514 // constrain overlay (highlighted picks) disappears on the next render.
1515 m_sketch_tool.cancel();
1517}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ enter_viewport()

void Slic3r::GUI::DesignCanvas::enter_viewport ( )
321{
323 if (m_canvas) { m_canvas->reset_old_size(); m_canvas->set_as_dirty(); }
324}
void swap_camera()
Definition DesignCanvas.cpp:334
bool m_camera_swapped
Definition DesignCanvas.hpp:429

References m_camera_swapped, m_canvas, and swap_camera().

Here is the call graph for this function:

◆ faces_box()

BoundingBoxf3 Slic3r::GUI::DesignCanvas::faces_box ( std::vector< std::pair< int, int > > faces) const
inline
70 {
71 return m_sketch_tool.faces_box(std::move(faces));
72 }

References m_sketch_tool.

◆ filleting()

bool Slic3r::GUI::DesignCanvas::filleting ( ) const
776{ return m_sketch_tool.filleting(); }

References m_sketch_tool.

◆ finish_sketch()

void Slic3r::GUI::DesignCanvas::finish_sketch ( )
557{
558 m_sketch_tool.finish();
559 if (m_canvas) m_canvas->set_as_dirty();
560 if (m_canvas_widget) m_canvas_widget->Refresh();
561}

References m_canvas, m_canvas_widget, and m_sketch_tool.

Referenced by Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_commit().

Here is the caller graph for this function:

◆ fit_view()

void Slic3r::GUI::DesignCanvas::fit_view ( )
463{
464 if (m_canvas && !m_model.objects.empty()) {
465 m_canvas->zoom_to_volumes();
466 m_canvas->set_as_dirty();
467 if (m_canvas_widget)
468 m_canvas_widget->Refresh();
469 }
470}

References m_canvas, m_canvas_widget, and m_model.

◆ force_repaint()

void Slic3r::GUI::DesignCanvas::force_repaint ( )
343{
344 if (m_canvas == nullptr || m_canvas_widget == nullptr)
345 return;
346
347 CallAfter([this]() {
348 if (m_canvas == nullptr || m_canvas_widget == nullptr)
349 return;
350 m_canvas->set_as_dirty();
351 m_canvas_widget->Refresh();
352 m_canvas_widget->Update(); // synchronous: an expose may never come after a page show
353 });
354}

References m_canvas, and m_canvas_widget.

◆ has_any_selection()

bool Slic3r::GUI::DesignCanvas::has_any_selection ( ) const
1590{
1591 return m_sketch_tool.has_solid_selection() || m_sketch_tool.sketch_has_selection()
1592 || m_sketch_tool.display_pick() >= 0;
1593}

References m_sketch_tool.

Referenced by clear_any_selection().

Here is the caller graph for this function:

◆ holing()

bool Slic3r::GUI::DesignCanvas::holing ( ) const
801{ return m_sketch_tool.holing(); }

References m_sketch_tool.

◆ inline_busy()

bool Slic3r::GUI::DesignCanvas::inline_busy ( ) const
1368{
1369 // Two sources, still: the TOOL's flag says a value is pending, the editor says a field is
1370 // drawn. They agree now that the field is not a window — the orphan state (logically closed,
1371 // still on screen, still eating keys) cannot be represented when there is nothing to leave
1372 // mapped — but the union costs nothing and is the honest question to ask.
1373 return m_sketch_tool.inline_busy()
1374 || (m_inline_editor && m_inline_editor->is_open());
1375}

References m_inline_editor, and m_sketch_tool.

Referenced by set_on_context_menu().

Here is the caller graph for this function:

◆ inline_cancel()

void Slic3r::GUI::DesignCanvas::inline_cancel ( )
1388{
1389 if (m_inline_editor) m_inline_editor->cancel();
1390}

References m_inline_editor.

◆ inline_commit()

void Slic3r::GUI::DesignCanvas::inline_commit ( )
1383{
1384 if (m_inline_editor) m_inline_editor->commit();
1385}

References m_inline_editor.

◆ inline_has_focus()

bool Slic3r::GUI::DesignCanvas::inline_has_focus ( ) const
1378{
1379 return m_inline_editor && m_inline_editor->has_focus();
1380}

References m_inline_editor.

◆ is_constraining()

bool Slic3r::GUI::DesignCanvas::is_constraining ( ) const
1519{ return m_sketch_tool.is_constraining(); }

References m_sketch_tool.

◆ is_constraining_entities()

bool Slic3r::GUI::DesignCanvas::is_constraining_entities ( ) const
1540{
1541 return m_sketch_tool.is_constraining_entities();
1542}

References m_sketch_tool.

◆ is_sketching()

bool Slic3r::GUI::DesignCanvas::is_sketching ( ) const
603{ return m_sketch_tool.is_active(); }

References m_sketch_tool.

Referenced by Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_begin(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_cancel(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_commit(), and Slic3r::GUI::anonymous_namespace{McpControl.cpp}::mcp_sketch().

Here is the caller graph for this function:

◆ keep_segment_as_drawn()

void Slic3r::GUI::DesignCanvas::keep_segment_as_drawn ( )
652{
653 m_sketch_tool.keep_segment_as_drawn();
655}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ leave_viewport()

void Slic3r::GUI::DesignCanvas::leave_viewport ( )
327{
329 if (Plater* plater = wxGetApp().plater())
330 if (GLCanvas3D* editor = plater->get_current_canvas3D())
331 editor->reset_old_size();
332}
GLCanvas3D * get_current_canvas3D(bool exclude_preview=false)
Definition Plater.cpp:22126
@ Plater
Definition Shortcuts.hpp:21

References m_camera_swapped, Slic3r::GUI::plater(), and swap_camera().

Here is the call graph for this function:

◆ live_sketch_has_work()

bool Slic3r::GUI::DesignCanvas::live_sketch_has_work ( ) const
1399{
1400 return m_sketch_tool.live_sketch_has_work();
1401}

References m_sketch_tool.

◆ loop_pick_feature()

int Slic3r::GUI::DesignCanvas::loop_pick_feature ( ) const
710{
711 return m_sketch_tool.display_pick();
712}

References m_sketch_tool.

◆ loop_pick_region()

int Slic3r::GUI::DesignCanvas::loop_pick_region ( ) const
715{
716 return m_sketch_tool.display_pick_region();
717}

References m_sketch_tool.

◆ mcp_sketch_tool() [1/2]

DesignSketchTool & Slic3r::GUI::DesignCanvas::mcp_sketch_tool ( )
inline
381{ return m_sketch_tool; }

References m_sketch_tool.

Referenced by Slic3r::GUI::anonymous_namespace{McpControl.cpp}::mcp_sketch().

Here is the caller graph for this function:

◆ mcp_sketch_tool() [2/2]

const DesignSketchTool & Slic3r::GUI::DesignCanvas::mcp_sketch_tool ( ) const
inline
382{ return m_sketch_tool; }

References m_sketch_tool.

◆ model_mid_z()

double Slic3r::GUI::DesignCanvas::model_mid_z ( ) const
1189{
1190 const BoundingBoxf3 bb = m_model.bounding_box_exact();
1191 return bb.defined ? bb.center().z() : 0.0;
1192}

References Slic3r::BoundingBox3Base< PointType >::center(), Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::defined, and m_model.

Here is the call graph for this function:

◆ open_inline_value()

void Slic3r::GUI::DesignCanvas::open_inline_value ( double current,
std::function< void(double)> commit,
std::function< void()> cancel = {} )
1441{
1442 if (!m_inline_editor || !m_canvas_widget) { if (cancel) cancel(); return; }
1443 // Host-driven value entry (committed-feature Constrain path): the trigger is a toolbar
1444 // button. Anchor the field OVER the picked geometry (same as the draw-then-edit tools) when
1445 // the tool can project it; else fall back to the middle of the canvas, where the sketch is
1446 // in view. Everything here is canvas DEVICE px, the space the field is drawn in.
1447 const wxSize cs = m_canvas_widget->GetClientSize();
1448 const double sf = m_canvas_widget->GetContentScaleFactor();
1449 wxPoint anchor(int(cs.GetWidth() * sf) / 2, int(cs.GetHeight() * sf) / 2);
1450 m_sketch_tool.constrain_value_anchor(anchor); // device px in the canvas viewport
1451 m_sketch_tool.set_inline_busy(true);
1452 m_canvas_widget->SetFocus(); // same reason as the draw-then-edit path: ImGui reads the
1453 // canvas's key events, so the canvas must be the focused widget
1454
1455 m_inline_editor->open(anchor, current, "",
1456 [this, commit](double v) {
1457 m_sketch_tool.set_inline_busy(false);
1458 if (commit) commit(v);
1459 if (m_inline_editor && m_inline_editor->is_open()) m_sketch_tool.set_inline_busy(true);
1461 },
1462 [this, cancel]() {
1463 m_sketch_tool.set_inline_busy(false);
1464 if (cancel) cancel();
1466 });
1467}

References m_canvas_widget, m_inline_editor, m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ patterning()

bool Slic3r::GUI::DesignCanvas::patterning ( ) const
919{ return m_sketch_tool.patterning(); }

References m_sketch_tool.

◆ pending_dimension_type()

DesignSketchTool::DimType Slic3r::GUI::DesignCanvas::pending_dimension_type ( ) const
1475{
1476 return m_sketch_tool.pending_dimension_type();
1477}

References m_sketch_tool.

◆ pick0_point()

bool Slic3r::GUI::DesignCanvas::pick0_point ( Vec2d & out) const
1667{
1668 return m_sketch_tool.pick0_point(out);
1669}

References m_sketch_tool.

◆ rebuild_bodies()

void Slic3r::GUI::DesignCanvas::rebuild_bodies ( )
private
1283{
1284 ModelObject* obj = m_model.objects.empty() ? m_model.add_object() : m_model.objects.front();
1285 obj->clear_volumes();
1286 m_volumes.clear();
1287 const std::vector<TriangleMesh>& meshes = *m_body_meshes;
1288 size_t ntri = 0;
1289 for (const TriangleMesh& m : meshes)
1290 ntri += m.its.indices.size();
1291 const bool mapped = m_tri_face != nullptr && m_tri_face->size() == ntri;
1292 size_t off = 0;
1293 for (int b = 0; b < int(meshes.size()); ++b) {
1294 const TriangleMesh& mesh = meshes[b];
1295 const auto first = std::lower_bound(m_lit_faces.begin(), m_lit_faces.end(), std::make_pair(b, INT_MIN));
1296 const auto last = std::lower_bound(first, m_lit_faces.end(), std::make_pair(b + 1, INT_MIN));
1297 if (!mapped || first == last) {
1298 obj->add_volume(mesh);
1299 m_volumes.push_back({ b, false });
1300 } else {
1301 indexed_triangle_set parts[2]; // [0] the rest of the body, [1] its selected faces
1302 for (size_t i = 0; i < mesh.its.indices.size(); ++i) {
1303 const int f = (*m_tri_face)[off + i];
1304 const bool lit = std::binary_search(first, last, std::make_pair(b, f));
1305 parts[lit].indices.push_back(mesh.its.indices[i]);
1306 }
1307 for (int lit = 0; lit < 2; ++lit) {
1308 if (parts[lit].indices.empty())
1309 continue;
1310 parts[lit].vertices = mesh.its.vertices;
1311 its_compactify_vertices(parts[lit]);
1312 obj->add_volume(TriangleMesh(std::move(parts[lit])));
1313 m_volumes.push_back({ b, lit == 1 });
1314 }
1315 }
1316 off += mesh.its.indices.size();
1317 }
1318 if (obj->instances.empty())
1319 obj->add_instance();
1320}
const std::vector< int > * m_tri_face
Definition DesignCanvas.hpp:407
std::vector< std::pair< int, int > > m_lit_faces
Definition DesignCanvas.hpp:408
static double f(double x, double z_sin, double z_cos, bool vertical, bool flip)
Definition FillGyroid.cpp:124
int its_compactify_vertices(indexed_triangle_set &its, bool shrink_to_fit)
Definition TriangleMesh.cpp:773

References Slic3r::ModelObject::add_instance(), Slic3r::ModelObject::add_volume(), Slic3r::ModelObject::clear_volumes(), Slic3r::f(), Slic3r::ModelObject::instances, Slic3r::TriangleMesh::its, Slic3r::its_compactify_vertices(), m_body_meshes, m_lit_faces, m_model, m_tri_face, and m_volumes.

Referenced by set_bodies(), and sync_selected_faces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ redo_last_sketch_entity()

bool Slic3r::GUI::DesignCanvas::redo_last_sketch_entity ( )
1404{
1405 const bool did = m_sketch_tool.redo_last_entity();
1406 if (did) request_repaint();
1407 return did;
1408}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ refresh_bed()

void Slic3r::GUI::DesignCanvas::refresh_bed ( )
568{
569 const DynamicPrintConfig* config = wxGetApp().plater()->config();
570 if (!config) return;
571 const auto* bed_shape_opt = config->opt<ConfigOptionPoints>("printable_area");
572 if (!bed_shape_opt) return;
573 double printable_height = 100.0;
574 const auto* ph_opt = config->opt<ConfigOptionFloat>("printable_height");
575 if (ph_opt) printable_height = ph_opt->value;
576 // No position: the Design bed stays at the printer bed's home, whichever plate is current.
577 m_bed.set_shape(bed_shape_opt->values, printable_height, {}, {}, "", false); // mainline added extruder_areas/heights params
578}
zaa_minimize_perimeter_height ConfigOptionFloat
Definition PrintConfig.hpp:1954
zaa_minimize_perimeter_height printable_height((ConfigOptionFloatsNullable, extruder_printable_height))((ConfigOptionPoint

References m_bed, Slic3r::DynamicConfig::opt(), and Slic3r::printable_height().

Referenced by DesignCanvas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ region_entity_indices()

std::vector< std::vector< int > > Slic3r::GUI::DesignCanvas::region_entity_indices ( const std::vector< SketchEntity > & ents) const
683{
684 return m_sketch_tool.region_entity_indices(ents);
685}

References m_sketch_tool.

◆ region_entity_indices_with_holes()

std::vector< std::vector< int > > Slic3r::GUI::DesignCanvas::region_entity_indices_with_holes ( const std::vector< SketchEntity > & ents) const
688{
689 return m_sketch_tool.region_entity_indices_with_holes(ents);
690}

References m_sketch_tool.

◆ reload()

void Slic3r::GUI::DesignCanvas::reload ( )
private
365{
366 m_canvas->reset_volumes();
367
368 for (int i = 0; i < (int)m_model.objects.size(); ++i)
369 m_canvas->load_object(m_model, i);
370
371 const ColorRGBA ghost(0.26f, 0.66f, 1.0f, 0.45f);
372
373 const auto& volumes = m_canvas->get_volumes().volumes;
374 for (auto* v : volumes) {
375 int obj_idx = v->object_idx();
376 if (obj_idx == 0) {
377 // Object 0 holds the bodies (rebuild_bodies): each volume in its body's colour, so
378 // coexisting solids read as distinct parts (Onshape per-part colour), or in the
379 // selection colour when it holds the body's selected faces.
380 const int vi = v->volume_idx();
381 const int b = vi < int(m_volumes.size()) ? m_volumes[vi].body : vi;
382 const bool lit = vi < int(m_volumes.size()) && m_volumes[vi].lit;
383 bool hidden = (b >= 0 && b < int(m_body_visible.size())) && !m_body_visible[b];
384 // Preview-only mode (fillet/chamfer/draft, once a valid target is picked): hide
385 // every base body so only the result ghost is on screen until Confirm.
386 if (m_body_hidden) hidden = true;
387 v->is_active = !hidden; // per-body visibility toggle
388 if (!hidden) {
389 ColorRGBA c = lit ? design_selection_color() : body_color(b);
390 if (b == m_hl_body_target) c = ColorRGBA(0.30f, 0.90f, 0.70f, 1.0f); // target = teal-green
391 else if (b == m_hl_body_tool) c = ColorRGBA(1.00f, 0.55f, 0.15f, 1.0f); // tool = orange
392 if (m_body_translucent) c.a(0.30f);
393 else if (m_xray_focus >= 0 && b != m_xray_focus) c.a(0.25f);
394 v->set_color(c);
395 }
396 } else if (obj_idx == 1) {
397 // The ghost is the whole resulting model, normally drawn as a faint blue overlay on
398 // the visible bodies. Every face the feature leaves alone is in both, at the same
399 // depth, so the ghost is drawn with a depth bias: the bodies win on those faces instead
400 // of the two copies z-fighting, and the ghost shows only where the result reaches past
401 // the bodies. In preview-only mode it IS the result (base bodies hidden), so render it
402 // opaque so it reads as a finished solid rather than a see-through hint.
403 v->set_color(m_body_hidden ? ColorRGBA(0.40f, 0.82f, 1.0f, 1.0f) : ghost);
404 v->depth_bias = true;
405 }
406 }
407
408 // The camera stays where the user left it, even for the first body: Home and a double-click
409 // fit on demand.
410 m_canvas->set_as_dirty();
411 if (m_canvas_widget)
412 m_canvas_widget->Refresh();
413}
ColorRGBA body_color(int body) const
Definition DesignCanvas.cpp:737
bool m_body_hidden
Definition DesignCanvas.hpp:435
int m_hl_body_tool
Definition DesignCanvas.hpp:432
bool m_body_translucent
Definition DesignCanvas.hpp:433
int m_xray_focus
Definition DesignCanvas.hpp:434
int m_hl_body_target
Definition DesignCanvas.hpp:431
std::vector< bool > m_body_visible
Definition DesignCanvas.hpp:436
ColorRGBA design_selection_color(float alpha=1.0f)
Definition DesignSketchTool.hpp:49

References Slic3r::ColorRGBA::a(), body_color(), Slic3r::GUI::design_selection_color(), m_body_hidden, m_body_translucent, m_body_visible, m_canvas, m_canvas_widget, m_hl_body_target, m_hl_body_tool, m_model, m_volumes, and m_xray_focus.

Referenced by clear_mesh(), clear_preview(), set_bodies(), set_body_hidden(), set_body_translucent(), set_operand_bodies(), set_preview_mesh(), set_xray_focus(), and sync_selected_faces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_sketch_constraint()

bool Slic3r::GUI::DesignCanvas::remove_sketch_constraint ( int idx)
1640{
1641 const bool removed = m_sketch_tool.remove_constraint(idx);
1642 if (removed) request_repaint();
1643 return removed;
1644}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ render_hud()

void Slic3r::GUI::DesignCanvas::render_hud ( )
private
1210{
1211 if (m_hud_last.empty() && m_status_hud_last.IsEmpty()) return;
1212 ImGuiWrapper& imgui = *wxGetApp().imgui();
1213 const ImVec2 ds = ImGui::GetIO().DisplaySize;
1214 const float em = imgui.get_style_scaling(); // follows the font, so the DPI
1215 const float margin = 12.f * em;
1216 const int flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
1217 ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings |
1218 ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
1219 auto chip = [&](const char* id, const std::string& text, float x, float pivot_x, float wrap,
1220 const ImVec4* colour) {
1222 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.f * em, 4.f * em));
1223 imgui.set_next_window_pos(x, ds.y - margin, ImGuiCond_Always, pivot_x, 1.f);
1224 imgui.begin(std::string(id), flags);
1225 if (wrap > 0.f) ImGui::PushTextWrapPos(wrap);
1226 if (colour) ImGui::PushStyleColor(ImGuiCol_Text, *colour);
1227 ImGui::TextUnformatted(text.c_str());
1228 if (colour) ImGui::PopStyleColor();
1229 if (wrap > 0.f) ImGui::PopTextWrapPos();
1230 imgui.end();
1231 ImGui::PopStyleVar();
1233 };
1234 if (!m_status_hud_last.IsEmpty()) {
1235 // Past the view cube and the round view buttons, which own the bottom-left corner. Asked
1236 // of the canvas, which lays them out: they follow the monitor's DPI on Windows, where `em`
1237 // does not, so a fixed inset in `em` let them cover the start of the line at 150%.
1238 // A sentence can be a sentence: it wraps to the room left of the readout chip.
1239 const float left = m_canvas->get_canvas_toolbar_right() + margin;
1240 const ImVec4 col = m_status_hud_colour.IsOk()
1241 ? ImVec4(m_status_hud_colour.Red() / 255.f, m_status_hud_colour.Green() / 255.f,
1242 m_status_hud_colour.Blue() / 255.f, 1.f)
1243 : ImVec4();
1244 chip("##design_status", m_status_hud_last.ToUTF8().data(), left, 0.f,
1245 std::max(ds.x * 0.6f - left, 120.f * em), m_status_hud_colour.IsOk() ? &col : nullptr);
1246 }
1247 if (!m_hud_last.empty())
1248 chip("##design_readout", m_hud_last, ds.x - margin, 1.f, 0.f, &ImGuiWrapper::COL_ORCA);
1249}
std::string m_hud_last
Definition DesignCanvas.hpp:452
wxColour m_status_hud_colour
Definition DesignCanvas.hpp:454
wxString m_status_hud_last
Definition DesignCanvas.hpp:453
static void pop_common_window_style()
Definition ImGuiWrapper.cpp:2839
static const ImVec4 COL_ORCA
Definition ImGuiWrapper.hpp:408
static void push_common_window_style(const float scale)
Definition ImGuiWrapper.cpp:2794
@ left
Definition MarchingSquares.hpp:188

References Slic3r::GUI::ImGuiWrapper::begin(), Slic3r::GUI::ImGuiWrapper::COL_ORCA, Slic3r::GUI::ImGuiWrapper::end(), Slic3r::GUI::ImGuiWrapper::get_style_scaling(), m_canvas, m_hud_last, m_status_hud_colour, m_status_hud_last, Slic3r::GUI::ImGuiWrapper::pop_common_window_style(), Slic3r::GUI::ImGuiWrapper::push_common_window_style(), and Slic3r::GUI::ImGuiWrapper::set_next_window_pos().

Referenced by DesignCanvas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ repaint_now()

void Slic3r::GUI::DesignCanvas::repaint_now ( )
357{
358 if (m_canvas == nullptr || m_canvas_widget == nullptr)
359 return;
360 request_repaint(); // mark dirty + Refresh (hardware GL) or render (software GL)
361 m_canvas_widget->Update(); // service the pending paint immediately (a modal popup owns the loop)
362}

References m_canvas, m_canvas_widget, and request_repaint().

Here is the call graph for this function:

◆ request_repaint()

void Slic3r::GUI::DesignCanvas::request_repaint ( )
282{
283 if (!m_canvas)
284 return;
285 m_canvas->set_as_dirty();
286
287 // NOTHING may touch GL before the canvas has initialised it. The backend probe below calls
288 // OpenGLManager::get_gl_info().get_renderer(), which runs GLInfo::detect() -> glGetString
289 // with no context current and, before init_opengl(), no loaded function pointers — a
290 // segfault at startup with no window and nothing in the log. Anything that asks for a
291 // repaint while the panel is still being built lands here, so the guard belongs at the top
292 // rather than around the render() call: the crash was in the PROBE, not in the paint.
293 if (!m_canvas->is_initialized()) {
294 if (m_canvas_widget)
295 m_canvas_widget->Refresh(); // the first real paint draws the current state anyway
296 return;
297 }
298
299 if (m_sw_gl < 0) {
300 // Cache the backend once it's known; the renderer string is empty until
301 // GL is initialised, so stay "unknown" and take the safe direct path till then.
302 const std::string& r = OpenGLManager::get_gl_info().get_renderer();
303 if (!r.empty())
304 m_sw_gl = (boost::icontains(r, "llvmpipe") || boost::icontains(r, "softpipe") ||
305 boost::icontains(r, "swrast") || boost::icontains(r, "software")) ? 1 : 0;
306 }
307
308 if (m_sw_gl == 0) {
309 if (m_canvas_widget)
310 m_canvas_widget->Refresh(); // hardware GL: paint cycle drives render()
311 } else {
312 m_canvas->render(); // software GL or backend not yet known
313 }
314}
int m_sw_gl
Definition DesignCanvas.hpp:415
const std::string & get_renderer() const
Definition OpenGLManager.cpp:82
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106

References Slic3r::GUI::OpenGLManager::get_gl_info(), Slic3r::GUI::OpenGLManager::GLInfo::get_renderer(), m_canvas, m_canvas_widget, and m_sw_gl.

Referenced by DesignCanvas(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_add(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_construction(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_delete(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_heal(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_mirror(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_offset(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_select(), Slic3r::GUI::anonymous_namespace{McpControl.cpp}::action_sketch_set_value(), add_sketch_regions(), apply_segment_length(), apply_sketch_dimension(), begin_constrain(), begin_constrain_entities(), begin_fillet_gizmo(), begin_hole_gizmo(), begin_imported_transform(), begin_move_body(), begin_pattern_gizmo(), begin_revolve_gizmo(), begin_shell_gizmo(), begin_thread_gizmo(), cancel_sketch_dimension(), clear_any_selection(), clear_base_pick(), clear_cut_gizmo(), clear_datum_gizmo(), clear_draft_gizmo(), clear_extrude_gizmo(), clear_fillet_gizmo(), clear_helix_gizmo(), clear_hole_gizmo(), clear_move_gizmo(), clear_pattern_gizmo(), clear_revolve_gizmo(), clear_rib_gizmo(), clear_shell_gizmo(), clear_sketch_selection(), clear_thread_gizmo(), delete_selected_sketch_entities(), edit_sketch_selection_value(), end_constrain(), keep_segment_as_drawn(), open_inline_value(), redo_last_sketch_entity(), remove_sketch_constraint(), repaint_now(), request_sketch_exit(), select_body(), set_base_pick(), set_constraint_glyphs(), set_constraint_highlight(), set_cut_gizmo(), set_datum_gizmo(), set_datum_planes(), set_display_sketches(), set_draft_gizmo(), set_extrude_gizmo(), set_helix_gizmo(), set_highlight_faces(), set_highlight_sketches(), set_loop_pick(), set_mate_connectors(), set_mate_links(), set_on_context_menu(), set_rib_gizmo(), set_section_plane(), set_show_bed(), set_sketch_dimension_value(), set_status_text(), sketch_abort_gesture(), sketch_confirm_pending(), sketch_disarm_tool(), toggle_axes(), toggle_planes(), toggle_sketch_construction_selection(), undo_last_sketch_entity(), update_constrain_entities(), update_constrain_profile(), view_normal_to_sketch(), and zoom_to_box().

Here is the call graph for this function:

◆ request_sketch_exit()

void Slic3r::GUI::DesignCanvas::request_sketch_exit ( )
1393{
1394 m_sketch_tool.request_exit();
1396}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ reset_canvas_volumes()

void Slic3r::GUI::DesignCanvas::reset_canvas_volumes ( )
253{
254 if (m_canvas) m_canvas->reset_volumes();
255}

References m_canvas.

◆ revolving()

bool Slic3r::GUI::DesignCanvas::revolving ( ) const
861{ return m_sketch_tool.revolving(); }

References m_sketch_tool.

◆ select_body()

void Slic3r::GUI::DesignCanvas::select_body ( int body)
948{
949 m_sketch_tool.select_body(body);
952}

References m_sketch_tool, request_repaint(), and sync_selected_faces().

Here is the call graph for this function:

◆ selected_constrain_axis()

int Slic3r::GUI::DesignCanvas::selected_constrain_axis ( ) const
1662{
1663 return m_sketch_tool.pick2();
1664}

References m_sketch_tool.

◆ selected_constrain_entities()

bool Slic3r::GUI::DesignCanvas::selected_constrain_entities ( int & e0,
int & e1 ) const
1657{
1658 return m_sketch_tool.selected_constrain_entities(e0, e1);
1659}

References m_sketch_tool.

◆ selected_loop_entities()

std::vector< SketchEntity > Slic3r::GUI::DesignCanvas::selected_loop_entities ( ) const
678{
679 return m_sketch_tool.selected_loop_entities();
680}

References m_sketch_tool.

◆ selected_segment()

bool Slic3r::GUI::DesignCanvas::selected_segment ( int & a,
int & b ) const
1522{
1523 return m_sketch_tool.selected_segment(a, b);
1524}

References m_sketch_tool.

◆ selected_solid_edges()

std::vector< int > Slic3r::GUI::DesignCanvas::selected_solid_edges ( ) const
927{
928 return m_sketch_tool.selected_edges();
929}

References m_sketch_tool.

◆ selection_box()

BoundingBoxf3 Slic3r::GUI::DesignCanvas::selection_box ( ) const
inline
68{ return m_sketch_tool.selection_box(); }

References m_sketch_tool.

◆ set_base_pick()

void Slic3r::GUI::DesignCanvas::set_base_pick ( std::vector< SketchPlane > planes,
std::vector< int > bases,
std::vector< std::string > labels = {} )
1034{
1035 m_sketch_tool.set_base_pick(std::move(planes), std::move(bases), std::move(labels));
1037}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_bodies()

void Slic3r::GUI::DesignCanvas::set_bodies ( const std::vector< TriangleMesh > * body_meshes,
const std::vector< bool > & visible = {} )
417{
418 // Object 0 is built by rebuild_bodies; picking uses the combined mesh from set_solid_pick.
419 m_body_visible = visible; // empty => all visible; reload() reads this per volume
420 if (body_meshes == nullptr || body_meshes->empty()) { clear_mesh(); return; }
421
422 m_body_meshes = body_meshes;
423 m_sketch_tool.refresh_body_edges(); // of the bodies set_solid_pick() pointed the tool at
424 m_lit_faces = m_sketch_tool.selected_faces();
426 reload();
427}
void rebuild_bodies()
Definition DesignCanvas.cpp:1282
void clear_mesh()
Definition DesignCanvas.cpp:429

References clear_mesh(), m_body_meshes, m_body_visible, m_lit_faces, m_sketch_tool, rebuild_bodies(), and reload().

Here is the call graph for this function:

◆ set_body_hidden()

void Slic3r::GUI::DesignCanvas::set_body_hidden ( bool on)
1352{
1353 if (m_body_hidden == on) return;
1354 m_body_hidden = on;
1355 m_sketch_tool.set_body_edges_hidden(on);
1356 reload(); // hides/show base bodies + flips the ghost opaque/faint for preview-only mode
1357}

References m_body_hidden, m_sketch_tool, and reload().

Referenced by set_section_plane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_body_translucent()

void Slic3r::GUI::DesignCanvas::set_body_translucent ( bool on)
1337{
1338 if (m_body_translucent == on) return;
1339 m_body_translucent = on;
1340 reload(); // re-applies object-0 alpha so the solid fades for the fillet preview
1341}

References m_body_translucent, and reload().

Referenced by set_section_plane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_constraint_glyphs()

void Slic3r::GUI::DesignCanvas::set_constraint_glyphs ( std::vector< SketchEntityConstraintDef > cons)
1684{
1685 m_sketch_tool.set_constraint_glyphs(std::move(cons));
1687}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_constraint_highlight()

void Slic3r::GUI::DesignCanvas::set_constraint_highlight ( std::vector< int > entities)
1678{
1679 m_sketch_tool.set_constraint_highlight(std::move(entities));
1681}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_cut_gizmo()

void Slic3r::GUI::DesignCanvas::set_cut_gizmo ( const SketchPlane & plane,
double offset,
const Vec3d & body_center,
double half_extent )
888{
889 m_sketch_tool.set_cut_gizmo(plane, offset, body_center, half_extent);
891}

References m_sketch_tool, Slic3r::offset(), and request_repaint().

Here is the call graph for this function:

◆ set_datum_gizmo()

void Slic3r::GUI::DesignCanvas::set_datum_gizmo ( const SketchPlane & plane,
double usize,
double vsize,
const Vec3d & base_origin,
const Vec3d & base_normal,
double offset,
bool offset_on )
975{
976 m_sketch_tool.set_datum_gizmo(plane, usize, vsize, base_origin, base_normal, offset, offset_on);
978}

References m_sketch_tool, Slic3r::offset(), and request_repaint().

Here is the call graph for this function:

◆ set_datum_planes()

void Slic3r::GUI::DesignCanvas::set_datum_planes ( std::vector< SketchPlane > planes,
std::vector< Vec2d > sizes = {} )
1130{
1131 m_sketch_tool.set_datum_planes(std::move(planes), std::move(sizes));
1133}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_display_sketches()

void Slic3r::GUI::DesignCanvas::set_display_sketches ( std::vector< DesignSketchTool::DisplaySketch > ds)
1123{
1124 m_sketch_tool.set_display_sketches(std::move(ds));
1125 // Overlay changed programmatically (no mouse event) — force a repaint.
1127}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_draft_gizmo()

void Slic3r::GUI::DesignCanvas::set_draft_gizmo ( const Vec3d & face_centroid,
const Vec3d & face_normal,
double angle )
869{
870 m_sketch_tool.set_draft_gizmo(face_centroid, face_normal, angle);
872}
Vec3f face_normal(const stl_vertex vertex[3])
Definition TriangleMesh.hpp:349

References Slic3r::angle(), Slic3r::face_normal(), m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_escalate_on_repick()

void Slic3r::GUI::DesignCanvas::set_escalate_on_repick ( bool on)
720{
721 m_sketch_tool.set_escalate_on_repick(on);
722}

References m_sketch_tool.

◆ set_extrude_gizmo()

void Slic3r::GUI::DesignCanvas::set_extrude_gizmo ( const SketchPlane & plane,
const Vec2d & centroid,
double depth,
double depth2,
bool two_sided,
bool flip )
956{
957 m_sketch_tool.set_extrude_gizmo(plane, centroid, depth, depth2, two_sided, flip);
959}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_helix_gizmo()

void Slic3r::GUI::DesignCanvas::set_helix_gizmo ( const SketchPlane & plane,
double radius,
double pitch,
double height,
double taper,
bool left_handed )
998{
999 m_sketch_tool.set_helix_gizmo(plane, radius, pitch, height, taper, left_handed);
1001}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_highlight_faces()

void Slic3r::GUI::DesignCanvas::set_highlight_faces ( const std::vector< std::pair< int, int > > & faces)
1252{
1253 m_sketch_tool.set_highlight_faces(faces);
1256}

References m_sketch_tool, request_repaint(), and sync_selected_faces().

Here is the call graph for this function:

◆ set_highlight_sketches()

void Slic3r::GUI::DesignCanvas::set_highlight_sketches ( std::vector< std::pair< int, ColorRGBA > > hl)
1331{
1332 m_sketch_tool.set_highlight_sketches(std::move(hl));
1334}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_hole_face_bounds()

void Slic3r::GUI::DesignCanvas::set_hole_face_bounds ( bool has,
double umin,
double umax,
double vmin,
double vmax )
791{
792 m_sketch_tool.set_hole_face_bounds(has, umin, umax, vmin, vmax);
793}

References m_sketch_tool.

◆ set_loop_pick()

void Slic3r::GUI::DesignCanvas::set_loop_pick ( int feature,
int region )
704{
705 m_sketch_tool.set_display_pick(feature, region);
707}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_mate_connectors()

void Slic3r::GUI::DesignCanvas::set_mate_connectors ( std::vector< DesignSketchTool::MateConnectorGlyph > g)
1136{
1137 m_sketch_tool.set_mate_connectors(std::move(g));
1139}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_mate_links()

void Slic3r::GUI::DesignCanvas::set_mate_links ( std::vector< std::pair< Vec3d, Vec3d > > l)
1142{
1143 m_sketch_tool.set_mate_links(std::move(l));
1145}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_on_body_move_changed()

void Slic3r::GUI::DesignCanvas::set_on_body_move_changed ( std::function< void(int, const Transform3d &)> cb)
759{
760 m_sketch_tool.on_body_move_changed = std::move(cb);
761}

References m_sketch_tool.

◆ set_on_context_menu()

void Slic3r::GUI::DesignCanvas::set_on_context_menu ( std::function< void(const wxPoint &)> cb)
1071{
1072 m_on_context_menu = std::move(cb);
1074 return;
1075 m_ctx_bound = true;
1076 // Bound AFTER GLCanvas3D's own handlers, so this runs first and can consume the event.
1077 // It only consumes when it actually opens the offer.
1078 // Right-drag may pan or orbit (Preferences > Control). Without remembering where the press
1079 // landed, every such drag ended by popping the offer over wherever the camera stopped — the
1080 // menu appearing as the reward for moving the view. A right-click is the release of a
1081 // STATIONARY press (kCadRightClickDriftPx); only that reaches the sketch tool or the offer.
1082 m_canvas_widget->Bind(wxEVT_RIGHT_DOWN, [this](wxMouseEvent& e) {
1083 m_ctx_press = e.GetPosition();
1084 m_ctx_travelled = false;
1085 // Drop any press the tool still keeps (only a click's release takes it, so a pan's stays)
1086 // before the canvas offers it this one, which ImGui may take instead.
1087 m_sketch_tool.drop_right_click();
1088 e.Skip(); // the canvas still needs the press to seed a pan or an orbit
1089 });
1090 m_canvas_widget->Bind(wxEVT_MOTION, [this](wxMouseEvent& e) {
1091 if (e.RightIsDown()) {
1092 const wxPoint d = e.GetPosition() - m_ctx_press;
1093 if (std::max(std::abs(d.x), std::abs(d.y)) > kCadRightClickDriftPx) m_ctx_travelled = true;
1094 }
1095 e.Skip();
1096 });
1097 m_canvas_widget->Bind(wxEVT_RIGHT_UP, [this](wxMouseEvent& e) {
1098 const wxPoint d = e.GetPosition() - m_ctx_press;
1099 // Click, or navigation? A press that travelled panned or orbited; one that did not, did not.
1100 const bool is_click = !m_ctx_travelled && std::max(std::abs(d.x), std::abs(d.y)) <= kCadRightClickDriftPx;
1101 // Ending a chain or abandoning an anchor uses the click up.
1102 const bool terminated = is_click && m_canvas && m_sketch_tool.take_right_click(*m_canvas);
1103 if (terminated)
1104 m_canvas->set_as_dirty(); // drawn by the canvas's own RightUp (e.Skip below) or at idle
1105 else if (m_on_context_menu && !inline_busy() && is_click) {
1106 // The menu belongs to what you POINTED AT — and pointing happened at the PRESS, not
1107 // at the release, so the raycast uses the press position. Within a 3 px budget the
1108 // two are the same pixel in practice; using the press is what makes that a
1109 // guarantee rather than a coincidence. Pick first, so a right-click on a line offers
1110 // that line's verbs instead of the empty-selection vocabulary. Selecting an entity
1111 // that is already selected is a no-op, so a multi-entity pick survives a
1112 // right-click on one of its members.
1113 if (m_canvas && m_sketch_tool.select_at_screen(*m_canvas, m_ctx_press.x, m_ctx_press.y))
1116 return; // consumed
1117 }
1118 e.Skip();
1119 });
1120}
bool m_ctx_bound
Definition DesignCanvas.hpp:419
bool m_ctx_travelled
Definition DesignCanvas.hpp:421
std::function< void(const wxPoint &)> m_on_context_menu
Definition DesignCanvas.hpp:418
bool inline_busy() const
Definition DesignCanvas.cpp:1367
wxPoint m_ctx_press
Definition DesignCanvas.hpp:420
constexpr int kCadRightClickDriftPx
Definition DesignInteraction.hpp:55

References inline_busy(), Slic3r::GUI::kCadRightClickDriftPx, m_canvas, m_canvas_widget, m_ctx_bound, m_ctx_press, m_ctx_travelled, m_on_context_menu, m_sketch_tool, request_repaint(), and Slic3r::GUI::wxMouseEvent.

Here is the call graph for this function:

◆ set_on_cursor_metrics()

void Slic3r::GUI::DesignCanvas::set_on_cursor_metrics ( std::function< void(double, double, bool)> cb)
631{
632 m_sketch_tool.on_cursor_metrics = std::move(cb);
633}

References m_sketch_tool.

◆ set_on_cut_offset_changed()

void Slic3r::GUI::DesignCanvas::set_on_cut_offset_changed ( std::function< void(double)> cb)
902{
903 m_sketch_tool.set_on_cut_offset_changed(std::move(cb));
904}

References m_sketch_tool.

◆ set_on_datum_base_picked()

void Slic3r::GUI::DesignCanvas::set_on_datum_base_picked ( std::function< void(int)> cb)
1046{
1047 m_sketch_tool.on_datum_base_picked = std::move(cb);
1048}

References m_sketch_tool.

◆ set_on_datum_offset_changed()

void Slic3r::GUI::DesignCanvas::set_on_datum_offset_changed ( std::function< void(double)> cb)
992{
993 m_sketch_tool.on_datum_offset_changed = std::move(cb);
994}

References m_sketch_tool.

◆ set_on_datum_size_changed()

void Slic3r::GUI::DesignCanvas::set_on_datum_size_changed ( std::function< void(double, double)> cb)
987{
988 m_sketch_tool.on_datum_size_changed = std::move(cb);
989}

References m_sketch_tool.

◆ set_on_dimension_pick_complete()

void Slic3r::GUI::DesignCanvas::set_on_dimension_pick_complete ( std::function< void(double)> cb)
1470{
1471 m_sketch_tool.on_dimension_pick_complete = std::move(cb);
1472}

References m_sketch_tool.

◆ set_on_display_sketch_activated()

void Slic3r::GUI::DesignCanvas::set_on_display_sketch_activated ( std::function< void(int)> cb)
673{
674 m_sketch_tool.on_display_sketch_activated = std::move(cb);
675}

References m_sketch_tool.

◆ set_on_display_sketch_selected()

void Slic3r::GUI::DesignCanvas::set_on_display_sketch_selected ( std::function< void(int, int, int)> cb)
668{
669 m_sketch_tool.on_display_sketch_selected = std::move(cb);
670}

References m_sketch_tool.

◆ set_on_draft_angle_changed()

void Slic3r::GUI::DesignCanvas::set_on_draft_angle_changed ( std::function< void(double)> cb)
883{
884 m_sketch_tool.set_on_draft_angle_changed(std::move(cb));
885}

References m_sketch_tool.

◆ set_on_empty_pick()

void Slic3r::GUI::DesignCanvas::set_on_empty_pick ( std::function< void()> cb)
943{
944 m_sketch_tool.on_empty_pick = std::move(cb);
945}

References m_sketch_tool.

◆ set_on_extrude_depth_changed()

void Slic3r::GUI::DesignCanvas::set_on_extrude_depth_changed ( std::function< void(double, bool)> cb)
968{
969 m_sketch_tool.on_extrude_depth_changed = std::move(cb);
970}

References m_sketch_tool.

◆ set_on_fillet_radius_changed()

void Slic3r::GUI::DesignCanvas::set_on_fillet_radius_changed ( std::function< void(double)> cb)
779{
780 m_sketch_tool.on_fillet_radius_changed = std::move(cb);
781}

References m_sketch_tool.

◆ set_on_helix_changed()

void Slic3r::GUI::DesignCanvas::set_on_helix_changed ( std::function< void(double, double, double)> cb)
1010{
1011 m_sketch_tool.on_helix_changed = std::move(cb);
1012}

References m_sketch_tool.

◆ set_on_hole_changed()

void Slic3r::GUI::DesignCanvas::set_on_hole_changed ( std::function< void(double, double, double, double)> cb)
804{
805 m_sketch_tool.on_hole_changed = std::move(cb);
806}

References m_sketch_tool.

◆ set_on_imported_transform()

void Slic3r::GUI::DesignCanvas::set_on_imported_transform ( std::function< void(int, Vec2d, double, double)> cb)
1507{
1508 m_sketch_tool.on_imported_transform = std::move(cb);
1509}

References m_sketch_tool.

◆ set_on_pattern_changed()

void Slic3r::GUI::DesignCanvas::set_on_pattern_changed ( std::function< void(double)> cb)
922{
923 m_sketch_tool.on_pattern_changed = std::move(cb);
924}

References m_sketch_tool.

◆ set_on_revolve_angle_changed()

void Slic3r::GUI::DesignCanvas::set_on_revolve_angle_changed ( std::function< void(double)> cb)
864{
865 m_sketch_tool.on_revolve_angle_changed = std::move(cb);
866}

References m_sketch_tool.

◆ set_on_rib_thickness_changed()

void Slic3r::GUI::DesignCanvas::set_on_rib_thickness_changed ( std::function< void(double)> cb)
1028{
1029 m_sketch_tool.on_rib_thickness_changed = std::move(cb);
1030}

References m_sketch_tool.

◆ set_on_segment_drawn()

void Slic3r::GUI::DesignCanvas::set_on_segment_drawn ( std::function< void(double, double)> cb)
626{
627 m_sketch_tool.on_segment_drawn = std::move(cb);
628}

References m_sketch_tool.

◆ set_on_shell_thickness_changed()

void Slic3r::GUI::DesignCanvas::set_on_shell_thickness_changed ( std::function< void(double)> cb)
844{
845 m_sketch_tool.on_shell_thickness_changed = std::move(cb);
846}

References m_sketch_tool.

◆ set_on_sketch_commit()

void Slic3r::GUI::DesignCanvas::set_on_sketch_commit ( std::function< void(const SketchProfile &, const SketchPlane &)> cb)
613{
614 m_on_sketch_commit = std::move(cb);
615}

References m_on_sketch_commit.

◆ set_on_sketch_constraints_changed()

void Slic3r::GUI::DesignCanvas::set_on_sketch_constraints_changed ( std::function< void()> cb)
1647{
1648 m_sketch_tool.on_constraints_changed = std::move(cb);
1649}

References m_sketch_tool.

◆ set_on_sketch_entities_commit()

void Slic3r::GUI::DesignCanvas::set_on_sketch_entities_commit ( std::function< void(const std::vector< SketchEntity > &, const std::vector< SketchEntityConstraintDef > &, const SketchPlane &)> cb)
621{
622 m_on_sketch_entities_commit = std::move(cb);
623}

References m_on_sketch_entities_commit.

◆ set_on_sketch_exit()

void Slic3r::GUI::DesignCanvas::set_on_sketch_exit ( std::function< void()> cb)
1056{
1057 m_sketch_tool.on_exit = std::move(cb);
1058}

References m_sketch_tool.

◆ set_on_sketch_exit_refused()

void Slic3r::GUI::DesignCanvas::set_on_sketch_exit_refused ( std::function< void()> cb)
1061{
1062 m_sketch_tool.on_exit_refused = std::move(cb);
1063}

References m_sketch_tool.

◆ set_on_sketch_face_selected()

void Slic3r::GUI::DesignCanvas::set_on_sketch_face_selected ( std::function< void(int)> cb)
663{
664 m_sketch_tool.on_face_selected = std::move(cb);
665}

References m_sketch_tool.

◆ set_on_sketch_notice()

void Slic3r::GUI::DesignCanvas::set_on_sketch_notice ( std::function< void(const std::string &, bool)> cb)
1066{
1067 m_sketch_tool.on_notice = std::move(cb);
1068}

References m_sketch_tool.

◆ set_on_sketch_selection_changed()

void Slic3r::GUI::DesignCanvas::set_on_sketch_selection_changed ( std::function< void(int)> cb)
658{
659 m_sketch_tool.on_selection_changed = std::move(cb);
660}

References m_sketch_tool.

◆ set_on_sketch_step()

void Slic3r::GUI::DesignCanvas::set_on_sketch_step ( std::function< void(DesignSketchTool::Mode, int, int)> cb)
641{
642 m_sketch_tool.on_step_changed = std::move(cb);
643}

References m_sketch_tool.

◆ set_on_solid_selection_changed()

void Slic3r::GUI::DesignCanvas::set_on_solid_selection_changed ( std::function< void(int, int, int, int)> cb)
932{
933 // Wrapped so every pick change in the tool also re-splits the filled faces.
934 m_on_solid_selection_changed = std::move(cb);
935 m_sketch_tool.on_solid_selection_changed = [this](int level, int body, int face, int edge) {
938 m_on_solid_selection_changed(level, body, face, edge);
939 };
940}
std::function< void(int, int, int, int)> m_on_solid_selection_changed
Definition DesignCanvas.hpp:411

References m_on_solid_selection_changed, m_sketch_tool, and sync_selected_faces().

Here is the call graph for this function:

◆ set_on_solve_state()

void Slic3r::GUI::DesignCanvas::set_on_solve_state ( std::function< void(int, bool, bool)> cb)
636{
637 m_sketch_tool.on_solve_state = std::move(cb);
638}

References m_sketch_tool.

◆ set_on_thread_changed()

void Slic3r::GUI::DesignCanvas::set_on_thread_changed ( std::function< void(double, double, double, double)> cb)
824{
825 m_sketch_tool.on_thread_changed = std::move(cb);
826}

References m_sketch_tool.

◆ set_operand_bodies()

void Slic3r::GUI::DesignCanvas::set_operand_bodies ( int target_body,
int tool_body )
1323{
1324 if (m_hl_body_target == target_body && m_hl_body_tool == tool_body) return;
1325 m_hl_body_target = target_body;
1326 m_hl_body_tool = tool_body;
1327 reload(); // recolours the body volumes
1328}

References m_hl_body_target, m_hl_body_tool, and reload().

Here is the call graph for this function:

◆ set_preview_mesh()

void Slic3r::GUI::DesignCanvas::set_preview_mesh ( const TriangleMesh & mesh)
442{
443 // Remove existing ghost (object 1) if present
444 if (m_model.objects.size() > 1)
445 m_model.delete_object((size_t)1);
446
447 auto* obj = m_model.add_object();
448 obj->add_volume(mesh);
449 obj->add_instance();
450
451 reload();
452}

References m_model, and reload().

Here is the call graph for this function:

◆ set_readout()

void Slic3r::GUI::DesignCanvas::set_readout ( const std::string & text)
private
1195{
1196 if (text == m_hud_last) return;
1197 m_hud_last = text;
1198 if (m_canvas) m_canvas->set_as_dirty(); // drawn by the next frame (the tool feeds this from one)
1199}

References m_canvas, and m_hud_last.

Referenced by DesignCanvas().

Here is the caller graph for this function:

◆ set_rib_gizmo()

void Slic3r::GUI::DesignCanvas::set_rib_gizmo ( const SketchPlane & plane,
const Vec2d & p0,
const Vec2d & p1,
double thickness )
1016{
1017 m_sketch_tool.set_rib_gizmo(plane, p0, p1, thickness);
1019}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_section_plane()

void Slic3r::GUI::DesignCanvas::set_section_plane ( bool on,
double z,
bool keep_upper = false )
1162{
1163 m_section_on = on;
1164 // The kept half must read as a SOLID part, never a see-through ghost: make sure no leftover
1165 // preview translucency is applied while the section is on. Guarded — a no-op if already opaque.
1166 if (on) { set_body_translucent(false); set_body_hidden(false); }
1167 if (m_canvas) {
1168 if (on) {
1169 // GLCanvas3D turns the two clipping planes into a Z-RANGE: set_z_range(-p0.offset,
1170 // p1.offset). keep_upper=false keeps the LOWER half (z in [-1e5, z]); keep_upper=true
1171 // keeps the OPPOSITE, UPPER half (z in [z, +1e5]). Only HIDES geometry — no bodies.
1172 if (keep_upper) {
1173 m_canvas->set_clipping_plane(0, ClippingPlane(Vec3d(0.0, 0.0, 1.0), -z)); // min_z = z
1174 m_canvas->set_clipping_plane(1, ClippingPlane(Vec3d(0.0, 0.0, 1.0), 1.0e5)); // max_z = +1e5
1175 } else {
1176 m_canvas->set_clipping_plane(0, ClippingPlane(Vec3d(0.0, 0.0, 1.0), 1.0e5)); // min_z = -1e5
1177 m_canvas->set_clipping_plane(1, ClippingPlane(Vec3d(0.0, 0.0, 1.0), z)); // max_z = z
1178 }
1179 m_canvas->set_use_clipping_planes(true);
1180 } else {
1181 m_canvas->set_use_clipping_planes(false);
1182 }
1183 m_canvas->set_as_dirty();
1184 }
1186}
void set_body_hidden(bool on)
Definition DesignCanvas.cpp:1351
void set_body_translucent(bool on)
Definition DesignCanvas.cpp:1336
bool m_section_on
Definition DesignCanvas.hpp:445
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68

References m_canvas, m_section_on, request_repaint(), set_body_hidden(), and set_body_translucent().

Here is the call graph for this function:

◆ set_selected_base()

void Slic3r::GUI::DesignCanvas::set_selected_base ( std::function< int()> cb)
1051{
1052 m_sketch_tool.selected_base = std::move(cb);
1053}

References m_sketch_tool.

◆ set_show_bed()

void Slic3r::GUI::DesignCanvas::set_show_bed ( bool b)
581{
582 if (!m_canvas) return;
583 if (m_canvas->get_show_bed() == b) return; // no repaint for a no-op toggle
584 m_canvas->set_show_bed(b);
586}

References m_canvas, and request_repaint().

Here is the call graph for this function:

◆ set_sidebar_collapse()

void Slic3r::GUI::DesignCanvas::set_sidebar_collapse ( std::function< CollapseSide()> side,
std::function< void()> toggle )
589{
591 return;
592 m_canvas->set_collapse_toolbar(&m_collapse_toolbar, std::move(side));
593 m_canvas->enable_collapse_toolbar(true);
594 // Shift+Tab: the canvas posts this for its sidebar, as Prepare's canvases do.
595 m_canvas_widget->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [toggle](SimpleEvent&) { toggle(); });
596}
GLToolbar m_collapse_toolbar
Definition DesignCanvas.hpp:416
bool setup_collapse_toolbar(GLToolbar &toolbar, std::function< void()> toggle)
Definition GLToolbar.cpp:1679

References m_canvas, m_canvas_widget, m_collapse_toolbar, and Slic3r::GUI::setup_collapse_toolbar().

Here is the call graph for this function:

◆ set_sidebar_collapse_tooltip()

void Slic3r::GUI::DesignCanvas::set_sidebar_collapse_tooltip ( const std::string & tooltip)
599{
600 m_collapse_toolbar.set_tooltip(m_collapse_toolbar.get_item_id("collapse_sidebar"), tooltip);
601}

References m_collapse_toolbar.

◆ set_sketch_construction()

void Slic3r::GUI::DesignCanvas::set_sketch_construction ( bool c)
520{
521 m_sketch_tool.set_construction(c);
522}

References m_sketch_tool.

◆ set_sketch_dimension_value()

void Slic3r::GUI::DesignCanvas::set_sketch_dimension_value ( double v)
1480{
1481 m_sketch_tool.set_dimension_value(v);
1483}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ set_sketch_polygon_circumscribed()

void Slic3r::GUI::DesignCanvas::set_sketch_polygon_circumscribed ( bool c)
552{
553 m_sketch_tool.set_polygon_circumscribed(c);
554}

References m_sketch_tool.

◆ set_sketch_polygon_sides()

void Slic3r::GUI::DesignCanvas::set_sketch_polygon_sides ( int n)
547{
548 m_sketch_tool.set_polygon_sides(n);
549}

References m_sketch_tool.

◆ set_sketch_tool()

void Slic3r::GUI::DesignCanvas::set_sketch_tool ( DesignSketchTool::Mode mode)
513{
514 m_sketch_tool.set_tool(mode);
515 if (m_canvas) m_canvas->set_as_dirty();
516 if (m_canvas_widget) m_canvas_widget->Refresh();
517}

References m_canvas, m_canvas_widget, and m_sketch_tool.

◆ set_solid_pick()

void Slic3r::GUI::DesignCanvas::set_solid_pick ( const std::vector< CadBody > * bodies,
const TriangleMesh * mesh,
const std::vector< int > * tri_face,
const std::vector< int > * tri_body,
const std::vector< bool > * visible = nullptr,
const std::vector< Transform3d > * xform = nullptr )
728{
729 m_color_bodies = bodies; // stable address (m_doc.bodies); reload() reads colour overrides
730 m_tri_face = tri_face;
731 m_sketch_tool.set_solid_pick(bodies, mesh, tri_face, tri_body, visible, xform);
732 sync_selected_faces(); // the tool just reset its pick
733}

References m_color_bodies, m_sketch_tool, m_tri_face, and sync_selected_faces().

Here is the call graph for this function:

◆ set_status_text()

void Slic3r::GUI::DesignCanvas::set_status_text ( const wxString & text,
const wxColour & colour )
1202{
1203 if (text == m_status_hud_last && colour == m_status_hud_colour) return;
1204 m_status_hud_last = text;
1205 m_status_hud_colour = colour;
1207}

References m_status_hud_colour, m_status_hud_last, and request_repaint().

Here is the call graph for this function:

◆ set_view()

void Slic3r::GUI::DesignCanvas::set_view ( const std::string & view_name)
483{
484 if (m_canvas) {
485 if (view_name == "iso")
486 select_iso_view(wxGetApp().plater()->get_camera()); // the Design camera while the tab is shown
487 else
488 m_canvas->select_view(view_name);
489 m_canvas->zoom_to_volumes();
490 m_canvas->set_as_dirty();
491 if (m_canvas_widget)
492 m_canvas_widget->Refresh();
493 }
494}

References m_canvas, m_canvas_widget, Slic3r::GUI::plater(), and Slic3r::GUI::select_iso_view().

Here is the call graph for this function:

◆ set_xray_focus()

void Slic3r::GUI::DesignCanvas::set_xray_focus ( int body)
1344{
1345 if (m_xray_focus == body) return;
1346 m_xray_focus = body;
1347 m_sketch_tool.set_pick_only_body(body);
1348 reload(); // re-applies per-body alpha so the non-focused bodies fade
1349}

References m_sketch_tool, m_xray_focus, and reload().

Here is the call graph for this function:

◆ shelling()

bool Slic3r::GUI::DesignCanvas::shelling ( ) const
841{ return m_sketch_tool.shelling(); }

References m_sketch_tool.

◆ sketch_abort_gesture()

bool Slic3r::GUI::DesignCanvas::sketch_abort_gesture ( )
1564{
1565 if (!m_sketch_tool.abort_gesture()) return false;
1566 request_repaint(); // the rubber band is gone; the canvas must stop drawing it
1567 return true;
1568}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ sketch_confirm_pending()

bool Slic3r::GUI::DesignCanvas::sketch_confirm_pending ( )
1571{
1572 if (!m_sketch_tool.confirm_pending()) return false;
1574 return true;
1575}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ sketch_constraint_count()

int Slic3r::GUI::DesignCanvas::sketch_constraint_count ( ) const
1630{
1631 return int(m_sketch_tool.constraints().size());
1632}

References m_sketch_tool.

◆ sketch_constraints()

const std::vector< SketchEntityConstraintDef > & Slic3r::GUI::DesignCanvas::sketch_constraints ( ) const
1635{
1636 return m_sketch_tool.constraints();
1637}

References m_sketch_tool.

◆ sketch_dimension_current()

double Slic3r::GUI::DesignCanvas::sketch_dimension_current ( ) const
1429{
1430 return m_sketch_tool.dimension_current();
1431}

References m_sketch_tool.

◆ sketch_dimension_kind()

DesignSketchTool::DimType Slic3r::GUI::DesignCanvas::sketch_dimension_kind ( ) const
1424{
1425 return m_sketch_tool.dimension_kind();
1426}

References m_sketch_tool.

◆ sketch_disarm_tool()

bool Slic3r::GUI::DesignCanvas::sketch_disarm_tool ( )
1578{
1579 if (!m_sketch_tool.disarm_tool()) return false;
1581 return true;
1582}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ sketch_entities()

const std::vector< SketchEntity > & Slic3r::GUI::DesignCanvas::sketch_entities ( ) const
1625{
1626 return m_sketch_tool.entities();
1627}

References m_sketch_tool.

◆ sketch_first_selected_type()

bool Slic3r::GUI::DesignCanvas::sketch_first_selected_type ( SketchEntity::Type & out) const
1615{
1616 return m_sketch_tool.first_selected_type(out);
1617}

References m_sketch_tool.

◆ sketch_is_selecting()

bool Slic3r::GUI::DesignCanvas::sketch_is_selecting ( ) const
inline

◆ sketch_selection()

const std::vector< int > & Slic3r::GUI::DesignCanvas::sketch_selection ( ) const
1620{
1621 return m_sketch_tool.selection();
1622}

References m_sketch_tool.

◆ sketch_selection_count()

int Slic3r::GUI::DesignCanvas::sketch_selection_count ( ) const
1545{
1546 return int(m_sketch_tool.selection().size());
1547}

References m_sketch_tool.

◆ swap_camera()

void Slic3r::GUI::DesignCanvas::swap_camera ( )
private
335{
336 Plater* plater = wxGetApp().plater();
337 if (plater == nullptr) return;
338 std::swap(plater->get_camera(), m_parked_camera);
340}
const Camera & get_camera() const
Definition Plater.cpp:22567

References m_camera_swapped, m_parked_camera, and Slic3r::GUI::plater().

Referenced by enter_viewport(), and leave_viewport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sync_selected_faces()

void Slic3r::GUI::DesignCanvas::sync_selected_faces ( )
private
1259{
1260 // Deferred to the end of the current event, which may change the selection several times:
1261 // every re-split reloads all the bodies. A set_bodies in between splits by the current
1262 // selection itself and leaves this nothing to do.
1263 if (m_split_pending)
1264 return;
1265 m_split_pending = true;
1266 CallAfter([this] {
1267 m_split_pending = false;
1268 std::vector<std::pair<int, int>> want = m_sketch_tool.selected_faces();
1269 if (want == m_lit_faces)
1270 return;
1271 m_lit_faces = std::move(want);
1272 if (m_body_meshes == nullptr || m_model.objects.empty())
1273 return;
1275 reload();
1276 });
1277}
bool m_split_pending
Definition DesignCanvas.hpp:410

References m_body_meshes, m_lit_faces, m_model, m_sketch_tool, m_split_pending, rebuild_bodies(), and reload().

Referenced by clear_solid_pick(), select_body(), set_highlight_faces(), set_on_solid_selection_changed(), and set_solid_pick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ threading()

bool Slic3r::GUI::DesignCanvas::threading ( ) const
821{ return m_sketch_tool.threading(); }

References m_sketch_tool.

◆ toggle_axes()

bool Slic3r::GUI::DesignCanvas::toggle_axes ( )
1155{
1156 const bool on = m_sketch_tool.toggle_show_axes();
1158 return on;
1159}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ toggle_planes()

bool Slic3r::GUI::DesignCanvas::toggle_planes ( )
1148{
1149 const bool on = m_sketch_tool.toggle_show_planes();
1151 return on;
1152}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ toggle_sketch_construction_selection()

int Slic3r::GUI::DesignCanvas::toggle_sketch_construction_selection ( )
532{
533 const int n = m_sketch_tool.toggle_selection_construction();
534 if (n > 0) request_repaint();
535 return n;
536}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ try_add_sketch_constraints()

bool Slic3r::GUI::DesignCanvas::try_add_sketch_constraints ( const std::vector< SketchEntityConstraintDef > & defs)
1652{
1653 return m_sketch_tool.try_add_constraints(defs);
1654}

References m_sketch_tool.

◆ unbind_canvas_event_handlers()

void Slic3r::GUI::DesignCanvas::unbind_canvas_event_handlers ( )
248{
249 if (m_canvas) m_canvas->unbind_event_handlers();
250}

References m_canvas.

◆ undo_last_sketch_entity()

bool Slic3r::GUI::DesignCanvas::undo_last_sketch_entity ( )
1411{
1412 const bool did = m_sketch_tool.undo_last_entity();
1413 if (did) request_repaint();
1414 return did;
1415}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ update_constrain_entities()

void Slic3r::GUI::DesignCanvas::update_constrain_entities ( const std::vector< SketchEntity > & ents)
1672{
1673 m_sketch_tool.set_constrain_entities(ents);
1675}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ update_constrain_profile()

void Slic3r::GUI::DesignCanvas::update_constrain_profile ( const std::vector< Vec2d > & pts)
1527{
1528 m_sketch_tool.set_profile_points(pts);
1530}

References m_sketch_tool, and request_repaint().

Here is the call graph for this function:

◆ view_normal_to_sketch()

bool Slic3r::GUI::DesignCanvas::view_normal_to_sketch ( )
1550{
1551 if (m_canvas == nullptr) return false;
1552 const SketchPlane& pl = m_sketch_tool.plane();
1553 Camera& cam = wxGetApp().plater()->get_camera();
1554 // Keep the distance: this is an orientation change, not a zoom. The plane's own y axis is
1555 // the up vector, so "up" on screen is up in sketch coordinates — which is what makes a
1556 // dimension typed after pressing N land where the eye expects it.
1557 const double dist = cam.get_distance();
1558 cam.look_at(pl.origin + pl.normal * dist, pl.origin, pl.y_axis);
1560 return true;
1561}
@ Camera
Definition Shortcuts.hpp:72
T dist(const boost::polygon::point_data< T > &p1, const boost::polygon::point_data< T > &p2)
Definition Geometry.cpp:298

References Slic3r::Geometry::dist(), Slic3r::GUI::Camera::get_distance(), Slic3r::GUI::Camera::look_at(), m_canvas, m_sketch_tool, Slic3r::SketchPlane::normal, Slic3r::SketchPlane::origin, request_repaint(), and Slic3r::SketchPlane::y_axis.

Here is the call graph for this function:

◆ zoom_to_box()

bool Slic3r::GUI::DesignCanvas::zoom_to_box ( BoundingBoxf3 box)
473{
474 if (m_canvas == nullptr || !box.defined)
475 return false;
477 m_canvas->zoom_to_box(box);
479 return true;
480}
static void pad_box(BoundingBoxf3 &box)
Definition DesignSketchTool.cpp:3826

References Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::defined, m_canvas, Slic3r::GUI::DesignSketchTool::pad_box(), and request_repaint().

Here is the call graph for this function:

Member Data Documentation

◆ m_bed

Bed3D Slic3r::GUI::DesignCanvas::m_bed
private

◆ m_body_hidden

bool Slic3r::GUI::DesignCanvas::m_body_hidden {false}
private
435{false}; // preview-only mode → hide base bodies, ghost = the result

Referenced by reload(), and set_body_hidden().

◆ m_body_meshes

const std::vector<TriangleMesh>* Slic3r::GUI::DesignCanvas::m_body_meshes {nullptr}
private
406{nullptr}; // set_bodies

Referenced by clear_mesh(), rebuild_bodies(), set_bodies(), and sync_selected_faces().

◆ m_body_translucent

bool Slic3r::GUI::DesignCanvas::m_body_translucent {false}
private
433{false};// fillet/chamfer preview → render the body see-through

Referenced by reload(), and set_body_translucent().

◆ m_body_visible

std::vector<bool> Slic3r::GUI::DesignCanvas::m_body_visible
private

Referenced by reload(), and set_bodies().

◆ m_camera_swapped

bool Slic3r::GUI::DesignCanvas::m_camera_swapped {false}
private
429{false}; // guards a leave without an enter, and the reverse

Referenced by enter_viewport(), leave_viewport(), and swap_camera().

◆ m_canvas

◆ m_canvas_widget

◆ m_collapse_toolbar

GLToolbar Slic3r::GUI::DesignCanvas::m_collapse_toolbar {GLToolbar::Normal, "Collapse"}
private
416{GLToolbar::Normal, "Collapse"};
@ Normal
Definition GLToolbar.hpp:274

Referenced by set_sidebar_collapse(), and set_sidebar_collapse_tooltip().

◆ m_color_bodies

const std::vector<CadBody>* Slic3r::GUI::DesignCanvas::m_color_bodies {nullptr}
private
439{nullptr};

Referenced by body_color(), and set_solid_pick().

◆ m_ctx_bound

bool Slic3r::GUI::DesignCanvas::m_ctx_bound {false}
private
419{false}; // bind the RIGHT_UP handler once, however often the cb is set

Referenced by set_on_context_menu().

◆ m_ctx_press

wxPoint Slic3r::GUI::DesignCanvas::m_ctx_press {0, 0}
private
420{0, 0}; // right-press origin: a right-DRAG orbits, it must not offer

Referenced by set_on_context_menu().

◆ m_ctx_travelled

bool Slic3r::GUI::DesignCanvas::m_ctx_travelled {false}
private
421{false}; // the right press wandered past the budget at ANY point,

Referenced by set_on_context_menu().

◆ m_hl_body_target

int Slic3r::GUI::DesignCanvas::m_hl_body_target {-1}
private
431{-1};

Referenced by reload(), and set_operand_bodies().

◆ m_hl_body_tool

int Slic3r::GUI::DesignCanvas::m_hl_body_tool {-1}
private
432{-1};

Referenced by reload(), and set_operand_bodies().

◆ m_hud_last

std::string Slic3r::GUI::DesignCanvas::m_hud_last
private

Referenced by render_hud(), and set_readout().

◆ m_inline_editor

std::unique_ptr<SketchInlineEditor> Slic3r::GUI::DesignCanvas::m_inline_editor
private

◆ m_lit_faces

std::vector<std::pair<int, int> > Slic3r::GUI::DesignCanvas::m_lit_faces
private

◆ m_model

◆ m_on_context_menu

std::function<void(const wxPoint&)> Slic3r::GUI::DesignCanvas::m_on_context_menu
private

Referenced by set_on_context_menu().

◆ m_on_sketch_commit

std::function<void(const SketchProfile&, const SketchPlane&)> Slic3r::GUI::DesignCanvas::m_on_sketch_commit
private

◆ m_on_sketch_entities_commit

std::function<void(const std::vector<SketchEntity>&, const std::vector<SketchEntityConstraintDef>&, const SketchPlane&)> Slic3r::GUI::DesignCanvas::m_on_sketch_entities_commit
private

◆ m_on_solid_selection_changed

std::function<void(int, int, int, int)> Slic3r::GUI::DesignCanvas::m_on_solid_selection_changed
private

◆ m_parked_camera

Camera Slic3r::GUI::DesignCanvas::m_parked_camera
private

Referenced by DesignCanvas(), and swap_camera().

◆ m_section_on

bool Slic3r::GUI::DesignCanvas::m_section_on {false}
private
445{false};

Referenced by set_section_plane().

◆ m_sketch_tool

DesignSketchTool Slic3r::GUI::DesignCanvas::m_sketch_tool
private

Referenced by DesignCanvas(), add_sketch_regions(), apply_segment_length(), apply_sketch_dimension(), begin_constrain(), begin_constrain_entities(), begin_fillet_gizmo(), begin_hole_gizmo(), begin_imported_transform(), begin_move_body(), begin_pattern_gizmo(), begin_revolve_gizmo(), begin_shell_gizmo(), begin_sketch(), begin_thread_gizmo(), can_redo_sketch_entity(), can_undo_sketch_entity(), cancel_sketch(), cancel_sketch_dimension(), clear_any_selection(), clear_base_pick(), clear_cut_gizmo(), clear_datum_gizmo(), clear_draft_gizmo(), clear_extrude_gizmo(), clear_fillet_gizmo(), clear_helix_gizmo(), clear_hole_gizmo(), clear_loop_pick(), clear_mesh(), clear_move_gizmo(), clear_pattern_gizmo(), clear_revolve_gizmo(), clear_rib_gizmo(), clear_shell_gizmo(), clear_sketch_selection(), clear_solid_pick(), clear_thread_gizmo(), cutting(), delete_selected_sketch_entities(), drafting(), drawing_in_progress(), edit_sketch(), edit_sketch_selection_value(), end_constrain(), faces_box(), filleting(), finish_sketch(), has_any_selection(), holing(), inline_busy(), is_constraining(), is_constraining_entities(), is_sketching(), keep_segment_as_drawn(), live_sketch_has_work(), loop_pick_feature(), loop_pick_region(), mcp_sketch_tool(), mcp_sketch_tool(), open_inline_value(), patterning(), pending_dimension_type(), pick0_point(), redo_last_sketch_entity(), region_entity_indices(), region_entity_indices_with_holes(), remove_sketch_constraint(), request_sketch_exit(), revolving(), select_body(), selected_constrain_axis(), selected_constrain_entities(), selected_loop_entities(), selected_segment(), selected_solid_edges(), selection_box(), set_base_pick(), set_bodies(), set_body_hidden(), set_constraint_glyphs(), set_constraint_highlight(), set_cut_gizmo(), set_datum_gizmo(), set_datum_planes(), set_display_sketches(), set_draft_gizmo(), set_escalate_on_repick(), set_extrude_gizmo(), set_helix_gizmo(), set_highlight_faces(), set_highlight_sketches(), set_hole_face_bounds(), set_loop_pick(), set_mate_connectors(), set_mate_links(), set_on_body_move_changed(), set_on_context_menu(), set_on_cursor_metrics(), set_on_cut_offset_changed(), set_on_datum_base_picked(), set_on_datum_offset_changed(), set_on_datum_size_changed(), set_on_dimension_pick_complete(), set_on_display_sketch_activated(), set_on_display_sketch_selected(), set_on_draft_angle_changed(), set_on_empty_pick(), set_on_extrude_depth_changed(), set_on_fillet_radius_changed(), set_on_helix_changed(), set_on_hole_changed(), set_on_imported_transform(), set_on_pattern_changed(), set_on_revolve_angle_changed(), set_on_rib_thickness_changed(), set_on_segment_drawn(), set_on_shell_thickness_changed(), set_on_sketch_constraints_changed(), set_on_sketch_exit(), set_on_sketch_exit_refused(), set_on_sketch_face_selected(), set_on_sketch_notice(), set_on_sketch_selection_changed(), set_on_sketch_step(), set_on_solid_selection_changed(), set_on_solve_state(), set_on_thread_changed(), set_rib_gizmo(), set_selected_base(), set_sketch_construction(), set_sketch_dimension_value(), set_sketch_polygon_circumscribed(), set_sketch_polygon_sides(), set_sketch_tool(), set_solid_pick(), set_xray_focus(), shelling(), sketch_abort_gesture(), sketch_confirm_pending(), sketch_constraint_count(), sketch_constraints(), sketch_dimension_current(), sketch_dimension_kind(), sketch_disarm_tool(), sketch_entities(), sketch_first_selected_type(), sketch_is_selecting(), sketch_selection(), sketch_selection_count(), sync_selected_faces(), threading(), toggle_axes(), toggle_planes(), toggle_sketch_construction_selection(), try_add_sketch_constraints(), undo_last_sketch_entity(), update_constrain_entities(), update_constrain_profile(), and view_normal_to_sketch().

◆ m_split_pending

bool Slic3r::GUI::DesignCanvas::m_split_pending {false}
private
410{false};

Referenced by sync_selected_faces().

◆ m_status_hud_colour

wxColour Slic3r::GUI::DesignCanvas::m_status_hud_colour
private

Referenced by render_hud(), and set_status_text().

◆ m_status_hud_last

wxString Slic3r::GUI::DesignCanvas::m_status_hud_last
private

Referenced by render_hud(), and set_status_text().

◆ m_sw_gl

int Slic3r::GUI::DesignCanvas::m_sw_gl {-1}
private
415{-1}; // -1 unknown, 0 hardware GL, 1 software GL

Referenced by request_repaint().

◆ m_tri_face

const std::vector<int>* Slic3r::GUI::DesignCanvas::m_tri_face {nullptr}
private
407{nullptr}; // per-triangle face id, all bodies in order

Referenced by rebuild_bodies(), and set_solid_pick().

◆ m_volumes

std::vector<BodyVolume> Slic3r::GUI::DesignCanvas::m_volumes
private

Referenced by clear_mesh(), rebuild_bodies(), and reload().

◆ m_xray_focus

int Slic3r::GUI::DesignCanvas::m_xray_focus {-1}
private
434{-1}; // >=0: only this body is opaque+clickable (CoordSys picking)

Referenced by reload(), and set_xray_focus().


The documentation for this class was generated from the following files: