mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 17:04:54 +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:
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@
|
|||
},
|
||||
"ExtractThumbnail": {
|
||||
"enabled": true,
|
||||
"subsets": [],
|
||||
"integrate_thumbnail": false,
|
||||
"background_color": [
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -202,6 +202,12 @@
|
|||
"key": "enabled",
|
||||
"label": "Enabled"
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"object_type": "text",
|
||||
"key": "subsets",
|
||||
"label": "Subsets"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "integrate_thumbnail",
|
||||
|
|
|
|||
|
|
@ -176,6 +176,10 @@ class ExtractThumbnailOIIODefaultsModel(BaseSettingsModel):
|
|||
class ExtractThumbnailModel(BaseSettingsModel):
|
||||
_isGroup = True
|
||||
enabled: bool = SettingsField(True)
|
||||
product_names: list[str] = SettingsField(
|
||||
default_factory=list,
|
||||
title="Product names"
|
||||
)
|
||||
integrate_thumbnail: bool = SettingsField(
|
||||
True,
|
||||
title="Integrate Thumbnail Representation"
|
||||
|
|
@ -844,6 +848,7 @@ DEFAULT_PUBLISH_VALUES = {
|
|||
},
|
||||
"ExtractThumbnail": {
|
||||
"enabled": True,
|
||||
"product_names": [],
|
||||
"integrate_thumbnail": True,
|
||||
"target_size": {
|
||||
"type": "source"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.1.4"
|
||||
__version__ = "0.1.5"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue