Read a Driven Channel

From The Foundry MODO SDK wiki
Jump to: navigation, search

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.

scene =
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)