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
This commit is contained in:
jean-pierre charras 2024-03-30 19:12:15 +01:00
parent c841d0df6d
commit bf84536863
1 changed files with 15 additions and 2 deletions

View File

@ -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<int> 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,10 +586,16 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
{
setting->m_Ctl_color->SetSwatchColor( colors[ setting->m_Id ], false );
// 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 );
}
}
}
if( cfg )
m_cbUseBoardStackupColors->SetValue( cfg->m_UseStackupColors );