Skip to content

Commit

Permalink
Merge pull request #25580 from Eism/backend_parts_id_fix
Browse files Browse the repository at this point in the history
Backend. Parts id fix. 4.4.4
  • Loading branch information
Eism authored Nov 21, 2024
2 parents 1f05ce7 + 9955dcf commit b8b5ac0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/converter/internal/compat/backendapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,25 +536,25 @@ Ret BackendApi::doExportScoreParts(const IMasterNotationPtr masterNotation, QIOD
ExcerptNotationList excerpts = allExcerpts(masterNotation);

for (IExcerptNotationPtr excerpt : excerpts) {
mu::engraving::Score* part = excerpt->notation()->elements()->msScore();
std::map<String, String> partMetaTags = part->metaTags();
mu::engraving::Score* partScore = excerpt->notation()->elements()->msScore();
std::map<String, String> partMetaTags = partScore->metaTags();

QJsonValue partTitle(part->name());
QJsonValue partTitle(partScore->name());
partsTitles << partTitle;

QVariantMap meta;
for (const String& key: muse::keys(partMetaTags)) {
meta[key] = partMetaTags[key].toQString();
}

meta["open"] = part->isOpen();
meta["id"] = QString::fromStdString(part->eid().toStdString());
meta["open"] = partScore->isOpen();
meta["id"] = QString::fromStdString(partScore->eid().toStdString());

QJsonValue partMetaObj = QJsonObject::fromVariantMap(meta);
partsMetaList << partMetaObj;

std::string fileName = io::escapeFileName(part->name().toStdString()).toStdString() + ".mscz";
QJsonValue partObj(QString::fromLatin1(scorePartJson(part, fileName).val));
std::string fileName = io::escapeFileName(partScore->name().toStdString()).toStdString() + ".mscz";
QJsonValue partObj(QString::fromLatin1(scorePartJson(partScore, fileName).val));
partsObjList << partObj;
}

Expand Down
7 changes: 6 additions & 1 deletion src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Score::Score(const modularity::ContextPtr& iocCtx)
}

Score::validScores.insert(this);
m_masterScore = 0;
m_masterScore = nullptr;

m_engravingFont = engravingFonts()->fontByName("Leland");

Expand All @@ -180,6 +180,11 @@ Score::Score(MasterScore* parent, bool forcePartStyle /* = true */)
{
Score::validScores.insert(this);
m_masterScore = parent;

if (m_masterScore) {
setEID(m_masterScore->getEID()->newEID(type()));
}

if (DefaultStyle::defaultStyleForParts()) {
m_style = *DefaultStyle::defaultStyleForParts();
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/engraving/rw/read410/read410.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ bool Read410::readScore410(Score* score, XmlReader& e, ReadContext& ctx)
while (e.readNextStartElement()) {
ctx.setTrack(muse::nidx);
const AsciiStringView tag(e.name());
if (tag == "Staff") {
if (tag == "eid") {
AsciiStringView s = e.readAsciiText();
score->setEID(EID::fromStdString(s));
} else if (tag == "Staff") {
StaffRead::readStaff(score, e, ctx);
} else if (tag == "Omr") {
e.skipCurrentElement();
Expand Down
6 changes: 6 additions & 0 deletions src/engraving/rw/write/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ void Writer::write(Score* score, XmlWriter& xml, WriteContext& ctx, bool selecti

xml.startElement(score);

if (!MScore::testMode && !score->isPaletteScore()) {
if (score->eid().isValid()) {
xml.tag("eid", score->eid().toUint64());
}
}

if (Excerpt* e = score->excerpt()) {
if (!e->name().empty()) {
xml.tag("name", e->name());
Expand Down

0 comments on commit b8b5ac0

Please sign in to comment.