mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Fix FPS check for asset overridden values (and simplify getting required asset fps)
This commit is contained in:
parent
4d763157d3
commit
b2ca58723f
3 changed files with 22 additions and 12 deletions
|
|
@ -252,7 +252,7 @@ def collect_container_metadata(container):
|
|||
return hostlib.get_additional_data(container)
|
||||
|
||||
|
||||
def get_project_fps():
|
||||
def get_asset_fps():
|
||||
"""Returns project's FPS, if not found will return 25 by default
|
||||
|
||||
Returns:
|
||||
|
|
@ -260,10 +260,20 @@ def get_project_fps():
|
|||
|
||||
"""
|
||||
|
||||
data = get_project_data()
|
||||
fps = data.get("fps", 25.0)
|
||||
key = "fps"
|
||||
|
||||
return fps
|
||||
# FPS from asset data (if set)
|
||||
asset_data = get_asset_data()
|
||||
if key in asset_data:
|
||||
return asset_data[key]
|
||||
|
||||
# FPS from project data (if set)
|
||||
project_data = get_project_data()
|
||||
if key in project_data:
|
||||
return project_data[key]
|
||||
|
||||
# Fallback to 25 FPS
|
||||
return 25.0
|
||||
|
||||
|
||||
def get_project_data():
|
||||
|
|
@ -298,7 +308,7 @@ def get_asset_data(asset=None):
|
|||
Returns:
|
||||
dict
|
||||
"""
|
||||
|
||||
|
||||
asset_name = asset or avalon.api.Session["AVALON_ASSET"]
|
||||
document = io.find_one({"name": asset_name,
|
||||
"type": "asset"})
|
||||
|
|
|
|||
|
|
@ -1472,8 +1472,7 @@ def validate_fps():
|
|||
|
||||
"""
|
||||
|
||||
asset_data = lib.get_asset_data()
|
||||
fps = asset_data.get("fps", lib.get_project_fps()) # can be int or float
|
||||
fps = lib.get_asset_fps()
|
||||
current_fps = mel.eval('currentTimeUnitToFPS()') # returns float
|
||||
|
||||
if current_fps != fps:
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@ class ValidateMayaUnits(pyblish.api.ContextPlugin):
|
|||
|
||||
def process(self, context):
|
||||
|
||||
# Collected units
|
||||
linearunits = context.data('linearUnits')
|
||||
angularunits = context.data('angularUnits')
|
||||
|
||||
fps = context.data['fps']
|
||||
project_fps = lib.get_project_fps()
|
||||
|
||||
asset_fps = lib.get_asset_fps()
|
||||
|
||||
self.log.info('Units (linear): {0}'.format(linearunits))
|
||||
self.log.info('Units (angular): {0}'.format(angularunits))
|
||||
|
|
@ -32,7 +33,7 @@ class ValidateMayaUnits(pyblish.api.ContextPlugin):
|
|||
|
||||
assert angularunits and angularunits == 'deg', ("Scene angular units "
|
||||
"must be degrees")
|
||||
assert fps and fps == project_fps, "Scene must be %s FPS" % project_fps
|
||||
assert fps and fps == asset_fps, "Scene must be %s FPS" % asset_fps
|
||||
|
||||
@classmethod
|
||||
def repair(cls):
|
||||
|
|
@ -49,5 +50,5 @@ class ValidateMayaUnits(pyblish.api.ContextPlugin):
|
|||
cls.log.debug(current_linear)
|
||||
|
||||
cls.log.info("Setting time unit to match project")
|
||||
project_fps = lib.get_project_fps()
|
||||
mayalib.set_scene_fps(project_fps)
|
||||
asset_fps = lib.get_asset_fps()
|
||||
mayalib.set_scene_fps(asset_fps)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue