mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 08:54:53 +01:00
refactor function, fix comments
This commit is contained in:
parent
6e70c412e9
commit
e631218ee4
2 changed files with 23 additions and 16 deletions
|
|
@ -452,11 +452,11 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
render_file_name = os.path.basename(col[0])
|
||||
else:
|
||||
render_file_name = os.path.basename(col)
|
||||
|
||||
preview = match_aov_pattern(self, app, render_file_name)
|
||||
aov_patterns = self.aov_filter.keys()
|
||||
preview = match_aov_pattern(app, aov_patterns, render_file_name)
|
||||
|
||||
|
||||
|
||||
# toggle preview on if multipart is on
|
||||
if instance_data.get("multipartExr"):
|
||||
preview = True
|
||||
|
||||
|
|
@ -530,9 +530,10 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
preview = False
|
||||
render_file_name = list(collection[0])
|
||||
app = os.environ.get("AVALON_APP", "")
|
||||
aov_patterns = self.aov_filter.keys()
|
||||
# if filtered aov name is found in filename, toggle it for
|
||||
# preview video rendering
|
||||
preview = match_aov_pattern(self, app, render_file_name)
|
||||
preview = match_aov_pattern(app, aov_patterns, render_file_name)
|
||||
# toggle preview on if multipart is on
|
||||
if instance.get("multipartExr", False):
|
||||
preview = True
|
||||
|
|
|
|||
|
|
@ -1,16 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
|
||||
|
||||
def match_aov_pattern(self, app, render_file_name):
|
||||
"""Matching against a AOV pattern in the render files
|
||||
In order to match the AOV name
|
||||
we must compare against the render filename string
|
||||
that we are grabbing the render filename string
|
||||
from the collection that we have grabbed from exp_files.
|
||||
def match_aov_pattern(app, aov_patterns, render_file_name):
|
||||
"""Matching against a `AOV` pattern in the render files.
|
||||
|
||||
In order to match the AOV name we must compare
|
||||
against the render filename string that we are
|
||||
grabbing the render filename string from the collection
|
||||
that we have grabbed from `exp_files`.
|
||||
|
||||
Args:
|
||||
app (str): Host name.
|
||||
aov_patterns (list): List of AOV patterns from AOV filters.
|
||||
render_file_name (str): Incoming file name to match against.
|
||||
|
||||
Returns:
|
||||
bool: Review state for rendered file (render_file_name).
|
||||
"""
|
||||
if app in self.aov_filter.keys():
|
||||
for aov_pattern in self.aov_filter[app]:
|
||||
if re.match(aov_pattern, render_file_name):
|
||||
preview = True
|
||||
return preview
|
||||
aov_pattern = aov_patterns.get(app, [])
|
||||
if aov_pattern:
|
||||
return any(re.match(aov_pattern, render_file_name) for aov_pattern in aov_patterns)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue