diff --git a/client/ayon_core/plugins/publish/extract_thumbnail.py b/client/ayon_core/plugins/publish/extract_thumbnail.py index 90e0ef7431..1471a5fb78 100644 --- a/client/ayon_core/plugins/publish/extract_thumbnail.py +++ b/client/ayon_core/plugins/publish/extract_thumbnail.py @@ -2,6 +2,7 @@ import os import subprocess import tempfile +import re import pyblish.api from ayon_core.lib import ( @@ -49,6 +50,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin): # attribute presets from settings oiiotool_defaults = None ffmpeg_args = None + product_names = [] def process(self, instance): # run main process @@ -103,6 +105,26 @@ def _main_process(self, instance): 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.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 explicit_repres = self._get_explicit_repres_for_thumbnail(instance) if explicit_repres: diff --git a/client/ayon_core/settings/defaults/project_settings/global.json b/client/ayon_core/settings/defaults/project_settings/global.json index bb7e3266bd..782fff1052 100644 --- a/client/ayon_core/settings/defaults/project_settings/global.json +++ b/client/ayon_core/settings/defaults/project_settings/global.json @@ -70,6 +70,7 @@ }, "ExtractThumbnail": { "enabled": true, + "subsets": [], "integrate_thumbnail": false, "background_color": [ 0, diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index 7aa86aafa6..8506801e7e 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -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 @@ class PublishPuginsModel(BaseSettingsModel): }, "ExtractThumbnail": { "enabled": True, + "product_names": [], "integrate_thumbnail": True, "target_size": { "type": "source"