Skip to content

Instantly share code, notes, and snippets.

@ivogrig
ivogrig / meshMaterials.py
Created July 24, 2015 11:31
Example of finding materials connected to a mesh. This should become redundant as there will be convenience functions added to the TD SDK soon.
# Example of finding materials connected to a mesh. This should become redundant as
# there will be convenience functions added to the TD SDK soon.
import modo
# This gets the selected mesh if any
mesh = modo.Mesh()
if mesh:
@ivogrig
ivogrig / CreateMeshPoints.py
Created July 15, 2015 10:14
Example of creating a mesh and adding a vertex using Modo's Python API
# Example of creating a mesh and adding a vertex using Modo's Python API
import lxu
# Get current scene
scene = lxu.select.SceneSelection().current()
# Create new mesh item
scene_service = lx.service.Scene()
mesh_type = scene_service.ItemTypeLookup(lx.symbol.sTYPE_MESH)
@ivogrig
ivogrig / SelectionSet.py
Created July 6, 2015 10:03
Modo Selection set
# There is no dedicated methods for the selection sets in the TD SDK as of yet.
# Currently you can only create pickMaps for vertices using the vmaps methods.
import modo
# Create a sphere
lx.eval('script.implicit "Unit Sphere Item"')
mesh = modo.Mesh('Sphere')
@ivogrig
ivogrig / cmdPrintWeights.py
Last active August 29, 2015 14:22
Modo Python API example for skin weight access
# Python API example for skin weight access
# Place this file into an lxserv folder
#
# Creates a command that takes the names of a mesh and a connected joint locator and inverts the weight values
#
# Example command usage:
# example.printJointWeights locator:"Skeleton_Joint (4)" mesh:MyCube
import lx
import lxu