Importing colored lyrics from MusicXML works only for first line (number="1")

• Apr 5, 2020 - 19:45
Reported version
3.4
Type
Functional
Frequency
Few
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
  1. Create two lines of lyrics; assign a colour to the second.
  2. Save as MusicXML (see attached test.musicxml).
  3. Open again - the colour has gone
Attachment Size
test.musicxml 3.82 KB

Comments

Right you are!
On top of https://github.com/musescore/MuseScore/pull/6021 apply this:

$ git diff
diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp
index 7f4751769..d129ba6a9 100644
--- a/importexport/musicxml/importmxmlpass2.cpp
+++ b/importexport/musicxml/importmxmlpass2.cpp
@@ -788,7 +788,6 @@ static void addLyric(MxmlLogger* logger, const QXmlStreamReader* const xmlreader
             }
       else {
             l->setNo(lyricNo);
-            l->setEvenLyricStyle(lyricNo & 1);
             cr->add(l);
             extendedLyrics.setExtend(lyricNo, cr->track(), cr->tick());
             }
@@ -5359,8 +5360,10 @@ void MusicXMLParserLyric::parse()
 
       //qDebug("formatted lyric '%s'", qPrintable(formattedText));
       lyric->setXmlText(formattedText);
-      if (lyricColor != QColor::Invalid)
-            lyric->setColor(lyricColor);
+      if (lyricColor != QColor::Invalid) {
+            lyric->setProperty(Pid::COLOR, lyricColor);
+            lyric->setPropertyFlags(Pid::COLOR, PropertyFlags::UNSTYLED);
+            }
 
       const auto l = lyric.release();
       _numberedLyrics[lyricNo] = l;
diff --git a/libmscore/lyrics.cpp b/libmscore/lyrics.cpp
index 3dc3584a5..b63bffb69 100644
--- a/libmscore/lyrics.cpp
+++ b/libmscore/lyrics.cpp
@@ -155,17 +155,6 @@ bool Lyrics::readProperties(XmlReader& e)
       return true;
       }
 
-//---------------------------------------------------------
-//   setEvenLyricStyle
-//    used with setNo, when importing from mxml, to treat even lyrics correctly and preserve their style on the first call of layout
-//---------------------------------------------------------
-
-void Lyrics::setEvenLyricStyle(bool b)
-      {
-      Q_ASSERT(b ? isEven() : !isEven());
-      _evenLyricStyle = b;
-      }
-
 //---------------------------------------------------------
 //   add
 //---------------------------------------------------------

This actually reduces the entire PR to just

diff --git a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
index c959a01bc..17717cae1 100644
--- a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
+++ b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
@@ -5533,7 +5533,8 @@ void MusicXMLParserLyric::parse()
     //qDebug("formatted lyric '%s'", qPrintable(formattedText));
     lyric->setXmlText(formattedText);
     if (lyricColor != QColor::Invalid) {
-        lyric->setColor(lyricColor);
+        lyric->setProperty(Pid::COLOR, lyricColor);
+        lyric->setPropertyFlags(Pid::COLOR, PropertyFlags::UNSTYLED);
     }
 
     const auto l = lyric.release();

for master (and similarly short'n'sweet for 3.x)

Status PR created fixed

Fixed in branch master, commit f7f7f4e0e4

_Fix #303422: Importing colored lyrics from MusicXML

Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together_