I’d like to run this code (or code like it) in the plugin I’m making:
Krita.instance().action(‘add_new_paint_layer’).trigger()
When I run this as a script (i.e. through the scripter), I have no issues.
However, when I use this code in my plugin, and if the active node is a grouplayer, this code doesn’t work.
I found the exact same thing happen for this workaround I was trying:
application = Krita.instance()
currentDoc = application.activeDocument()
currentLayer = currentDoc.activeNode()
if currentLayer.type() == “grouplayer”:
currentLayer.setName(“I’m a groupy boi”)
else:
currentLayer.setName(“ew I’m not a group ew noo”)
When this code was running as a script, it all worked exactly as intended. However when it was in my plugin, and the active node was a group layer, the “if” part of the statement didn’t trigger at all, although the “else” still worked perfectly fine. I tried switching it to != “grouplayer”, but still the group layers weren’t affected by my code, even though paint layers were fine.
This has made me very suspicious of me getting the “grouplayer” reference correct, but I checked the API like hella lots. Or maybe did I miss something that I needed to import something in one of the plugin files?
I updated Krita literally yesterday, so I’m having this problem on todays version.
Is there a reason for this, or is it a bug? And does anyone know how I would be able to create paint layers when the active node is a group layer?