Debugging "activeNode not updated in Python Script"

Vita vita75737 at gmail.com
Wed Jan 17 16:55:47 GMT 2024


Hi!

I am debugging an issue where changing a layer within a python script does
not affect the activeNode() until the script is finished executing
<https://krita-artists.org/t/active-layer-not-updated-in-plugin/81240>.

Here's what I found:
Within KisNodeManager::Private::activateNodeImpl, there is code that gets a
shape for the node. In the script, this shape ends up being Null, so the
function fails this assert
<https://github.com/KDE/krita/blob/c237d74b5765896e19e481f47e082bbb6cc9816d/libs/ui/kis_node_manager.cpp#L165>
and never gets to "imageView->setCurrentNode
<https://github.com/KDE/krita/blob/c237d74b5765896e19e481f47e082bbb6cc9816d/libs/ui/kis_node_manager.cpp#L177>
".

I've placed a breakpoint in KisNodeDummiesGraph::addNode
<https://github.com/KDE/krita/blob/c237d74b5765896e19e481f47e082bbb6cc9816d/libs/ui/flake/kis_node_dummies_graph.cpp#L116>
and
found that it gets called when copying a layer manually, but not when it's
done in the script.

Chasing this upstream, I found that the KisNodeDummiesGraph::addNode is
called in response to a QEvent within KisSynchronizedConnectionBase::event
but now I'm getting a little lost.

Any pointers on how I could continue chasing this down?
I don't understand what the "Shape" is and at which point in the flow it is
supposed to be added for a new layer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kimageshop/attachments/20240117/1ce41e52/attachment.htm>


More information about the kimageshop mailing list