mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
feat(ppro): synchronization of ftrack project back on
This commit is contained in:
parent
86f2f8b475
commit
19a33b7272
1 changed files with 35 additions and 0 deletions
35
pype/plugins/premiere/publish/integrate_auto_sync_back_on.py
Normal file
35
pype/plugins/premiere/publish/integrate_auto_sync_back_on.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import sys
|
||||
import pyblish.api
|
||||
import avalon.api
|
||||
|
||||
try:
|
||||
from pype.modules.ftrack.lib.avalon_sync import CUST_ATTR_AUTO_SYNC
|
||||
except Exception:
|
||||
CUST_ATTR_AUTO_SYNC = "avalon_auto_sync"
|
||||
|
||||
|
||||
class IntegrateAutoSyncBackOn(pyblish.api.ContextPlugin):
|
||||
"""Ensure that autosync value in ftrack project is set to True.
|
||||
|
||||
In case was set to False and event server with the sync to avalon event
|
||||
is not running this will set synchronization back on.
|
||||
"""
|
||||
|
||||
order = pyblish.api.IntegratorOrder + 1
|
||||
families = ['clip']
|
||||
label = 'Ftrack project\'s auto sync on'
|
||||
|
||||
def process(self, context):
|
||||
session = context.data["ftrackSession"]
|
||||
project_name = avalon.api.Session["AVALON_PROJECT"]
|
||||
query = 'Project where full_name is "{}"'.format(project_name)
|
||||
project = session.query(query).one()
|
||||
if not project["custom_attributes"][CUST_ATTR_AUTO_SYNC]:
|
||||
project["custom_attributes"][CUST_ATTR_AUTO_SYNC] = True
|
||||
|
||||
try:
|
||||
session.commit()
|
||||
except Exception:
|
||||
tp, value, tb = sys.exc_info()
|
||||
session.rollback()
|
||||
raise
|
||||
Loading…
Add table
Add a link
Reference in a new issue