from PyQt5.QtWidgets import QApplication, QToolButton
from krita import Krita
transforms = {
"Free": "freeTransformButton",
"Perspective": "perspectiveTransformButton",
"Warp": "warpButton",
"Cage": "cageButton",
"Liquify": "liquifyButton",
"Mesh": "meshButton",
}
def activate_specific_transform(name: str):
"""
name: The name of the tranform.
"""
app = Krita.instance()
qwin = app.activeWindow().qwindow()
app.action("KisToolTransform").trigger()
QApplication.processEvents()
button: QToolButton = qwin.findChild(QToolButton, name)
button.click()
# Free, Perspective, Warp, Cage, Liquify, Mesh
activate_specific_transform(transforms["Mesh"])
The activation is done via calling activate_specific_transform function with a particular argument. Replace “Mesh” with any of the values: Free, Perspective, Warp, Cage, Liquify, Mesh to activate the type of transformation you want to use.
Download sequence.
Do you use different kinds of transforms interchangeably? Make a group with different scripts and use Pie Menu for quick access.