Python - Blend Modes List Request

just as you can do

Krita.instance().filters()

to request the list of available filters, being able to do something like

Krita.instance().blendModes()

to ask all available blending modes.

Hi

You can find list of possible blending mode here:

And their translation in human language here:

Not as simple as than a python function, but better than nothing :slight_smile:

Grum999

1 Like

yes that was what I was doing right now.

but it gets hard coded if anyone adds a new blending mode as I am expecting with the height blending mode coming over the list will become soon be outdated. and being able to read the whole lot would allow not to fall on that. because applying a bad blending mode string does not destroy the input when it reverts back to normal with in krita so I need to check before I apply and an updated list would help tons.

You can technically pull them out dynamically out of the layer listbox, no?

Here is an example:

from krita import Krita
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

qwindow = Krita.instance().activeWindow().qwindow()
mod = qwindow.findChild(QComboBox, "cmbComposite").model()


blendModes = [ mod.itemData(mod.index(i,0)) for i in range(mod.rowCount()) if mod.flags(mod.index(i,0)) & Qt.ItemIsUserCheckable  ]

print (blendModes)

Edit: added example