Bug 447807 - Document.refreshProjection() does not refresh for Fill Layers
Summary: Document.refreshProjection() does not refresh for Fill Layers
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: Scripting (show other bugs)
Version: 5.0.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 447892 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-01-02 00:51 UTC by jungwnr
Modified: 2022-01-04 16:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jungwnr 2022-01-02 00:51:28 UTC
SUMMARY
When using the Python Scripting to modify parameters for a Fill Layer, the fill layer does not update after calling refreshProjection().

STEPS TO REPRODUCE
1.  Create a new document.
2.  Create a new Fill Layer. Choose any color except green (because my example script will try to make it green)
3.  Run the following script:

###### SCRIPT START ######
from krita import *
import xml.etree.ElementTree as ET

activeDoc = Krita.instance().activeDocument()
node = activeDoc.nodeByName("Fill Layer 1")
config = node.filterConfig()
properties = config.properties()
xmlObj = ET.fromstring(properties["color"])
xmlObj[0].set("r", "0.00")
xmlObj[0].set("g", "1.00")
xmlObj[0].set("b", "0.00")
result = ET.tostring(xmlObj, encoding="unicode")
properties["color"] = result
config.setProperty("color", properties["color"])
node.setGenerator("color", config)
activeDoc.refreshProjection()
###### SCRIPT END ######

OBSERVED RESULT
The Fill Layer remains the old color. It will update correctly if you right click the layer and go to "Properties".

EXPECTED RESULT
The Fill Layer color change should be reflected on the canvas.

SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.12.12

ADDITIONAL INFORMATION
I have reproduced this issue on 2 different machines:
- Core i9 Desktop on Windows 10
- Core i7 Wacom MobileStudio Pro on Windows 10
Comment 1 Halla Rempt 2022-01-04 12:37:10 UTC
I can confirm the issue. I also see that the call to setGenerator returns True, so that is not the problem.
Comment 2 Bug Janitor Service 2022-01-04 13:46:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1277
Comment 3 amyspark 2022-01-04 16:53:10 UTC
*** Bug 447892 has been marked as a duplicate of this bug. ***
Comment 4 amyspark 2022-01-04 16:57:02 UTC
Git commit 60141f1b8e77ba24e927075a174aba9959a10175 by L. E. Segovia, on behalf of Halla Rempt.
Committed on 04/01/2022 at 16:44.
Pushed by lsegovia into branch 'master'.

Update the FilLayer when the config is set from Python

When setting the filter from FillLayer,

filter()->compareTo(filterConfig.constData())

returns true, so the layer never gets updated.

M  +5    -4    libs/image/generator/kis_generator_layer.cpp
M  +2    -2    libs/image/generator/kis_generator_layer.h
M  +2    -2    libs/image/kis_adjustment_layer.cc
M  +1    -1    libs/image/kis_adjustment_layer.h
M  +2    -2    libs/image/kis_filter_mask.cpp
M  +1    -1    libs/image/kis_filter_mask.h
M  +1    -1    libs/image/kis_node_filter_interface.cpp
M  +6    -1    libs/image/kis_node_filter_interface.h
M  +2    -3    libs/libkis/FillLayer.cpp

https://invent.kde.org/graphics/krita/commit/60141f1b8e77ba24e927075a174aba9959a10175
Comment 5 amyspark 2022-01-04 16:58:09 UTC
Git commit 8eff6eed1cba30339f23c53001f750aeea49d5e4 by L. E. Segovia, on behalf of Halla Rempt.
Committed on 04/01/2022 at 16:58.
Pushed by lsegovia into branch 'krita/5.0'.

Update the FilLayer when the config is set from Python

When setting the filter from FillLayer,

filter()->compareTo(filterConfig.constData())

returns true, so the layer never gets updated.

(cherry picked from commit 60141f1b8e77ba24e927075a174aba9959a10175)

M  +5    -4    libs/image/generator/kis_generator_layer.cpp
M  +2    -2    libs/image/generator/kis_generator_layer.h
M  +2    -2    libs/image/kis_adjustment_layer.cc
M  +1    -1    libs/image/kis_adjustment_layer.h
M  +2    -2    libs/image/kis_filter_mask.cpp
M  +1    -1    libs/image/kis_filter_mask.h
M  +1    -1    libs/image/kis_node_filter_interface.cpp
M  +6    -1    libs/image/kis_node_filter_interface.h
M  +2    -3    libs/libkis/FillLayer.cpp

https://invent.kde.org/graphics/krita/commit/8eff6eed1cba30339f23c53001f750aeea49d5e4
Comment 6 amyspark 2022-01-04 16:58:29 UTC
Git commit ccf08a00e75b5f9213f7919eb04660dc6f4d0cb9 by L. E. Segovia, on behalf of Halla Rempt.
Committed on 04/01/2022 at 16:58.
Pushed by lsegovia into branch 'krita/5.0.0'.

Update the FilLayer when the config is set from Python

When setting the filter from FillLayer,

filter()->compareTo(filterConfig.constData())

returns true, so the layer never gets updated.

(cherry picked from commit 60141f1b8e77ba24e927075a174aba9959a10175)

M  +5    -4    libs/image/generator/kis_generator_layer.cpp
M  +2    -2    libs/image/generator/kis_generator_layer.h
M  +2    -2    libs/image/kis_adjustment_layer.cc
M  +1    -1    libs/image/kis_adjustment_layer.h
M  +2    -2    libs/image/kis_filter_mask.cpp
M  +1    -1    libs/image/kis_filter_mask.h
M  +1    -1    libs/image/kis_node_filter_interface.cpp
M  +6    -1    libs/image/kis_node_filter_interface.h
M  +2    -3    libs/libkis/FillLayer.cpp

https://invent.kde.org/graphics/krita/commit/ccf08a00e75b5f9213f7919eb04660dc6f4d0cb9