Maya Python interface

Maya Python interface

Anonymous
Not applicable
1,011 Views
2 Replies
Message 1 of 3

Maya Python interface

Anonymous
Not applicable

Hello,

 

Is there a way to create these two controls (TimeSlider and RangeSlider) in a MEL/Python UI? I would like to maintain all of the functionality for scrubbing, playback, setting keys, audio, etc. if possible. I'm building a floating toolset UI and cannot find any examples of how to create these widgets.

 

Screen Shot 2021-05-10 at 2.35.43 PM.png

0 Likes
1,012 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Can someone please validate something for me? I am seeing this behavior in both Maya 2018 and 2019 on Windows 10 and Mac...

 

From the help docs it appears the solution to my issue would be the timePort and rangeControl commands. However, when I execute this simple snippet I get a blank window. Can you please try this in your Maya to see if this is a bug or if I have something wrong with the code? The UI this code produces is a blank window with no widgets, but I do not get any error message output:

from maya import cmds

cmds.window(w=500, h=75, title="Timeline Controls UI")
cl = cmds.columnLayout(adjustableColumn=True)
cmds.rangeControl('myRangeSlider', parent=cl)
cmds.timePort('myTimePort', parent=cl)
cmds.showWindow()
0 Likes
Message 3 of 3

Anonymous
Not applicable

As it turns out, the issue is not with either of the two widgets, but with the layout...

Bad:

 

cmds.window( w=500, h=60, title="Timeline Controls UI" )
cl = cmds.columnLayout(adjustableColumn=True)
cmds.timePort( 'myTimePort', parent=cl, backgroundColor=(0,1,0) )
cmds.rangeControl( 'myRangeSlider', minRange=0, maxRange=60, parent=cl, backgroundColor=(1,0,0))
cmds.showWindow()

 

Good:

 

cmds.window( w=500, h=60 )
fl = cmds.frameLayout(labelVisible=False)
cmds.timePort( 'myTimePort', parent=fl, backgroundColor=(0,1,0) )
cmds.rangeControl( 'myRangeSlider', minRange=0, maxRange=60, parent=fl, backgroundColor=(1,0,0))
cmds.showWindow()

 

 

Screen Shot 2021-05-13 at 3.24.53 PM.png

 

0 Likes