import pymel.core from sgMaya import sgCmds sels = pymel.core.ls( sl=1 ) blendMesh = sels[0] resultMesh = pymel.core.duplicate( sels[0] )[0] detailSkinedMesh = pymel.core.duplicate( sels[0] )[0] sgCmds.autoCopyWeight( sels[0], resultMesh ) pymel.core.skinCluster( sels[0], e=1, ub=1 ) blendMesh.rename( 'facialBase_blendMesh' ) detailSkinedMesh.rename( 'facialBase_detailSkinedMesh' ) resultMesh.rename( 'face' ) bl = pymel.core.blendShape( blendMesh, detailSkinedMesh, resultMesh )[0] bl.w[0].set( 1 ) bl.w[1].set( 1 ) grp = pymel.core.group( em=1, n='facialBase' ) pymel.core.xform( grp, ws=1, matrix= blendMesh.wm.get() ) blendMesh.setParent( grp ) detailSkinedMesh.setParent( grp )
from sgMaya import sgCmds import pymel.core sels = pymel.core.ls( sl=1 ) srcMesh = sels[0] others = sels[1:] for other in others: children = other.listRelatives( c=1, ad=1, type='transform' ) children.append( other ) trs = [] for child in children: shape = child.getShape() if not shape: continue trs.append( child ) for tr in trs: sgCmds.autoCopyWeight( srcMesh, tr )
from sgMaya import sgCmds import pymel.core sels = pymel.core.ls( sl=1 ) srcMesh = sels[0] others = sels[1:] srcChildren = srcMesh.listRelatives( c=1, ad=1, type='transform' ) for other in others: children = other.listRelatives( c=1, ad=1, type='transform' ) for i in range( len( srcChildren ) ): if not sgCmds.getNodeFromHistory( srcChildren[i], 'skinCluster' ): continue sgCmds.autoCopyWeight( srcChildren[i], children[i] )
from sgMaya import sgCmds import pymel.core sels = pymel.core.ls(sl=1) srcMesh = sels[0] others = sels[1:] srcChildren = srcMesh.listRelatives(c=1, ad=1, type='transform') for other in others: children = other.listRelatives(c=1, ad=1, type='transform') for i in range(len(srcChildren)): if not sgCmds.getNodeFromHistory(srcChildren[i], 'skinCluster'): continue sgCmds.autoCopyWeight(srcChildren[i], children[i])
from sgMaya import sgCmds import pymel.core sels = pymel.core.ls(sl=1) srcMesh = sels[0] others = sels[1:] for other in others: children = other.listRelatives(c=1, ad=1, type='transform') children.append(other) trs = [] for child in children: shape = child.getShape() if not shape: continue trs.append(child) for tr in trs: sgCmds.autoCopyWeight(srcMesh, tr)
from sgMaya import sgCmds import pymel.core sels = pymel.core.ls( sl=1 ) firstGrp = sels[0] secondGrp = sels[1] firstChildren = firstGrp.listRelatives( c=1, ad=1, type='transform' ) secondChildren = secondGrp.listRelatives( c=1, ad=1, type='transform' ) for i in range( len( firstChildren ) ): if not firstChildren[i].getShape(): continue try:sgCmds.autoCopyWeight( firstChildren[i], secondChildren[i] ) except:pass
from sgMaya import sgCmds import pymel.core sels = pymel.core.ls(sl=1) firstGrp = sels[0] secondGrp = sels[1] firstChildren = firstGrp.listRelatives(c=1, ad=1, type='transform') secondChildren = secondGrp.listRelatives(c=1, ad=1, type='transform') for i in range(len(firstChildren)): if not firstChildren[i].getShape(): continue try: sgCmds.autoCopyWeight(firstChildren[i], secondChildren[i]) except: pass
import pymel.core from sgMaya import sgCmds sels = pymel.core.ls(sl=1) blendMesh = sels[0] resultMesh = pymel.core.duplicate(sels[0])[0] detailSkinedMesh = pymel.core.duplicate(sels[0])[0] sgCmds.autoCopyWeight(sels[0], resultMesh) pymel.core.skinCluster(sels[0], e=1, ub=1) blendMesh.rename('facialBase_blendMesh') detailSkinedMesh.rename('facialBase_detailSkinedMesh') resultMesh.rename('face') bl = pymel.core.blendShape(blendMesh, detailSkinedMesh, resultMesh)[0] bl.w[0].set(1) bl.w[1].set(1) grp = pymel.core.group(em=1, n='facialBase') pymel.core.xform(grp, ws=1, matrix=blendMesh.wm.get()) blendMesh.setParent(grp) detailSkinedMesh.setParent(grp)
import pymel.core from sgMaya import sgCmds sels = pymel.core.ls( sl=1 ) src = sels[0] dst = sels[1] srcChildren = pymel.core.listRelatives( src, c=1, ad=1, type='transform' ) dstChildren = pymel.core.listRelatives( dst, c=1, ad=1, type='transform' ) for i in range( len( srcChildren ) ): srcChild = srcChildren[i] dstChild = dstChildren[i] if not srcChild.getShape(): continue if not sgCmds.getNodeFromHistory( srcChild, 'skinCluster' ): continue sgCmds.autoCopyWeight( srcChild, dstChild )