Pipeline steps : names vs short code (code vs short_name) confusing

Hi,

I have a pipeline step named ‘ModelAnimation’. It’s short code is ‘ModelAnim’

I have a maya scene file which corresponds to a template. This template uses the {Step} key.

If I do this:

mayascene = r"\\server01\shared2\projects\Donat_test123_P42918\assets\Character\Bidule\ModelAnim\work\Bidule_ModelAnim_v004.ma"

tk = sgtk.sgtk_from_path(mayascene)
context = tk.context_from_path(mayascene)

print context.step['name']

I get ModelAnimation

If I do this:

tmpl = tk.templates["maya_asset_work"]
print tmpl.validate_and_get_fields(mayascene)['Step']

I get ModelAnim

This is annoying because in our code we sometime use the context, and sometime the template to find out the pipeline step. Is their a way to:
a/ with the context, return the short name of the pipeline step
b/ with the template, return the ‘long’ name of the pipeline step

Regards

2 Likes

It should be possible to use either name as the step parameter by modifying your folder schema - open e.g. config/core/schema/project/sequences/shot/step.yml and you’ll see the name property which defines what field to use. Admittedly, this part is a bit more magical than it should be, for instance the entity types seem limited. (I cannot say for sure)

For the context, of course you can make an extra request and obtain the short name from the step:

shotgun.find("Step", [["id", "is", context.step["id"]]], ["short_name"])

But it would be nice to have it in the context by default. Perhaps there is a core hook for that.

4 Likes

What @mmoshev suggested is right, we only store minimum required info in the context object so an extra look up would be needed.

You can get a context from the path and then perform a lookup as described above.

1 Like