It appears that there is an in-editor option to change the opacity of Sprite components, and an in-code function to change the opacity of layers.
Correct me if I'm wrong, but there doesn't appear to be the inverse of the above set of options, specifically, the option to change the opacity of Sprites in the code, or the option to change the opacity of layers from the editor.
Maybe there could be a setOpacity function for Sprites, and a setOpacity function for SceneObjects, which sets the opacity for all the SceneObject's Sprite components in one call. This should probably also include the appropriate getOpacity functions, where the one for SceneObject could take a Sprite index argument, and if called without argument gets opacity of just the first Sprite component.
For changing the layer opacity in the editor, the field could maybe be per layer, among the other layer settings in the Properties panel when it is contextually "Scene Properties".
Just some ideas.