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
- class avrPos:
- def __init__(self):
- #Creat the window, but first check to see if its created, if so, then delete it first
- if cmds.window('OG_PosPlace_v1.0', q=True, exists=True):
- cmds.deleteUI('OG_PosPlace_v1.0', window=True)
- posGUI = cmds.window( title='OG_Pos_Place_v1.0', iconName='OG_POS', w=170, h=170, s=False)
- if cmds.windowPref( posGUI, exists=True):
- cmds.windowPref( posGUI, remove=True)
- posTypeForm = cmds.formLayout(numberOfDivisions=100)
- self.text1 = cmds.text( label='Select the verticies you want to position your utility!')
- pushButton = cmds.button( label="Place Joint", w=50, h=50)
- moveButtons = cmds.formLayout( posGUI, edit=True, attachForm=[(pushButton, 'bottom', 10), (pushButton, 'left', 45)])
- cmds.showWindow( posGUI )
- def averagePos(self,bone=0, loc=0):
- #store the vert selection
- vertSel = cmds.filterExpand( ex=True, sm=31)
- #Raise an error if nothing is selected
- if not vertSel:
- raise RuntimeError('No verticies were selected')
- clustSet = cmds.cluster(n='Dummy_Cluster')
- cmds.select(clear=True)
- if clustSet:
- if bone:
- mkobj = cmds.joint(p=(0,0,0))
- if loc:
- mkobj = cmds.spaceLocator(p=(0,0,0), n='Dummy_Position_LOC_')
- position = cmds.delete(cmds.pointConstraint(mkobj, mkjnt, w=1))
- cmds.delete(clustSet)
- if __name__=='__main__':
- arvPos()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement