mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
Merged in bugfix/thumbnail_event_on_not_task (pull request #355)
fixed not crashing event thumbnail updates if thumbnail is not happening on task Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
commit
e6ac4fcb75
1 changed files with 16 additions and 9 deletions
|
|
@ -20,7 +20,8 @@ class ThumbnailEvents(BaseEvent):
|
||||||
if parent.get('thumbnail') and not task.get('thumbnail'):
|
if parent.get('thumbnail') and not task.get('thumbnail'):
|
||||||
task['thumbnail'] = parent['thumbnail']
|
task['thumbnail'] = parent['thumbnail']
|
||||||
self.log.info('>>> Updated thumbnail on [ %s/%s ]'.format(
|
self.log.info('>>> Updated thumbnail on [ %s/%s ]'.format(
|
||||||
parent['name'], task['name']))
|
parent['name'], task['name']
|
||||||
|
))
|
||||||
|
|
||||||
# Update task thumbnail from published version
|
# Update task thumbnail from published version
|
||||||
# if (entity['entityType'] == 'assetversion' and
|
# if (entity['entityType'] == 'assetversion' and
|
||||||
|
|
@ -32,18 +33,24 @@ class ThumbnailEvents(BaseEvent):
|
||||||
|
|
||||||
version = session.get('AssetVersion', entity['entityId'])
|
version = session.get('AssetVersion', entity['entityId'])
|
||||||
thumbnail = version.get('thumbnail')
|
thumbnail = version.get('thumbnail')
|
||||||
task = version['task']
|
|
||||||
|
|
||||||
if thumbnail:
|
if thumbnail:
|
||||||
task['thumbnail'] = thumbnail
|
parent = version['asset']['parent']
|
||||||
task['parent']['thumbnail'] = thumbnail
|
task = version['task']
|
||||||
self.log.info('>>> Updating thumbnail for task and shot\
|
parent['thumbnail_id'] = version['thumbnail_id']
|
||||||
[ {} ]'.format(task['name']))
|
if parent.entity_type.lower() == "project":
|
||||||
|
name = parent["full_name"]
|
||||||
|
else:
|
||||||
|
name = parent["name"]
|
||||||
|
msg = '>>> Updating thumbnail for shot [ {} ]'.format(name)
|
||||||
|
|
||||||
|
if task:
|
||||||
|
task['thumbnail_id'] = version['thumbnail_id']
|
||||||
|
msg += " and task [ {} ]".format(task["name"]))
|
||||||
|
|
||||||
|
self.log.info(msg)
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def register(session, plugins_presets):
|
def register(session, plugins_presets):
|
||||||
'''Register plugin. Called when used as an plugin.'''
|
'''Register plugin. Called when used as an plugin.'''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue