Skip to content

Instantly share code, notes, and snippets.

@ivogrig
Last active November 23, 2015 10:06
Show Gist options
  • Save ivogrig/99dd56b1f3465832549e to your computer and use it in GitHub Desktop.
Save ivogrig/99dd56b1f3465832549e to your computer and use it in GitHub Desktop.
Using channel sets in python
import modo
scene = modo.Scene()
# Add a channel set group and select it, so it will display
channelSet = scene.addGroup( name='MyChannelSet', gtype='chanset')
# Create locator and add some channel to the channel set
loc = scene.addItem(modo.c.LOCATOR_TYPE)
channelSet.addChannel( loc.position.x )
channelSet.addChannel( loc.position.y )
channelSet.addChannel( loc.channel('visible') )
# Just an example for removing a channel again
channelSet.removeChannel( loc.position.y, loc )
# The display of the channel group (meaning the floating window in the UI) is controlled via the 'currentGroups' graph
graph = channelSet.itemGraph('currentGroups')
# You should see the channel group appear in the 3D viewport, much like the channel haul
# Scene is currently missing a 'internalItem' method, so we are using the private attribute modo.Scene._item for now
graph.AddLink(scene._item, channelSet)
# This will hide the channel set:
# graph.DeleteLink(scene._item, channelSet)
# Note that there should always be only one or zero object connected via the 'currentGroups'
# You can also alternatively hide it with the command group.current {} chanset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment