1761 Commits

Author SHA1 Message Date
Jeff Young e4b8fde25b PANEL_PREVIEW_3D_MODEL does its own pretty-printing.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23401
2026-03-17 13:16:06 +00:00
Seth Hillbrand 8617a71633 Remove unused currentVariant in 3D renderers
The currentVariant variable was only used for the DNP condition
that was removed in commit 40205eb181. Remove the now-unused
declarations to fix -Wunused-variable warnings.
2026-03-05 09:44:33 -08:00
John Beard c4c19018c3 Pcbnew: Restrict includes of pad.h/footprint.h
There are some headers which don't need to include pad.h (which brings
padstack.h) - they just need forward defines.

While pad.h is not an especially heavy include on the scale of things,
footprint is quite heavy. And both reduce inclusion load and
reduce the number of files needlessly sensitive to changes in headers.
2026-03-05 02:18:34 +08:00
John Beard 113746dc81 Pcbnew: move PCB_TRACK types to a lightweight header
This lightens the load when including forwards for PCB_TRACK and
friends as we don't need all the transitive includes. Sometimes
you just need the enums - many users just wanted VIATYPE, or
just needed a forward.

And reduces transitive code churn when something is changed in the
header - this reduces the files affected by a change in
pcb_track.h from nearly 400 to under 200.
2026-03-04 23:28:31 +08:00
Ian McInerney 40205eb181 Remove extra DNP condition in FP rendering path
DNP footprints have a control layer for if they should be shown, which
is handled by the IsFootprintShown() method, so we shouldn't gate them
unconditionally just because of their DNP property.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23316
2026-03-03 18:53:00 +00:00
Jeff Young 50bd5d1a21 Don't account for non-physical layers when generating board outline.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23115
2026-02-27 19:01:11 +00:00
Alex Shvartzkop a7aa5d5f35 Use PCH in 3d-viewer. 2026-02-26 02:28:51 +03:00
Alex Shvartzkop 4889204ec5 Include glad before glcanvas. 2026-02-26 00:08:47 +03:00
Seth Hillbrand f166bd84b6 3D viewer: fix crash on knockout PCB_TEXTBOX in addText
The knockout branch in addText() unconditionally cast aOwner to
PCB_TEXT*, but aOwner can be a PCB_TEXTBOX (or PCB_TABLECELL) which
does not inherit from PCB_TEXT. The invalid static_cast caused a crash
when opening the 3D viewer for boards with knockout textboxes.

Use dynamic_cast to dispatch to the correct TransformTextToPolySet
implementation for both PCB_TEXT and PCB_TEXTBOX hierarchies.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23230
2026-02-23 20:30:18 -08:00
Alex Shvartzkop f8cb730edf Use core GL function names instead of EXT/ARB.
GLAD aliases most EXT/ARB function names.
2026-02-22 14:56:40 +03:00
Alex Shvartzkop 3fa40e05dc Use GLAD for OpenGL loading instead of GLEW.
This allows us to pick GLX on X11 and EGL on Wayland
at runtime when building with wxWidgets 3.3.2+

GLEW only allowed to choose between GLX/EGL at compile time.

This also removes KICAD_USE_EGL option, KiCad will use
whatever wxWidgets was built with.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20647
2026-02-22 14:56:40 +03:00
Seth Hillbrand 5455b77afd 3D Viewer: Add stencil buffer to export FBO for hole rendering
The off-screen framebuffer used for image export (File > Export Image
and Edit > Copy 3D Image to Clipboard) was missing a stencil buffer
attachment.  The OpenGL renderer's DrawCulled() uses stencil operations
to cut through-holes and vias out of copper layers and the board body.
Without a stencil buffer, these operations silently became no-ops,
leaving the exported image with no visible holes.

Change the depth-only renderbuffer (GL_DEPTH_COMPONENT24) to a combined
depth+stencil renderbuffer (GL_DEPTH24_STENCIL8) so that stencil-based
hole cutting works correctly in exported images.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23137
2026-02-18 13:46:17 -08:00
Seth Hillbrand 9799a349ff Fix copper traces nearly invisible in 3D viewer
The TransparencyControl function was squaring the gray color value to
make dark solder masks more opaque, but this made the default green mask
(gray ~0.13) nearly completely opaque, hiding copper traces underneath.

