Bug 475827

Summary: "Perchannel" Filter Layer curves don't change after setting up the node object
Product: [Applications] krita Reporter: Rui Antunes <rui.andre.antunes>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: dimula73
Priority: NOR    
Version First Reported In: 5.2.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Script used to illustrate the issue.

Description Rui Antunes 2023-10-19 13:27:11 UTC
Created attachment 162419 [details]
Script used to illustrate the issue.

SUMMARY
A `perchannel` `FilterLayer` node does not display the changes configured in the `Filter` object's values it required for creation.
This is despite the `InfoObject` for the `Filter` being successfully configured, except for the `nTransfers` property, which remains at `0`.
Also, after saving and quitting the file, the configuration of the new layer is completely cleared.


STEPS TO REPRODUCE
1. I've provided a `test.py` file that I've used to debug my code and come to the conclusions below. Please run that script.
2. Save the file and quit
3. Reload the file and inspect the new `node`'s configuration


OBSERVED RESULT
1. The new `FilterLayer` node, that is set to `perchannel` (`Color Adjust`) seems to be correctly configured, except for `nTransfers`. Both `InfoObject` of the `Filter` passed to `FilterLayer`, as well as the `Filter` that's inspected from the new `FilterLayer` object seem to have the `curve` values specified in the `Properties` `dict`, again, except for `nTransfers`, defaulting to `0` in the new object. Despite this, the actual image does not visibly change. The filter configuration should yield visible changes to the transparency of the image.

3. After saving the file and reloading, if we inspect the Color Adjustment layer that we've created we can see that it's configuration returns to the default values: `{"nTransfers": 0}. The values for the curves are not present in the `InfoObject` after reloading.
Object inspection was made with the following snippet:
```py
filter = Krita.instance().activeDocument().activeNode().filter()
print("\nInfoObject from created node:\n", filter.configuration().properties())
```

EXPECTED RESULT
1. The Color Adjustment Filter Layer should visibly change the image's transparency, according to the values it was set to.


SOFTWARE/OS VERSIONS
Windows: 10 22H2


ADDITIONAL INFORMATION
This was first discussed in this Krita-Artists thread (https://krita-artists.org/t/cant-set-perchannel-ntransfers-through-5-2-api/76239) and was further assisted by user @KnowZero to come to the above conclusions.
Comment 1 Dmitry Kazakov 2025-01-22 18:14:27 UTC
It looks like it is the same bug as bug 482491. The 'nTransfers` property should be set seperately, before all other properties.

It is still a bug, but with a simple workaround.

*** This bug has been marked as a duplicate of bug 482491 ***