Don't write sim.params for library model unless we actually have overrides.

This commit is contained in:
Jeff Young 2022-12-23 12:33:39 +00:00
parent cd7be966c0
commit 3f49fa5361
1 changed files with 7 additions and 4 deletions

View File

@ -1484,7 +1484,6 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
SIM_LIBRARY::MODEL model = libMgr.CreateModel( spiceLib, spiceModel.ToStdString(), SIM_LIBRARY::MODEL model = libMgr.CreateModel( spiceLib, spiceModel.ToStdString(),
emptyFields, sourcePins ); emptyFields, sourcePins );
spiceParams = wxString( model.model.GetBaseModel()->Serializer().GenerateParams() );
libraryModel = true; libraryModel = true;
if( pinMap.IsEmpty() ) if( pinMap.IsEmpty() )
@ -1577,9 +1576,13 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
nameField.SetText( spiceModel ); nameField.SetText( spiceModel );
aSymbol.AddField( nameField ); aSymbol.AddField( nameField );
T_field paramsField( &aSymbol, -1, SIM_MODEL::PARAMS_FIELD ); // Don't write a paramsField unless we actually have overrides
paramsField.SetText( spiceParams ); if( !spiceParams.IsEmpty() )
aSymbol.AddField( paramsField ); {
T_field paramsField( &aSymbol, -1, SIM_MODEL::PARAMS_FIELD );
paramsField.SetText( spiceParams );
aSymbol.AddField( paramsField );
}
if( modelFromValueField ) if( modelFromValueField )
valueField->SetText( wxT( "${SIM.NAME}" ) ); valueField->SetText( wxT( "${SIM.NAME}" ) );