Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I get a layer ID by its position ? [Script-Fu]
#1
Hi everyone !

It seems to be the most stupid question in the world but I can't find the answer and begin to lose my hair ... 

I just want to get a layer ID by its POSITION ... (its relative position to be exact, but it doesn't matter)

In practice : I want to write a script which use the active layer (ok, so easy --> gimp-image-get-active-layer) AND the layer below ... then ... for it ... what can I do ?
Of course I know the position of my active layer in the tree (gimp-image-get-item-position) .... but I can't find the procedure to get the ID of a layer below (or above, or anything else) ...

((I could use gimp-image-get-layers to obtain the entire list, then write a loop to check each layer, one by one, until matching my active layer, then get the next ...... but ... that is a so heavy and  absurd and annoying solution ... (EDIT : Ok I can also use the position of my active layer to a bit more directly find the layer below in the list ... but I understood that I can't directly get an item in a list, so it would be more or less the same : write a loop which will review one by one each layer until reaching the position "+1"....) ))


There must be a simple and obvious way to do it... but I can't find it...


Thanks in advance to anyone who'll give me the answer !
Reply


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

Forum Jump: