Skip to content

Expose paintOpAngle to Python View

Maciej Jesionowski requested to merge yavn/krita:brush-rotation-python into master

Continuation of work from MR !1967 (merged)

Adds two new Python functions to the View class:

  • brushRotation -> paintOpAngle
  • setBrushRotation -> setPaintOpAngle

MyPaint weirdness

While testing Python scripts, I noticed that MyPaint brush implementation behaved very erratically when the angle was exposed to the user. I added a separate commit with a fix that makes the set/get values consistent across the calls (i.e., calling setBrushRotation with the same value repeatedly does not result in a "random" change).

In general, setting the rotation to 0 results in no change from the default MyPaint brush's elliptical dab angle, which is often 90 degrees.

Test Plan

The following snippet can be used with Scripter. Should be used with a pixel and mypaint brushes.

from krita import *

krita = Krita.instance()
window = krita.activeWindow()
view = window.activeView()

desired = 10
old = view.brushRotation()
view.setBrushRotation(desired)
new = view.brushRotation()
print(old, desired, new)

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Edited by Maciej Jesionowski

Merge request reports