Unable to change frame rate by using userSetup.py (or userSetup.mel)

Unable to change frame rate by using userSetup.py (or userSetup.mel)

huseila
Enthusiast Enthusiast
530 Views
3 Replies
Message 1 of 4

Unable to change frame rate by using userSetup.py (or userSetup.mel)

huseila
Enthusiast
Enthusiast

Hi all,

 

I tried to use this snippet in userSetup.py to make frame rate set to 25 when opening a new maya scene. But it doesn't work at all:

 

import maya.cmds as cmds

cmds.currentUnit(time='pal')

Also I tried the mel equivalent in userSetup.mel but also doesn't work. Just wondering is it possible to change frame rate when launching Maya ?

0 Likes
Accepted solutions (1)
531 Views
3 Replies
Replies (3)
Message 2 of 4

Cagetron
Advocate
Advocate

It might be the new scene setting that is on by default to reset your working units. It's oddly separate from your global prefs. Go to File > New Scene > options to disable it.

Message 3 of 4

huseila
Enthusiast
Enthusiast
Hi Cagetron,
In fact i'm looking for a way to dynamically change the global fps setting when launching Maya. In our case we hope Maya can automatically set to proper fps when artist start working on different shows. I've found the solution and I'll share it in the following post 🙂
Message 4 of 4

huseila
Enthusiast
Enthusiast
Accepted solution

OK, I think this snippet works in userSetup.py 

import maya.cmds as cmds

import maya.utils


def set_fps(fps_name):

    cmds.currentUnit(time=fps_name)

 

# Get project fps data from server. It could be "film", "pal", "ntsc"
# The key point to drive "cmds.currentUnit" work is using "maya.utils.executeDeferred"
maya.utils.executeDeferred(lambda *args: set_fps(fps_name_from_server))