Jump to content

Status on version sets equal status on the task.


Recommended Posts

This is subject to discussion, work-flow wise...

 

I understand the need for having different status on multiple levels - ie, approval of a task shouldn't affect the status of the shot, because the shot has more tasks to be done.

 

However, when approving a version on a task, in my world, means that the task itself is approved. I can't think of a situation where it wouldn't be like that. The version represents the task.

 

It's just that I think there's one too many levels to set the status right now. Version, task, shot...

 

 

Link to post
Share on other sites

Hi,

 

This has been up before and we haven't yet had the time to take it further. You can however write a Python script that listens to the events thrown when a status is changed.

 

Have a look at the following page in the docs for an example on how to set it up https://api.ftrack.com/developing/events/index.html

 

Let me know if you need any help.

 

Cheers

Link to post
Share on other sites

Hi Jussing,

 

We do it the other way around, artist change the status of the task, I want the status of the highest version to reflect this. Also we want the status of the shot the resemble the status of the tasks belonging to it.

 

Below is the code we use, you can easily change it to what you want:

import sys,osimport datetimeimport ftrackdef update_callback(topic, *args, **kwargs):    date = datetime.datetime.now().strftime("%Y_%m_%d %H:%M ")    entities = kwargs.get('entities')    for item in entities:        try:            task = ftrack.Task(item['entityId'])        except Exception as e:            return        if item["entityType"] == "task" and task.getObjectType() == "Task":                # The name below is our in-house naem convention, maybe a bit long ;-)                name = task.getParent().getParent().getParent().getName()+"_"+task.getParent().getParent().getName()+"_"+task.getParent().getName()+" " +task.getType().getName()                 if item["keys"] != [] and item["keys"][0] == "statusid":                    print("Status changed!")                                        # Set Shot status                                        # Set shot status according to task statusses                    # "on hold" or "problem" -> shot to "on hold"                    # "good to go" -> shot to "good to go"                    # "client approved qt" or "client approved bl" -> shot to approved                    # all else -> shot to in progress                                        statussen = [shot_task.getStatus().getName() for shot_task in task.getParent().getTasks() if shot_task.getStatus().getName() != "Cancelled"]                    status = "In Progress"                    gtg = True                    approved = True                    for stat in statussen:                        if stat in ["on hold","problem"]:                            status = "On Hold"                            gtg = False                            approved = False                            break                        if stat != "good to go":                            gtg = False                        if not stat in ["client approved qt","client approved bl"]:                            approved = False                    if approved :                        status = "Approved"                    if gtg:                        status = "Good to Go"                    print("Changing shot "+name+" status to "+status+".")                    for stat in ftrack.getShotStatuses():                        if stat.getName() == status:                            task.getParent().setStatus(stat)                                                                            # Set version status                                        # Change version status when task status changes.                    # Latest version should reflect status of task.                                        # let's get all the latest versions on this task                                        for asset in task.getAssets():                        highest_version = {"version_number" : 0, "object": None}                        for version in asset.getVersions():                            if int(version.getVersion()) > int(highest_version["version_number"]):                                highest_version["version_number"] = version.getVersion()                                highest_version["object"]  = version                                                if highest_version["object"]:                            # set status of this highest version to task status                            highest_version["object"].setStatus(task.getStatus())                            logger.info("Changed status on " + name +\                                "_v" + str(highest_version["version_number"]) +\                                " for asset "+ asset.getName() + \                                " v"+str(highest_version["object"].getVersion()) +\                                " to "+str(task.getStatus().getName()))                            #--- ENDdef enable_actions():    #setup the event listener    ftrack.setup()    print "setup ftrack okey"    #subscribe to button-callback    ftrack.TOPICS.subscribe('update', update_callback)    ftrack.TOPICS.wait()    #--- ENDenable_actions() 
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...