Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Last active September 5, 2017 15:03
Show Gist options
  • Select an option

  • Save SEVEZ/8b4f2391ce83c9973d590c281c5ab89c to your computer and use it in GitHub Desktop.

Select an option

Save SEVEZ/8b4f2391ce83c9973d590c281c5ab89c to your computer and use it in GitHub Desktop.
Copy polymesh shape to locator #misc
import maya.OpenMaya as OpenMaya
import maya.cmds as cmds
cmds.polySphere()
cmds.spaceLocator()[0]
selection_list = OpenMaya.MSelectionList()
selection_list.add('pSphereShape1')
shape = OpenMaya.MObject()
selection_list.getDependNode(0, shape)
selection_list = OpenMaya.MSelectionList()
selection_list.add('locator1')
transform = OpenMaya.MObject()
selection_list.getDependNode(0, transform)
mesh_fn = OpenMaya.MFnMesh()
mesh_fn.copy(shape, transform)
@SEVEZ
Copy link
Author

SEVEZ commented May 19, 2016

image

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