Name any unnamed fields so they don't clobber each other.
Fixes https://gitlab.com/kicad/code/kicad/issues/10039
This commit is contained in:
parent
21144481d2
commit
8eb10c41d8
|
@ -209,8 +209,7 @@ public:
|
|||
for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
|
||||
{
|
||||
SCH_SYMBOL* symbol = m_symbolsList[ i ].GetSymbol();
|
||||
m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName,
|
||||
m_frame );
|
||||
m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2342,16 +2342,30 @@ void SCH_ALTIUM_PLUGIN::ParseParameter( const std::map<wxString, wxString>& aPro
|
|||
|
||||
SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
|
||||
SCH_FIELD* field = nullptr;
|
||||
wxString upperName = elem.name.Upper();
|
||||
|
||||
if( elem.name.Upper() == "COMMENT" )
|
||||
if( upperName == "COMMENT" )
|
||||
{
|
||||
field = symbol->GetField( VALUE_FIELD );
|
||||
}
|
||||
else
|
||||
{
|
||||
int fieldIdx = symbol->GetFieldCount();
|
||||
wxString fieldName = elem.name.Upper();
|
||||
|
||||
if( fieldName == "VALUE" )
|
||||
if( fieldName.IsEmpty() )
|
||||
{
|
||||
int disambiguate = 1;
|
||||
|
||||
do
|
||||
{
|
||||
fieldName = wxString::Format( "ALTIUM_UNNAMED_%d", disambiguate++ );
|
||||
} while( !symbol->GetFieldText( fieldName ).IsEmpty() );
|
||||
}
|
||||
else if( fieldName == "VALUE" )
|
||||
{
|
||||
fieldName = "ALTIUM_VALUE";
|
||||
}
|
||||
|
||||
field = symbol->AddField( SCH_FIELD( VECTOR2I(), fieldIdx, symbol, fieldName ) );
|
||||
}
|
||||
|
|
|
@ -708,7 +708,7 @@ SCH_FIELD* SCH_SYMBOL::GetFieldById( int aFieldId )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_SYMBOL::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const
|
||||
wxString SCH_SYMBOL::GetFieldText( const wxString& aFieldName ) const
|
||||
{
|
||||
for( const SCH_FIELD& field : m_fields )
|
||||
{
|
||||
|
|
|
@ -353,7 +353,7 @@ public:
|
|||
*
|
||||
* @param aFieldName is the name of the field
|
||||
*/
|
||||
wxString GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const;
|
||||
wxString GetFieldText( const wxString& aFieldName ) const;
|
||||
|
||||
/**
|
||||
* Populate a std::vector with SCH_FIELDs.
|
||||
|
|
Loading…
Reference in New Issue