Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Reduce usage of legacy io #4723

Merged
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
39849a7
General: Connect to AYON server (base) (#3924)
iLLiCiTiT Mar 24, 2023
1316e3b
replace 'legacy_io' with context functions in load plugins
iLLiCiTiT Mar 27, 2023
01ae9f3
added 'get_global_context' to pipeline init
iLLiCiTiT Mar 27, 2023
4546f88
use context getters instead of legacy_io in publish plugins
iLLiCiTiT Mar 27, 2023
beee910
use data on context instead of 'legacy_io' in submit publish job
iLLiCiTiT Mar 27, 2023
77d32b7
skip query of asset docs in collect nuke reads
iLLiCiTiT Mar 27, 2023
b34875c
use context functions on other places
iLLiCiTiT Mar 27, 2023
cde736d
'list_looks' expects project name
iLLiCiTiT Mar 27, 2023
06bbff1
remove 'get_context_title'
iLLiCiTiT Mar 27, 2023
0410a51
don't pass AvalonMongoDB to prelaunch hooks
iLLiCiTiT Mar 27, 2023
a1c985b
change how context is calculated in hiero
iLLiCiTiT Mar 27, 2023
8289730
implemented function 'get_fps_for_current_context' for maya
iLLiCiTiT Mar 27, 2023
19cdffc
initialize '_image_dir' and '_image_prefixes' in init
iLLiCiTiT Mar 27, 2023
6681e78
legacy creator is using 'get_current_project_name'
iLLiCiTiT Mar 27, 2023
8079fd0
fill docstrings
iLLiCiTiT Mar 27, 2023
16e1f12
use context functions in workfile builders
iLLiCiTiT Mar 27, 2023
b028cd4
hound fixes
iLLiCiTiT Mar 27, 2023
3759412
'create_workspace_mel' can expect project settings
iLLiCiTiT Mar 28, 2023
8b9fa2c
swapped order of arguments
iLLiCiTiT Mar 28, 2023
057db1b
use information from instance/context data
iLLiCiTiT Mar 28, 2023
8a56fb1
Use self.project_name in workfiles tool
iLLiCiTiT Mar 28, 2023
17ea073
Remove outdated todo
iLLiCiTiT Mar 28, 2023
4ff2b71
don't query project document in nuke lib
iLLiCiTiT Mar 28, 2023
c036d76
Fix access to context data
iLLiCiTiT Mar 28, 2023
a0c409b
Use right function to get project name
iLLiCiTiT Mar 28, 2023
bc18caf
fix submit max deadline and swap order of arguments
iLLiCiTiT Mar 28, 2023
61a26d9
added 'get_context_label' to nuke
iLLiCiTiT Mar 28, 2023
8fa2bb7
fix import
iLLiCiTiT Mar 28, 2023
63bdf7b
fix typo 'curent_context' -> 'current_context'
iLLiCiTiT Mar 28, 2023
7b4113a
fix project_setting variable
iLLiCiTiT Mar 28, 2023
fc49d4a
fix submit publish job environments
iLLiCiTiT Mar 28, 2023
4fd2727
use task from context
iLLiCiTiT Mar 28, 2023
ae2c058
Removed unused import
iLLiCiTiT Mar 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
implemented function 'get_fps_for_current_context' for maya
  • Loading branch information
iLLiCiTiT committed Apr 3, 2023
commit 82897308b38829962ad816a66f54cf183aaef153
49 changes: 32 additions & 17 deletions openpype/hosts/maya/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,35 @@ def set_scene_resolution(width, height, pixelAspect):
cmds.setAttr("%s.pixelAspect" % control_node, pixelAspect)


def get_fps_for_current_context():
"""Get fps that should be set for current context.

Todos:
- Skip project value.
- Merge logic with 'get_frame_range' and 'reset_scene_resolution' ->
all the values in the functions can be collected at one place as
they have same requirements.

Returns:
Union[int, float]: FPS value.
"""

project_name = get_current_project_name()
asset_name = get_current_asset_name()
asset_doc = get_asset_by_name(
project_name, asset_name, fields=["data.fps"]
) or {}
fps = asset_doc.get("data", {}).get("fps")
if not fps:
project_doc = get_project(project_name, fields=["data.fps"]) or {}
fps = project_doc.get("data", {}).get("fps")

if not fps:
fps = 25

return convert_to_maya_fps(fps)


def get_frame_range():
"""Get the current assets frame range and handles."""

Expand Down Expand Up @@ -2110,10 +2139,7 @@ def reset_frame_range(playback=True, render=True, fps=True):
"""

if fps:
fps = convert_to_maya_fps(
float(legacy_io.Session.get("AVALON_FPS", 25))
)
set_scene_fps(fps)
set_scene_fps(get_fps_for_current_context())

frame_range = get_frame_range()

Expand Down Expand Up @@ -2178,18 +2204,9 @@ def set_context_settings():
"""

# Todo (Wijnand): apply renderer and resolution of project
project_name = legacy_io.active_project()
project_doc = get_project(project_name)
project_data = project_doc["data"]
asset_doc = get_current_project_asset(fields=["data.fps"])
asset_data = asset_doc.get("data", {})

# Set project fps
fps = convert_to_maya_fps(
asset_data.get("fps", project_data.get("fps", 25))
)
legacy_io.Session["AVALON_FPS"] = str(fps)
set_scene_fps(fps)
set_scene_fps(get_fps_for_current_context())

reset_scene_resolution()

Expand All @@ -2209,9 +2226,7 @@ def validate_fps():

"""

expected_fps = convert_to_maya_fps(
get_current_project_asset(fields=["data.fps"])["data"]["fps"]
)
expected_fps = get_fps_for_current_context()
current_fps = mel.eval('currentTimeUnitToFPS()')

fps_match = current_fps == expected_fps
Expand Down