mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
improve the check on the valid representations for thumbnail creation
This commit is contained in:
parent
625e782d7e
commit
c0db02f7b5
1 changed files with 14 additions and 11 deletions
|
|
@ -336,7 +336,8 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
return need_thumb_repres
|
||||
|
||||
def _get_filtered_repres(self, instance):
|
||||
filtered_repres = []
|
||||
review_repres = []
|
||||
other_repres = []
|
||||
src_repres = instance.data.get("representations") or []
|
||||
|
||||
for repre in src_repres:
|
||||
|
|
@ -348,18 +349,22 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
# to be published locally
|
||||
continue
|
||||
|
||||
if "review" not in tags:
|
||||
if not self._is_valid_images_repre(repre):
|
||||
continue
|
||||
|
||||
if not repre.get("files"):
|
||||
self.log.debug((
|
||||
"Representation \"{}\" doesn't have files. Skipping"
|
||||
).format(repre["name"]))
|
||||
continue
|
||||
|
||||
filtered_repres.append(repre)
|
||||
return filtered_repres
|
||||
has_review_tag = "review" in tags
|
||||
if not has_review_tag and not self._is_valid_images_repre(repre):
|
||||
continue
|
||||
|
||||
if has_review_tag:
|
||||
review_repres.append(repre)
|
||||
else:
|
||||
other_repres.append(repre)
|
||||
|
||||
return review_repres + other_repres
|
||||
|
||||
def _is_valid_images_repre(self, repre):
|
||||
"""Check if representation contains valid image files
|
||||
|
|
@ -372,9 +377,6 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
"""
|
||||
files = repre.get("files")
|
||||
if not files:
|
||||
self.log.debug((
|
||||
"Representation \"{}\" doesn't have files. Skipping"
|
||||
).format(repre["name"]))
|
||||
return False
|
||||
|
||||
# Get first file's extension
|
||||
|
|
@ -384,7 +386,8 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
first_file = files
|
||||
|
||||
ext = os.path.splitext(first_file)[1].lower()
|
||||
return ext in IMAGE_EXTENSIONS
|
||||
|
||||
return ext in IMAGE_EXTENSIONS or ext in VIDEO_EXTENSIONS
|
||||
|
||||
def _create_thumbnail_oiio(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue