Created
May 3, 2016 20:20
-
-
Save SEVEZ/1eabd0891729980af93a14b519ab609e to your computer and use it in GitHub Desktop.
Duplicate only selected meshes without children, materials etc.
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 maya.cmds as mc | |
sel = mc.ls( sl=1 ) | |
def dupMeshOnly( obj ): | |
objShape = mc. listRelatives( obj, s=1 ) | |
par = mc.duplicate( objShape[0], po=1 ) | |
shape = mc.createNode( 'mesh', p=par[0] ) | |
mc.connectAttr( objShape[0] + '.outMesh', shape + '.inMesh', f=1 ) | |
mc.evalDeferred( 'import maya.cmds; maya.cmds.disconnectAttr( \'' + objShape[0] + '.outMesh\', \'' + shape + '.inMesh\' )' ) | |
return par[0] | |
for s in sel: | |
res = dupMeshOnly( s ) | |
mc.polyTransfer( res, uv=1, ao=s ) | |
print res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you it is awesome...