Skip to content

Instantly share code, notes, and snippets.

@ivogrig
ivogrig / CmdSetTag.py
Last active May 7, 2016 07:22
Example command to read or write item tags
"""Example command to read or write item tags
Example usage:
item.editTag sunLight013 TAGN "Test"
item.editTag sunLight013 TAGN ?
import modo
item = modo.Item('Directional Light')
value = 'Test'
@ivogrig
ivogrig / pointInCamera.py
Last active June 18, 2016 01:47
Test is a given point is visible in the camera and Convert between 3d and screen coordinates
# Test is a given point is visible in the camera
# Convert between 3d and screen coordinates
import modo
# Assuming the camera is also the active view
def pointInCamera(cam, position):
aperture_x = cam.channel(lx.symbol.sICHAN_CAMERA_APERTUREX).get()
aperture_y = cam.channel(lx.symbol.sICHAN_CAMERA_APERTUREY).get()
@ivogrig
ivogrig / channelSets.py
Last active November 23, 2015 10:06
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)
@ivogrig
ivogrig / RemoveZeroRotation.py
Last active November 21, 2017 09:11
Example command for removing zero rotations from a locator item.
"""
Example command for removing zero rotations from a locator item.
Clears the zero rotation offset while maintaining the pose. Acts on all selected locator items.
Limitation: Only works if the rotation item's location is subsequent to the zero rotation item
(As by default when using the skeleton tool)
Existing animation curves are removed
Simplified example, no argument handling or command helps/configs added.