mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
cosmetic tweaks and code clean up
This commit is contained in:
parent
2cfc38bc34
commit
5f309994c3
3 changed files with 22 additions and 10 deletions
|
|
@ -1,5 +1,19 @@
|
|||
"""Backwards compatible implementation of ExitStack for Python 2.
|
||||
|
||||
ExitStack contextmanager was implemented with Python 3.3. As long as we support
|
||||
Python 2 hosts we can use this backwards compatible implementation to support both
|
||||
Python 2 and Python 3.
|
||||
|
||||
Instead of using ExitStack from contextlib, use it from this module:
|
||||
|
||||
>>> from openpype.hosts.maya.api.exitstack import ExitStack
|
||||
|
||||
It will provide the appropriate ExitStack implementation for the current
|
||||
running Python version.
|
||||
|
||||
"""
|
||||
# TODO: Remove the entire script once dropping Python 2 support.
|
||||
import contextlib
|
||||
# TODO: Remove the entire script once dropping Python 2.
|
||||
if getattr(contextlib, "nested", None):
|
||||
from contextlib import ExitStack # noqa
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"""Standalone helper functions"""
|
||||
|
||||
import os
|
||||
import copy
|
||||
from pprint import pformat
|
||||
import sys
|
||||
import uuid
|
||||
|
|
@ -176,12 +177,9 @@ def maintained_selection():
|
|||
|
||||
def reload_all_udim_tile_previews():
|
||||
"""Regenerate all UDIM tile preview in texture file"""
|
||||
texture_files = cmds.ls(type="file")
|
||||
if texture_files:
|
||||
for texture_file in texture_files:
|
||||
if cmds.getAttr("{}.uvTilingMode".format(texture_file)) > 0:
|
||||
cmds.ogs(regenerateUVTilePreview=texture_file)
|
||||
cmds.ogs(reloadTextures=True)
|
||||
for texture_file in cmds.ls(type="file"):
|
||||
if cmds.getAttr("{}.uvTilingMode".format(texture_file)) > 0:
|
||||
cmds.ogs(regenerateUVTilePreview=texture_file)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
@ -227,7 +225,7 @@ def render_capture_preset(preset):
|
|||
json.dumps(preset, indent=4, sort_keys=True)
|
||||
)
|
||||
)
|
||||
|
||||
preset = copy.deepcopy(preset)
|
||||
# not supported by `capture` so we pop it off of the preset
|
||||
reload_textures = preset["viewport_options"].pop("reloadTextures", True)
|
||||
|
||||
|
|
@ -235,6 +233,7 @@ def render_capture_preset(preset):
|
|||
stack.enter_context(maintained_time())
|
||||
stack.enter_context(panel_camera(preset["panel"], preset["camera"]))
|
||||
stack.enter_context(viewport_default_options(preset))
|
||||
preset.pop("panel")
|
||||
if preset["viewport_options"].get("textures"):
|
||||
# Force immediate texture loading when to ensure
|
||||
# all textures have loaded before the playblast starts
|
||||
|
|
@ -242,7 +241,6 @@ def render_capture_preset(preset):
|
|||
if reload_textures:
|
||||
# Regenerate all UDIM tiles previews
|
||||
reload_all_udim_tile_previews()
|
||||
preset.pop("panel")
|
||||
path = capture.capture(log=self.log, **preset)
|
||||
|
||||
return path
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ def get_template_name_profiles(
|
|||
project_settings
|
||||
["global"]
|
||||
["publish"]
|
||||
["IntegrateAssetNew"]
|
||||
["IntegrateHeroVersion"]
|
||||
["template_name_profiles"]
|
||||
)
|
||||
if legacy_profiles:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue