item module

The item 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().

Note

Item channels: In modo channels aren’t really ‘properties’ or attributes of items in any kind of OOP sense. Instead they’re looked up dynamically as needed to be either read or written using ChannelRead and ChannelWrite objects. In the modo API channels have been implemented as objects that wrap the required boilerplate for reading/writing internally and which are added to an Item object as python properties when it’s created.

The default naming convention for channels in modo is to use camel case and allows for periods as word separators. This is incompatible with Python’s naming rules so to avoid naming collisions and fix the periods channel properties for Item objects in the modo API are prefixed with “ch_” and have the periods in the channel name replaced with underscores eg the Camera Item’s “focalLen” channel will appear as a property called “ch_focalLen” etc

Additionally, since there are over 400 separate registered item types in a default installation of modo and only a small proportion of those are implemented as discrete classes in the modo each item’s channel properties are enumerated and added to the Item object’s __dict__ attribute when it’s created. Dynamically adding channels as properties in this manner a major advantage in that all channels, including user channels, and all items, including any implemented by third parties as plugins are automatically supported.

The main ‘issue’, if it can be describes as such, is that even though the channel properties for an Item object can be introspected once it’s created they can’t be documented along with the item classes in the item module. As an alternative there’s an Item Channel Reference page which contains a table of channel names, the corresponding property/attribute name that will appear on the Item along with type information for every item type that ships by default with modo.

Item

class modo.item.Item(item=None)[source]

Base item class

Takes an optional lx.object.Item object as an argument. If none is provided (the default) then the most recently selected item is used.

Parameters:

item (an instance of lx.object.Item or lxu.object.item) – Optional item object to wrap.

Raises:
  • ValueError – if no item is passed as an argument and no valid items are currently selected.
  • LookupError – if a string (item name or ID) is passed as the item argument and no item with that name or ID cane be found in the scene.
  • TypeError – if the object passed as the ‘item’ argument isn’t an instance of lx.object.Item.
baseName
Getter:Item’s base name.
Returns:item’s base name before disambiguation.
Return type:basestring
channel(channelName)[source]

Returns a channel object for the channel name provided.

Parameters:channelName (basestring) – name of the channel.
Returns:a channel object for the specified channel
Return type:modo.channel.Channel.
Raises LookupError:
 if the channel can not be found
channelNames
Getter:Returns a list of all the names of the channels belonging to an object.
Returns:list of channel names.
Return type:list
channels(name=None)[source]

Returns a generator object for iterating all channels of this item

Returns generator object:
 iterable of channel objects
childAtIndex(index)[source]

Returns the child item at the specified index.

Parameters:index (int) – the child’s index.
Returns:the child item at the specified index.
Return type:an instance of one of the defined modo.Item subtypes or an modo.Item
childCount()[source]

returns the number of children an item has.

Returns:the number of child items the item has.
Return type:int
children(recursive=False, itemType=None)[source]

Returns a list of the child items of this item. Each type of each of the returned child items will be one of the item types supported by the modo.util.typeToFunc() method if possible, or an object of type lx.item.Item otherwise.

Parameters:
  • recursive (bool) – Returns all childen’s children if True.
  • itemType (basestring) – Filter to return only specific item types. Can either be string or int
Returns:

the children of the item.

Return type:

list

childrenByType(itype)[source]

Returns all the children of an item that are of the specified type.

Parameters:itype (int or basestring) – the type of the children to return
Returns:list of all the children of the specified type.
Return type:list
connectedGroups
Getter:Returns a tuple of all Group objects that this item belongs to
Return type:tuple
deformers
Getter:Returns input connections of the ‘deformers’ graph
Parameters:dtype (basestring) – Optionally filter the result by this type.
Returns tuple:Deformer items
deselect()[source]

Deselects this item

getTags(values=True)[source]

Get the string tags attached to an item.

if ‘values’ is True (default) a dictionary of tag name/tag value pairs is returned, if ‘values’ is False a list of tag names is returned instead.

Returns:the string tags attached to the item.
Return type:dictionary or list.
hasTag(tagName)[source]

Returns whether the tag with the specified name exists or not.

