Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Description: Script well let you place a bone or locator at the average location of the two selected verticies
- '''
- #!user/bin/env python
- import maya.cmds as cmds
- def averagePos(bone=0, loc=0):
- #store the vert selection
- vertSel = cmds.ls(sl=True)
- #Raise an error if nothing is selected
- if not vertSel:
- raise RuntimeError('No verticies were selected')
- clustSet = cmds.cluster(n='Dummy_Cluster')
- if clustSet:
- if bone:
- clear = cmds.select(clear=True)
- mkjnt = cmds.joint(p=(0,0,0))
- position = cmds.delete(cmds.pointConstraint('Dummy_Cluster', mkjnt, w=1)
- cmds.delete(clustSet)
- if loc:
- clear = cmds.select(clear=True)
- mkloc = cmds.spaceLocator(p=(0,0,0), n='Dummy_Position_LOC_')
- position = cmds.delete(cmds.pointConstraint('Dummy_Cluster', mkjnt, w=1)
- cmds.delete(clustSet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement