Use the same ordering as KiCad 8 to reduce diffs
A first cut of following the KiCad 8 ordering.
All the logic is contained in a few 'key' functions in the serialiser module, which emulate the logic in KiCad (mostly in footprint.cpp's comparision function objects). Because C++ and python do things differently (C++ uses comparison operators, Python uses key functions, and due to the generators having multiple classes that resolve to one serialised type) they're not 100% identical, but the general similarity between the code can be seen.
This means that the only real differences from a resaved footprint in Kicad in the limited tests I have done do far are:
- UUIDs are removed
- Polygon points are one per line, but KiCad packs a little tighter
- Some default fields are not set (the generators have always done that)
The test files:
- Load in KiCad
- Have exactly equal +/- changes in the diffs
git show --stat -- **/*.kicad_mod
.....
27 files changed, 2252 insertions(+), 2252 deletions(-)
- Look like only re-orders in diffs and don't seem to change in the KiCad UI
I tried to do a visual diff across the change, but the html-diff tool has other requirements on footprints like reference texts and similar that mean it doesn't work on the stripped-down test files.