Skip to content

Commit 365591c

Browse files
committed
Add inferencing for incorrect part names
Sibelius seems to export part names as "P#" rather than specifying print-object="no". This commit adds handling of this case, omitting part names of the (regex) form "$P[0-9]+^".
1 parent d5af232 commit 365591c

File tree

4 files changed

+862
-89
lines changed

4 files changed

+862
-89
lines changed

importexport/musicxml/importmxmlpass2.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,19 @@ SpannerSet MusicXMLParserPass2::findIncompleteSpannersAtPartEnd()
14371437
return res;
14381438
}
14391439

1440+
1441+
//---------------------------------------------------------
1442+
// isLikelyIncorrectPartName
1443+
//---------------------------------------------------------
1444+
/**
1445+
Sibelius exports part names of the form "P#" rather than
1446+
specifying print-object="no". This finds those.
1447+
*/
1448+
1449+
static bool isLikelyIncorrectPartName(const QString& partName) {
1450+
return partName.contains(QRegularExpression("^P[0-9]+$"));
1451+
}
1452+
14401453
//---------------------------------------------------------
14411454
// multi-measure rest state handling
14421455
//---------------------------------------------------------
@@ -1653,7 +1666,7 @@ void MusicXMLParserPass2::part()
16531666
// set the part name
16541667
auto mxmlPart = _pass1.getMusicXmlPart(id);
16551668
_pass1.getPart(id)->setPartName(mxmlPart.getName());
1656-
if (mxmlPart.getPrintName())
1669+
if (mxmlPart.getPrintName() && !isLikelyIncorrectPartName(mxmlPart.getName()))
16571670
_pass1.getPart(id)->setLongName(mxmlPart.getName());
16581671
else
16591672
_pass1.getPart(id)->setLongName("");
933 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)