1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
import maya.cmds as cmds import maya.mel as mel
WindowWinUi="TargetFollow"
def zarmWppsWinExe(*args): if cmds.window(WindowWinUi, exists = True): cmds.deleteUI(WindowWinUi)
def Doit(): stime = cmds.intField( 'startTimeField', q=1, v=1 ) etime = cmds.intField( 'endTimeField', q=1, v=1 ) + 1 time = stime sel = cmds.ls(sl = True) for i in range(stime,etime): cmds.currentTime(i) cmds.xform( sel[0],ws=1, m=cmds.xform(sel[1],q=1,ws=1,m=1) ) cmds.setKeyframe(sel[0])
zarmWppsWinExe()
cmds.window(WindowWinUi,bgc=(0.5,0.5,0.5) )
cmds.columnLayout("A")
cmds.rowColumnLayout(p="A",nc=1,cw=[(1,100)])
cmds.text( label='Target Object:')
cmds.separator ( h=5, style='none')
cmds.button(l="Apply",bgc=(0.5,0.8,0.5), command=('Doit()'))
cmds.separator ( h=5, style='none')
cmds.text( label='Time Range:')
cmds.rowColumnLayout(p="A",nc=3,cw=[(1,100),(2,100)])
cmds.intField('startTimeField', v=cmds.playbackOptions( q=1, min=1))
cmds.intField('endTimeField', v=cmds.playbackOptions( q=1, max=1 ))
cmds.showWindow(WindowWinUi) cmds.window(WindowWinUi,e=1,wh=(204,102),s=1 ) cmds.window(WindowWinUi,q=1,wh=1)
|