Skip to content

05 - how to add 0.5 exposure to every light

Wayne keeps asking good questions, cmon everyone else!

Say I have a bunch of lights, and they all have different exposures. How can I add 0.5 to every light with pymel?

Based on what we know so far, we can get every light exposure like this:

python
[ x.exposure.get() for x in ls(type='phxAreaLight') ]
[ x.exposure.get() for x in ls(type='phxAreaLight') ]

and we could set them all to the same value with .set()

python
[ x.exposure.set(2) for x in ls(type='phxAreaLight') ]
[ x.exposure.set(2) for x in ls(type='phxAreaLight') ]

to take the current exposure and add a value, you nest the get() inside the set() call:

python
x.get()
# becomes
x.set(  x.get() + 0.5 )
x.get()
# becomes
x.set(  x.get() + 0.5 )

so to add 0.5 to every light:

python
[ x.exposure.set( x.exposure.get() + 0.5 ) for x in ls(type='phxAreaLight') ]
[ x.exposure.set( x.exposure.get() + 0.5 ) for x in ls(type='phxAreaLight') ]

similarly, to multiply every light exposure by 0.25:

python
[ x.exposure.set( x.exposure.get() * 0.25 ) for x in ls(type='phxAreaLight') ]
[ x.exposure.set( x.exposure.get() * 0.25 ) for x in ls(type='phxAreaLight') ]