Skip to content

Instantly share code, notes, and snippets.

@mattcox
Last active December 17, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcox/5584024 to your computer and use it in GitHub Desktop.
Save mattcox/5584024 to your computer and use it in GitHub Desktop.
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