Fix render jobs not honoring layer presets

When executing render jobs from jobsets, the code stored the preset name
in m_CurrentPreset but never actually applied the preset's layer visibility
settings and colors. This caused renders to use whatever settings were in
the user's 3D viewer config instead of the specified preset.

Add code to look up the preset and apply its settings using SetVisibleLayers()
and SetLayerColors(), matching the behavior of the 3D viewer GUI.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21887
This commit is contained in:
Seth Hillbrand
2026-02-05 09:13:16 -08:00
parent e87f655293
commit 0dc4c5d08b
+19
View File
@@ -781,6 +781,25 @@ int PCBNEW_JOBS_HANDLER::JobExportRender( JOB* aJob )
cfg.m_UseStackupColors = aRenderJob->m_useBoardStackupColors;
boardAdapter.m_Cfg = &cfg;
// Apply the preset's layer visibility and colors to the render settings
if( !aRenderJob->m_appearancePreset.empty() )
{
wxString presetName = wxString::FromUTF8( aRenderJob->m_appearancePreset );
if( presetName == FOLLOW_PCB || presetName == FOLLOW_PLOT_SETTINGS )
{
boardAdapter.SetVisibleLayers( boardAdapter.GetVisibleLayers() );
}
else if( LAYER_PRESET_3D* preset = cfg.FindPreset( presetName ) )
{
boardAdapter.SetVisibleLayers( preset->layers );
boardAdapter.SetLayerColors( preset->colors );
if( preset->name.Lower() == _( "legacy colors" ) )
cfg.m_UseStackupColors = false;
}
}
if( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::TRANSPARENT
|| ( aRenderJob->m_bgStyle == JOB_PCB_RENDER::BG_STYLE::DEFAULT
&& aRenderJob->m_format == JOB_PCB_RENDER::FORMAT::PNG ) )