Read a Driven Channel

Code snippet demonstrating how to read a driven channel - in this case the “Azimuth” channel of a Directional Light when used in a “Physical Daylight” setting.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import lxu.select
scene = lxu.select.SceneSelection().current()
scnsvc = lx.service.Scene()

sunlight = scene.ItemLookup('Directional Light')
# this is a driven channel so we can just pass 'None' as the type argument
chan = scene.Channels(None, 0.0)
# get the index of the light's "Azimuth" channel
chan_idx = sunlight.ChannelLookup(lx.symbol.sICHAN_SUNLIGHT_AZIMUTH)
# read the channel's value
azimuth = chan.Double(sunlight, chan_idx)