Skip to content

Instantly share code, notes, and snippets.

@splinecraft
Created July 29, 2017 21:32
Show Gist options
  • Save splinecraft/0215762f041b313bc2883615301115c6 to your computer and use it in GitHub Desktop.
Save splinecraft/0215762f041b313bc2883615301115c6 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')
if constraint:
constraint = constraint[0]
src = mc.listConnections(constraint+'.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