diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index da5c387179..ee4fb4f60a 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -92,8 +93,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() : { wxLogTrace( m_logTrace, wxT( "BOARD_ADAPTER::BOARD_ADAPTER" ) ); - if( PgmOrNull() ) - m_colors = Pgm().GetSettingsManager().GetColorSettings(); + ReloadColorSettings(); m_boardPos = VECTOR2I(); m_boardSize = VECTOR2I(); @@ -208,6 +208,15 @@ BOARD_ADAPTER::~BOARD_ADAPTER() } +void BOARD_ADAPTER::ReloadColorSettings() noexcept +{ + wxASSERT( PgmOrNull() ); + + PCBNEW_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + m_colors = Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme ); +} + + bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const { wxASSERT( aLayer < PCB_LAYER_ID_COUNT ); diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index 4e8ce26abe..1204a504a1 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -100,7 +100,7 @@ public: void SetBoard( BOARD* aBoard ) noexcept { m_board = aBoard; } const BOARD* GetBoard() const noexcept { return m_board; } - void SetColorSettings( COLOR_SETTINGS* aSettings ) noexcept { m_colors = aSettings; } + void ReloadColorSettings() noexcept; /** * Function to be called by the render when it need to reload the settings for the board. diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 4155c709bd..9abf179ac9 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -141,7 +141,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList, // long calculation time) m_3d_render = m_3d_render_opengl; - m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() ); + m_boardAdapter.ReloadColorSettings(); wxASSERT( a3DCachePointer != nullptr ); m_boardAdapter.Set3dCacheManager( a3DCachePointer ); @@ -304,7 +304,7 @@ void EDA_3D_CANVAS::ReloadRequest( BOARD* aBoard , S3D_CACHE* aCachePointer ) if( aBoard != nullptr ) m_boardAdapter.SetBoard( aBoard ); - m_boardAdapter.SetColorSettings( Pgm().GetSettingsManager().GetColorSettings() ); + m_boardAdapter.ReloadColorSettings(); if( m_3d_render ) m_3d_render->ReloadRequest();