Fix creating polygons from footprint rule areas

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10257
This commit is contained in:
Jon Evans 2022-01-04 21:28:04 -05:00
parent 873353d8d7
commit e9b91b6fab
2 changed files with 10 additions and 0 deletions

View File

@ -119,12 +119,17 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
int changeFlags = ent.m_type & CHT_FLAGS;
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( ent.m_item );
wxASSERT( ent.m_item );
// Module items need to be saved in the undo buffer before modification
if( m_isFootprintEditor )
{
// Be sure that we are storing a footprint
if( ent.m_item->Type() != PCB_FOOTPRINT_T )
{
ent.m_item = ent.m_item->GetParent();
wxASSERT( ent.m_item );
}
// We have not saved the footprint yet, so let's create an entry
if( savedModules.count( ent.m_item ) == 0 )

View File

@ -29,6 +29,7 @@
#include <collectors.h>
#include <confirm.h>
#include <convert_basic_shapes_to_polygon.h>
#include <footprint.h>
#include <footprint_edit_frame.h>
#include <fp_shape.h>
#include <geometry/shape_compound.h>
@ -183,6 +184,10 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent )
if( FP_SHAPE* graphic = dynamic_cast<FP_SHAPE*>( selection.Front() ) )
parentFootprint = graphic->GetParentFootprint();
else if( FP_ZONE* zone = dynamic_cast<FP_ZONE*>( selection.Front() ) )
parentFootprint = static_cast<FOOTPRINT*>( zone->GetParent() );
else
wxFAIL_MSG( "Unimplemented footprint parent in CONVERT_TOOL::CreatePolys" );
BOARD_COMMIT commit( m_frame );