From bf845368637bda171f045240357a3132c66d8b5c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 30 Mar 2024 19:12:15 +0100 Subject: [PATCH] 3D viewer: Allow setting colors not in board stackup, when use board stackup option is set. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17632 --- 3d-viewer/dialogs/appearance_controls_3D.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/3d-viewer/dialogs/appearance_controls_3D.cpp b/3d-viewer/dialogs/appearance_controls_3D.cpp index f38c9b9c76..b6586829fc 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.cpp +++ b/3d-viewer/dialogs/appearance_controls_3D.cpp @@ -83,6 +83,13 @@ const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_la RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ), }; +// The list of IDs that can have colors coming from the board stackup, and cannot be +// modified if use colors from stackup is activated +static std::vector inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP, + LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE, + LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM, + LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM + }; APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, wxWindow* aFocusOwner ) : @@ -579,8 +586,14 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls() { setting->m_Ctl_color->SetSwatchColor( colors[ setting->m_Id ], false ); - if( cfg ) - setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors ); + // if cfg->m_UseStackupColors is set, board colors cannot be modified locally, but + // other colors can be + if( std::find( inStackupColors.begin(), inStackupColors.end(), setting->m_Id ) + != inStackupColors.end() ) + { + if( cfg ) + setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors ); + } } }