mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-04 18:04:55 +01:00
Merge pull request #6197 from ynput/enhancement/OP-8103_thumbnail_subset_filtering
This commit is contained in:
commit
aecbfa7352
5 changed files with 40 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ import copy
|
|||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import re
|
||||
|
||||
import pyblish.api
|
||||
from openpype.lib import (
|
||||
|
|
@ -14,9 +15,10 @@ from openpype.lib import (
|
|||
path_to_subprocess_arg,
|
||||
run_subprocess,
|
||||
)
|
||||
from openpype.lib.transcoding import convert_colorspace
|
||||
|
||||
from openpype.lib.transcoding import VIDEO_EXTENSIONS
|
||||
from openpype.lib.transcoding import (
|
||||
convert_colorspace,
|
||||
VIDEO_EXTENSIONS,
|
||||
)
|
||||
|
||||
|
||||
class ExtractThumbnail(pyblish.api.InstancePlugin):
|
||||
|
|
@ -50,6 +52,8 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
# attribute presets from settings
|
||||
oiiotool_defaults = None
|
||||
ffmpeg_args = None
|
||||
subsets = []
|
||||
product_names = []
|
||||
|
||||
def process(self, instance):
|
||||
# run main process
|
||||
|
|
@ -104,6 +108,26 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
self.log.debug("Skipping crypto passes.")
|
||||
return
|
||||
|
||||
# We only want to process the subsets needed from settings.
|
||||
def validate_string_against_patterns(input_str, patterns):
|
||||
for pattern in patterns:
|
||||
if re.match(pattern, input_str):
|
||||
return True
|
||||
return False
|
||||
|
||||
product_names = self.subsets + self.product_names
|
||||
if product_names:
|
||||
result = validate_string_against_patterns(
|
||||
instance.data["subset"], product_names
|
||||
)
|
||||
if not result:
|
||||
self.log.debug(
|
||||
"Subset \"{}\" did not match any valid subsets: {}".format(
|
||||
instance.data["subset"], product_names
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
# first check for any explicitly marked representations for thumbnail
|
||||
explicit_repres = self._get_explicit_repres_for_thumbnail(instance)
|
||||
if explicit_repres:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue