Commit Graph

229 Commits

Author SHA1 Message Date
SoftFever
1e1d9cbaf8 Fix crash on printer switch from stale filament/extruder indices (#14103)
Switching to a printer with fewer filaments (e.g. H2D -> X2D) threw
std::out_of_range in check_filament_printable. Clear stale per-volume
extruder config on count shrink and bound-check filament indices at the
read sites.
2026-06-08 18:57:52 +08:00
Ian Bassi
c5855db578 Line Type preview: Display distances and amount values (#13681)
* feat(viewer): Display travel distance and move count in G-code summary

This commit introduces a new feature that enhances the G-code viewer by displaying the total travel distance and the total number of travel moves in the 'Line Type' summary.

This provides users with more detailed statistics about their prints, helping them to better understand the printer's behavior and identify opportunities to optimize travel moves for faster print times.

This commit also fixes a critical bug in the G-code processor where the travel distance was being calculated incorrectly. The distance variable was not being updated for non-extruding travel moves, leading to inaccurate statistics. The calculation has been corrected to ensure it is performed for all relevant move types, resulting in accurate travel distance reporting.

* Subfix segments

kilo mega giga tera peta exa

* Add missing values

* Grams to Kilos and tons

* add distance

* Fix tool view

* Record and display seam distances

Track seam-related distances in print statistics and show them in the GCode viewer. Added total_seam_gap_distance and total_seam_scarf_distance to PrintEstimatedStatistics (with initialization). In GCode::extrude_loop the code now computes seam gap and scarf distances and accumulates them for external perimeters. GCodeViewer uses the summed seam distance when the Seams option is selected in the legend.

* Fix travel / wipe distances

* Update GCode.cpp

* Filament changes estimated time

---------

Co-authored-by: Steve Scargall <37674041+sscargal@users.noreply.github.com>
2026-05-21 13:49:43 +08:00
Kiss Lorand
26e6216d91 Fix stale keyboard refresh and auto-resize flicker of speed profile window in Preview tab (#12707)
* Fix speed popup refresh and sizing in Preview

Fix two UX issues in the Preview actual speed profile popup.

Keyboard-driven horizontal slider changes could leave the popup visually stale
until a later input event, which made keyboard navigation feel delayed.
Also, the speed-profile popup could briefly render at an incorrect height
before resizing on the next frame.

This change makes keyboard slider updates explicitly request a follow-up frame,
so refresh no longer depends on incidental mouse activity.

It also removes auto-resize from ToolPositionTableWnd and sizes the popup
before begin() each frame. The popup height is computed from plot height,
table rows, and window paddings, then clamped to at least the height of the
adjacent ToolPosition window.

The popup width is now computed from translated header text and padding terms,
with a 16:9-derived minimum for a more stable appearance. The width is cached
for the session and recalculated when UI scale changes.

Result:
- keyboard navigation updates reliably
- popup no longer shows the transient wrong-height first draw
- sizing is more stable across scale and localization

* Fix ToolPosition window also + other fixes

* Fix compile error when ENABLE_ACTUAL_SPEED_DEBUG disabled

IMGUI_DEFINE_MATH_OPERATORS is needed even if ENABLE_ACTUAL_SPEED_DEBUG is not enabled

* Guard seam fallback vertex index in GCodeViewer
2026-05-15 00:48:23 +08:00
yw4z
c8be7fb708 Tool Position window improve reading of vertex info (#12614)
* Update GCodeViewer.cpp

* improve reading feature types and enable actual flow rate

* Update GCodeViewer.cpp

* Update GCodeViewer.cpp

* Update GCodeViewer.cpp

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* hide actual speed and actual flow

---------

Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-11 12:20:35 +08:00
yw4z
c2ac0baa05 Fix iconic button sizes on widgets (paint modes and gcode viewer buttons) (#13365)
* init

* update
2026-05-06 00:07:15 +08:00
Ian Bassi
f8b0bcc725 Add Kinematics (Jerk & Accel) visualization support (#13169)
* Acceleration preview

Co-Authored-By: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>

* Jerk visualization

* JD

---------

Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
2026-04-24 14:20:47 +08:00
Kegan Holtzhausen
f1cacd89c0 Display number of tool changes after slicing #12464 (#12474) 2026-04-24 14:04:09 +08:00
Ian Bassi
80ef058aaa Bambu H2D: Filament group wiki fix (#12880)
Co-authored-by: yw4z <yw4z@outlook.com>
Co-authored-by: yw4z <ywsyildiz@gmail.com>
2026-04-16 14:38:26 -03:00
SoftFever
3e4af2c723 WIP: Add native Wayland support for Linux (#13197)
* Add runtime display backend detection for Wayland support

Add LinuxDisplayBackend utility to detect X11 vs Wayland at runtime
using GDK_IS_X11_DISPLAY / GDK_IS_WAYLAND_DISPLAY macros. This is
the foundation for removing the forced GDK_BACKEND=x11 and enabling
native Wayland support.

- New files: LinuxDisplayBackend.hpp/.cpp with get_linux_display_backend(),
  is_running_on_wayland(), and is_running_on_x11()
- Propagate wxHAVE_GDK_X11 / wxHAVE_GDK_WAYLAND from FindGTK3.cmake
  as compile definitions to libslic3r_gui
- No-op on non-Linux platforms (returns Unknown / false)

* Fix Phase 1 code quality: pragma once, source ordering, static cache

* Make X11 initialization conditional for Wayland support

Remove the unconditional GDK_BACKEND=x11 force that blocked native
Wayland. Replace with conditional logic:

- EGL safety fallback: re-force X11 only when wxUSE_GLCANVAS_EGL is
  off and WAYLAND_DISPLAY is set, with a warning log
- XInitThreads() only called when DISPLAY is set (X11 in use)
- __GLX_VENDOR_LIBRARY_NAME only set when DISPLAY is present (GLX-specific)
- WEBKIT_DISABLE_COMPOSITING_MODE only set under XWayland (both
  DISPLAY and WAYLAND_DISPLAY present)
- Guard X11/Xlib.h include with __has_include for robustness
- Restore display validation to accept either DISPLAY or WAYLAND_DISPLAY

This is Phase 2 of the Wayland support plan.

* Fix Phase 2: safer EGL macro check, add clarifying comments

* Add GLAD2 library and replace GLEW linkage in build system

Set up GLAD2 as a static library to replace GLEW for OpenGL loading.
GLAD2 supports both GLX and EGL, which is required for Wayland support.

- Create src/glad/ with pre-generated GLAD2 sources (GL 4.6 compat)
- Add src/glad/CMakeLists.txt building glad as a static library
- Wire glad into src/CMakeLists.txt before libvgcode
- Modify libvgcode to use shared glad for GL path (keeps local copy
  only for GLES2/Emscripten) to avoid duplicate symbol conflicts
- Replace GLEW::GLEW with glad in libslic3r_gui link libraries

Note: GLEW is kept in deps for OpenCSG. Code migration from GL/glew.h
to glad/gl.h headers will follow in Phase 3B+3C.

* Fix Phase 3A+3D: libvgcode GLAD include, dead files, dlopen dep, OpenGL link var

* Migrate from GLEW to GLAD: replace headers and API calls across codebase

Replace all #include <GL/glew.h> with <glad/gl.h> across 49 source files.
Migrate GLEW API calls to GLAD equivalents:
- glewInit/glewExperimental -> gladLoaderLoadGL()
- GLEW_EXT_* / GLEW_ARB_* extension checks -> GLAD_GL_EXT_* / GLAD_GL_ARB_*
- Remove GLEW-specific EGL/GLX mismatch #error guards (not needed with GLAD)
- Replace unavailable EXT symbols with core GL equivalents in
  GLCanvas3D.cpp (GL_MAX_SAMPLES, glRenderbufferStorageMultisample,
  glBlitFramebuffer, GL_READ/DRAW_FRAMEBUFFER)
- Update log messages from glewInit to gladLoadGL

* Fix Phase 3B+3C: remove GLEW find, clean EXT symbols, update attribution

- Remove find_package(GLEW) block from root CMakeLists.txt since GLEW
  is no longer linked by any main application code
- Remove "glew" from SLIC3R_STATIC option description
- Replace all remaining EXT framebuffer symbols with core equivalents
  in render_thumbnail_framebuffer_ext and _rectangular_selection_picking_pass
- Update AboutDialog credits from GLEW to GLAD

* Enable EGL in wxWidgets and add runtime GLX/EGL selection for Wayland

- Set wxUSE_GLCANVAS_EGL=ON in wxWidgets build and Flatpak manifest
- Add PreferGLX() call on X11 sessions for driver compatibility
- Remove Phase 2 safety fallback (EGL is now always compiled in)
- Guard SwapBuffers against hidden canvases to prevent Wayland stalls

* Fix Phase 4: move PreferGLX to app startup, fix FPS counter guard

Move wxGLCanvas::PreferGLX() from OpenGLManager::create_wxglcanvas()
(static initializer) to GUI_App::on_init_inner() before any wxGLCanvas
is constructed. This prevents a race where SkipPartCanvas could trigger
wxGLBackend::Init() before the GLX preference is set. The new location
also adds explicit is_running_on_wayland() detection with a warning for
unknown backends.

Move increment_fps_counter() inside the IsShownOnScreen() guard so FPS
is only counted when a frame is actually swapped.

* Update GLFW from 3.3.7 to 3.4 for runtime Wayland/X11 backend selection

Replace the compile-time GLFW_USE_WAYLAND flag (which locked to a single
backend) with GLFW 3.4's GLFW_BUILD_WAYLAND + GLFW_BUILD_X11 flags that
build both backends and auto-select at runtime based on the available
display server. This enables the CLI thumbnail renderer to work on both
Wayland and X11 sessions without separate builds.

* wayland: Fix UI call sites that rely on global screen coordinates

On Wayland, wxGetMousePosition() returns (0,0) and SetPosition() is a
no-op for top-level windows. Fix the highest-impact call sites:

- GLCanvas3D: Use cached m_mouse.position from event handlers instead
  of wxGetMousePosition() + ScreenToClient() in get_local_mouse_position()
- Plater: Use event-relative coords via ClientToScreen(e.GetPosition())
  instead of wxGetMousePosition() in 3 leave-window handlers
- BBLTopbar: Use event.GetPosition() and FindToolByPosition() directly
  in mouse handlers instead of wxGetMousePosition()/FindToolByCurrentPosition()
- Search: Use focus-based dismiss logic on Wayland instead of
  wxGetMousePosition()-based rect checks in SearchDialog and
  SearchObjectDialog
- GUI_App: Skip SetPosition() in window_pos_restore() on Wayland where
  it is a no-op; still restore size and maximize state
- Button: Position tooltip relative to button widget via ClientToScreen
  instead of wxGetMousePosition()

* Fix SearchDialog Wayland dismiss: guard against search_line focus

* flatpak: Add Wayland socket permission for native Wayland support

* spec

* Fix crash on Wayland when wxWidgets lacks EGL support

Restore the safety fallback that forces GDK_BACKEND=x11 when wxWidgets
was not built with wxUSE_GLCANVAS_EGL=ON. Without this, the GLX backend
tries to access a non-existent X11 display on native Wayland, crashing
in wxGLCanvas::IsDisplaySupported() with SIGSEGV at offset 0xe4.

Also add a defense-in-depth guard in detect_multisample() that skips
the IsDisplaySupported call entirely on Wayland without EGL.

Root cause: deps/wxWidgets must be rebuilt after enabling EGL. The
compile-time check in OrcaSlicer.cpp detects the mismatch and falls
back safely.

* Fix EGL detection: use wxHAS_EGL instead of wxUSE_GLCANVAS_EGL

wxUSE_GLCANVAS_EGL is a CMake build option, NOT a C++ preprocessor
macro. The actual macro defined in wxWidgets setup.h is wxHAS_EGL.
All compile-time EGL checks were using the wrong macro, causing
the safety fallback to always trigger even with a properly built
EGL-enabled wxWidgets.

* Fix GL function pointers invalidated on Wayland/EGL

gladLoaderLoadGL() dlopen's libGL.so.1 to resolve GL function pointers
via dlsym, then immediately dlclose's the handle. On X11/GLX this is
fine because the GLX context keeps libGL.so mapped. On Wayland/EGL,
nothing else holds libGL.so open, so dlclose unmaps it and all function
pointers become dangling — causing SIGSEGV on the first GL call.

Fix: on Wayland, use gladLoadGL(eglGetProcAddress) which resolves
function pointers through the EGL loader without opening/closing
libGL.so.

* fix crash on start and various rendering issues

* fix crash on close

* small refactor

* move GPU selection to desktop file

* clean up a bit

* clean up more

* fix appimage error
2026-04-13 19:45:39 +08:00
SoftFever
85390a9da0 Guard wxToolTip::GetToolTipCtrl() for wx 3.3 and add explicit wx/utils.h includes
- Wrap GetToolTipCtrl() call in GUI_App.cpp with #if wxVERSION_NUMBER < 3300
  guard, as this API may not be accessible in wxWidgets 3.3. The dark tooltip
  theming is cosmetic and non-critical.

- Add explicit #include <wx/utils.h> to 7 source files that use functions from
  that header (wxGetMousePosition, wxLaunchDefaultBrowser, wxGetDisplaySize,
  wxBell) but relied on transitive includes. This preempts breakage from
  wxWidgets 3.3 reducing transitive includes.

Files with wx/utils.h added: BBLTopbar.cpp, CreatePresetsDialog.cpp,
CameraPopup.cpp, GLCanvas3D.cpp, GCodeViewer.cpp, GUI_ObjectList.cpp,
FilamentMapPanel.cpp.

Skipped BindDialog.cpp and FilamentPickerDialog.cpp as they already include
wx/wx.h which provides wx/utils.h transitively.

Part of wxWidgets 3.1.5 -> 3.3.2 upgrade.
2026-03-24 21:02:37 +08:00
yw4z
c9bf6f088a Remove duplicate items from actual speed plot (#12711)
* init

* update
2026-03-10 23:54:44 +08:00
Alexandre Folle de Menezes
dba8a6d88b Fix Celsius symbol not showing on G-code viewer (#12567) 2026-03-02 14:11:45 -03:00
Alexandre Folle de Menezes
72a4597107 Fix GUI strings that should start with uppercase (#12499) 2026-02-27 11:19:22 -03:00
Alexandre Folle de Menezes
ec7a5f5140 Add translation markers to measure units (#12403)
# Description
Some units were missing the translation markers, others were not in the standard format.
2026-02-23 22:53:19 +08:00
minicx
7e1b2d99d3 Add Pressure Advance visualization support (#11673)
* Add Pressure Advance visualization support

Signed-off-by: minicx <minicx@disroot.org>

* Port Pressure Advance visualization to libvgcode architecture

Adapt PA visualization (originally in commit e3a77259) to work with
the new libvgcode library introduced by upstream PR #10735.

Changes across the libvgcode stack:
- PathVertex: add pressure_advance field
- Types.hpp: add PressureAdvance to EViewType enum
- ViewerImpl: add ColorRange, color mapping, range updates for PA
- LibVGCodeWrapper: pass pressure_advance from MoveVertex to PathVertex

GCodeViewer UI integration:
- Add "Pressure Advance" to view type dropdown
- Add PA color range in legend (3 decimal places)
- Add PA value display in sequential view marker tooltip
- Add PA row in position properties table

The GCodeProcessor PA parsing (M900, M572, SET_PRESSURE_ADVANCE)
is preserved from the original implementation.

* Tag Pressure Advance visualization changes with ORCA comments

Signed-off-by: minicx <minicx@disroot.org>

---------

Signed-off-by: minicx <minicx@disroot.org>
Co-authored-by: Ioannis Giannakas <59056762+igiannakas@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-02-21 13:10:08 +00:00
yw4z
9604b01656 Fix: tool position window glitch on Linux (#12195)
fill buffer
2026-02-09 11:07:51 -03:00
yw4z
ea3685aacb Tool position window Fixes / Improvements (#12068)
* init

* fix fold/unfold button direction

* remove window border

* remove unused icons

* add scaling support

* match libvgcode roles with orca terms

* fix expanding table window

* Update GCodeViewer.cpp

* fix translation support

* fix translations

* fix imgui styles
2026-02-04 11:38:05 +00:00
Sabriel-Koh
c906075148 Fix: GCodeViewer displaying inconsistent data in title and body (#12014)
* Fix: GCodeViewer displaying inconsistent data in title and body

* Fix: remove actual flow info from GCodeViewer title

* Refactor: reduce repetition of N/A and headers
2026-01-21 00:32:52 +08:00
Kiss Lorand
95c6cd05fa Fix incorrect layer and time shown in Preview legend for pause/custom G-code entries (#11968)
Fix layer/time display in Preview legend for pause/custom G-code

The Preview legend showed incorrect layer numbers and elapsed time for pause/custom G-code entries. The issue was caused by:

• get_layer_id_at() performing a strict upper_bound search on float Z values,  while custom G-code stores Z positions as doubles. Minor precision differences  often pushed the lookup to return layer 0 or the last layer.

• The legend displayed the raw zero-based layer index.

Fixes included:

• Fetch layer Z values as doubles and use an epsilon-based closest-layer search.
• Display layers as 1-based values for user-facing UI.
• Accumulate time up to the beginning of the identified layer.

This aligns the legend with the vertical slider marker and provides consistent pause/custom G-code reporting.
2026-01-16 14:20:17 -03:00
Kiss Lorand
0a9cab3991 Fix: remove extra padding from GCode window (#11871) 2026-01-09 09:02:09 +00:00
SoftFever
779f4a890d QoL: improve gcode marker (#11881)
QoL: Improve gcode marker
2026-01-09 11:52:30 +08:00
SoftFever
3b4600d65b fix some minor issues 2026-01-06 18:19:50 +08:00
SoftFever
39df09be8b fix build errors 2026-01-06 16:31:54 +08:00
SoftFever
1b355be432 Merge branch 'main' into libvgcode 2026-01-06 11:09:09 +08:00
Ioannis Giannakas
2026a0cf0c Fix defaulting to filament preview when multiple tools are available but only 1 is used (#11734) 2025-12-24 14:50:48 +02:00
Rodrigo Faselli
29f4e66715 Line type by default for single extruder single material (#11397)
* line type by default single extruder

* Defautl to color print if use multicolor

* Update condition for setting view type in GCodeViewer

* Refine default view type selection in GCodeViewer

Improves logic for selecting the default view type based on nozzle and filament preset counts. Now selects 'Summary' for multiple nozzles, 'ColorPrint' for single nozzle with multiple filaments, and 'FeatureType' otherwise.

* Refactor multimaterial detection in GCodeViewer

Introduced a 'multimaterial' boolean to clarify logic for detecting multiple filament presets. This improves readability and maintains consistent behavior when setting the view type based on extruder and filament count.
2025-12-18 16:55:19 +00:00
Kiss Lorand
9a30704194 GPU overdrive fix (#4) 2025-11-25 12:25:03 -05:00
Kiss Lorand
a87df7f0b5 Bugfixes (#2)
* Bugfixes

* Reduce size of diff

to avoid merge conflicts when we cherry-pick from upstream :)

* remove extraneous space

---------

Co-authored-by: Andrew Sun <as-com@users.noreply.github.com>
2025-11-18 19:50:48 -05:00
Andrew Sun
7408f333a6 Merge remote-tracking branch 'upstream/main' into libvgcode
# Conflicts:
#	src/slic3r/GUI/GLCanvas3D.cpp
2025-11-16 22:53:04 -05:00
Alexandre Folle de Menezes
8ec2454835 Standard units need translation for CIS Languages (#11376)
* Standard units need translation for CIS Languages
2025-11-17 10:29:44 +08:00
Andrew Sun
7de779a0e0 Remove unnecessary requires_extra_frame call 2025-11-15 12:00:24 -05:00
Andrew Sun
fcdd3d3b2a Don't hide some properties for non-extrusion moves 2025-11-15 11:11:25 -05:00
enricoturri1966
e0cdae0cb4 SPE-2359: Added speed and volumetric flow rate to imgui vertex properties dialog (#12840)
(cherry picked from commit 0602723695664eb77570c1ea04971f55a8779d6c)
2025-11-15 11:11:25 -05:00
Andrew Sun
7814605906 Merge remote-tracking branch 'upstream/main' into libvgcode
# Conflicts:
#	src/libslic3r/GCode/GCodeProcessor.cpp
#	src/libslic3r/GCode/GCodeProcessor.hpp
#	src/slic3r/CMakeLists.txt
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GCodeViewer.hpp
#	src/slic3r/GUI/GLCanvas3D.cpp
#	src/slic3r/GUI/GLCanvas3D.hpp
#	src/slic3r/GUI/GUI_Preview.cpp
2025-11-15 11:11:20 -05:00
yw4z
b62187f076 Match UI of filament grouping & fixes (#11238)
* init

* update

* match radio icons

* fix background

* Show only on "summary" and "filament" tab

* delete unused icons
2025-11-08 20:44:37 +08:00
Noisyfox
9e889afb53 Fix issues with non-bbl multi-head printers 2025-10-19 22:54:48 +08:00
Noisyfox
01c02051f2 Merge branch 'main' into dev/h2d 2025-10-18 19:20:09 +08:00
Noisyfox
f12602c0bc Fix several imgui UTF8 related issues (#11078)
* FIX:add  tooltip(const std::string &label, float wrap_width) api

jira: none
Change-Id: I2372f57177a362f540e509747552a4a27f23fe8f
(cherry picked from commit 9d690cddd60245cd3c16498e6c83183ec8446241)

* Fix crash when rendering text icons

---------

Co-authored-by: zhou.xu <zhou.xu@bambulab.com>
2025-10-18 19:17:50 +08:00
Noisyfox
6ea106f754 Update gcode legend window to match orca style, also make it more space efficient 2025-10-11 10:27:12 +08:00
Noisyfox
a9c0490c68 Update color 2025-10-05 16:02:17 +08:00
songwei.li
e8d8fb5c7a FIX: the exported Gcode file is stuck when imported on Mac
suppressed_backround_processing_update when loading gcode to prevent deadlock.

jira: STUDIO-13899
Change-Id: Iad4f20cd5249bb5133146197bb1bc32101b08bdf
(cherry picked from commit 2579cdc7adb98c1f21c3169a9fcebba60597fb43)
(cherry picked from commit 13b14414e03e3907d9d1662cdab570c754200618)
2025-10-05 00:09:09 +08:00
zhou.xu
ef5458d231 FIX:Add array out of bounds protection
jira: none
Change-Id: I038e45be00664ab35dfbc2d59ddfa6c018cd2873
(cherry picked from commit d4967c8c269d0f9b918e9049addcd7d6f6fd2656)
2025-10-03 22:27:04 +08:00
shan.chang
bd066e7f96 ENH: add new arrangement features for wrapping detection area
Jira: STUDIO-13735

Change-Id: I198d19f5e6ef70f0adfa6370269290c81d21a557
(cherry picked from commit dc83637652526111611d0833d5f5798aaa3e7be7)
2025-10-02 17:41:41 +08:00
songwei.li
03eeb2bcd9 FIX: Slicing Result Color Mapping Makes No Sense
The extreme extrusion in the H2D first layer's start code caused the color range in the preview to be too large. Add a constraint to eliminate the effect of this start extrusion.

jira: STUDIO-13830
Change-Id: Ifccbd14449d1c424f0bb3c1e3d254bddffa41a7c
(cherry picked from commit 6b935a9de0f9fe98f041f509ab6d2d72b59e957b)
2025-10-02 17:07:20 +08:00
Andrew Sun
2cb5b02708 Fix crash in filament/color print view 2025-09-24 22:49:14 -04:00
Andrew Sun
9bee05744d Fix auto-switch to color print view type 2025-09-24 22:49:14 -04:00
Andrew Sun
f8a7589354 Clean up TODOs and commented out code 2025-09-24 22:49:14 -04:00
Andrew Sun
8ed12a8023 Styling changes for position window 2025-09-24 22:49:14 -04:00
Andrew Sun
8552f2efbf Wire up new position window from PrusaSlicer 2025-09-24 22:49:14 -04:00
Andrew Sun
d539540a65 Add support for Orca-specific extrusion roles 2025-09-24 22:49:14 -04:00