integrate thumbnail does not require 'AVALON_THUMBNAIL_ROOT' to be set if template does not use it

This commit is contained in:
Jakub Trllo 2022-08-29 13:31:28 +02:00
parent 55e4f4f468
commit 6f4f87418e

View file

@ -6,10 +6,9 @@ import copy
import six
import pyblish.api
from bson.objectid import ObjectId
from openpype.client import get_version_by_id
from openpype.pipeline import legacy_io
from openpype.client.operations import OperationsSession, new_thumbnail_doc
class IntegrateThumbnails(pyblish.api.InstancePlugin):
@ -24,13 +23,9 @@ class IntegrateThumbnails(pyblish.api.InstancePlugin):
]
def process(self, instance):
if not os.environ.get("AVALON_THUMBNAIL_ROOT"):
self.log.warning(
"AVALON_THUMBNAIL_ROOT is not set."
" Skipping thumbnail integration."
)
return
env_key = "AVALON_THUMBNAIL_ROOT"
thumbnail_root_format_key = "{thumbnail_root}"
thumbnail_root = os.environ.get(env_key) or ""
published_repres = instance.data.get("published_representations")
if not published_repres:
@ -51,6 +46,16 @@ class IntegrateThumbnails(pyblish.api.InstancePlugin):
).format(project_name))
return
thumbnail_template = anatomy.templates["publish"]["thumbnail"]
if (
not thumbnail_root
and thumbnail_root_format_key in thumbnail_template
):
self.log.warning((
"{} is not set. Skipping thumbnail integration."
).format(env_key))
return
thumb_repre = None
thumb_repre_anatomy_data = None
for repre_info in published_repres.values():