Clear render caches before plotting.

Also fixes a bug where text variables in LIB_TEXT weren't getting
expanded when plotting.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15765
This commit is contained in:
Jeff Young 2023-10-02 15:38:22 +01:00
parent 6d3b846eb5
commit 003acbd686
2 changed files with 20 additions and 1 deletions

View File

@ -1168,12 +1168,14 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
item->Plot( aPlotter, background );
}
// Plot the background items
for( const SCH_ITEM* item : other )
{
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter, background );
}
// Plot the foreground items
for( const SCH_ITEM* item : other )
{
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
@ -1187,7 +1189,10 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
aPlotter->SetCurrentLineWidth( std::max( sym->GetPenWidth(), defaultPenWidth ) );
for( SCH_FIELD field : sym->GetFields() )
{
field.ClearRenderCache();
field.Plot( aPlotter, false );
}
sym->PlotPins( aPlotter );

View File

@ -2332,6 +2332,17 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
tempPin->SetFlags( IS_DANGLING );
}
for( LIB_ITEM& item : tempSymbol.GetDrawItems() )
{
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( &item ) )
{
// Use SCH_FIELD's text resolver
SCH_FIELD dummy( (SCH_ITEM*) this, -1 );
dummy.SetText( text->GetText() );
text->SetText( dummy.GetShownText( false ) );
}
}
TRANSFORM temp = GetTransform();
aPlotter->StartBlock( nullptr );
@ -2340,9 +2351,12 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
tempSymbol.Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp,
GetDNP() );
for( const SCH_FIELD& field : m_fields )
for( SCH_FIELD field : m_fields )
{
field.ClearRenderCache();
field.Plot( aPlotter, local_background );
}
}
if( m_DNP )
PlotDNP( aPlotter );