fixed casting to integer for fps

This commit is contained in:
Ondrej Samohel 2019-11-12 13:57:19 +01:00
parent 2100a3e666
commit 378d363ba8
No known key found for this signature in database
GPG key ID: 8A29C663C672C2B7

View file

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