Skip to content

Instantly share code, notes, and snippets.

@bohdon
Created October 30, 2013 20:43
Show Gist options
  • Save bohdon/7239897 to your computer and use it in GitHub Desktop.
Save bohdon/7239897 to your computer and use it in GitHub Desktop.
find unlinked lights
import pymel.core as pm
def getUnlinkedLights():
linker = pm.selected()[0]
lonely = []
for i in range(linker.link.numElements()):
ln = linker.link[i]
lights = ln.light.inputs()
objects = ln.object.inputs()
if len(lights) and not len(objects):
lonely.extend(lights)
return lonely
def getUnlinkedObjects():
linker = pm.selected()[0]
lonely = []
for i in range(linker.link.numElements()):
ln = linker.link[i]
lights = ln.light.inputs()
objects = ln.object.inputs()
if not len(lights) and len(objects):
lonely.extend(objects)
return lonely
pm.select(getUnlinkedLights())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment