Skip to content

Add brush tip rotate actions

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

This PR implements the feature request from this thread: https://krita-artists.org/t/shortcut-to-rotate-brush/43675

Users requested a shortcut to modify brush tip rotation while staying on canvas. This change adds 4 new actions, rotate clockwise, rotate counter-clockwise, and at two granularities coarse and precise. Coarse is not specified in the UI (to avoid potential edits), but it's 15 degrees currently.

Implemented for brush-based paintops and for MyPaint. Other brush engines don't seem to benefit from the tip rotation too much.

The rotation paintop is defined as an increment + direction (cw/ccw) because the rotation direction as well as the unit (radians/degrees) may depend on the brush engine.

Adding the paintOpAngle() getter wasn't strictly necessary, but I added it just in case anyone needs it.

Please let me know if this is implemented in a wrong way or more testing/tweaking is necessary. I'm happy to continue refining this patch.

Test Plan

  1. Open Settings and bind the new actions to keys:

    • rotate_brush_tip_clockwise
    • rotate_brush_tip_clockwise_precise
    • rotate_brush_tip_counter_clockwise
    • rotate_brush_tip_counter_clockwise_precise

    image

  2. Open a new document and open the brush editor. From here it's easy to switch to a brush in a specific engine. The implementation works for regular Krita brushes (pixel engine) and MyPaint brushes.

  3. You can draw on canvas having the brush editor window open to observe the rotation of the brush tip changing.

** Rotation in action **

GIF is a bit laggy.

rotating_brush

Formalities Checklist

  • I confirmed this builds (on Windows 11).
  • 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.

Merge request reports

Loading