Jump to content

Add Status Types to Shot/Asset Build/Task/MilestoneVersions in schema through ftrack-python-api


Remus Avram

Recommended Posts

15 hours ago, Remus Avram said:

how can I add a new status type to one of this Shot/Asset Build/Task/MilestoneVersions in a schema using the ftrack-python-api?

Hey Remus!

Unfortunately this is quite complex, not documented or recommended by us. The api schemas that exposes the necessary entities even has some of the relations "private". As of now we recommend sticking to read access, using the  ProjectSchema entity help functions (get_statuses and get_types). Those functions tries to hide some of the underlying complexity.

If you still want to go down this route I would recommend looking at the code in https://bitbucket.org/ftrack/ftrack-python-api/src/3302fe001c5836889d571a7dec591b7b56766182/source/ftrack_api/entity/project_schema.py?at=master&fileviewer=file-view-default, to see how the statuses and types are structured in the workflow schemas. Modifications will require a per-user API KEY with access to System Settings.

Link to comment
Share on other sites

Hi Mattias,

thanks for your answer!

The types and the statuses already exists. What I would like to do is to just add them to the schema.

For example there are already keys for the 'ProjectSchema' called '_version_workflow' and '_task_workflow' which manage  the statuses for the version and respective task workflow.  And key '_task_type_schema' which manage the types for the tasks.

Example:

session = ftrack_api.Session()
session.query("ProjectSchema where name is '%s'" % (name))
print schema.keys()
print schema['_task_workflow'].keys()
print schema['_task_type_schema'].keys()

Result:
[u'_task_workflow', u'name', u'_overrides', u'_version_workflow', u'_task_type_schema', u'id', u'_schemas']
[u'overrides', u'id', u'statuses', u'name']
[u'id', u'types', u'name']

Unfortunately, there are no keys to manage the projectSchema for assetbuild, milestone and shot.

Is it possible to be implemented?

Link to comment
Share on other sites

40 minutes ago, Remus Avram said:

Thanks for the quick ansewer!

Yes, they are handled sligtly differently in a very complex way like you said.

Do you know if there any plans to improve this?

Yes we have, but up until now it has mostly been seen and prioritised as an internal difficulty that we've had to deal with when building things. Externally we've tried to simplify through those functions.

Link to comment
Share on other sites

  • 3 weeks later...
  • 6 months later...
22 hours ago, Remus Avram said:

Is this feature planned to be added in the future?

Yes, this will most likely be added, but I do not have any dates for it at the moment. We're more and more relying on the API ourselves when building the application so down the line things like this should be available.

A problem at the moment is that the underlying model is quite complex - both to understand and to get right. Either we will need to simplify it or come up with good helper methods. This is the main reason why it is not there already.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...