Friday, 23 August 2019

Maya - get FramesPerSecond setting by script

Here is small script snippet to get Maya settinsg for Frames Per Second playback settings. This is actually not straightforward.

Here is example how to get this in python:

import maya.cmds as mc

framesRateInSecondStr = mc.currentUnit( q = True, time = True )
    framesRateInSecondOptions = { 'game':15, 'film':24, 'pal':25, 'ntsc':30, 'show':48, 'palf':50, 'ntscf':60 }
    if 'fps' in framesRateInSecondStr:
        fpsStr = framesRateInSecondStr.replace( 'fps', '' )
        framesRateInSecond = float( fpsStr )
        framesRateInSecond = framesRateInSecondOptions[framesRateInSecondStr]

No comments: