Reputation: 1
so im working on a simple frame counter script as a way to start learning python in maya.
My plan is to have the script figure out how many frames are in the timeline , and then for each frame to create a text number (using the text curves command) then key the visibility on and off of these. I figure this will be faster than building them on the fly. Ive ran into a little problem trying to get the script to build the number on each frame though. script below:
code
import maya.cmds as cmds
newcurrent = cmds.currentTime(frame)
start = cmds.playbackOptions( q=True,min=True )
end = cmds.playbackOptions( q=True,max=True )
timerange = [start, end]
for frame in range (timerange):
cmds.textCurves( f='Times-Roman', t= newcurrent )
its obviously the 'for frame in range (timerange):' section that is causing me some problems. Im not sure on the correct syntax to do what I want here
thanks for any help!
Upvotes: 0
Views: 300
Reputation: 8814
I'm going to assume that start
and end are int
s, because you haven't provided that information. (If they're not int
s, you shouldn't be using range
anyway.) In the future, aim to create a [mcve].
What you've written amounts to this:
range([3, 7])
What you want though is this:
range(3, 7)
You can do this by one of these two approaches:
# Option 1
range(*timerange)
# Option 2
range(start, end)
Upvotes: 1