Don't show 3D color opacities where they're not supported.

Fixes https://gitlab.com/kicad/code/kicad/issues/8938
This commit is contained in:
Jeff Young 2021-08-14 13:16:29 +01:00
parent 4736578793
commit ef9f041279
2 changed files with 31 additions and 1 deletions

View File

@ -114,6 +114,16 @@ bool PANEL_3D_COLORS::TransferDataToWindow()
return COLOR4D( src.r, src.g, src.b, src.a );
};
m_backgroundTop->SetSupportsOpacity( false );
m_backgroundBottom->SetSupportsOpacity( false );
m_silkscreenTop->SetSupportsOpacity( false );
m_silkscreenBottom->SetSupportsOpacity( false );
m_solderMaskTop->SetBackgroundColour( *wxWHITE );
m_solderMaskBottom->SetBackgroundColour( *wxWHITE );
m_solderPaste->SetSupportsOpacity( false );
m_surfaceFinish->SetSupportsOpacity( false );
m_boardBody->SetBackgroundColour( *wxWHITE );
m_backgroundTop->SetSwatchColor( to_COLOR4D( m_boardAdapter.m_BgColorTop ), false );
m_backgroundBottom->SetSwatchColor( to_COLOR4D( m_boardAdapter.m_BgColorBot ), false );
m_silkscreenTop->SetSwatchColor( to_COLOR4D( m_boardAdapter.m_SilkScreenColorTop ), false );

View File

@ -30,7 +30,7 @@
///! Update the schema version whenever a migration is required
const int colorsSchemaVersion = 2;
const int colorsSchemaVersion = 3;
COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename ) :
@ -225,6 +225,26 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename ) :
( *m_internals )[ptr] = COLOR4D( 0.5, 0.4, 0, 0.8 ).ToWxString( wxC2S_CSS_SYNTAX );
return true;
} );
registerMigration( 2, 3,
[&]()
{
// We don't support opacity in some 3D colors but some versions of 5.99 let
// you set it.
for( wxString path : { "3d_viewer.background_top",
"3d_viewer.background_bottom",
"3d_viewer.copper",
"3d_viewer.silkscreen_top",
"3d_viewer.silkscreen_bottom",
"3d_viewer.solderpaste" } )
{
if( OPT<COLOR4D> optval = Get<COLOR4D>( path ) )
Set( path, optval->WithAlpha( 1.0 ) );
}
return true;
} );
}