mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
move render resolution function to lib
This commit is contained in:
parent
349cf6d35d
commit
977d0144d8
2 changed files with 21 additions and 21 deletions
|
|
@ -483,3 +483,23 @@ def get_plugins() -> list:
|
||||||
plugin_info_list.append(plugin_info)
|
plugin_info_list.append(plugin_info)
|
||||||
|
|
||||||
return plugin_info_list
|
return plugin_info_list
|
||||||
|
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def render_resolution(width, height):
|
||||||
|
"""Function to set render resolution option during
|
||||||
|
context
|
||||||
|
|
||||||
|
Args:
|
||||||
|
width (int): render width
|
||||||
|
height (int): render height
|
||||||
|
"""
|
||||||
|
current_renderWidth = rt.renderWidth
|
||||||
|
current_renderHeight = rt.renderHeight
|
||||||
|
try:
|
||||||
|
rt.renderWidth = width
|
||||||
|
rt.renderHeight = height
|
||||||
|
yield
|
||||||
|
finally:
|
||||||
|
rt.renderWidth = current_renderWidth
|
||||||
|
rt.renderHeight = current_renderHeight
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import os
|
||||||
import logging
|
import logging
|
||||||
import contextlib
|
import contextlib
|
||||||
from pymxs import runtime as rt
|
from pymxs import runtime as rt
|
||||||
from .lib import get_max_version
|
from .lib import get_max_version, render_resolution
|
||||||
|
|
||||||
log = logging.getLogger("openpype.hosts.max")
|
log = logging.getLogger("openpype.hosts.max")
|
||||||
|
|
||||||
|
|
@ -24,26 +24,6 @@ def play_preview_when_done(has_autoplay):
|
||||||
rt.preferences.playPreviewWhenDone = current_playback
|
rt.preferences.playPreviewWhenDone = current_playback
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
|
||||||
def render_resolution(width, height):
|
|
||||||
"""Function to set render resolution option during
|
|
||||||
context
|
|
||||||
|
|
||||||
Args:
|
|
||||||
width (int): render width
|
|
||||||
height (int): render height
|
|
||||||
"""
|
|
||||||
current_renderWidth = rt.renderWidth
|
|
||||||
current_renderHeight = rt.renderHeight
|
|
||||||
try:
|
|
||||||
rt.renderWidth = width
|
|
||||||
rt.renderHeight = height
|
|
||||||
yield
|
|
||||||
finally:
|
|
||||||
rt.renderWidth = current_renderWidth
|
|
||||||
rt.renderHeight = current_renderHeight
|
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def viewport_camera(camera):
|
def viewport_camera(camera):
|
||||||
"""Function to set viewport camera during context
|
"""Function to set viewport camera during context
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue