Skip to content

Instantly share code, notes, and snippets.

@mattcox

mattcox/IsItAMask.py

Last active Dec 17, 2015
Embed
What would you like to do?
IsItAMask - Modo Python API example to show if the selected item is a texture layer mask or not.
import lx
import lxu.select
scn_svc = lx.service.Scene()
def IsItAMask(item):
if scn_svc.ItemTypeName(scn_svc.ItemTypeSuper(item.Type())) == lx.symbol.sITYPE_TEXTURELAYER:
scene = item.Context()
graph = lx.object.ItemGraph(scene.GraphLookup(lx.symbol.sGRAPH_SHADELOC))
if graph.RevCount(item) > 0:
return True
else:
return False
for item in lxu.select.ItemSelection().current():
if IsItAMask(item) == True:
lx.out("%s: It's a mask" % item.UniqueName())
else:
lx.out("%s: It's not a mask" % item.UniqueName())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment