Add camera height function to perspective transformations

This MR aims to add some slight functionality to control the camera height of perspective transformations in the transform tool.

By holding down ctrl and dragging a transformation, you can activate perspective mode. Now, if you stop holding ctrl and continue dragging, you can move your cursor up or down to adjust the fov/focal length/perspective strength.

This functionality is familiar to many users of professional 3d sculpting and texturing software, in which letting go of a modifier but not the pen can allow the camera to be zoomed in and out of the object.

While I had hoped this would be a simple addition to make my life easier when doing these transformation myself, I have run into 2 problems, one minor and one major:

  1. (minor) Because the switch from PERSPECTIVE to CAMERA HEIGHT occurs during the same action, the cursor tool icon never changes from the PERSPECTIVE icon (I assume it's only switched at the beginning). The only thing I've thought of was maybe ending/beginning a new action when the modes switch, rather than have them handle the switching themselves? I don't know enough to even know if that's possible or the right way to go about it.
  2. (major) As of right now the 'ctrl' key is hardcoded. I had hoped this would be for temporary testing, but I quickly found that continuePrimaryAction doesn't have a perspectiveModifierActive like I found in setTransformFunction . Figuring out how to add such an argument to the function is above my skill level since the arguments seem to be defined in a base class that many other transform tools use. If a user's perspectiveModifierActive key is anything other than ctrl, this prevents perspective transforms altogether. I can find a way to add this argument to continuePrimaryAction but I didn't want to invest the time if it's the absolute wrong way to go about it.

Test Plan

I've only tested on Linux at the moment, and with the default keybinds. It does not work on my 'production' drawing environment because my perspectiveModifierActive is alt rather than ctrl.

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.
  • Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?

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 Ralek Kolemios

Merge request reports

Loading