mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Fix missing schematic symbol instance data.
This fix adds missing symbol instance data that defaults the instance data to no annotation which will will trigger a annotation request on any operations that require a fully annotated schematic. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18486
This commit is contained in:
parent
55b3ef2ff2
commit
0cf1110367
@ -185,7 +185,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||||||
CreateScreens();
|
CreateScreens();
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromSchPath( fullFileName, KICTL_KICAD_ONLY );
|
SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromSchPath( fullFileName,
|
||||||
|
KICTL_KICAD_ONLY );
|
||||||
|
|
||||||
if( schFileType == SCH_IO_MGR::SCH_LEGACY )
|
if( schFileType == SCH_IO_MGR::SCH_LEGACY )
|
||||||
{
|
{
|
||||||
@ -498,13 +499,14 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||||||
|
|
||||||
// Restore all of the loaded symbol and sheet instances from the root sheet.
|
// Restore all of the loaded symbol and sheet instances from the root sheet.
|
||||||
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20221002 )
|
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20221002 )
|
||||||
sheetList.UpdateSymbolInstanceData( Schematic().RootScreen()->GetSymbolInstances());
|
sheetList.UpdateSymbolInstanceData( Schematic().RootScreen()->GetSymbolInstances() );
|
||||||
|
|
||||||
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20221110 )
|
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20221110 )
|
||||||
sheetList.UpdateSheetInstanceData( Schematic().RootScreen()->GetSheetInstances());
|
sheetList.UpdateSheetInstanceData( Schematic().RootScreen()->GetSheetInstances());
|
||||||
|
|
||||||
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
|
if( Schematic().RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
|
||||||
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
for( SCH_SCREEN* screen = schematic.GetFirst(); screen;
|
||||||
|
screen = schematic.GetNext() )
|
||||||
screen->FixLegacyPowerSymbolMismatches();
|
screen->FixLegacyPowerSymbolMismatches();
|
||||||
|
|
||||||
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
||||||
@ -524,6 +526,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||||||
|
|
||||||
schematic.PruneOrphanedSymbolInstances( Prj().GetProjectName(), sheetList );
|
schematic.PruneOrphanedSymbolInstances( Prj().GetProjectName(), sheetList );
|
||||||
schematic.PruneOrphanedSheetInstances( Prj().GetProjectName(), sheetList );
|
schematic.PruneOrphanedSheetInstances( Prj().GetProjectName(), sheetList );
|
||||||
|
sheetList.CheckForMissingSymbolInstances( Prj().GetProjectName() );
|
||||||
|
|
||||||
Schematic().ConnectionGraph()->Reset();
|
Schematic().ConnectionGraph()->Reset();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -23,6 +23,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <refdes_utils.h>
|
||||||
#include <sch_screen.h>
|
#include <sch_screen.h>
|
||||||
#include <sch_item.h>
|
#include <sch_item.h>
|
||||||
#include <sch_marker.h>
|
#include <sch_marker.h>
|
||||||
@ -667,6 +668,33 @@ void SCH_SHEET_PATH::RemoveSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_SHEET_PATH::CheckForMissingSymbolInstances( const wxString& aProjectName )
|
||||||
|
{
|
||||||
|
wxCHECK( !aProjectName.IsEmpty() && LastScreen(), /* void */ );
|
||||||
|
|
||||||
|
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
|
{
|
||||||
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||||
|
|
||||||
|
wxCHECK2( symbol, continue );
|
||||||
|
|
||||||
|
SCH_SYMBOL_INSTANCE symbolInstance;
|
||||||
|
|
||||||
|
if( !symbol->GetInstance( symbolInstance, Path() ) )
|
||||||
|
{
|
||||||
|
wxLogTrace( traceSchSheetPaths, "Adding missing symbol \"%s\" instance data for "
|
||||||
|
"sheet path '%s'.",
|
||||||
|
symbol->m_Uuid.AsString(), PathHumanReadable( false ) );
|
||||||
|
|
||||||
|
symbolInstance.m_Reference = UTIL::GetRefDesUnannotated( symbol->GetPrefix() );
|
||||||
|
symbolInstance.m_ProjectName = aProjectName;
|
||||||
|
symbolInstance.m_Path = Path();
|
||||||
|
symbol->AddHierarchicalReference( symbolInstance );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHEET_PATH::MakeFilePathRelativeToParentSheet()
|
void SCH_SHEET_PATH::MakeFilePathRelativeToParentSheet()
|
||||||
{
|
{
|
||||||
wxCHECK( m_sheets.size() > 1, /* void */ );
|
wxCHECK( m_sheets.size() > 1, /* void */ );
|
||||||
@ -1370,6 +1398,13 @@ void SCH_SHEET_LIST::AddNewSheetInstances( const SCH_SHEET_PATH& aPrefixSheetPat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_SHEET_LIST::CheckForMissingSymbolInstances( const wxString& aProjectName )
|
||||||
|
{
|
||||||
|
for( SCH_SHEET_PATH& sheetPath : *this )
|
||||||
|
sheetPath.CheckForMissingSymbolInstances( aProjectName );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_SHEET_LIST::GetLastVirtualPageNumber() const
|
int SCH_SHEET_LIST::GetLastVirtualPageNumber() const
|
||||||
{
|
{
|
||||||
int lastVirtualPageNumber = 1;
|
int lastVirtualPageNumber = 1;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -409,6 +409,8 @@ public:
|
|||||||
|
|
||||||
void RemoveSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPath );
|
void RemoveSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPath );
|
||||||
|
|
||||||
|
void CheckForMissingSymbolInstances( const wxString& aProjectName );
|
||||||
|
|
||||||
bool operator==( const SCH_SHEET_PATH& d1 ) const;
|
bool operator==( const SCH_SHEET_PATH& d1 ) const;
|
||||||
|
|
||||||
bool operator!=( const SCH_SHEET_PATH& d1 ) const { return !( *this == d1 ) ; }
|
bool operator!=( const SCH_SHEET_PATH& d1 ) const { return !( *this == d1 ) ; }
|
||||||
@ -688,6 +690,8 @@ public:
|
|||||||
|
|
||||||
void RemoveSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPath );
|
void RemoveSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPath );
|
||||||
|
|
||||||
|
void CheckForMissingSymbolInstances( const wxString& aProjectName );
|
||||||
|
|
||||||
bool HasPath( const KIID_PATH& aPath ) const;
|
bool HasPath( const KIID_PATH& aPath ) const;
|
||||||
|
|
||||||
bool ContainsSheet( const SCH_SHEET* aSheet ) const;
|
bool ContainsSheet( const SCH_SHEET* aSheet ) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user