Merged in fix/maya-fps-mapping (pull request #365)

fixed casting to integer for fps

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Ondřej Samohel 2019-11-13 08:33:58 +00:00 committed by Milan Kolar
commit ade6a02115

View file

@ -3,6 +3,7 @@
import re
import os
import uuid
import math
import bson
import json
@ -1776,9 +1777,10 @@ def set_scene_fps(fps, update=True):
# pull from mapping
# this should convert float string to float and int to int
# so 25.0 is converted to 25, but 23.98 will be still float.
decimals = int(str(fps-int(fps))[2:])
if decimals == 0:
fps = int(fps)
dec, ipart = math.modf(fps)
if dec == 0.0:
fps = int(ipart)
unit = fps_mapping.get(str(fps), None)
if unit is None:
raise ValueError("Unsupported FPS value: `%s`" % fps)
@ -1861,6 +1863,7 @@ def set_context_settings():
# Set project fps
fps = asset_data.get("fps", project_data.get("fps", 25))
api.Session["AVALON_FPS"] = fps
set_scene_fps(fps)
# Set project resolution