channel module

The channel module exposes many of the most commonly used item types that would generally be added to a scene from the item list as individual classes. Not all item types are directly exposed as classes but any that aren’t can be created as instances of the generic, top level, modo.item.Item class allowing access to the more convenient modo style methods & properties instead of the core Python API methods. Core API methods, should you need them, are still accessible from within the modo classes through attribute lookup. For example, the Item class wraps the core API’s lx.object.Item.UniqueName() and lx.object.Item.setName() methods as a single property, Item.name but the core methods are still available as Item.UniqueName() and Item.SetName().

Channel

class modo.channel.Channel(chan, item)[source]

Add a link between this channel and another.

Parameters:to_channel (modo.channel.Channel) – The channel to link to.

Delete a link from the channel graph.

Parameters:to_channel (modo.channel.Channel) – The channel the link is to.
disconnectInput(other=None)[source]

Removes an input connection from another channel if it exists.

Parameters:other (Channel) – Other channel to disconnect from. If it is None, all input connections are removed.
envelope

Returns the channel’s animation envelope.

Getter:Returns the channel’s animation envelope.
Return type:modo.channel.Envelope
Raises LookupError:
 if the channel isn’t animated.
evalType

Returns the evaluation type of a channel, which is the type of slot allocated in the eval state vector. This will return the “gradstack” exo-type for gradient channels.

Getter:Returns the evaluation type of the channel
Return type:basestring
forward(index)[source]

Returns the linked channel at the specified index forward of this channel in the channel graph.

Parameters:index (int) – The index of the channel to return.
Returns:The channel at specified index forward of this channel.
Return type:modo.channel.Channel
fwdCount

Returns the number of linked channels forward of this channel in this channel graph.

Getter:Returns the number of linked channels forward of this channel in this channel graph.
Return type:int
fwdLinked

Returns a list of the linked channels forward of this channel in the channel graph.

Getter:Returns the forward channels in this item’s channel graph.
Return type:list
get(time=None, action=None)[source]

Returns a channel’s value for an action at a specific time. Defaults to reading the channel’s evaluated value at the current time.

Parameters:
  • time (float) – Optional time in seconds to read the value at.
  • action (basestring) – The action to read the value from. Defaults to None (evaluation).
Returns:

the channel’s value.

Return type:

depends on the type of the channel being read.

graph

The channel’s channel graph.

Getter:Returns the channel’s channel graph.
Return type:lxu.object.ChannelGraph
index

The channel’s index.

Getter:Returns the channel’s index.
Return type:int
isAnimated

Returns whether the channel is animated.

Getter:Returns whether the channel is animated or not.
Return type:bool
item
Getter:Returns the item that is associated with this channel
Return type:Item
name

The channel’s name.

Getter:Returns the channel’s name.
Return type:basestring
revCount

Returns the number of linked channels that occur before this channel in the channel graph.

Getter:Returns the number of linked channels that occur before this channel in the channel graph.
Return type:int
revLinked

Returns a list of the linked channels that appear before this channel in the channel graph.

Getter:Returns the linked channels that appear before this channel in the channel graph.
Return type:list
reverse(index)[source]

Returns the linked channel at the specified index before this channel in the channel graph.

Parameters:index (int) – The index of the channel to return.
Returns:The channel at specified index before of this channel.
Return type:modo.channel.Channel
set(value, time=None, key=False, action='edit')[source]

Sets a channel’s value for an action at a specific time. Defaults to setting the channel’s value for the “edit” action and at the current time.

Parameters:
  • value (depends on the type of the channel) – The value to set for the channel.
  • time (float) – optional time in seconds to set the value for.
  • key (bool) – Specifies whether to set a key for the channel.
  • action (basestring) – The action to set the value on.

Set a link’s position (from index, to index) in the channel graph.

Parameters:
  • from_index (int) – The index in the channel graph for the current (from) channel.
  • to_channel (modo.channel.Channel) – The to channel.
  • to_index (int) – the index in the channel graph for the ‘to’ channel.
storageType

