[plugin] Custom Canvas Rotation

Description:
Krita’s canvas rotation’s gizmo is currently bound to the center, which means no matter where on screen your cursor is the gizmo remains in centre. This means that to rotate canvas the cursor has to move across the whole screen for a full 360° rotation or you have to move the cursor closer to the center of the screen to use shorter circular movement for the rotation.

This plugin introduces a new shortcut and a semi-new function which utilizes Krita’s original canvas rotation but instead of having window/screen as a centre for the rotation gizmo the cursor’s position at the moment of shortcut activation is utilized as the gizmo’s centre.

Youtube brief showcase:

Link to the plugin:

This is linked to the feature request I made:

Hopefully, this will demonstrate the functionality well to be considered as a feature one day in the future :slight_smile: for now I created this as a substitute.

I tested this on keyboard, pen buttons, pen display buttons on win 10 in the latest stable Krita version 4.4.1.

So far I haven’t encountered issues (which I haven’t solved already) but I’m limited in way I can test this.
At least for now it seems to work just fine for me on my system.

I should note I’m not a python programmer at all, no exp with pyqt or krita’s development so if someone finds their way here and thinks there’s a way to improve the code feel free to leave a comment or two ;0

12 Likes

I just updated the plugin to let’s call it a v 1.1 :slight_smile:

Briefly: works with both left or middle mouse click + some performance benefit + animation is now smooth

  1. Now it works the same way as Krita’s default canvas rotation in how shortcut is used: Press shortcut + press left/middle mouse button or use pen on screen/tablet and then you can rotate

  2. Qtimer event loop removed and replaced with mouseMove event which makes it as fluid as the built-int canvas rotation (animation wise).

3 Likes

Small new update.

Added a circle icon to indicate where’s the centre of rotation while rotating canvas.

4 Likes

I had some time on my hands to check it out and I think you did something really cool. Congrats.
I really was not aware of how much your able to do with extensions. Dockers are a bit their own little islands and this is so encompassing. I am still amazed.

I just had some minor notes I would like to perhaps bring to your consideration.

  • the in krita manual seems quite empty. after I was not able to make things work it was the first place I took a look and then I was clicking around to find your instructions. For what I can see you just need to kinda copy and paste and then add some html tags for it.
  • I don’t think you have to be so shy to say what is the default shortcut is, you can “claim it” so to speak and then sell the “it is customizable” option after it in case people want to change it. I was looking and it is nothing that should mangle anything what so ever on the current layout.
  • the dot on the last update is a big difference I know it may be short on code but it makes it visible which is a big thing to me. I watched the initial video the first time and I had a really hard time to understand what was happening and when the dot appeared while using it for real I was like “oh wait… nice~”.
1 Like

Thanks a lot, I actually think the dot is a big thing too xD. It changed the feeling so much hehe.

In my next plugin I’ll be positng here probably tomorrow I’m changing the approach with a video. Though it’s a pretty long video so I’ll probable make 2 one just to showcase it and the other thel ong with explanation :-).

The krita manual, hmm. I completely forgot about it. Heh. Thanks for bringing this up to my attention I’ll add it with an update.
Now I kinda need it for me new plugin too but I’ll do that one later…

Thanks a lot. I actually have your plugin installed but the code base is so huge that my brain melts going through it hehehe.

oh neat I will curious to see what it is about for sure. I also feel a bit inspired after watching your stuff to do a new plugin it is like a big door opening that I thought was closed for the longest time. Extensions really are something.

oh yeah. you and me both. most of the time I have the feeling I really don’t know what I am doing and that I have no recollection of it either. I just know the internal schematic that is a bit weird. I have 2 points of contact with krita (read and write) and after that things go down the code like a waterfall affecting the pyqt5 until it can’t run more without a new cycle.

1 Like

I’m wondering if it could make sense for the anchor point to be where the user last drew a stroke?

Also, can this add-on work with just pressing middle mouse and nothing else? Thanks.

2 Likes

Hm, not sure about the last stroke, I don’t think that one would be particular sought feature but I do plan to (if I find a proper way) change the zoom so it zooms to where your cursor position is rather than simply the center of the screen since it feels more natural (it’s also the way Krita’s zoom works but I haven’t found a smooth way to do it at the time I was making this plugin). :wink:

WHen it comes ot the middle mouse button, hmm Krita does not allow mouse buttons in custom shortcuts so I’d have to handle that internally which is not a good way since middle mouse button is used by Krita so the functions would fight each other.

This is more of a Krita devs feature request stuff so if they ever allow it it will be possible so I’m sorry but I don’t think I’ll be adding mid mouse button since it would just bring more problems but you can always ask in the feature request here on this forum. :wink:

1 Like

Oh Wow Exactly what I was looking for!! THANKS!!

1 Like

I would definitely second this as an option, also something I was hoping to find. But if not then the cursor would do for now, but last stroke would be real nice to have.

2 Likes

Hi. Okay so I tried it out but maybe I misunderstood what it’s supposed to do.
Ideally I want the cursor to become the center of axis where the canvas is turned around, but it appears the plugin still uses the canvas center axis to rotate the canvas?
I found that if I’m working on a small details for example, and I want to rotate the canvas to make the next stroke, and I’m for instance on the outer edges of the canvas (not the center), then the part I’m working on actually rotates away from me, and I have to each time move the canvas to get back to where I was working. Thus ideally wanted to be able to have the canvas rotate around the cursor axis, not the center of the canvas.

1 Like

Yep the screen center is even the description that’s all it does, this plugin allows you to have less of a cursor movement.
I’d like to eventually get through with the rotation around the cursor but no promises right now, not everything is possible with python in Krita :slight_smile:

Also I’ve been having some tough life events so I haven’t been updating my plugins for a while, I did not quit just need more time before I get back to it.

1 Like

All good bud, sorry to hear about your troubles, I know the feeling, big challenges this side too. Don’t worry about little things like plugins, always a workaround. Take care.

1 Like