When openeing a kicad_pcb and storing it again, the pads in all
embedded modules get reversed. This is generally not really nice if
the pcb is managed by version control as it creates churn and could
make merges hard.

The problem is that pads are inserted rather than appended when
loading a pcb, so the pads are reversed on reading. The attached patch
that fixes that.

In general, there are more places of Add() where ADD_APPEND would
probably make more sense (e.g. in the copy constructor and the
assignment operator for MODULE), but I have not touched these here as
it requires more thorough inspection.

The fact that the default behavior is ADD_INSERT probably results in a
lot of trouble. I wonder when _ever_ someone means to insert things in
the beginning ? It feels like a rare operation. Maybe not making the
kind of insert operation a default parameter of the Add() function but
rather have the user decide every time which operation is needed -
this might reduce the accidents like this (in particular, since the
name of the operation, Add(), kindof more strongly implies appending).
(and I would almost bet that we don't even need ADD_INSERT so could
simplify a lot of places).

Anyway, something I might look into when having a little more time
(all BOARD_ITEM_CONTAINER have that, so there are probably more bugs
like this lurking). This is the second issue like that I noticed (last
year same with segments).

For now a simple patch that fixes the issue at hand.


Attachment: patch-fix-alternating-pad-save-sequence.patch.gz
Description: GNU Zip compressed data

Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to