heisenshark / blender-krita-link-plugin

simple way to edit blender textures in krita, alternative to using blender image editor
GNU General Public License v3.0
39 stars 1 forks source link

"Sending on Draw" does not work #11

Open tracefree opened 2 weeks ago

tracefree commented 2 weeks ago

Hi, first of all let me thank you for this amazing plugin, I have been looking for something like this for a long time!

I noticed that the "Sending on Draw" functionality does not work for me. The image is only sent when I manually press "Send Image". The terminal does also not show any output when drawing. I am using Krita 5.2.3 on Arch Linux with KDE Plasma 6.1 with Wayland.

I managed to identify the the issue: isinstance(obj, QOpenGLWidget) in eventFilter in ImageState.py always evaluates to False for me. I saw that obj is only used in a print message, by changing the order of the if statements the problem is fixed for me. I'll submit a pull request shortly, but I'm not familiar with Krita's plugin system so feel free to reject it if my change isn't a proper solution or you'd prefer to handle it differently.

heisenshark commented 2 weeks ago

oh, your solution is working but, I want only buttonUp event on canvas to trigger refresh, and the best way to check that was to accept any input on QOpenGLWidget object as it is type of the canvas. this may not be case in your system. your current solution accepts all events no matter the object they occur on to trigger refresh.

I checked on plasma wayland 6.1(arch btw) and did not encounter the issue. Could you please use this plugin to check the type of canvas in the object tree (you might also be using some other krita plugins that may be causing issues)

Also thanks for contribution as I cant see and test all problems related to plugin

heisenshark commented 2 weeks ago

nvm the issue is probably setting in the krita config Settings>Configure>Display, without the hardware acceleration the canvas is just a QWidget. So yeah I think the code should check for the meta class like

if obj.metaObject().className() == "KisOpenGLCanvas2" or obj.metaObject().className() == "KisQPainterCanvas":

and then trigger the draw so it works on accelerated and not accelerated mode

tracefree commented 2 weeks ago

Ah, so that was the difference! Looks like I forgot to activate hardware acceleration on this install. Yes your fix works for me as well, both with the setting activated and with it deactivated. Thanks! I assume you'll want to commit this yourself and I should close my PR?

heisenshark commented 2 weeks ago

Yeah, can do. but only to dev rn as it probably needs testing on windows.