As you haven’t gotten a reply, I’ll share what I was thinking at first.

If you count the time between the frames, you can calculate your own fps.

import time

time_before = time.time()
# your code here
time.sleep(0.1)  # Pretend it takes a tenth of a second per frame

time_after = time.time()
time_delta = time_after - time_before
fps = 1.0 / time_delta
print "%f fps" % fps

Which prints, around:

9.30343 fps

​

On 13 November 2014 20:04, Chi Ngai Lai <[email protected]> wrote:

> Hi All,
>
> I'm going  to write a script, which I want a realtime FPS value during the
> scene playback.
>
> I've tried the following codes, which were not worked for me.
>
> # specify how many times for playing
> cmds.playbackOptions(loop='once')
> # scrub the time cursor to frame 1
> cmds.currentTime(1)
> # begin to play
> cmds.play()
>
> # make sure the scene is playing, then query for the realtime fps value
> if cmds.play(q=True, st=True):
>     print cmds.playbackOptions(fps=True)
>
> Result: it only print 0.0 at the beging, then it stops printing fps
> values, and the scene was continue playing.
>
> I've to manually keep executing those 2 lines of "if" codes, then it could
> keep printing the realtime fps value for me.
>
> But I want it automatically keep printing the fps values for me during the
> playback.
>
> Any thoughts? Much appreciate in advance. :)
>
> Cheers,
> Parker
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/86e30ad5-e448-42dd-b577-ef5a9b6925a0%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/86e30ad5-e448-42dd-b577-ef5a9b6925a0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Marcus Ottosson*
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCoaV1MgaUgv3HTYVwGLy2aeS_qRSyNW%2BdH5SjcVSi5qQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to