OP-3589 - added thumbnail extract to traypublisher

Added check if thumbnail representation is not present, created by different plugin by any chance.
ExtractThumbnailSP should be removed when SP is removed, no need to copy and have 2 plugins.
This commit is contained in:
Petr Kalis 2022-07-15 13:12:09 +02:00
parent 70d6836bc8
commit 9f2bbbbe38

View file

@ -22,7 +22,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
"imagesequence", "render", "render2d", "prerender",
"source", "plate", "take"
]
hosts = ["shell", "fusion", "resolve"]
hosts = ["shell", "fusion", "resolve", "traypublisher"]
enabled = False
# presetable attribute
@ -46,6 +46,10 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
self.log.info("Skipping - no review set on instance.")
return
if self._has_thumbnail_already(instance):
self.log.info("Thumbnail representation already present.")
return
filtered_repres = self._get_filtered_repres(instance)
for repre in filtered_repres:
repre_files = repre["files"]
@ -102,6 +106,14 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
# There is no need to create more then one thumbnail
break
def _has_thumbnail_already(self, instance):
for repre in instance.data.get("representations", []):
self.log.info("repre {}".format(repre))
if repre["name"] == "thumbnail":
return True
return False
def _get_filtered_repres(self, instance):
filtered_repres = []
src_repres = instance.data.get("representations") or []