The squaring was unnecessary since truly dark colors already produce
near-zero transparency from the existing cubic formula.  The specular
floor, dynamic shininess, and reflection scaling from the same commit
already properly handle dark solder mask appearance.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23103
2026-02-18 13:25:00 -08:00
Christoph Moench-Tegeder 129995acbd Handle libspnav login on FreeBSD just like on Linux
FreeBSD uses libspnav, just like a Linux does, so all the
conditional code addressing the spnav APIs should be used
on FreeBSD, too.
Unfortunately, the logic was not consistent in all places:
sometimes we had "#ifdef", sometimes "#if defined" and
sometimes it was negated as "#ifndef". To make the intention
clearer across both Linux and FreeBSD, I unified all places
to a "#if defined(__linux__) || defined(__FreeBSD__)".
If we get another OS latching onto the same logic, we should
introduce a simple flag for this, but for only two OSes I
decided against adding central logic for this.
2026-02-16 22:56:27 +00:00
Seth Hillbrand 6c9c75eb07 Remove property.h and property_mgr.h from inspectable.h
This breaks the view_item.h -> inspectable.h -> property.h chain that
pulled wx/propgrid/property.h into 150-200 TUs. The lean inspectable.h
now includes only wx/any.h, wx/string.h, wx/variant.h.

Headers using DECLARE_ENUM_TO_WXANY (board_item.h, sch_item.h) retain
their property.h include since the macro requires it.
2026-02-13 19:54:46 -08:00
Seth Hillbrand c52ab91c84 Reduce compile times by extracting headers
Break the most expensive header include chains that contaminate the
largest number of translation units

New lightweight headers for extractdded types:
font_metrics.h, mouse_drag_action.h, board_project_settings_params.h,
common_settings_internals.h, wx_infobar_message_type.h,
zone_layer_properties_grid.h
2026-02-13 17:10:45 -08:00
Alex Shvartzkop 639f5e155d Gate wxGLCanvas::SetSwapInterval to wx 3.3.3 2026-02-13 18:06:44 +03:00
Alex Shvartzkop a324781627 Show GL backend in version info on GTK. 2026-02-13 13:55:56 +03:00
Alex Shvartzkop 8e79799118 Support EGL canvas on wx 3.3.2+ 2026-02-13 12:55:13 +03:00
Damjan 54c6040fde 3D Viewer: Fix plated barrels visibility toggle 2026-02-05 09:56:13 -08:00
Seth Hillbrand 24b19558ec Fix SpaceMouse axis mapping and rotation speed
Pan Y now correctly maps to Z, pan Z maps to Y. Removed
negation from rotation Y axis and reduced rotation speed
divisor from 5.0 to 20.0 for better control sensitivity.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22833
2026-02-03 15:08:48 -08:00
Mark Roszko f95a58c5dd KIWAY_EXPRESS -> KIWAY_MAIL_EVENT 2026-02-02 20:33:08 -05:00
Jeff Young dd65b38b4d Cleanup some TODOs. 2026-01-30 19:15:57 +00:00
Seth Hillbrand f3e910e5f9 Fix SpaceMouse rotation axis mapping in 3D Viewer on Linux
The rotation axes from libspnav were incorrectly swapped: rx was being
applied to camera Y rotation and ry to camera X rotation. This caused
SpaceMouse movements to produce unexpected rotations in the 3D Viewer.

The fix properly maps each libspnav rotation axis to its corresponding
camera rotation, with Y negated to account for the coordinate system
difference between libspnav (Y-away) and KiCad's 3D viewer (Y-towards).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22833
2026-01-30 10:24:43 -08:00
Mark Roszko 70bfc7469d Add missing FromDIP for initial 3d-viewer appearance panel size 2026-01-30 14:49:09 +01:00
Seth Hillbrand 8eb3f3c618 Enable GVFS/network filesystem visibility in file dialogs
On GTK, wxFileDialog defaults to local_only mode which hides GVFS-mounted
filesystems like Google Drive, SMB shares, and external drives mounted
through GVFS. This adds a platform-specific function that disables
local_only mode to show these network/virtual filesystems.

