Re: [Gimp-user] Arrays in Python



On 04/10/18 00:57, Beinsezii wrote:
AFAIK you can't, but anyway how do you expect the user to enter the
bazillion numbers? If you want that many numbers just ask for a file
name and read the file.
The user already can. I wrote a custom system for making GTK configuration
windows that I use with all my plugins instead of the default python-fu thing
that just stacks all the widgets into a grand tower of Babel.
Where the enums come into play is allowing other scripts to call this one via
the PDB. Not really a problem right now since the registry's dead and therefore
it won't end up in the hands of others for a while (right?). I'm just
perfectionist.


Guess for now I'll refactor it to make the PDB method take i32's & floats
instead of arrays, and if some other weirdo wants the full horror of my plugin,
they'll just have to import the class.


If anyone else knows a way or has other inquiries, I'll stay subbed to this
thread.




Or maybe your array can be pixels values in a layer (these are easy to
get in Python) in which case the user would just specify a second
layer.
You say that, but I was entirely unable to get proper pixel info in one of my
past scripts. I could get standard 8-bit info, but no 32-bit floating point info
that everything apparently uses now (2.10 RC-1).
Unless I'm completely missing it, the python-fu docs are patchy at best. Most of
my knowledge comes from trying to interpret the auto-generated pydoc stuff,
incomplete docs from like 4 years ago, or reverse engineering other over-the-top
scripts like LayerFX.

I have rarely seenĀ  a Python script use another, most people would just copy the code they need to avoid the dependency. And you can factor you code to have a class that does the work and a registration facade, so that other Pythin script can import you code and call the useful code directly.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]