Plugins cannot read `scores` array (not available) and `curScore.name` always delivers "Score"

• Mar 25, 2019 - 20:57
Reported version
3.0
Type
Plugins
Frequency
Many
Severity
S1 - Blocker
Reproducibility
Always
Status
PR created
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


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.

Reported version 3.x-dev 3.0
import QtQuick 2.0
import MuseScore 3.0
 
MuseScore {
      menuPath: "Plugins.pluginName"
      description: "Description goes here"
      version: "1.0"
      onRun: {
            console.log(curScore.excerpts)
            Qt.quit()
            }
      }

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 it

Title Plugin cannot read scores array (not available) and name of curSore delivers always "Score" Plugins cannot read `scores` array (not available) and `curScore.name` always delivers "Score"

A fix for curScore.name is pretty easy, once we agreed on the spelling of that property (as mentioned name is used for something else already, so we'd better pick anogther one, but then again we could also overwrite it.