From 656821b2822cfa8ad097b50534cc3bfdb487c6dd Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Thu, 29 Feb 2024 22:04:50 +0300 Subject: [PATCH] Improve 3D appearance manager preset compare. --- 3d-viewer/dialogs/appearance_controls_3D.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/3d-viewer/dialogs/appearance_controls_3D.cpp b/3d-viewer/dialogs/appearance_controls_3D.cpp index f4af6f696c..53c280a81b 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.cpp +++ b/3d-viewer/dialogs/appearance_controls_3D.cpp @@ -563,7 +563,8 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection() std::bitset visibleLayers = m_frame->GetAdapter().GetVisibleLayers(); std::map colors = m_frame->GetAdapter().GetLayerColors(); - auto it = std::find_if( presets.begin(), presets.end(), + auto it = std::find_if( + presets.begin(), presets.end(), [&]( const LAYER_PRESET_3D& aPreset ) { for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer ) @@ -578,9 +579,12 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection() return false; } - for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_ADHESIVE; ++layer ) + for( int layer = LAYER_3D_START + 1; layer < LAYER_3D_END; ++layer ) { - if( aPreset.colors.at( layer ) != colors.at( layer ) ) + auto it1 = aPreset.colors.find( layer ); + auto it2 = colors.find( layer ); + + if( it1 != aPreset.colors.end() && it2 != colors.end() && *it1 != *it2 ) return false; }