Improve 3D appearance manager preset compare.

This commit is contained in:
Alex Shvartzkop 2024-02-29 22:04:50 +03:00
parent 41147dc3b3
commit 656821b282
1 changed files with 7 additions and 3 deletions

View File

@ -563,7 +563,8 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers(); std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors(); std::map<int, COLOR4D> 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 ) [&]( const LAYER_PRESET_3D& aPreset )
{ {
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer ) for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer )
@ -578,9 +579,12 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
return false; 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; return false;
} }