Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I get a layer ID by its position ? [Script-Fu]
#2
As you say you have to use an index in the layers list, but AFAIK you can get the nth item of a list using list-ref:
Code:
> (list-ref '(a b c d) 2)
c

Note: it is usually a better idea to declare your script has taking a second argument that will be the target layer (SF-LAYER), and it will be set to the active layer when the script is called from the UI. Otherwise you can be looking for an active layer when there is none (because the active "drawable" is something else, like a channel).
Reply


Messages In This Thread
RE: How can I get a layer ID by its position ? [Script-Fu] - by Ofnuts - 07-21-2024, 08:57 PM

Forum Jump: