musescore / musescore/MuseScore

MS4 Plugin API onScoreStateChanged is never called

Open
#20,290 6 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

community needs review plugins regression MS3
Dominant language
C++
Stars
15.1k
Forks
3.3k
Avg merge
2d 2h
Merged PRs (30d)
91

Description

Issue type

Other type of issue

Bug description

The event onScoreStateChanged in plugins is not called anymore in MS4. It used to work in MS3.6.

Maybe the reason is that scoreStateChanged is not called anymore from MuseScore?

My plugin relies on this because it needs to be informed when the note selection changes (state.selectionChanged).

Steps to reproduce

Try this plugin: test.qml


import QtQuick 2.15
import MuseScore 3.0
import QtQuick.Dialogs 1.3
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

MuseScore {
    id: plugin
    title:      "test"
    version:    "1.0"
    description: "description"
    requiresScore: true
    pluginType: "dialog"
    onRun:

    onScoreStateChanged: {
        console.warn('onScoreStateChanged. state: ' + state)
        if (state.selectionChanged) {
            console.warn('selection changed')
        }
    }

    Pane {
        anchors.fill: parent
        Text {
            text: "Test"
            horizontalAlignment: Text.AlignHCenter
            Layout.fillWidth: true
        }
    }
}

  1. Start MS from terminal to see stdout/stderr messages
  2. Enable the plugin in the plugin manager
  3. Open a score
  4. Start the plugin

It now should print warnings to stdout when you change note selection.

But it doesn't.

Screenshots/Screen recordings

No response

MuseScore Version

4.1.0 - 4.1.2

Regression

Yes, this used to work in MuseScore 3.x and now is broken

Operating system

Linux/NixOS

Additional context

Revision: OS: NixOS 23.05 (Stoat), Arch.: x86_64, MuseScore version (64-bit): 4.0.2-, revision: github-musescore-musescore-

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.