Jump to content

Duncan

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Duncan

  1. Hi All,

    I'm trying to create an event listener to update task statuses based on changes made to dependent statuses. For example, when render task is marked as "complete" the Comp task is changed to "Ready".

    This is some of the code I have so far -

    def InBetweens_Status (task, status):

        if status['name'] == "InProgress":
            Shot = task['parent']
            Render = Shot['children'][4]
            if Render['status']['name'] == "NotStarted":
                print "No change"
            if Render['status']['name'] == "InProgress":
                print "Do something"

    def Update_Statuses(event):

       for entity in event['data'].get('entities', []):    
            if entity.get('entity_type') == 'Task' and entity['action'] == 'update':
                entity_Id = entity['entityId']
                task = session.get('Task',entity_Id)
                Status_Id = entity['changes']['statusid']['new']
                status = session.get('Status',Status_Id)
                InBetweens(task, status)


    # Subscribe to events with the update topic.
    session = ftrack_api.Session(auto_connect_event_hub=True)
    session.event_hub.subscribe('topic=ftrack.update', Update_Statuses)
    session.event_hub.wait()

    This works and gives me the status of the 'Render' task related to my 'InBetweens' task, however if I change that status and then update the status of the 'InBetweens' again it returns the original 'Render' status rather than the new one.

    Any idea why this would be happening?

    Thanks in advance,

×
×
  • Create New...