GSoC 2020: Tree Model - Week 6

Posted 3 years ago

Hello! Sorry for the delayed blog post, I was busy making final changes to my pull request and squashing the 25 commits into 7 major ones. I thought it's going to be 1 hour's work and I'll write my blog post after finishing it, but it took 1-2 days. It really was a struggle against git... 😂

So here's what I have been working on this week:

  1. I have added MMRests (or rather, MMRest measures) to the tree model!
    Basically, when you have a Multi measure rest, it replaces all the measures that were supposed to contain full measure rests. So in the new tree model, those measures are children of the MMRest measure.

    I had figured out that depending on a style property called Sid::CreateMultiMeasureRests the systems will either contain the empty measures or they will contain the MMRest Measure. Initially, I had thought of using two versions of the tree depending on this property. In Tree A I have System containing the MMRest measure which contains the empty measures inside it. In Tree B I have the normal measures in the system and the MMRest is the child of the first measure in the MMRest. In the end, I found out it's not really necessary to keep tree B and kept only tree A.

    bitmap.png

So now I don't check the property at all, I only add the children to the MMRest measure if it is found in a system. So whenever this property is enabled, the system will contain the MMRest measure, and the tree will be able to find the MMRest measure as well as all the measures in it. If the property is false, the MMRest won't be in any system so it won't appear in the tree.

The advantage of doing it like this is that this code would continue to work even if later allow MMRests to be created independent of this property.

  1. I found the correct way to add new measures to systems without making the other tests fail, my solution involves adding a function fixupSystems() to measureBaseList.
  2. I added all the vtest files to tst_scanElements and fixed all the vtests one by one.
  3. Added all the remaining bits and pieces of old scanElements to the new implementation.
  4. Hit some bugs involving mmrests which took me a few days to fix. (but I managed to fix it in the end)
  5. Finally squashed all the commits into a few major ones, and restructured them a little bit.

I also found some new bugs, due to some comments from @shoogle and @marcsabatella, which I'll be fixing now.

I have now marked the PR as ready for review. This week I'll be addressing all the review comments, making final changes to the PR, fixing old bugs and any new bugs I find.

Other links

Pull request: https://github.com/musescore/MuseScore/pull/6274
Previous blog: https://musescore.org/en/user/1743616/blog/2020/07/06/gsoc-2020-tree-mo…
Next blog: https://musescore.org/en/user/1743616/blog/2020/07/20/gsoc-2020-tree-mo…