API: Fix serialization of footprint rule overrides; add missing allow_soldermask_bridges attribute

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21674
This commit is contained in:
Jon Evans
2025-11-22 09:59:03 -05:00
parent f230800365
commit ea5ae7cc5d
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -846,6 +846,9 @@ message FootprintAttributes
bool exempt_from_courtyard_requirement = 6;
bool do_not_populate = 7;
FootprintMountingStyle mounting_style = 8;
// Since: 9.0.7
bool allow_soldermask_bridges = 9;
}
message NetTieDefinition
+6 -1
View File
@@ -309,6 +309,7 @@ void FOOTPRINT::Serialize( google::protobuf::Any &aContainer ) const
attrs->set_exclude_from_bill_of_materials( IsExcludedFromBOM() );
attrs->set_exempt_from_courtyard_requirement( AllowMissingCourtyard() );
attrs->set_do_not_populate( IsDNP() );
attrs->set_allow_soldermask_bridges( GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES );
if( m_attributes & FP_THROUGH_HOLE )
attrs->set_mounting_style( types::FootprintMountingStyle::FMS_THROUGH_HOLE );
@@ -326,7 +327,7 @@ void FOOTPRINT::Serialize( google::protobuf::Any &aContainer ) const
// TODO: serialize library mandatory fields
types::FootprintDesignRuleOverrides* overrides = def->mutable_overrides();
types::FootprintDesignRuleOverrides* overrides = footprint.mutable_overrides();
if( GetLocalClearance().has_value() )
overrides->mutable_copper_clearance()->set_value_nm( *GetLocalClearance() );
@@ -394,6 +395,7 @@ void FOOTPRINT::Serialize( google::protobuf::Any &aContainer ) const
modelMsg.set_opacity( model.m_Opacity );
itemMsg->PackFrom( modelMsg );
}
kiapi::common::PackSheetPath( *footprint.mutable_symbol_path(), m_path );
footprint.set_symbol_sheet_name( m_sheetname.ToUTF8() );
@@ -475,6 +477,9 @@ bool FOOTPRINT::Deserialize( const google::protobuf::Any &aContainer )
SetAllowMissingCourtyard( footprint.attributes().exempt_from_courtyard_requirement() );
SetDNP( footprint.attributes().do_not_populate() );
if( footprint.attributes().allow_soldermask_bridges() )
m_attributes |= FP_ALLOW_SOLDERMASK_BRIDGES;
// Definition
SetFPID( kiapi::common::LibIdFromProto( footprint.definition().id() ) );
// TODO: how should anchor be handled?