Can't find skinCluster when in subselect isolation


#1

This one has left me completely stumped. I have a function I use in loads of my scripts that returns the name of the skinCluster from the selected geo. However, it doesn’t seem to work if I’m in subselect and isolation mode together. If I return the connected nodes, there isn’t a skinCluster returned. I’m at a loss for why this could be. I’ve tried troubleshooting on my own, but does anyone know of a reason that the output would be different?

def get_skin_cluster():
    #Get skin cluster from selected geo (split in case selection is subselect based)
    sel = cmds.ls(sl=1, l=1)[0].split('.')[0]
    sel_shape = cmds.listRelatives(sel, shapes=1, f=1)[0]
    return [i for i in cmds.listConnections(sel_shape) if cmds.nodeType(i) == 'skinCluster'][0]