LoginSignup
3
4

More than 5 years have passed since last update.

Maya Python FPSを変更する

Last updated at Posted at 2016-04-05

MayaのFPSを変更する

GUIで変更

[ウィンドウ]->[設定/プリファレンス]->[プリファレンス]
160405_mayafps.png

[設定]->[作業単位]->[時間]
160405_mayafps_002.png

Python

Reference

FPSを変更する場合:currentUnit

Source

FPSを取得する場合
MelのcurrentTimeUnitToFPSを呼び出して取得する

GetFPS.py
import maya.cmds
import maya.mel as mel

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

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

currentUnitに設定する文字列はよく使用するFPSは文字列を設定する
- game: 15 fps
- film: 24 fps
- pal: 25 fps
- ntsc: 30 fps
- show: 48 fps
- palf: 50 fps
- ntscf: 60 fps

関数を作成した

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)

参照

[mel] fspを調べたりしてみる
fps設定。

3
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4