Apply AllowNetworkFileSystems to all file dialogs across KiCad
to ensure directories on network filesystems are visible when
browsing for files.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14372
2026-01-29 12:43:20 -08:00
Seth Hillbrand 44e5ef0aa0 3D Viewer: Fix missing barrel walls for NPTH holes in OpenGL mode
NPTH holes were not showing barrel walls because their polygons were
stored in m_NPTH_ODPolys but the barrel wall generation in generateHoles()
only used m_TH_ODPolys. Add NPTH polygons to the outer polygon set before
generating through-hole geometry.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21181
2026-01-29 09:20:09 -08:00
Seth Hillbrand 4ff5d8675f 3D Viewer: Fix dark solder mask display
Dark solder mask colors like black were rendering poorly with excessive
copper show-through and washed-out appearance due to high reflectivity.
The material properties were originally tuned for green solder mask.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11597
2026-01-28 16:15:57 -08:00
Damjan f011c8f533 Add hotkey for "show 3d navigator" in 3d viewer 2026-01-28 12:54:50 +00:00
jean-pierre charras e40d8202ee 3D viewer: Backdrill support: ensure start and end layers are valid.
If a via has a backdrill option set, a start and/or end layer can be undefined
(i.e. < 0 ). It can happens with 2 layers boards.
In this case the 3d viewer crashed when calling LAYER_RANGE().
The backdrill code is now skipped if a undefined layer is found.
2026-01-27 09:51:31 +01:00
Wayne Stambaugh 8bc56cd501 Defensive programming measures.
Recent issue conversations are suggesting that it's no possible for
footprints to contain null fields.  Rather than blindly dereferencing
field pointers in loops, check to make sure the field pointer is not
null before dereferencing.
2026-01-14 10:39:14 -05:00
Seth Hillbrand 6bad3c58e1 Added: PCB Variant support
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2131
2026-01-05 17:47:39 -08:00
Seth Hillbrand 77f2df9339 Numeric eval in 3d preview
Allows using formulas in scale/rotation/offset fields
2026-01-01 08:41:06 -08:00
Jeff Young 37e95db7a6 Allow clients to request an inferred outline if no real outline is available. 2025-12-12 15:22:24 +00:00
Jeff Young 88e87bab3e Don't short-cicuit Remove() or RemoveAll().
Also, make sure PCB_GRID_HELPER installs itself
as a board listener.  (Otherwise its
OnBoardItemRemoved() handler will never get
called.)
2025-12-09 14:46:55 +00:00
jean-pierre charras 94718a7676 Minor enhancement: PANEL_PREVIEW_3D_MODEL_BASE: add tool tips 2025-12-01 20:05:56 +01:00
Seth Hillbrand 899d4888aa ADDED: Backdrill support
- Allow setting backdrill (from B.Cu up) and tertiary drill (from F.Cu
  down) width and target layer (backdrill is inclusive)
- Allow setting post machining options (counterbore, countersink)
- Update properties for vias and THT pads
- Add output for Excellon and Gerber drill files as separated files for
  different drill depths
- Add drill map output calling out post-machined holes
- Add STEP export support
- Add 3d-viewer support
- Add 2581 support using backdrill property.  Post machining called out
  in comments
- Add ODB++ support using separate drill file for each depth
- Add DRC check for tracks connected to pad layers that are backdrilled
  or post-machined

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18836
2025-11-29 17:59:31 -08:00
Mark Roszko 93c62b2a18 Remove unused include path 2025-11-21 20:48:58 -05:00
jean-pierre charras c242d767b8 3D viewer: Handle filled closed shapes when the outline is not a simple line
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22364
2025-11-21 18:09:12 +01:00
jean-pierre charras 13c9806c08 3D viewer: minor enhancement: show ref and value when roll over components
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22231
2025-11-05 19:27:56 +01:00
Jon Evans baa29c1a58 Port footprint library table to new system 2025-11-04 06:54:53 -05:00
Jeff Young 7d47e4031c Formatting and other cleanup. 2025-10-31 13:22:50 +00:00
Jeff Young ce6d6cd5b2 Don't depend on a global MaxError value.
It can't handle multiple IUScales.
2025-10-23 17:43:29 +01:00
Jeff Young f4a1554cb7 Formatting; cleanup. 2025-10-15 17:34:47 +01:00
Jeff Young e84c94a557 Performance tweaks. 2025-10-06 15:06:39 +01:00
Jeff Young 2fe7219474 Support translation in tool context menus that are long-lived.
(The specialized ones are OK as they're created
for each use.)

Also, enum maps must be untranslated.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21859
2025-10-01 00:03:45 +01:00
Jeff Young 11b21d912b Remove potentially unnecessary asserts.
(They cause the 3DViewer to hang when there are no
vias on the board.)
2025-09-28 18:45:40 +01:00
Jeff Young 02b9757e55 Fill in some more barcode code. 2025-09-28 18:45:40 +01:00
jean-pierre charras a49c87e71b 3D viewer: handle PCB_BARCODE items. 2025-09-27 16:06:37 +02:00
Jeff Young 425b77b34c wxString::both goes with Strip(), not Trim().
But Strip() is deprecated, so we shouldn't use it
(or wxString::leading/trailing/both) at all.
2025-09-16 17:51:11 +01:00