Posts: 159
Threads: 32
Joined: Jan 2017
Reputation:
8
Operating system(s):
What is the syntax to set a layergroup (and possibly a layer within it) as active?
I have looked through the console and searched the web without success.
If, for instance, I wish to insert a layer it is straight forward - I can specify parent and position.
Should not the same syntax apply to other layer commands, or is it that the console has not been updated?
Posts: 6,365
Threads: 276
Joined: Oct 2016
Reputation:
565
Operating system(s):
Gimp version: 3.00RC1
In script-fu you can use (gimp-image-set-active-layer image active-layer), in Python pdb.gimp_image_set_active_layer(image, active_layer), but the active_layer attribute of a gimp.Image object is writable: image.active_layer=image.layers[1].
However the "active layer" is a human user thing. All the functions that apply to a layer take an explicit layer parameter so there is little point in changing the active layer. The only thing I would use this for is to change the active layer before returning control to the user, assuming it is not what the user would expect.
Posts: 159
Threads: 32
Joined: Jan 2017
Reputation:
8
Operating system(s):
Thanks for the replies.
The reason I wished to set the active layer was, having copied a layer to the buffer, I then wanted to paste it to the mask of a layer in a layer-group.
However, if I understand the reply from Ofnuts correctly, I can address the layer-group numerically like any other layer.
At 76 years of age it takes me a long time to get my brain around these concepts!
Posts: 6,365
Threads: 276
Joined: Oct 2016
Reputation:
565
Operating system(s):
Gimp version: 3.00RC1
05-18-2023, 09:47 AM
(This post was last modified: 05-18-2023, 09:48 AM by Ofnuts.)
the paste operation take a target "drawable" parameter, which can be a layer or a mask (or a channel). This doesn't need to be the "active" one.