Saving segment positions with MuseScore 3 leads to elements with sx attributes being mostly 0
S5 - Suggestion
Steps to reproduce:
- execute musescore export job with .spos as target
- sx distance is always 0
Original thread: https://musescore.org/en/node/307253
I actually had feedback by mail from the original user complaining about it and am waiting for a file 'without the issue' to check what is expected. Also have a copy of their code exploiting the data (end of https://musescore.org/en/node/311914 )
But I'm pretty sure the line computing the sx value as: "sx *= ndpi;" coupled with an issue in the voice related algo above would be the region to watch for fix. https://github.com/musescore/MuseScore/blob/3f4894ec3f734f4af6f720195f6…
Will try to fix/pr today.
So I diged into this today, from what I understand, and after getting a better overview of the object model through: https://musescore.org/fr/developers-handbook/references/musescore-inter…
Chord segment have a bbox of (0,0,0,0), so is the sx = 0. When I inspect the child elements composing it, their boxes are correct, but not reflected on the parent element. The rests are still working as their bbox could be accessed correctly. Also, Y/X/SY are based on segment coord, that's why they "continued to work", even tho, I have some question about X below.
Is there an already established way of getting the Chord bbox considering the child objects? Or should I implement it by computing min/max of the childs? Or take another approach? As the codebase is really large and with a long history, it's kind of overwhelming to find an example of that being done. I tried to find an existing one, but without success for the moment and it would be surprising it doesn't exist, but considering musescore work with the Chord bbox (0,0,0,0), I would guess it's not really used like that or never was used before as-is.
Maybe another issue, x distance is not computed correctly, or the same as in ms2. It's actually given by segment page pos, but for instance, ledger lines are not taken into account, in ms3 that means it usually correspond to the the beam position, while it was a more accurate box in ms2.
Cfr the following given by the OP:
sy value, which is stable to system height in both file can be used to find an easy straight forward conversion factor between the two for analysis, as to your own export, as OP didn't gave image file but musescore file, dependent upon export settings.
I reached to the OP about that, as that might be subtle and maybe didn't broke anything on his side (yet), but should be fixed if Chord bbox are computed correctly imho.
Thanks in advance for you help and pointers,
love an play.