Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Created May 3, 2016 20:20
Show Gist options
  • Save SEVEZ/1eabd0891729980af93a14b519ab609e to your computer and use it in GitHub Desktop.
Save SEVEZ/1eabd0891729980af93a14b519ab609e to your computer and use it in GitHub Desktop.
Duplicate only selected meshes without children, materials etc.
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
@LasiGitHub
Copy link

thank you it is awesome...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment