Use name (even for fallback models) *if* it's specified in dropdown.

Fixes https://gitlab.com/kicad/code/kicad/issues/12425
This commit is contained in:
Jeff Young 2023-03-06 11:16:19 +00:00
parent eeee3adb94
commit 7547e550aa
1 changed files with 3 additions and 3 deletions

View File

@ -312,10 +312,10 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataFromWindow()
if( fn.MakeRelativeTo( Prj().GetProjectPath() ) && !fn.GetFullPath().StartsWith( ".." ) ) if( fn.MakeRelativeTo( Prj().GetProjectPath() ) && !fn.GetFullPath().StartsWith( ".." ) )
path = fn.GetFullPath(); path = fn.GetFullPath();
if( dynamic_cast<SIM_MODEL_SPICE_FALLBACK*>( &curModel() ) ) if( !m_modelNameChoice->IsEmpty() )
name = SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::NAME_FIELD, false );
else if( !m_modelNameChoice->IsEmpty() )
name = m_modelNameChoice->GetStringSelection().ToStdString(); name = m_modelNameChoice->GetStringSelection().ToStdString();
else if( dynamic_cast<SIM_MODEL_SPICE_FALLBACK*>( &curModel() ) )
name = SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::NAME_FIELD, false );
} }
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY::LIBRARY_FIELD, path ); SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY::LIBRARY_FIELD, path );