Here is one way of doing it.
import timefrom maya import OpenMaya as om
time.__previous = time.time()def callback(*args, **kwargs):
current = time.time()
fps = 1 / (current - time.__previous)
time.__previous = current
print("%.1f" % fps) # Show only 1 decimal
job = om.MDGMessage.addTimeChangeCallback(callback, 'transform')
The additions to the time module were to maintain a reference to the
previous_time variable, which apparently gets lost in a callback like this.
Output.
28.622.227.822.228.622.727.023.328.622.228.6
Alternatively, you could also use a script
<http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/Nodes/script.html>
node, or an expression. Both of which are capable of listening in on
timeChanged.
On 12 November 2015 at 13:43, Ravi Jagannadhan <[email protected]> wrote:
> Sorry, playback in Maya.
>
> "There are no dumb questions" - Carl Sagan.
>
> On Nov 12, 2015, at 00:10, Marcus Ottosson <[email protected]> wrote:
>
> Frame rates of what?
>
> On 12 November 2015 at 04:51, Ravi Jagannadhan <[email protected]> wrote:
>
>> Hi all, does anyone have any scripts handy for measuring frame rates (one
>> that's not in the GUI)?
>>
>> Thank you for your time,
>> Ravi
>> --
>> Where we have strong emotions, we're liable to fool ourselves - Carl
>> Sagan.
>>
>> --
>> 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/CADHeb2Z8NXCQVc79PODDY80qj6Szp27NN%2BhZ_8%3Dt0SYiv1xBLw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CADHeb2Z8NXCQVc79PODDY80qj6Szp27NN%2BhZ_8%3Dt0SYiv1xBLw%40mail.gmail.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/CAFRtmOAaAJ6G1teCW%3D8gbMnrmEUqE25zPGfG_ZWbRV%2B2muHdNA%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAaAJ6G1teCW%3D8gbMnrmEUqE25zPGfG_ZWbRV%2B2muHdNA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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/2BDEC120-2AB2-4625-BE4B-9BC342AFE10A%40gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/2BDEC120-2AB2-4625-BE4B-9BC342AFE10A%40gmail.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/CAFRtmODHxumN0zfqCin_n1C185z0rNXpkO4mUvV_A6tr6v4rMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.