Esempio n. 1
0
def rename_connectedSkinClusters():
	args = pm.ls(sl=True)
	for arg in args:
		if arg.getShape():
			if arg.getShape().listConnections(type='skinCluster'):
				skinCluster = arg.getShape().listConnections(type='skinCluster')[0]
				if skinCluster:
					suffix = name.detectSuffix(arg)[0]
					if suffix:
						skinCluster.rename(arg.name().replace(suffix,'SKNCLSTR'))
					else:
						skinCluster.rename(arg.name()+'_SKNCLSTR')
Esempio n. 2
0
def rename_connectedSkinClusters(transforms, suffix='SKNCLSTR'):
    """ Renames skinClusters on transforms with the suffix.
    Args:
        transforms [pm.nt.Transform]: input list of transforms
        suffix (str): skin cluster suffix to use
    Returns [pm.nt.SkinCluster]: modified skin clusters
    """
    scs = []
    for transform in transforms:
        if transform.getShape():
            connected_skinClusters = transform.getShape().listConnections(type='skinCluster')
            skinCluster = connected_skinClusters[0] if connected_skinClusters else None
            if skinCluster:
                # TODO: remove name module dependency?
                suffix_detect = name.detectSuffix(transform)[0] or ''
                if suffix_detect:
                    skinCluster.rename(transform.name().replace(suffix_detect,suffix))
                else:
                    skinCluster.rename(transform.name()+suffix)
                scs.append(skinCluster)
    return scs