Returns the storage type of the channel, which can be valid exo-type name for numeric and stored custom types or None if no storage type is found.

Getter:Returns the channel storage type
Return type:basestring
type

Returns the channel type. The numeric and gradient types can be keyframed. The return type is an int which translates to the following types:

0: none
1: integer
2: float
3: gradient
4: storage
5: eval
Getter:Returns the channel type.
Return type:int

ChannelTriple

class modo.channel.ChannelTriple(item, channelName)[source]

Wrapper to allow setting and reading all three channels on a vector ‘channel’ at once

Parameters:
  • channelName (basestring) – The channel name. eg ‘diffCol’
  • item (modo.item.Item) – The item the channel belongs to.
Raises:

LookUpError if no respective channel of the given name was found

get(*args, **kwargs)[source]

Same arguments as Channel.get()

set(values, time=None, action='edit')[source]

Sets three values for the three channels at once

Parameters:
  • time (float) – Time in seconds for the value to be set at (optional)
  • action (basestring) – Action to set the value for (optional)

Envelope

class modo.channel.Envelope(envelope)[source]
behavior

gets/sets the behavior of times for both before the first keyframe and after the last keyframe in the envelope.

Setter:Sets the envelope behavior
Parameters:behavior (int) – the behaviour to set for the envelope. See preBehaviour() for available options.
Getter:Returns the envelope behavior
Return type:int
clear()[source]

Clears (removes all keys from) the envelope.

interpolation

Returns the interpolation setting for the envelope. Can be one of:

lx.symbol.iENVv_INTERP_CURVE
lx.symbol.iENVv_INTERP_LINEAR
lx.symbol.iENVv_INTERP_STEPPED
Getter:Returns the interpolation setting for the envelope.
Return type:int
isInt

Returns whether the envelope is integer-valued type, if not it’s a float type.

Getter:Returns True if the envelope is integer-valued type, False otherwise.
Return type:bool
keyframes

Returns a Keyframes object that provides access to the keyframes set for the envelope and methods to manipulate them.

Getter:Returns a Keyframes object containing the keys for this envelope.
Return type:modo.channel.Keyframes
postBehaviour

gets/sets the behavior of times after the last keyframe in the envelope.

Setter:Sets the envelope post behavior
Parameters:behavior (int) – the behaviour to set for the envelope. See preBehaviour() for available options.
Getter:Returns the envelope post behavior
Return type:int
preBehaviour

gets/sets the behavior of times before the first keyframe in the envelope.

  • RESET A default value, or may be just zero.
  • CONSTANT The value of the first or last keyframe. For first or last keys set to “Auto” or “Auto Flat” the slopes of the keys will be adjusted to provide a smooth interpolation to or from the behavior.
  • REPEAT The values in the keyframe range repeating continuously.
  • OSCILLATE Like repeat, but the values run forwards and backward alternately. For first or last keys set to “Auto” or “Auto Flat” the slopes of the keys will be adjusted to provide a smooth interpolation to or from the behavior.
  • OFFSETREPEAT Like repeat, but the values are offset in each cycle by the difference between the first and last keyframes. For first or last keys set to “Auto” or “Auto Flat” the slopes of the keys will be adjusted to provide a smooth interpolation to or from the behavior.
  • LINEAR Linear interpolation from the slope at the nearest keyframe.
  • NONE Indicates that the envelope does not exist before or after the explicit keyframe range. This can be used by motion evaluation code to decide whether to use the envelope for a channel or to look up the parent envelope or default value.
  • CONSTANT_KEEP_SLOPE As for constant except that the slopes of the first or last keys are not changed.
  • OSCILLATE_KEEP_SLOPE As for oscillate except that the slopes of the first or last keys are not changed.
  • OFFSETREPEAT_KEEP_SLOPE As for offset repeat except that the slopes of the first or last keys are not changed.
Setter:Sets the behavior
Parameters:behavior (int) –

the behaviour to set for the envelope. Can be one of:

