-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[kle2json] [WIP] populate rotation in info.json #8980
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a step in the right direction and (seems) backward compatible.
sorry. wip: need to update the ui to handle these changes keeping it backwards compatible was simpler. adding the new rotation sub-element adds a little complexity |
that extra decimal place looks unnecessary but it is needed
I removed the changes to the json file format. There are a bunch of proposed changes in that file so going to This format is 100% backwards compatible. Looking forward to seeing the info.json evolve, but letting that happen on a different timeline |
Thank you for your contribution! |
Thank you for your contribution! |
Overview
QMK uses info.json to know how to render a representation of the keyboard. If the
info.json
file had rotational data, then QMK could render keyboards that look more similar to the physical keyboard.Keyboard designers often use keyboard layout editor to design a keyboard layout. From there they want to transfer that information to QMK's
info.json
file. [kle2json] helps the developers by taking an kle.json file and creating ainfo.json
file.Part of initiative: qmk/qmk_configurator#725
Types of Changes
Checklist
Blocker
Up until this point, the
info.json
files do not have rotational data.The
configurator
could not display it, and the results tended to render better when rotational data was removed.If the configurator could render keyboards with rotated keys, then it would be great if
kle2json
could populate those fields. This would help developers better understand the capabilities of theconfigurator
and the QMK suite.File formats
Both kle.json and info.json have fields to specify the rotation (
r
,rx
,ry
).The future info.json format is setup to also support the addition of those fields.
How to encode rotation information?
Rotate in place
Initially it seemed best to provide an x and y value and rotate the pieces around the center of the piece.
Values from
kle.json
Next it seemed best to pass the values directly from the kle json file.
Values from kle properties tab
In the end, it worked best to pass the values that kle displays in the properties view.
The values in kle's properties view are different from those in the raw kle file export file. Those values have a more reasonable
x
andy
value so the output makes more sense.Conversion
kle.json
files with no rotational data should generate the sameinfo.json
file before and after this change.kle.json
files with rotational data should generate ainfo.json
that is very similar to the non rotational one, just with 3 extra fields populated.Testing
I used 2 files to test the converter.
I used the [alice layout] and a alternate kle layout that I coded by hand.
From there I rendered the files in the configurator to ensure the results looked as expected.
alternate
kle.json
This file was generated by hand, which is not typical.
I used the circuit board to measure the key placement.
alternate
info.json
kle2json
converted thekle.json
to ainfo.json
file that looks very similar before and after the process. There are 3 extra fields populated when the key is rotated.Also, a bug was fixed with the interaction between
x
andy
values values and their rotational counterpartsrx
andry
. The introduction ofrx
andry
reset the position of the keys on the screen.