Merge pull request #3517 from pypeclub/chore/OP-3589_TrayPublisher-Create-thumbnail

Traypublisher: added thumbnail extract
This commit is contained in:
Petr Kalis 2022-07-18 10:54:36 +02:00 committed by GitHub
commit 396079985d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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._already_has_thumbnail(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 _already_has_thumbnail(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 []