Parameters:tagName (basestring) – the four character tag ID
Returns:True if the specified tag exists on the group, False if not.
Return type:bool
id
Getter:Item’s unique ID (Ident)
Returns:ID
Return type:basestring
index
Getter:Index of the item in the collection of items of the same type in the scene.
Returns:Returns item index by type.
Return type:int
internalItem
Getter:Returns the internal Modo item embedded in this object
isAnInstance
Getter:Returns True if item is an instance of another item, False otherwise.
Return type:bool
isLocatorSuperType()[source]
Returns bool:whether this item derives from the locator type.
itemGraph(graphType='deformers', reverse=True)[source]

Retrieve ItemGraph by name

Returns ItemGraph:
 
itemGraphNames
Getter:Get connected ItemGraph names
Returns list of strings:
 List of connected graph types
Type:list
itemGraphs
Getter:Returns list of connected ItemGraphs
Return type:list
iterChannels(name=None)[source]

Returns a generator object for iterating all channels of this item

Returns generator object:
 iterable of channel objects
name
Getter:Item’s name.
Returns:Item’s unique (disambiguated) name
Return type:string
Parameters:name – Item’s base name - before disambiguation.
Type:basestring
packageNames()[source]
Returns list:Package names that are attached to this item
parent
Getter:Item parent

When setting accepts either an item object (modo.Item or lx.object.Item) or a string (item ID or name).

Returns:parent item or None if the item has no parent
Return type:modo.item.Item
Parameters:parent (basestring, modo.Item or lx.object.Item) – item to parent to
Raises LookupError:
 if the argument was a string and no item with that name or id can be found.
parentIndex
Getter:Returns the index of this item from from the perspective of it’s parent

This correlates to the order items appear in the UI, i.e. the item view and Shader Tree

Returns int:Index
parents
Getter:Returns list of all ancestor parents
Return type:tuple
readTag(tagName)[source]

Get the value of a string tag attached to the item.

Parameters:tagName (basestring) – the four character tag ID.
Returns:the value of the specified tag.
Return type:string
select(replace=False)[source]

Selects this item

Parameters:replace (bool) – If True, the selection is cleared before selecting this item
selected
Getter:Returns True if this item is selected, False otherwise
Type:bool
setParent(newParent=None, index=None)[source]

Parents this item to another

Parameters:
  • newParent (modo.item.Item) – Item to parent to. If None, the item is parented to root level.
  • index (int) – Optionally sets the position the item appears in the item view for locatorSuperType items

Note that this method does not preserve world transformations as in parenting in place. Please use the command ‘item.parent’ instead

setTag(tagName, tagval)[source]

Create or set a string tag on to the item.

Parameters:
  • tagName (basestring) – the four character tagID.
  • tagval (basestring) – The string value to be stored under the tag. Pass None to remove the tag.
superType
Getter:Returns the parent type of the item as a string.
Returns:the type of the item.
Return type:basestring
type
Getter:Returns the type of the item as a string.
Returns:the type of the item.
Return type:basestring

ActionClip

class modo.item.ActionClip(clip)[source]

Bases: modo.item.Item

Action Clip and Render pass item.

Parameters:item (an instance of modo.item.Item) – either an item of type ‘actionclip’ or an item name/ID to lookup.
active

Set or get the active state of the render pass.

Getter:Returns the active state of the render pass.
Return type:bool
Setter:Sets the active state of the renter pass
Parameters:state (bool) – active state.
enabled

Get or set the enabled state of the render pass.

Getter:Returns the enabled state.
Return type:bool
Setter:Sets the enabled state of the render pass
Parameters:state (bool) – enabled state.
getValue(chan, time=0.0)[source]

Read a value set on a channel for this render pass.

Parameters:
  • chan (modo.channel.Channel object) – the channel to read the value from.
  • time (float) – the time (in seconds) to read the value for, defaults to 0.0.
name

Name of the render pass.

Getter:Returns the name of the render pass
Return type:basestring
Setter:Assigns a new name to the render pass
Parameters:name (basestring) – new name for the render pass.
passGroup

The render pass group that the render pass belongs to.

Getter:Returns the render pass group
Return type:modo.item.RenderPassGroup
Setter:Sets the render pass group
Parameters:group (modo.item.RenderPassGroup) – render pass group to parent to.
setValue(chan, value, time=0.0, key=False)[source]

Set a value on a channel for this render pass.

Parameters:
  • chan (modo.channel.Channel object) – the channel to set the value on.
  • value (any) – the value to set for the channel.
  • time (float) – the time (in seconds) to set the value for, defaults to 0.0.
  • key – whether to set a key for the value or not, defaults to False.
  • key – bool

