Plugins cannot read `scores` array (not available) and `curScore.name` always delivers "Score"
Reported version
3.0
Type
Plugins
Frequency
Many
Severity
S1 - Blocker
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project
Just write a little plugin and put
console.log(curScore.name);
in it.
run it ( do not forget to select a score before)
and the name shown will be 'Score'.
the the array of open scores is not visible to plugins.
console.log(scores);
creates errors like:
ReferenceError: scores is not defined
Fix version
3.2.0
Comments
I can confirm that this is an issue, and makes development for plugins requiring information about the current score impossible. curScore.exerpts also always returns undefined, along with many other things we're supposed to have access to.
In reply to I can confirm that this is… by FireController1847
About curScore.excerpts: I think that one should work – looks like there's a 'c' missing in your example.
produces:
Running…
Plugin Details:
Menu Path: Plugins.pluginName
Version: 1.0
Description: Description goes here
Requires Score
Debug: [object Object]
Not the excerpts' names, but not 'undefined' either. But
curScore.excerpts[0].title
gives the name of the excerpt, so work like it should.curScore.name
indeed prints "Score", not helpful, but also by currenbt design, see below.curScore.npages
,curScore.nstaves
,curScore.nmeasures
,curScore.nparts
work, but that's mostlty about itLooking at the current documentation for Score shows that there is no property
name
at all, but there is for ScoreElement, which inherits from, and that gives the name of the class, so correctly gives "Score" hereAnd
scores
is commented out in the code with a TODO comment, as are many others, see for example https://dmitrio95.github.io/plugins/html/score_8h_source.htmlI guess that because
name
is used already (for the name of the class/element), we'd needscoreName
or something like that here?A fix for
curScore.name
is pretty easy, once we agreed on the spelling of that property (as mentionedname
is used for something else already, so we'd better pick anogther one, but then again we could also overwrite it.a fix for the
scores
array is even easiersee https://github.com/musescore/MuseScore/pull/5021
Fixed in branch master, commit 1aa445eea2
_Fix #286707: add
scores
andScore.name
back to plugin APIAlso adding more APIs and some documentation for them.
And some more changes to the existing plugins and documentation._
Automatically closed -- issue fixed for 2 weeks with no activity.