03-16-2018, 11:47 PM
(03-16-2018, 03:07 PM)dinasset Wrote: I'm trying to use (from inside a .py filter) the effect "stroke" of the filter "layerfx.py".
While interactively both options ("color" and "gradient", didn't test the pattern) work properly, when called the option "color" works, the option "gradient" gives an ununderstandable error message (something like: wrong number of parameters, expected maximum 4 received 8).
Hence there should be something wrong in my call.
I wrote a little filter for testing, some expert can simply read the source and find the error or run the minifilter and test the 2 options (default=color, gradient only if chosen).
Thanks for any help.
(I'm running Windows 10 64bits, but the problem has been confirmed also on a system running Windows 7 32bits)
Nothing to do with your code, alas(*). It seems that the message come from there:
Code:
case GIMP_PDB_COLOR:
value = pygimp_rgb_new(¶ms[i].data.d_color);
break;
In other words, the plugin interface defines a parameter which is a PDB_COLOR. Since the call parameter is a tuple it is used to create a color, expecting 3 or 4 arguments but getting 8 from the gradient definition.
In interactive mode, the code isn't called via the PDB, so there is no parameter conversion and the "fill" parameter type can be anything.
So,layerfx.py needs to be fixed. Given its interface it seems rather ancient and several things could be improved, like the unnecessary duplication of functions.
Btw, the bug is so bad that is makes Gimp crash on Linux (fortunately after the error messages have been issued).
(*) but you can remove the double parentheses in ((160,160,160,255))