"New Layout Code" Clarification

• Apr 16, 2018 - 06:31

Would someone be kind enough to explain the impetus behind the new layout code for MuseScore 3?

I've been looking at a bug that affects adding Staff Text to MM rests. I believe there is a commonality in the cause of several MM rest related bugs. It seems that, in this instance, an error is occurring when a reference to a QList element is out-of-bounds. What I've noticed is a distinct change to the implementation of the curLine method(s). It's hard to pinpoint why the cursor call approach used in 2.2.1 is no longer needed or used. I sense it is impacting the aforementioned functionality (based on stack trace).


Comments

I can explain the impetus but for the details, I will forward your question to Werner, the lead dev.

In 2.x, if you change a note pitch, add a staccato or do any action on a score, the whole score needs to be relayouted. If your score is large and your CPU is weak, just changing a pitch can take several seconds. In MuseScore 3, it's being changed so MuseScore only layout the music up to where it's needed. At the same time, MuseScore 2 layout didn't do any anti collision detection, MuseScore 3 tries to do that.

I am not sure i understand what you are asking. The layout code had to be changed to implement the partial layout functionality to speed things up for larger scores. The implementation of Text() has changed bc. dependencies for some Qt classes are removed. This was done in the hope of getting rid of some long standing problems. Text is work in progress. Especially the implementation of text editing is not complete.

In reply to by Marc Sabatella

I'm working on issue #251451: Crash when trying to add staff text to multimeasure rests

I was able to narrow the particular issue down to an invalid QList element request (size of the list was 0, yet an element was being requested from it). I was able to silence the bug by "hacking" the request with an append to the QList immediately prior to the request. Though I "fixed" the bug, adding staff text to MM rests still isn't possible in version MuseScore 3.0 . It allows me to type staff text, but it is cut-off, appearing almost off the page at the top of the document, while typing. After clicking away from the staff to exit the text-edit mode, the text doesn't relocate to the top of the staff (or persist, for that matter).

I don't know enough about what the final flow of control is supposed to look like in the code, so I don't know which responsibilities to assign where (for example where the QList _layout is supposed to be initialized with at least one element before being referenced).

I found the issue in the curLine() function in Text.cpp

I also noticed an issue where the style elements for adding staff text is missing in Style.cpp

I'd be interested in going further with this, but would appreciate any advice or mentorship that you are willing to offer.

Do you still have an unanswered question? Please log in first to post your question.