Bonjour tout le monde,

Je suis en train de bosser sur un script python dans maya pour créer des anticipations. Le truc c'est que j'aimerai pouvoir changer une valeur en utilisant un slider dans mon interface, mais je ne sais pas comment (

Je vous remercie d'avance pour votre aide !

(La valeur que je voudrais changer se trouve dans la commande Anticipation, ligne 16 : le 6)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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()