move render resolution function to lib

This commit is contained in:
Kayla Man 2023-10-19 21:24:50 +08:00
parent 349cf6d35d
commit 977d0144d8
2 changed files with 21 additions and 21 deletions

View file

@ -483,3 +483,23 @@ def get_plugins() -> list:
plugin_info_list.append(plugin_info)
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