Add "project.tank_name" and "step.short_name" to sgtk.Context

Hi everyone!

I want to propose a small feature request to add the fields “project.tank_name” and “step.short_name” to the sgtk.Context. They are used throughout all SGTK templates and I find myself querying them in quite a few places in my code. It would just be handy to have them at the finger tips when you need them.

To be clear here I would love this to pseudo code to work:

>>> import sgtk
>>> tk = sgtk.sgtk_from_path("/studio.08/demo_project")
>>> ctx = tk.context_from_path("/studio.08/demo_project/sequences/AAA/ABC/Light/work")
>>> ctx.project
{'type': 'Project', 'id': 4, 'name': 'demo_project', 'tank_name': 'dp'}  # extra "tank_name" field
>>> ctx.step
{'type': 'Step', 'id': 12, 'name': 'Light', 'short_name': 'LGT'}  # extra "short_name" field

I know that you probably do not want to start adding “arbitrary” fields to the Context object, but since these fields are used quite a lot, I hope you are willing to consider :smiley: .

Cheers,
Fabian

2 Likes

fwiw, you can get at the tank name via tk.pipeline_configuration._project_name.
But I agree it would be nice to have this information in the context, and the step short name, too.

2 Likes

Hi @mmoshev! Thanks for the trick shot (did not know about this one) and for the plus one! :smiley:

Can I +9000 (and over) this? :heart_eyes:

2 Likes

Hi @shotgun!
We are currently at +9002 for this feature request :grimacing:, what do you think about this idea?

1 Like

I think they’ll tell us to put it here :stuck_out_tongue:

If you send it, I’ll +1 it :slight_smile:

1 Like

I think the feature request is probably too small for the Roadmap. Can try to submit it, but I think it will not be accepted. Maybe @philip.scadding and @jfboismenu have some input on this feature request :slight_smile: ?

1 Like

I’d add my +1 to this but with the added possibility of being able to choose which extra fields to store (maybe in a core hook?) as we drive our step name on disk via a different field (legacy reasons).

Also useful for ctx.entity as we also use custom fields for Shots on disk.

2 Likes

I’m gonna try and pus my stuff in this bank holiday weekend, sorry its been such a busy few weeks! :smiley: