Last active
December 17, 2015 08:59
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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