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
| import maya.cmds as cmds
#commande
def Anticipation():
cmds.currentTime(1)
posD = cmds.getAttr(o[0]+".translate")
print(posD)
cmds.currentTime(20)
posF = cmds.getAttr(o[0]+".translate")
print(posF)
deplace = [(posF[0][0] - posD[0][0],posF[0][1] - posD[0][1],posF[0][2] - posD[0][2])]
print(deplace)
anticipation = [(-deplace[0][0] / 6, -deplace[0][1] / 6, -deplace[0][2] / 6)]
print(anticipation)
cmds.currentTime(5)
cmds.move(anticipation[0][0],anticipation[0][1],anticipation[0][2] )
cmds.setKeyframe()
#fenetre
cmds.window(title="Anticipation", width = 550, height = 100, menuBar=True)
cmds.columnLayout(adjustableColumn=True)
cmds.menu( label='Supprimer tout', tearOff=True )
cmds.menuItem( label='Sans regret ?!', command="cmds.delete()")
cmds.button(label="Select Objet",c="o=cmds.ls(sl=True)")
cmds.button(label="Anticiper",c="Anticipation()")
cmds.button(label="PLAY !" , c="cmds.play(forward=True)")
cmds.setParent( '..' )
cmds.showWindow() |
Partager