Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,19 @@ SpannerSet MusicXMLParserPass2::findIncompleteSpannersAtPartEnd()
return res;
}


//---------------------------------------------------------
// isLikelyIncorrectPartName
//---------------------------------------------------------
/**
Sibelius exports part names of the form "P#" rather than
specifying print-object="no". This finds those.
*/

static bool isLikelyIncorrectPartName(const QString& partName) {
return partName.contains(QRegularExpression("^P[0-9]+$"));
}

//---------------------------------------------------------
// multi-measure rest state handling
//---------------------------------------------------------
Expand Down Expand Up @@ -1653,10 +1666,14 @@ void MusicXMLParserPass2::part()
// set the part name
auto mxmlPart = _pass1.getMusicXmlPart(id);
_pass1.getPart(id)->setPartName(mxmlPart.getName());
if (mxmlPart.getPrintName())
if (mxmlPart.getPrintName() && !isLikelyIncorrectPartName(mxmlPart.getName()))
_pass1.getPart(id)->setLongName(mxmlPart.getName());
else
_pass1.getPart(id)->setLongName("");
if (mxmlPart.getPrintAbbr())
_pass1.getPart(id)->setPlainShortName(mxmlPart.getAbbr());
else
_pass1.getPart(id)->setPlainShortName("");
// try to prevent an empty track name
if (_pass1.getPart(id)->partName() == "") {
QString instrId = _pass1.getInstrList(id).instrument(Fraction(0, 1));
Expand Down
Binary file added mtest/musicxml/io/testPartNames.pdf
Binary file not shown.
Loading