Bug 391511 - Canvas is not updated when Node::setVisible() is called from python script
Summary: Canvas is not updated when Node::setVisible() is called from python script
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.0 pre-alpha
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-07 10:37 UTC by Aurélien Da Campo
Modified: 2018-03-07 11:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This image shows the inconsitency between the canvas & the layers docker (160.43 KB, image/png)
2018-03-07 10:37 UTC, Aurélien Da Campo
Details

Note You need to log in before you can comment on or make changes to this bug.
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