Skip to content

Commit

Permalink
@Jojo-Schmitz MusicXML Import - Arpeggios don't have their color impo…
Browse files Browse the repository at this point in the history
…rted

Backport of musescore#26495, 2nd commit
  • Loading branch information
Jojo-Schmitz committed Feb 14, 2025
1 parent f1db51b commit 0f3a4ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8071,7 +8071,7 @@ static void addGlissandoSlide(const Notation& notation, Note* note,
// addArpeggio
//---------------------------------------------------------

static void addArpeggio(ChordRest* cr, const QString& arpeggioType)
static void addArpeggio(ChordRest* cr, const QString& arpeggioType, QColor arpeggioColor)
{
// no support for arpeggio on rest
if (!arpeggioType.isEmpty() && cr->type() == ElementType::CHORD) {
Expand All @@ -8083,6 +8083,8 @@ static void addArpeggio(ChordRest* cr, const QString& arpeggioType)
arpeggio->setArpeggioType(ArpeggioType::DOWN);
else if (arpeggioType == "non-arpeggiate")
arpeggio->setArpeggioType(ArpeggioType::BRACKET);
if (arpeggioColor.isValid())
arpeggio->setColor(arpeggioColor);
// there can be only one
if (!(static_cast<Chord*>(cr))->arpeggio()) {
cr->add(arpeggio.release());
Expand Down Expand Up @@ -8401,6 +8403,9 @@ void MusicXMLParserNotations::parse()
_arpeggioType = _e.attributes().value("direction").toString();
if (_arpeggioType.isEmpty())
_arpeggioType = "none";
QColor color = _e.attributes().value("color").toString();
if (color.isValid())
_arpeggioColor = color;
_e.skipCurrentElement(); // skip but don't log
}
else if (_e.name() == "articulations") {
Expand Down Expand Up @@ -8500,7 +8505,7 @@ void MusicXMLParserNotations::addToScore(ChordRest* const cr, Note* const note,
TrillStack& trills, MusicXMLTieMap& ties, std::vector<Note*>& unstartedTieNotes,
std::vector<Note*>& unendedTieNotes)
{
addArpeggio(cr, _arpeggioType);
addArpeggio(cr, _arpeggioType, _arpeggioColor);
addWavyLine(cr, Fraction::fromTicks(tick), _wavyLineNo, _wavyLineType, spanners, trills, _logger, &_e);

for (const Notation& notation : _notations) {
Expand Down
1 change: 1 addition & 0 deletions importexport/musicxml/importmxmlpass2.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class MusicXMLParserNotations {
QString _wavyLineType;
int _wavyLineNo { 0 };
QString _arpeggioType;
QColor _arpeggioColor;
bool _slurStop { false };
bool _slurStart { false };
bool _wavyLineStop { false };
Expand Down
3 changes: 3 additions & 0 deletions mtest/musicxml/io/testColors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@
<stem>down</stem>
<notehead color="#9437FF">normal</notehead>
<beam number="1" color="#FF0000">begin</beam>
<notations>
<arpeggiate color="#FF0000"/>
</notations>
</note>
<note>
<pitch>
Expand Down

0 comments on commit 0f3a4ab

Please sign in to comment.