From ef9f041279e2decf837f290280cfd9f65d7dff3a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 14 Aug 2021 13:16:29 +0100 Subject: [PATCH] Don't show 3D color opacities where they're not supported. Fixes https://gitlab.com/kicad/code/kicad/issues/8938 --- .../3d_viewer/dialogs/panel_3D_colors.cpp | 10 +++++++++ common/settings/color_settings.cpp | 22 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/3d-viewer/3d_viewer/dialogs/panel_3D_colors.cpp b/3d-viewer/3d_viewer/dialogs/panel_3D_colors.cpp index e97dc3b735..fb50c61ad8 100644 --- a/3d-viewer/3d_viewer/dialogs/panel_3D_colors.cpp +++ b/3d-viewer/3d_viewer/dialogs/panel_3D_colors.cpp @@ -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 ); diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index d585ee024e..cf1ebb8f12 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -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 optval = Get( path ) ) + Set( path, optval->WithAlpha( 1.0 ) ); + } + return true; } ); }