Actor

class modo.item.Actor(groupItem=None, gtype='')[source]

Bases: modo.item.Group

Wrapper class for actor groups.

actions
Getter:Returns a list of ActionClip objects for this Actor
Return type:list
addAction(name=None)[source]

Adds an action to this actor

Note: please avoid naming actions ‘setup’, ‘edit’ or ‘scene’

Returns ActionClip:
 ActionClip
Parameters:name (basestring) – Optional name for the action
addPose(name=None, activate=True)[source]

Adds a pose to this actor

Returns ActionClip:
 ActionClip
Parameters:name (basestring) – Optional name for the pose
currentAction
Getter:Returns the currently active action if any. None if no action is active
Return type:ActionClip
items
Getter:Returns a list of LocatorSuperType items that are connected to this action.
Return type:list
pose(poseName)[source]

Return a pose by name

Parameters:poseName (basestring) – Name of the pose to look up
Returns:Pose
poses
Getter:Returns a list of ActionClip objects for this Actor
Return type:list

Locator SuperType

class modo.item.LocatorSuperType(item=None)[source]

Bases: modo.item.Item

The LocatorSuperType reflects all items that can be seen and transformed in the 3d view. Locators have transform items that hold the respective transform channels, such as position and rotation.

pivot
Getter:Returns a position TransformItem object. An appropriate channel is created if it does not exist.
Return type:TransformItem
position
Getter:Returns a position TransformItem object. An appropriate channel is created if it does not exist.
Return type:TransformItem
rotation
Getter:Returns a rotation TransformItem object. An appropriate channel is created if it does not exist.
Return type:TransformItem
scale
Getter:Returns a scale TransformItem object. An appropriate channel is created if it does not exist.
Return type:TransformItem
transforms
Getter:Access to the stacked transform items.
Return type:TransformItems

Camera

class modo.item.Camera(camera=None)[source]

Bases: modo.item.LocatorSuperType

Camera item class.

Takes an optional ‘camera’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘camera’ or an item name or ID to look up. If no camera item is supplied as an argument an attempt will be made to wrap the most recently selected camera.

Parameters:

