Don't render un-enabled layers.

Fixes https://gitlab.com/kicad/code/kicad/issues/7313
This commit is contained in:
Jeff Young 2021-01-29 17:36:18 +00:00
parent 488a5b7567
commit e72262a007
1 changed files with 10 additions and 19 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -151,6 +151,9 @@ bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
{ {
wxASSERT( aLayer < PCB_LAYER_ID_COUNT ); wxASSERT( aLayer < PCB_LAYER_ID_COUNT );
if( !m_board->IsLayerEnabled( aLayer ) )
return false;
DISPLAY3D_FLG flg; DISPLAY3D_FLG flg;
// see if layer needs to be shown // see if layer needs to be shown
@ -159,66 +162,54 @@ bool BOARD_ADAPTER::Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const
{ {
case B_Adhes: case B_Adhes:
case F_Adhes: case F_Adhes:
flg = FL_ADHESIVE; return GetFlag( FL_ADHESIVE );
break;
case B_Paste: case B_Paste:
case F_Paste: case F_Paste:
flg = FL_SOLDERPASTE; return GetFlag( FL_SOLDERPASTE );
break;
case B_SilkS: case B_SilkS:
case F_SilkS: case F_SilkS:
flg = FL_SILKSCREEN; return GetFlag( FL_SILKSCREEN );
break;
case B_Mask: case B_Mask:
case F_Mask: case F_Mask:
flg = FL_SOLDERMASK; return GetFlag( FL_SOLDERMASK );
break;
case Dwgs_User: case Dwgs_User:
case Cmts_User: case Cmts_User:
if( GetFlag( FL_USE_REALISTIC_MODE ) ) if( GetFlag( FL_USE_REALISTIC_MODE ) )
return false; return false;
flg = FL_COMMENTS; return GetFlag( FL_COMMENTS );
break;
case Eco1_User: case Eco1_User:
case Eco2_User: case Eco2_User:
if( GetFlag( FL_USE_REALISTIC_MODE ) ) if( GetFlag( FL_USE_REALISTIC_MODE ) )
return false; return false;
flg = FL_ECO; return GetFlag( FL_ECO );
break;
case Edge_Cuts: case Edge_Cuts:
if( GetFlag( FL_SHOW_BOARD_BODY ) || GetFlag( FL_USE_REALISTIC_MODE ) ) if( GetFlag( FL_SHOW_BOARD_BODY ) || GetFlag( FL_USE_REALISTIC_MODE ) )
return false; return false;
return true; return true;
break;
case Margin: case Margin:
if( GetFlag( FL_USE_REALISTIC_MODE ) ) if( GetFlag( FL_USE_REALISTIC_MODE ) )
return false; return false;
return true; return true;
break;
case B_Cu: case B_Cu:
case F_Cu: case F_Cu:
return m_board->IsLayerVisible( aLayer ) || GetFlag( FL_USE_REALISTIC_MODE ); return m_board->IsLayerVisible( aLayer ) || GetFlag( FL_USE_REALISTIC_MODE );
break;
default: default:
// the layer is an internal copper layer, used the visibility // the layer is an internal copper layer, used the visibility
return m_board->IsLayerVisible( aLayer ); return m_board->IsLayerVisible( aLayer );
} }
// The layer has a flag, return the flag
return GetFlag( flg );
} }