获取maya帧速率


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


def get_frame_rate_mel():
    # 使用 MEL 命令获取当前时间单位
    time_unit = mel.eval('currentUnit -query -time')
    
    # 定义不同时间单位对应的帧速率
    time_unit_to_fps = {
        'game': 15.0,
        'film': 24.0,
        'pal': 25.0,
        'ntsc': 30.0,
        'show': 48.0,
        'palf': 50.0,
        'ntscf': 60.0,
    }
    
    # 获取对应的帧速率
    fps = time_unit_to_fps.get(time_unit, None)
    
    if fps is not None:
        print(f"Current frame rate: {fps} FPS")
    else:
        print(f"Unknown time unit: {time_unit}")

get_frame_rate_mel()

评论
  目录