-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for MEI export and import of MuseScore IDs #22978
base: master
Are you sure you want to change the base?
Conversation
src/project/qml/MuseScore/Project/internal/Export/MeiSettingsPage.qml
Outdated
Show resolved
Hide resolved
Great, thank you. Still two problems with the current approach:
Try this file to see duplicated IDs: Also there needs to be an additional check on assigning them on load if they are valid. |
Yes, this needs to be documented and users should be explained MuseScore IDs should not been edited or made up. I am planning to add that in the documentation.
Yes, this should be fixed, but it can be done separately since this is not strictly related to the MEI exporter. |
@cbjeukendrup Anything in the way for this to be merged? |
Sorry, I had lost track of it. I'll look into it again tonight. At this point, it would be good to rebase it, since there have been some changes to MuseScore's id system recently. (Update: it looks fine in principle, but really needs a rebase to fix conflicts not detected by Git, since #25666.) |
@lpugin could you please do a rebase and adjust this to the changes in EID? |
* Set LastID in mei@xml:id
…age.qml Co-authored-by: Casper Jeukendrup <[email protected]>
e0dc070
to
a45ffbe
Compare
There is now one issue with string EID containing |
} | ||
String eidStr = String::fromStdString(eid.toStdString().c_str()); | ||
xmlId << "mscore-" << eidStr.replace('/', '.').replace('+', '-').toStdString(); | ||
m_mei.append_attribute("xml:id") = xmlId.str().c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_mei.append_attribute.operator=
makes a copy of the string being assigned, right? Otherwise, a pointer to (very) temporary memory is being stored here...
hasRootXmlId = true; | ||
String xmlIdStr = String(xmlId.value()); | ||
if (xmlIdStr.startsWith(u"mscore-")) { | ||
// Keep a global flag since we are going to read them only if mei@xml:id is given with LastEID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LastEID is not a thing anymore now that MuseScore uses randomly generated IDs. So perhaps this comment should be adjusted.
Adds an option so enable the use of MuseScore EIDs in the MEI export.
The option is not selected by default at this stage.
When selected, MEI elements take the MuseScore EID as
@xml:id
whenever appropriate, always prefixed withmscore-
The LastEID is stored in the
mei@xml:id
, also prefixed withmscore-
. The values are preserved in the importer. When re-exporting the file, only themei@xml:id
is expected to change in the same way is does with MuseScore files.