Created
March 22, 2018 18:51
-
-
Save marvolo3d/59a6134dce6922467e6af141cd34a140 to your computer and use it in GitHub Desktop.
transfer uvs to skinned mesh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
sourceMesh, skinnedMesh = pm.ls(sl=1, tr=1) | |
origShape = [x for x in skinnedMesh.listRelatives(s=1) if x not in skinnedMesh.listRelatives(s=1, ni=1)] | |
if len(origShape) == 0: | |
pm.displayError("found no orig shape for skinned mesh") | |
elif len(origShape) > 1: | |
pm.displayError("found more than one orig shape for skinned mesh") | |
else: | |
origShape = origShape[0] | |
hist = pm.listHistory(origShape, pdo=1) | |
if len(hist) != 0: | |
pm.displayError("orig shape has history. see script editor for more info") | |
print 'orig shape history includes:\n {}'.format(hist) | |
else: | |
origShape.intermediateObject.set(False) | |
pm.transferAttributes(sourceMesh, origShape, pos=0, nml=0, uvs=2, col=0, spa=4, sus='map1', tus='map1', sm=3, fuv=0, clb=1) | |
pm.delete(origShape, ch=1) | |
origShape.intermediateObject.set(True) | |
pm.displayInfo('succesfully transfered uv to skinned mesh') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment