Modify Maya Python FPS

Change Maya FPS

Change with GUI

Window-> Preferences / Preferences-> Preferences 160405_mayafps.png

[Settings]-> [Unit of work]-> [Time] 160405_mayafps_002.png

Python

Reference When changing FPS: currentUnit

Source

When getting FPS Get by calling Mel's currentTimeUnitToFPS

GetFPS.py


import maya.cmds
import maya.mel as mel

fps = mel.eval('currentTimeUnitToFPS')
print fps

When setting FPS

SetFPS.py


import maya.cmds
import maya.mel as mel

import maya.cmds
import maya.mel as mel

cmds.currentUnit( time='ntsc' )
fps = mel.eval('currentTimeUnitToFPS')
print fps
# 30.0

cmds.currentUnit( time='250fps' )
fps = mel.eval('currentTimeUnitToFPS')
print fps
# 250.0

The character string set in currentUnit is often used. FPS sets the character string.

Created a function

DefGetFPS.py


import maya.cmds
import maya.mel as mel

def SetFPS(fps):
    unit = 'ntscf'
    if fps == 15:
        unit = 'game'
    elif fps == 24:
        unit = 'film'
    elif fps == 25:
        unit = 'pal'
    elif fps == 30:
        unit = 'ntsc'
    elif fps == 48:
        unit = 'show'
    elif fps == 50:
        unit = 'palf'
    elif fps == 60:
        unit = 'ntscf'
    else:
        unit = str(fps)+'fps'
        
    cmds.currentUnit( time=unit )
    fps = mel.eval('currentTimeUnitToFPS')
    print fps
        
SetFPS(15)
SetFPS(24)
SetFPS(25)
SetFPS(30)
SetFPS(48)
SetFPS(50)
SetFPS(60)
SetFPS(250)

reference

[mel] Check out fsp fps setting.

Recommended Posts

Modify Maya Python FPS
mayapy --Python in Maya
Change Maya Python Timeline
Simple FPS measurement of python
Python
Python interpreter in Maya, Houdini, blender, Nuke
Use pathlib in Maya (Python 2.7) for upcoming Python 3.7
How to run a Maya Python script