Created
August 26, 2011 02:15
-
-
Save danvas/1172536 to your computer and use it in GitHub Desktop.
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 pymel.core as pm | |
def chDir(object, *filtr): | |
"""Check methods: Returns a list of methods bound to the instanced object. Filter search with string(s) filtr.""" | |
if not filtr: | |
return [meth for meth in dir(object)] | |
else: | |
return [meth for string in filtr for meth in dir(object) if string in meth] | |
def lightLinks(breakLink = True): | |
"""Make or break links of selected lights to selected meshes.""" | |
lights = [o for o in pm.ls(sl=1) if 'Light' in pm.nodeType(o.getShape())] | |
meshes = [o for o in pm.ls(sl=1) if 'mesh' in pm.nodeType(o.getShape())] | |
if len(lights) == 0: | |
print("// At least one light must be selected") | |
if len(meshes) == 0: | |
print("// At least one mesh must be selected") | |
pm.lightlink(b = breakLink, light = lights, object = meshes) | |
if breakLink: | |
for l in lights: | |
print('// {0} has been unlinked to:'.format(str(l))) | |
for m in meshes: | |
print('//\t'+str(m)) | |
print('\n') | |
else: | |
for l in lights: | |
print('// {0} has been linked to:'.format(str(l))) | |
for m in meshes: | |
print('//\t'+ str(m)) | |
print('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment