Hi
yes, “bug”
The Document.waitForDone()
doesn’t work properly and when working with triggered action results are not really good…
Here a modified version of script:
from krita import *
from PyQt5.Qt import *
def sleep(value):
loop = QEventLoop()
QTimer.singleShot(value, loop.quit)
loop.exec()
inst = Krita.instance()
doc = inst.createDocument(60, 40, "TestDoc", "RGBA", "U8", "", 100.0)
inst.activeWindow().addView(doc)
newLayer = doc.createNode("PaintLayer", "paintlayer")
doc.rootNode().addChildNode(newLayer, None)
newLayer.enableAnimation()
doc.setActiveNode(newLayer)
doc.refreshProjection()
doc.setCurrentTime(0)
doc.waitForDone()
sleep(500)
Krita.instance().action('add_blank_frame').trigger()
def printNodes(n, indent = 0):
print(4*indent*' ' + n.name() + ': animated=' + str(n.animated()))
for c in n.childNodes():
printNodes(c, indent+1)
printNodes(doc.rootNode())
I use a sleep()
with a duration long enough to be sure that action has been triggered (on my computer for this action, I need to wait 500ms)
You can take a look on this topic too:
I show examples to create animated document, and the one using triggered action and waitForDone()
is (currently) clearly not a solution…
Grum999