Skip to content

Instantly share code, notes, and snippets.

@fereria
Created May 12, 2016 07:29
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 fereria/8d52798b3e69ea8b71511cbe363de41b to your computer and use it in GitHub Desktop.
Save fereria/8d52798b3e69ea8b71511cbe363de41b to your computer and use it in GitHub Desktop.
import maya.cmds as mc
selection = mc.ls(sl=1)
toSelect = []
for item in selection:
constraint = mc.listConnections( item+'.parentInverseMatrix[0]', d=1, s=0,type='constraint')
for i in constraint:
src = mc.listConnections(i+'.target[0].targetParentMatrix', d=0, s=1)
if src:
toSelect.extend(src)
try:
mc.select(toSelect)
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment