So basically i have to retrieve the value of frame rate of a shot from shotgun and then set it to the shot opened in Maya but I am not able to see any changes in the frame rate value:
def query_frame_rate():
"""
Shot level : return frame_rate value for shot if it's present
Hierarchy level : If frame_rate is not present in shot it goes for corresponding project
and then extract the frame_rate value from the Project
"""
sht_entity = db_query.query_context("entity")
result = sg.find_one("Shot", [["id", "is", sht_entity["id"]]], ["sg_frame_rate"])
frame_rate = result["sg_frame_rate"]
if frame_rate == None:
project = sg.find_one("Shot", [["id", "is", sht_entity["id"]]], ["project"])
project_id = project["project"]["id"]
result = sg.find_one("Project", [["id", "is", project_id]], ["sg_frame_rate"])
frame_rate = result["sg_frame_rate"]
return frame_rate
if __name__ == "__main__":
frame_per_second = query_frame_rate()
frame_per_second = 16.0
import maya.cmds as cmds
cmds.playbackOptions(minTime=cmds.playbackOptions(q=True, minTime=True),
maxTime=cmds.playbackOptions(q=True, maxTime=True),
fps=16.0)
#cmds.playbackOptions( fps=frame_per_second )
print("Done frame rate has been set to {}".format(frame_per_second))
So yes that's the only issue i am facing here, any help would be great Thanks
playbackOptions command can be used to query the value, in order to set the value you can use currentUnit command https://help.autodesk.com/cloudhelp/2019/ENU/Maya-Tech-Docs/Commands/currentUnit.html but you have to set your value as a rate standard string name like pal, ntsc
for example // Change the current time unit to ntsc currentUnit -time ntsc;
this is also an useful gist on github for the topic - https://gist.github.com/gansaibow/c30b93bd80dd9a0396d926c31832c4f7