05-17-2023, 11:21 PM
(05-17-2023, 09:17 PM)Ofnuts Wrote: 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.
Indeed so, but I've come across some exceptions that reply on the active layer so they would need it setting to the one that's wanted if not already it e.g.
pdb.plug_in_autocrop_layer (that caught me out)
pdb.script_fu_perspective_shadow (strangely)
pdb.plug_in_gmic_qt (maybe)
Of course it's a long shot david wants to use one of these so I guess that raises the question, david what do you want the active layer set for?