musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.11k stars 2.62k forks source link

Some properties of slurs and volta's are lost after vertical blocks are removed. #20841

Closed Serg-SVM closed 1 month ago

Serg-SVM commented 8 months ago

Issue type

UX/Interaction bug (incorrect behaviour)

Bug description

In some cases, when removing horizontal or text blocks, some elements (such as slur and volta) lose some properties (for example, manual position adjustment). The problem is present in versions 3.6.2 and 4.2

Steps to reproduce

  1. Open the example test.zip
  2. Delete the block labeled "Delete me"
  3. The Slur loses the adjustment of its position, Volta resets the "Automatic placement" property

Screenshots/Screen recordings

Shot_2024-01-05_13-29-58 Shot_2024-01-05_13-30-20

MuseScore Version

3.6.2

Operating system

Linux (Debian 12)

Serg-SVM commented 8 months ago

I tried to fix it, but I couldn't think of anything betterđť‚… mscore-slur-lost-properties-fix.zip

Jojo-Schmitz commented 8 months ago

Your patch, but easily visible and readable ;-) :

--- a/libmscore/layout.cpp
+++ b/libmscore/layout.cpp
@@ -3779,6 +3779,8 @@ System* Score::collectSystem(LayoutContext& lc)
       bool curHeader = lc.curMeasure->header();
       bool curTrailer = lc.curMeasure->trailer();

+      QList<System *> brokenSystems;
+
       while (lc.curMeasure) {    // collect measure for system
             System* oldSystem = lc.curMeasure->system();
             system->appendMeasure(lc.curMeasure);
@@ -3850,6 +3852,10 @@ System* Score::collectSystem(LayoutContext& lc)
                         }
                   }

+            if (oldSystem && system != oldSystem && !brokenSystems.contains(oldSystem) && lc.systemList.contains(oldSystem)) {
+                  brokenSystems.append(oldSystem);
+                  }
+
             if (lc.prevMeasure && lc.prevMeasure->isMeasure() && lc.prevMeasure->system() == system) {
                   //
                   // now we know that the previous measure is not the last
@@ -4065,6 +4071,10 @@ System* Score::collectSystem(LayoutContext& lc)
             }
       system->setWidth(pos.x());

+      for(System *system : brokenSystems) {
+            system->clear();
+            }
+
       layoutSystemElements(system, lc);
       system->layout2();   // compute staff distances
       // TODO: now that the code at the top of this function does this same backwards search,

This patch would only apply to Mu3 though

bkunda commented 8 months ago

@zacjansheski pls investigate

zacjansheski commented 8 months ago

Video of behavior in 4.2

https://github.com/musescore/MuseScore/assets/69917893/43fe601b-c906-4d23-941b-59464300fdf2

Jojo-Schmitz commented 8 months ago

I can confirm that your code does fix the issue for Mu3

Panogen commented 8 months ago

I have observed this issue with other elements as well, such as "Text lines" and hairpins. The behavior is very inconsistent and doesn't seem to only happen when frames are added/removed, but perhaps when other layout changes are applied as well, such as changing the number of measures on a system. I was able to reproduce it once with this "Text line" element by inserting and immediately removing a vertical frame on the measure shown: image But I wasn't able to get it to happen a second time. Interestingly, the layout seemed to change after adding and removing the frame, since this is how it looked beforehand. Note how some of the elements have "Auto-place" enabled: autoplace2 This is a reproduction of how it looked after the error. Observe now that ALL the elements have "Auto-place" enabled, which seems to have turned itself on: autoplace1 The last screenshot actually happened earlier while I was editing a completely different section of the score. I recall modifying (but not removing) the text frame containing the score title before this happened. I suspect that it might also have happened after I made changes to the number of measures on certain systems by using the "Group measures" property.