Bug 391511

Summary: Canvas is not updated when Node::setVisible() is called from python script
Product: [Applications] krita Reporter: Aurélien Da Campo <aurelien.dacampo>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: halla
Priority: NOR    
Version: 4.0 pre-alpha   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: This image shows the inconsitency between the canvas & the layers docker

Description Aurélien Da Campo 2018-03-07 10:37:37 UTC
Created attachment 111241 [details]
This image shows the inconsitency between the canvas & the layers docker

When layers are hidden from the "Scripter" extension the canvas is not updated.
However, the "Layer" docker is updated.

Note: This happens on krita-nightly-x64-v4.0.0.51-594-gba8550543c


Here is a simple sample code to reproduce this issue:
---
from krita import *

doc =  Krita.instance().activeDocument()
if doc is not None:
    for node in doc.topLevelNodes():
        node.setVisible(False)
else:
    print("No active document.")
---
Comment 1 Halla Rempt 2018-03-07 11:01:31 UTC
You should call doc.refreshProjection() after adding a node to update the view. We made that a separate step because updating the projection after adding a node can take a lot of time.

So, I'm not sure whether this really is a bug that should be fixed...
Comment 2 Aurélien Da Campo 2018-03-07 11:30:37 UTC
Thanks a lot it makes a lot of sense.

So yes indeed that's not a bug in my sense. Just me being lazy to figure it out or simply a lack of documentation regarding this specific thing.

I actually looked for Document/Node::updateXXX, Document/Node::invalidate() or Document/Node::validate() but didn't find the Document::refreshXXX() one ;)

It works fine.
Comment 3 Halla Rempt 2018-03-07 11:41:19 UTC
Okay, then we can close this? I'll try to figure out how to improve the dox; right now, the example for this is with cerateFillLayer