camera (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional camera item object (type lx.symbol.sITYPE_CAMERA) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid camera item selected.
  • TypeError – if the item passed as an argument isn’t either an instance of lx.object.Item of type ‘camera’ or an item name or ID string.
  • LookupError – if a name or ID is supplied as the camera argument but no item with that name/ID can be found.

Mesh

class modo.item.Mesh(mesh=None)[source]

Bases: modo.item.LocatorSuperType

Mesh item class.

Takes an optional ‘mesh’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘mesh’ or an item name or ID to look up. If no mesh item is supplied as an argument an attempt will be made to wrap the most recently selected mesh layer.

Parameters:

mesh (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional mesh item object (type lx.symbol.sITYPE_MESH) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid mesh item selected.
  • TypeError – if the item passed as an argument isn’t either an instance of lx.object.Item of type ‘mesh’ or an item name or ID string.
  • LookupError – if a name or ID is supplied as the mesh argument but no item with that name/ID can be found.

The mesh geometry can be accessed by the geometry attribute.

geometry
Return type:MeshGeometry

Locator

class modo.item.Locator(locator=None)[source]

Bases: modo.item.LocatorSuperType

Locator item class.

Takes an optional ‘locator’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘locator’ or an item name or ID to look up. If no locator item is supplied as an argument an attempt will be made to wrap the most recently selected locator item.

Parameters:

locator (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional locator item object (type lx.symbol.sITYPE_LOCATOR) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid locator item selected.
  • TypeError – if the item passed as an argument isn’t either an instance of lx.object.Item of type ‘locator’ or an item name or ID string.
  • LookupError – if a name or ID is supplied as the locator argument but no item with that name/ID can be found.

Hint: Items of other locator derived types should be casted as LocatorSuperType, casting to this class will fail.


Group Locator

class modo.item.GroupLocator(grploc=None)[source]

Bases: modo.item.LocatorSuperType

Group locator item class.

Takes an optional ‘grploc’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Group locator’ or an item name or ID to look up. If no grploc item is supplied as an argument an attempt will be made to wrap the most recently selected group locator item.

Parameters:

grploc (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional group locator item object (type lx.symbol.sITYPE_GROUPLOCATOR) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid group locator item selected.
  • TypeError – if the item passed as an argument isn’t either an instance of lx.object.Item of type ‘group locator’ or an item name or ID string.
  • LookupError – if a name or ID is supplied as the grploc argument but no item with that name/ID can be found.

Transform Items

class modo.item.TransformItems(item)[source]

Bases: modo.item.LocatorSuperType

Container class for the stacked transform items of a Locator object.

Transform items contain channels for either position, rotation or scale. The order of how they are processed can be changed and new transform items can be inserted or existing ones deleted.

example:

scene = modo.scene.current()

# Grab first selected object
for item in scene.selected[:1]:

    # Print the amount of transform items
    print len(item.transforms)

    # Add a new position transform item
    position = item.transforms.insert('position', values=(1,0,0), name='New_Position')

    # Add a new scale transform item
    scale = item.transforms.insert('scale', values=(2,2,2), name='Scaled')

    # Swap the indices of the first two transform items
    item.transforms.reposition(0,1)

    # Delete
    item.transforms.delete(scale)

    # Clear values of all transforms
    for i in item.transforms:
        i.clear()
insert(xfrmType='position', placement='append', values=None, name=None)[source]

Insert a new transform item into the transform chain.

The ‘prepend’ and ‘append’ placement values place the new item at the top or bottom of the stack, where ‘pre’ and ‘post’ place it around the respective transform highlighted in black in the channel view.

I am myself confused about the order though, is it bottom to top or the other way around?

Note that modo always keeps at least one of each type of transform, so when you attempt to delete it a new one is created automatically.

Parameters:
  • xfrmType (string) – ‘position’, ‘rotation’ or ‘scale’
  • placement (string) – ‘prepend’, ‘append’, ‘pre’ or ‘post’
  • values (tuple) – Initial xyz values to be optionally set
  • name (string) – Optional name
reposition(indexFrom, indexTo)[source]

Places a transform item to the provided index of the transform item stack

Parameters:
  • indexFrom (int) – Source Index of the item that is to be moved
  • indexTo (int) – Destination index to place item at

Transform Item

class modo.item.TransformItem(item=None)[source]

Bases: modo.item.Item

Contains a group of animatable transform channels of a locator object.

It has convenience functions for access of the locator’s position, rotation and scale.

examples:

# We retrieve two meshes from the current scene by name, assuming they exist
cube = modo.Mesh('Cube')
sphere = modo.Mesh('Sphere')

# Set rotation values
cube.rotation.set(10, 20, 30, degrees=True)

# Link the position.x channel of the sphere to to the position.x channel of the cube
cube.position.y.setLink(0, sphere.position.x, 0)

# Set position values to zero
cube.position.clear()

# Insert keyframe for rotation on frame 21
frame = lx.service.Value().FrameToTime(21)
cube.rotation.insertKey(time=frame)
clear(*args, **kwargs)[source]

Sets values to 1.0 if is a scaling transform and to 0.0 otherwise

Parameters:arguments – Same as Channel.set
get(time=None, action=None, degrees=False)[source]

Function to get the x, y and z-values of the locator at once.

Parameters:
  • degrees (bool) – If set, values are interpreted as degrees instead of radians. Only relevant when getting rotation.
  • keywords – Same as as Channel.get
Returns tuple:

x, y and z values

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

Inserts a keyframe on the respective x, y and z channels.

Parameters:
  • time (float) – Time in seconds to create the new keys
  • action – Action to create keys in.
removeKey(time=None, action=None)[source]
set(values, time=None, key=False, action='edit', degrees=False)[source]

Function to set the x, y and z-values of the locator at once.

Parameters:
  • values – either three floats, or a list/tuple containing the x, y, z values to set
  • degrees (bool) – If set, values are interpreted as degrees instead of radians. Only relevant when setting rotation.
  • keywords – Same as as Channel.set
x

Shortcut to the x channel of the locator

Getter:Channel
Return type:float
y

Shortcut to the y channel of the locator

Getter:Channel
Return type:float
z

Shortcut to the z channel of the locator

Getter:Channel
Return type:float

TextureLocator

class modo.item.TextureLocator(texloc=None)[source]

Bases: modo.item.LocatorSuperType

Texture locator item class.

Takes an optional ‘texloc’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Texture locator’ or an item name or ID to look up. If no texloc item is supplied as an argument an attempt will be made to wrap the most recently selected group locator item.

Parameters:

texloc (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional texture locator item object (type lx.symbol.sITYPE_TEXTURELOC) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid texture locator item selected.
  • TypeError – if the item passed as an argument isn’t either an instance of lx.object.Item of type ‘texture locator’ or an item name or ID string.
  • LookupError – if a name or ID is supplied as the texloc argument but no item with that name/ID can be found.

Light

class modo.item.Light(light)[source]

Bases: modo.item.LocatorSuperType

Base Light item class.

Each light item encapsulates both an lx.object.Item object (via inheritance from the Item class) of a specific modo light type and a corresponding lx.object.Item of type ‘lightMaterial’ as a LightMaterial object via the light’s material property.

example:

# to set the diffuse color on the currently selected spotlight
spotlight = modo.SpotLight()
spotlight.material.ch_diffCol.set((0.7, 0.1, 0.5))

Note

Although “Light” isn’t technically a base class since, like all other classes in modo.item, it inherits from “Item”, it does encapsulate modo’s ‘Light” supertype and can be treated as a kind of ‘pseudo’ base class for all modo’s light types. As such it should not be instantiated directly, create one of the specific light types instead.


Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional light item object to wrap. Must be a specific type of light, not the light supertype.

Raises:
  • ValueError – if no valid light item selected.
  • TypeError – if the item passed as an argument isn’t an instance of a specific subclass of Light.
material

The light material item associated with this light

Getter:the base light material (ie the light material at the bottom of the stack if there are more than one) for the light item.
Return type:modo.item.LightMaterial
Setter:Parents a material to the light
Parameters:material (modo.item.LightMaterial) – a material item to parent to the light

Area Light
class modo.item.AreaLight(light=None)[source]

Bases: modo.item.Light

Area light item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Area Light’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Area Light item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional area light item object (type lx.symbol.sITYPE_AREALIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid area light item selected.
  • TypeError – if the item passed as an argument isn’t either an area light item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Cylinder Light
class modo.item.CylinderLight(light=None)[source]

Bases: modo.item.Light

Cylinder light item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Cylinder Light’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Cylinder Light item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Cylinder light item object (type lx.symbol.sITYPE_CYLINDERLIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid cylinder light item selected.
  • TypeError – if the item passed as an argument isn’t either a cylinder light or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Directional Light
class modo.item.DirectionalLight(light=None)[source]

Bases: modo.item.Light

Directional light item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Directional Light’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Directional Light item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Directional light item object (type lx.symbol.sITYPE_SUNLIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid directional light item selected.
  • TypeError – if the item passed as an argument isn’t either a Directional light item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Dome Light
class modo.item.DomeLight(light=None)[source]

Bases: modo.item.Light

Dome light item class

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Dome Light’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Dome Light item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Dome light item object (type lx.symbol.sITYPE_DOMELIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid Dome light item selected.
  • TypeError – if the item passed as an argument isn’t either a Dome light item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Photometric Light
class modo.item.PhotometricLight(light=None)[source]

Bases: modo.item.Light

Photometric (ies) light item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Photometric Light’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Photometric Light item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Photometric light item object (type lx.symbol.sITYPE_PHOTOMETRYLIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid Photometric light item selected.
  • TypeError – if the item passed as an argument isn’t either a Photometric light item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Point Light
class modo.item.PointLight(light=None)[source]

Bases: modo.item.Light

Point light item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Point Light’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Point Light item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Point light item object (type lx.symbol.sITYPE_POINTLIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid Point light item selected.
  • TypeError – if the item passed as an argument isn’t either a Point light item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Portal
class modo.item.Portal(light=None)[source]

Bases: modo.item.Light

Portal item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Portal’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Portal item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Portal item object (type ‘portal’) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid Portal item selected.
  • TypeError – if the item passed as an argument isn’t either a Portal item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

SpotLight
class modo.item.SpotLight(light=None)[source]

Bases: modo.item.Light

Spotlight item class.

Takes an optional ‘light’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Spotlight’ or an item name or ID to look up. If no light item is supplied as an argument an attempt will be made to wrap the most recently selected Spotlight item.

Parameters:

light (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – Optional Spotlight item object (type lx.symbol.sITYPE_SPOTLIGHT) or string (item name or ID) to look up.

Raises:
  • ValueError – if no valid Spotlight item selected.
  • TypeError – if the item passed as an argument isn’t either a Spotlight item or an item name or ID string.
  • LookupError – if a name or ID is supplied as the light argument but no item with that name/ID can be found.

Group

class modo.item.Group(groupItem=None, gtype='')[source]

Bases: modo.item.Item

A group item.

Takes an optional ‘groupItem’ argument which can be either an item object (lx.object.Item or lxu.object.Item) of type ‘Group’ or an item name or ID to look up. If no groupItem is supplied as an argument an attempt will be made to wrap the most recently selected Area Light item.

NOTE: The ‘gtype’ argument is now deprecated and unused.

Parameters:

groupItem (an instance of lx.object.Item, lxu.object.item or modo.item.Item) – an optional group item (type lx.symbol.sITYPE_GROUP) or an item name/ID to look up.

Raises:
  • TypeError – if an item is supplied as the groupItem argument but is not of type lx.symbol.sITYPE_GROUP.
  • ValueError – if no groupItem argument is supplied and no valid group item is selected in the scene.
  • LookupError – if a name or ID is supplied as the groupItem argument but no item with that name/ID can be found.

Note that the children() method derived from the Item object will only list child groups. To iterate the contained items, use the method items.

addChannel(chan, item=None)[source]

Add a channel to the group. The supplied channel argument be a modo.channel.Channel() object, in which case no item argument is required or a channel name (string) or index (int), both of which require an additional ‘item’ argument.

Parameters:
  • channel (modo.channel.Channel() object, int or basestring) – the channel to add.
  • item (modo.item.Item) – the item to which the channel belongs. Not required if a Channel() object is provided as the first argument.
addItems(items)[source]

Add one or more items to the group if they’re not already members.

Parameters:items (modo.item.Item or list of modo.item.Item objects) – the item or items to add
getItemAt(index)[source]

Gets the item at the specified index.

Returns:item at the specified index.
Return type:modo.item.Item
Parameters:index (int) – index of the item in the group’s list of items.
getItemIndex(item)[source]

Index of the item within the groups list of items.

Returns:item index in the group.
Return type:int
groupChannelCount

The number of channels in the group.

Getter:Returns the number of channels in the group.
Return type:int
groupChannels

returns a list of all the channels in the group. Each element of the list will be an modo.channel.Channel

Getter:Returns a list of channels.
Return type:list of modo.channel.Channel items
groupGetChannelAt(index)[source]

Gets the channel at the specified index.

Returns:the channel at the specified index.
Return type:modo.channel.Channel
Parameters:index (int) – index of the channel in the group’s list of channels.
groupRemoveChannelAt(index)[source]

Removes the channel at the specified index from the group’s list of channels.

Parameters:index (int) – index of the channel in the group’s list of channels.
hasChannel(chan, item=None)[source]

Check to see if the specified channel is a member of the group. The supplied channel argument be a modo.channel.Channel object, in which case no item argument is required, a channel name (string) or index (int), both of which require an additional ‘item’ argument.

Parameters:
  • chan (modo.channel.Channel, int or basestring) – the channel to check
  • item (modo.item.Item) – the item to which the channel belongs. Not required if a Channel() object is provided as the first argument.
Returns:

True if the channel is in the group, False if not.

Return type:

bool

hasItem(item)[source]
Parameters:item
Returns:True if the item is in the group, False if not.
Return type:bool
itemCount

The number of items in the group

Getter:Returns the number of items
Return type:int
items

Get a list of the items in the group.

Returns:the items in the group.
Return type:list
removeChannel(chan, item)[source]

Remove a channel from the group. The supplied channel argument can either be a channel name (string) or index (int).

Parameters:
  • item (modo.item.Item) – the item to which the channel belongs.
  • channel (int or basestring) – the channel to remove.
removeItemAt(index)[source]

Removes the item at the specified index from the group’s list of items.

Parameters:index (int) – index of the item in the group’s list of items.
removeItems(items)[source]

Remove one or more items from the group, if they exis.

Parameters:items (modo.item.Item or list of modo.item.Item objects) – the item or items to remove.
setItemIndex(item, index)[source]

Set’s the index for the specified item in the list of items within the group.

Parameters:
  • item (modo.item.Item) – the item to move
  • index (int) – the index in the list of items belonging to the group to move the item to.
Raises ValueError:
 

if index is less than zero.

type

Get or set the group type. If the group is a general group it has no type so returns None.

Getter:Returns the type of the group.
Return type:basestring or empty string
Raises ValueError:
 if the supplied argument isn’t one of the default group type strings.
Setter:Sets the group type
Parameters:gtype (basestring) – either one of the available group types - ‘assembly’, ‘actor’, ‘render’, ‘keyset’, ‘chanset’, ‘preset’, ‘shader’ to define the group as one of the built in types or any other string to define the group as a custom type of your own.

RenderPassGroup
class modo.item.RenderPassGroup(groupItem)[source]

Bases: modo.item.Group

Render pass group

Parameters:

groupItem (lx.object.item or modo.item.Item) – either a group item or an item name/ID to look up.

Raises:
  • TypeError – if the item is not a ‘Group” item.
  • LookupError – if a name or ID is supplied as the groupItem argument but no item with that name/ID can be found.
addPass(name=None)[source]

Add a render pass item to the group.

Parameters:name (basestring) – optional name for the render pass
Returns:the render pass item.
Return type:modo.item.ActionClip
passes
Getter:Returns a lst of render passes in the group.
Returns:list of render pass items
Return type:list of modo.item.ActionClip

LightMaterial

class modo.item.LightMaterial(material)[source]

Bases: modo.item.Item

Wraps a light material texture layer item.

Parameters:material (lx.object.Item of type lx.symbol.sITYPE_LIGHTMATERIAL) – the light material item to be wrapped.
light
Getter:The light item that the material belongs to.
Parameters:light_item (an instance of one of the modo.Light types or either lx.object.Item or lxu.object.Item of a specific light item type) – the light item to parent the material layer to.
Returns:the parent light item.
Return type:one of the modo light types.
lightCol

A wrapper property for the light material item’s three diffuse color channels. Returns an modo.channel.Channel object

Getter:Returns a channelTriple object.
Return type:modo.channel.channelTriple
scatteringCol
Getter:A wrapper property for the light material item’s three scattering color channels. Returns an

modo.channel.Channel object

Returns:a channelTriple object.
Return type:modo.channel.channelTriple
shadCol
Getter:A wrapper property for the light material item’s three shadow color channels. Returns an

modo.channel.Channel object

Returns:a channelTriple object.
Return type:modo.channel.channelTriple

ItemGraph

class modo.item.ItemGraph(item=None, graphType='parent', reverse=True)[source]

Utility container class for quick access to ItemGraph compatible graphs

Parameters:
  • item – Item to look up graph for
  • graphType (ls.symbol.sGRAPH_*) – Graph to look up. Common ones are ‘parent’, ‘deformers’, ‘groups’, ‘chanMods’
  • reverse (bool) – Indices traverse the graph forwards if false or reverse if true
connectInput(other)[source]

Connects the given item as input.

This function is called by the >> operator.

Parameters:other (Item) – Can be any type derived from Item
connectedItems
Getter:Returns a dictionary that lists the input- and output items at once.
Return type:dictionary
disconnectInput(other)[source]

Removes the given item from the input connections if any.

This function is called by the << operator.

Parameters:other (Item) – Can be any type derived from Item
forward(index=None)[source]
Returns list:Items of the forward connections
item
Getter:Returns the Item that this ItemGraph instance is bound to.
Return type:Item
reverse(index=None)[source]
Returns list:Items of the reverse connections
setReverse(reverse)[source]

Sets the direction that is used for lookup when using the angular brackets []

Parameters:reverse (bool) – If True the graph is looked up forwards, if False, backwards.
type
Getter:Returns the name of the graph type that this instance represents.
Return type:basestring

Deformer

class modo.item.Deformer(item)[source]

Bases: modo.item.Item

meshes
Getter:Returns a list of connected meshes
numMeshes
Getter:Returns the number of meshes connected to this deformer

class modo.item.GeneralInfluenceDeformer(item)[source]

Bases: modo.item.Deformer

mapName
Getter:Returns the UI version of the map name as string

DeformerGroup

class modo.item.DeformerGroup(item)[source]

Bases: modo.item.Item

connectInput(other)[source]

Connects an influence deformer into this deformGroup

Parameters:other