Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lighting Effecting plugin
#1
I'm trying my hand at bulk image generation via the Python console on Gimp 2.10.6 under Windows 10; I'm having a great time diving in at the deep end (I've been working with Python for nearly 12 hours now), but it I reckoned I might get on faster with Python-fu by asking for help. (It's the 21st century - I even ask for directions!)

It seems that the Lighting Effects plugin has more options than are passed through the function call: bump map depth and distance, for instance. 
I've dug as far as lighting-main.c to see what's going on - it looks like there are variables with a larger scope than you'd hope - but wondered if somebody who actually Knows What They're Doing can tell me whether I shall be able to replicate the Lighting plugin in its entirety or not - and a few hints on how to get it done, if y'd be so kind.

   
Getting reality to match the preview: hope or faint hope?
Reply
#2
If you mean that there are some parameters that can be set in the UI but not in the API (like the bump height(*)), then you're right. The UI also lets you play with several light sources... And no, you won't find these variables elsewhere, if that was what you were hoping for. You can report a bug (or even submit code), but don't hold your breath. Even if such omissions are often easy to fix, fixing them also breaks existing scripts that use the incomplete API.

(*) not too familiar with the plugin, but "distance" looks like just a preview setting.
Reply
#3
Thanks, once more, Ofnuts.

Yes, I'd noticed the 'single light source only' when I got the function header up on the console lookup. 
I wondered if it reran the code for each light source, but I can see a heap of difficulties with that approach.
About the only thing I've found so far that might get done on a bug fix report is changing the documentation to say you can't, in fact, pass a zero if you don't want to specify an  environment map (took me a while to figure that one out, being brand new to Python).
Don't you just love legacy code?

Thanks for diving into the source, I really appreciate it. Back in the day, I went straight from backroom coding to front line support with a phone on one ear and the codebase on the screen in front of me, because documentation was non-existent.  I've been a firm believer in highly descriptive commenting of code (and good supporting docs) since.

All the best,
thanks again,
QuinB
Reply
#4
A good deal of the Python API is just a facade on the Script-fu one. But there is one change that was made to make things immensely easier in Python, instead of passing object IDs, you pass objects(*). For instance the "bumpmap" and "envmap" parameters are of type gimp.Drawable, not integers (the API extracts the ID from the object). So of course if there is no object you don't use 0, you use None.

(*) there are, of course ,a few exceptions to this... Smile
Reply


Forum Jump: