Cross-channel color adjustment filter could not be configured by script. When such a filter is created by code, its configuration property is initialized to {'nTransfers': 0}. However, a normal color adjustment filter created by GUI dialog has configuration properties like {'curve0': '0,0.5;1,0.5;', 'curve1': '0,0.5;1,0.5;', 'curve2': '0,0.5;1,0.5;', 'curve3': '0,0.5;1,0.5;', 'curve4': '0,0;1,0.5;', 'curve5': '0,0.5;1,0.5;', 'curve6': '0,0.5;1,0.5;', 'curve7': '0,0.5;1,0.5;', 'nTransfers': 8}. Then, I tried to add these curve information to the initial empty configuration created by script. However, the code didn't work as expected, that the curve 0-7 is added to filter configuration while property 'nTransfers' always remains 0. (fig.1) According to the source code (fig.2), property 'nTransfers' should change with the curve information added, but it didn't work. Furthermore,the curve information is also ignored, the filter created by the script didn't work as the curve info I specified. Moreover, the curve 0-7 only specify the mapping curve for 8 output channels. However, the driver channel is not specified by the filter configuration, which means that driver channel information could not be accessed by script.(fig.3) Similar problem with other color adjustment filter: https://krita-artists.org/t/scripting-with-colour-adjustment-filter-layer/23229
*** Bug 482490 has been marked as a duplicate of this bug. ***
Created attachment 166441 [details] fig.1 Test code
Created attachment 166442 [details] Fig.2 Source code about 'nTransfer'
Created attachment 166443 [details] Fig3. Driver Channel
Created attachment 166444 [details] test script
Hi, mbcnve! Just to let you know a workaround, if you add an explicit line of `nTransfers` before other properties, then script will work: ```python from krita import * app = Krita.instance() doc = app.activeDocument() currentNode = doc.activeNode() myFilter = app.filter('crosschannel') myFilterConfig = myFilter.configuration() print(myFilterConfig.properties()) myFilterConfig.setProperties({'nTransfer': 8}) myFilterConfig.setProperties( {'curve0': '0,0.5;1,0.5;', 'curve1': '0,0.5;1,0.5;', 'curve2': '0,0.5;1,0.5;', 'curve3': '0,0.5;1,0.5;', 'curve4': '0,0;1,0.5;', 'curve5': '0,0.5;1,0.5;', 'curve6': '0,0.5;1,0.5;', 'curve7': '0,0.5;1,0.5;'}) print(myFilterConfig.properties()) ``` That is technically a bug, though I don't know how to solve it properly :)
*** Bug 475827 has been marked as a duplicate of this bug. ***
Thank you for your suggestion, Dmitry. I tried it, and I'm not succeeding in getting it to work with Krita 5.2.9 (Debian 12, appimage). (I'm assuming 'nTransfer' is a typo and should be 'nTransfers'). When setting it to '8' and printing the values, 'nTransfers' remains '0'. If I open the GUI in Krita, all settings remain on the default. Even if I only set the 'nTransfers' to '8' without touching the curves it remains '0'. Should I wait for a new release?
Retested with Krita 5.2.13 (Debian 12, AppImage) and the workaround doesn't seem to be working, I'm afraid. I'm using this script: ```python from krita import * app = Krita.instance() doc = app.activeDocument() currentNode = doc.activeNode() filter = app.filter("perchannel") config = filter.configuration() config.setProperty("nTransfers", "8") config.setProperty("curve0", "0.168092,0;0.962877,1;") for index in range(1, 8): config.setProperty(f"curve{index}", "0,0;1,1;") filter.setConfiguration(config) colorAdjustment = doc.createFilterMask("Color Adjustment", filter, currentNode) currentNode.addChildNode(colorAdjustment, None) ``` Indeed, if you print the config properties in the script, it says the value is set. But when I then open the Color Adjustment layer in Krita itself, the first (or zeroth, depending on how you count) is the set to the default curve.