Hi guys would appreciate some help
trying to write a script that connects the shapes of a referenced in shape under a transform to a similar shape that is already in the scene. Struggling with transforms that have more than one shape, the point is using the selected reference transform - striping the namesspace to identify the selected target and connecting the shapes of the referenced shape curves to the targets within the scene
S.
#print name of selection and split it from nameSpace to identify targetShape
import maya.cmds as mc
lSelection = cmds.ls(sl=True)
lShapes = mc.listRelatives(lSelection, s=True)
print lShapes
for obj in lShapes:
nameS = obj.split(':')[0]
print (nameS)
targetShapes = obj.split(':')[-1]
print (targetShapes)
cmds.connectAttr(lShapes + '.worldSpace', targetShapes + '.create' )