lx.symbol.iENV_RESET
lx.symbol.iENV_CONSTANT
lx.symbol.iENV_REPEAT
lx.symbol.iENV_OSCILLATE
lx.symbol.iENV_OFFSETREPEAT
lx.symbol.iENV_LINEAR
lx.symbol.iENV_NONE
lx.symbol.iENV_CONSTANT_KEEP_SLOPE
lx.symbol.iENV_OSCILLATE_KEEP_SLOPE
lx.symbol.iENV_OFFSETREPEAT_KEEP_SLOPE
Getter:Returns envelope behavior
Return type:int
value(time=None)[source]

Returns the value of the envelope evaluated at the specified time. If no time is explicitly provided the value of the envelope at the current time is returned

Parameters:time (float) – time to evaluate envelope at.
Returns:value of the envelope
Return type:float for float type envelopes, int for integer-valued type envelopes

Keyframes

class modo.channel.Keyframes(envelope)[source]
add(val, time=None)[source]

Adds a new keyframe at the specified time. If no time value is passed as an argument a keyframe is set at the current time.

Parameters:
  • time (float) – optional time (in seconds) to add a keyframe at.
  • val (int or float) – the value to set for the keyframe
delete()[source]

Deletes the current key

first()[source]

Go to the first keyframe.

getSlopeType(side)[source]

Returns the slope type for either side of a keyframe.

Returns:a tuple of the slope type set for the side of the keyframe specified and whether the slope is weighted or not.
Return type:(int, int)
last()[source]

Go to the last keyframe.

next()[source]

Go to the next keyframe.

numKeys
Getter:Returns the number of keyframes found
Return type:int
prev()[source]

Go to the previous keyframe.

setIndex(index)[source]

Go to the keyframe by index

setSlopeType(stype, side)[source]

Sets the slope type for either side of a keyframe

  • SLOPE_DIRECT the slope of the tangent is set based on the value stored in the key.
  • SLOPE_AUTO the slope of the tangent is calculated automatically with regard to surrounding keys. This is similar to the slope adjustments made by TCB curves.
  • SLOPE_LINEAR_IN the slope of the tangent is calculated to align with the previous key’s value.
  • SLOPE_LINEAR_OUT the slope of the tangent is calculated to align with the next key’s value.
  • SLOPE_FLAT The slope of the tangent is set to zero.
  • SLOPE_AUTOFLAT the same as auto but if a neighboring key has the same value as the key the slope is set to zero.
  • SLOPE_STEPPED Maintains the value of the previous key between pairs of keys.
Parameters:
  • stype (int) –

    set the slope type for the current keyframe. Can be one of:

    lx.symbol.iSLOPE_AUTO
    lx.symbol.iSLOPE_AUTOFLAT
    lx.symbol.iSLOPE_DIRECT
    lx.symbol.iSLOPE_FLAT
    lx.symbol.iSLOPE_LINEAR_IN
    lx.symbol.iSLOPE_LINEAR_OUT
    lx.symbol.iSLOPE_STEPPED
  • side (int) – the side of the key (in or out) the slope type is being set for
time

Returns & sets the time for the current keyframe.

Setter:Sets the time
Parameters:time (float) – the time to move the key to.
Getter:Returns the time of the current keyframe
Return type:float
value

Convenience property to get & set value of the current keyframe for the 90% case of an unbroken key.

Setter:Sets a value
Parameters:val (int or float) – the value to set for the key.
Getter:Returns the value of an (unbroken) key.
Return type:int or float

ChannelRead

class modo.channel.ChannelRead(scene)[source]
set(action=None, time=None)[source]

Initialises the channel read object with a new action and/or an explicit time to read from. If no action is provided the last action set is used. If no time value is provided the current time is used.

Parameters:
  • action (basestring) – optional action to read from.
  • time (float) – optional time (in seconds) to read at.

ChannelWrite

class modo.channel.ChannelWrite(scene)[source]
set(action=None, time=None)[source]

Initialises the channel write object with an action and/or a time write to. Defaults to writing to the “edit” action if no action is provided and to the current time if no time is provided.

Parameters:
  • action (basestring) – the action to write to.
  • time (float) – the time to write to in seconds.