diff --git a/common/settings/nested_settings.cpp b/common/settings/nested_settings.cpp index 813368f67c..7fa9b52755 100644 --- a/common/settings/nested_settings.cpp +++ b/common/settings/nested_settings.cpp @@ -152,7 +152,7 @@ bool NESTED_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce ) } -void NESTED_SETTINGS::SetParent( JSON_SETTINGS* aParent ) +void NESTED_SETTINGS::SetParent( JSON_SETTINGS* aParent, bool aLoadFromFile ) { m_parent = aParent; @@ -161,6 +161,7 @@ void NESTED_SETTINGS::SetParent( JSON_SETTINGS* aParent ) m_parent->AddNestedSettings( this ); // In case we were created after the parent's ctor - LoadFromFile(); + if( aLoadFromFile ) + LoadFromFile(); } } diff --git a/include/settings/nested_settings.h b/include/settings/nested_settings.h index bf4a9b86e2..61e2734107 100644 --- a/include/settings/nested_settings.h +++ b/include/settings/nested_settings.h @@ -49,7 +49,7 @@ public: */ bool SaveToFile( const wxString& aDirectory = "", bool aForce = false ) override; - void SetParent( JSON_SETTINGS* aParent ); + void SetParent( JSON_SETTINGS* aParent, bool aLoadFromFile = true ); JSON_SETTINGS* GetParent() { diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 4668d21dac..e577838e67 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -151,8 +151,9 @@ void BOARD::SetProject( PROJECT* aProject ) // Link the design settings object to the project file project.m_BoardSettings = &GetDesignSettings(); - // Set parent, which also will load the values from JSON stored in the project - project.m_BoardSettings->SetParent( &project ); + // Set parent, which also will load the values from JSON stored in the project if we don't + // have legacy design settings loaded already + project.m_BoardSettings->SetParent( &project, !m_LegacyDesignSettingsLoaded ); // The DesignSettings' netclasses pointer will be pointing to its internal netclasses // list at this point. If we loaded anything into it from a legacy board file then we diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index cd95267a75..916eec4c15 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -1574,10 +1574,16 @@ void PCB_PARSER::parseSetup() break; case T_user_trace_width: + { + // Make room for the netclass value + if( designSettings.m_TrackWidthList.empty() ) + designSettings.m_TrackWidthList.emplace_back( 0 ); + designSettings.m_TrackWidthList.push_back( parseBoardUnits( T_user_trace_width ) ); m_board->m_LegacyDesignSettingsLoaded = true; NeedRIGHT(); break; + } case T_trace_clearance: defaultNetClass->SetClearance( parseBoardUnits( T_trace_clearance ) ); @@ -1656,6 +1662,11 @@ void PCB_PARSER::parseSetup() { int viaSize = parseBoardUnits( "user via size" ); int viaDrill = parseBoardUnits( "user via drill" ); + + // Make room for the netclass value + if( designSettings.m_ViasDimensionsList.empty() ) + designSettings.m_ViasDimensionsList.emplace_back( VIA_DIMENSION( 0, 0 ) ); + designSettings.m_ViasDimensionsList.emplace_back( VIA_DIMENSION( viaSize, viaDrill ) ); m_board->m_LegacyDesignSettingsLoaded = true; NeedRIGHT();