Pierre
Pierre

Reputation: 35276

Gimp python-fu: selecting two layers

I would like to create a python-fu script for gimp where the user could select two layers.

register(
(....)
    [
    (PF_IMAGE, "image", "Input image", None),
    (PF_DRAWABLE, "layermask", "MASK:", None),
    (PF_LAYER, "drawinglayer", "DRAWING:", None),
    (PF_INT, "treshold", "TRESHOLD:", 1)
    ],
(...)

whenever I try this, my form contains only one choice (I suppose it uses the default layer ?) enter image description here.

How can I get two 'select' controls ? I've tried to change PF_DRAWABLE to PF_LAYER but I still get the same result.

Upvotes: 0

Views: 789

Answers (1)

xenoid
xenoid

Reputation: 8904

You are selecting two layers, but one doesn't appear in the auto-generated dialog because it is assumed to be the active layer(*): the PF_DRAWABLE argument after the PF_IMAGE is implicitly the current active layer (or active channel) when the script/plugin is called.

In other words your script doesn't work with two random layers, but with the active layer and another random layer (which is usually a good idea from a UI perspective, especially if you script modifies only one of the two).

(*) In some cases (Filters>Reshow ...) the auto-generated dialog can show a selector for that layer and so show you the two layer selectors you expect.

Upvotes: 1

Related Questions