mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge pull request #16 from ynput/enhancement/OP-8103_thumbnail_subset_filtering
This commit is contained in:
commit
64043c244c
3 changed files with 28 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import copy
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import re
|
||||||
|
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
from ayon_core.lib import (
|
from ayon_core.lib import (
|
||||||
|
|
@ -50,6 +51,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
||||||
# attribute presets from settings
|
# attribute presets from settings
|
||||||
oiiotool_defaults = None
|
oiiotool_defaults = None
|
||||||
ffmpeg_args = None
|
ffmpeg_args = None
|
||||||
|
product_names = []
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
# run main process
|
# run main process
|
||||||
|
|
@ -104,6 +106,26 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
||||||
self.log.debug("Skipping crypto passes.")
|
self.log.debug("Skipping crypto passes.")
|
||||||
return
|
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.product_names
|
||||||
|
if product_names:
|
||||||
|
result = validate_string_against_patterns(
|
||||||
|
instance.data["subset"], product_names
|
||||||
|
)
|
||||||
|
if not result:
|
||||||
|
self.log.debug(
|
||||||
|
"Product name \"{}\" did not match settings filters: {}".format(
|
||||||
|
instance.data["subset"], product_names
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# first check for any explicitly marked representations for thumbnail
|
# first check for any explicitly marked representations for thumbnail
|
||||||
explicit_repres = self._get_explicit_repres_for_thumbnail(instance)
|
explicit_repres = self._get_explicit_repres_for_thumbnail(instance)
|
||||||
if explicit_repres:
|
if explicit_repres:
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@
|
||||||
},
|
},
|
||||||
"ExtractThumbnail": {
|
"ExtractThumbnail": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"subsets": [],
|
||||||
"integrate_thumbnail": false,
|
"integrate_thumbnail": false,
|
||||||
"background_color": [
|
"background_color": [
|
||||||
0,
|
0,
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,10 @@ class ExtractThumbnailOIIODefaultsModel(BaseSettingsModel):
|
||||||
class ExtractThumbnailModel(BaseSettingsModel):
|
class ExtractThumbnailModel(BaseSettingsModel):
|
||||||
_isGroup = True
|
_isGroup = True
|
||||||
enabled: bool = SettingsField(True)
|
enabled: bool = SettingsField(True)
|
||||||
|
product_names: list[str] = SettingsField(
|
||||||
|
default_factory=list,
|
||||||
|
title="Product names"
|
||||||
|
)
|
||||||
integrate_thumbnail: bool = SettingsField(
|
integrate_thumbnail: bool = SettingsField(
|
||||||
True,
|
True,
|
||||||
title="Integrate Thumbnail Representation"
|
title="Integrate Thumbnail Representation"
|
||||||
|
|
@ -844,6 +848,7 @@ DEFAULT_PUBLISH_VALUES = {
|
||||||
},
|
},
|
||||||
"ExtractThumbnail": {
|
"ExtractThumbnail": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
|
"product_names": [],
|
||||||
"integrate_thumbnail": True,
|
"integrate_thumbnail": True,
|
||||||
"target_size": {
|
"target_size": {
|
||||||
"type": "source"
|
"type": "source"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue