Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created August 16, 2015 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigRoy/3fdbb6df0c2b302a804b to your computer and use it in GitHub Desktop.
Save BigRoy/3fdbb6df0c2b302a804b to your computer and use it in GitHub Desktop.
import maya.cmds as mc
def offsets_to_input(mesh):
num_pts = mc.getAttr('{0}.pnts'.format(mesh), size=True)
for i in range(num_pts):
# Get the internal offset
offset = mc.getAttr('{0}.pnts[{1}]'.format(mesh, i))[0]
# Move the vertex position by the internal offset value (relative)
mc.move(offset[0], offset[1], offset[2], '{0}.vtx[{1}]'.format(mesh, i), relative=True)
# Reset the internal offset to zero
mc.setAttr('{0}.pnts[{1}]'.format(mesh, i), 0.0, 0.0, 0.0, type='float3')
for mesh in mc.ls(sl=1, dag=1, leaf=1, type='mesh'):
offsets_to_input(mesh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment