Maybe this needs a script…
Yes I am interested in this too.
I currently use Ctrl+T to detect empty layers, because it’ll say you can’t transform the layer if it’s empty. Not the best
Hi,
Really basic script
from krita import *
def recursiveCleanup(node):
for childNode in list(node.childNodes()):
if childNode.type() == 'grouplayer':
recursiveCleanup(childNode)
if len(childNode.childNodes()) == 0:
print(f"Remove empty {childNode.type()}: {childNode.name()}")
node.removeChildNode(childNode)
else: # if childNode.type() == 'paintlayer':
if not childNode.hasExtents():
print(f"Remove empty {childNode.type()}: {childNode.name()}")
node.removeChildNode(childNode)
doc = Krita.instance().activeDocument()
if doc is not None:
recursiveCleanup(doc.rootNode())
Should work properly for paint layers & group layer, but might need some improvements to manage case of filter mask & co.
edit: ensure there’s an active document
Grum999
Thank you for your answer! It can now delete redundant paintlayers, vectorlayers and group layers with one click!
Ps: Strangely, when vector layer, clone layer and gruop are selected, I cannot execute the script, and the buttons are gray
![]()
Is it 10 script?
If yes I think that’s a limitation of plugin, to restrict execution in some condition only… ![]()
If you execute code from scripter, does it work in this case?
Grum999
Yes, it works.
It is not available on clone layer, file layer, vector layer, group layer and transform mask.
I think its judging condition is whether the layer has editable pixels.
Ideally, 10 scripts shouldn’t judge if a script is executable or not as some script may not be related to layer management…
I can’t do anything here, at least open a bug on bugs.kde.org to ask to remove current restriction: that’s the role of a script to ensure in which condition it could be executed, not the plugin…
Grum999
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.