What is the syntax to use to create template keys which contain values for other fields from the Shot (or Sequence or Project entities) besides the default value used in the schema?
Hi Donna,
Could you give more explain of your question? Is it about schema field create? And the value means data or the field like list?
Thanks
Loney
im going to assume we are talking about template keys inside the templates.yml shotgun configâŚ
maya_shot_render_path: â@shot_root/work/images/{task_name}/v{version}/{resolution}/{render_layer}/{project_name}{Sequence}{Shot}{task_name}{render_layer}_v{version}.%0{padding}d.{ext}â
this template key has a couple custom fields that are queried task_name, resolution, render_layer, padding
if we take a look at how render_layer for example is assigned:
render_layer:
type: str
shotgun_entity_type: PublishedFile
shotgun_field_name: sg_render_layer
we can see that render_layer is of type string, its part of the publishedFile entity, and the field name found in the SG database is sg_render_layer⌠that means a sg_render_layer field must be filled out within each publishedFile entity⌠and that field will then be passed to the template for any file that uses the template maya_shot_render_path.
we can also take a look at how I defined project_name, since your question was specific to fields from Project entities:
project_name:
type: str
shotgun_entity_type: Project
shotgun_field_name: sg_project_prefix
Hope that helps⌠itâs really easy to query shot/asset/project fields, define them, and pass them to templates
apologies, I wasnât very specific
Iâve been asked to create a directory structure & file naming like:
project name (the long project name)/sequence code (long name)/{sequence_short_code}{shot_number}/ {proj code}{seq short code}{shot num}{step}{version}.{ext}
In SG I created fields beyond the default ones that come with SG
However when I try to create keys for Project code and sequence short code in the templates, it says the contextis unable to resolve those values, however I am able to get the extra shot fields.
BTW I have figured out a work around since I first posted this.
But Iâm wondering why when creating a new file under a lighting context (the shot_step) that I seem to be unable to get values for other fields the Project and Sequence entities.
Iâm asking because when Iâm in a shot_step context. new_file errors saying it can not query values for Project or Sequence.
Does your schema match your templates? Thatâs the important thing here.
Make sure youâve set up schema so that the folders itâs generating match that of the templates.
If youâre not sure, Iâm happy to take a look at your schema and templates for you. You can either attach it here or if your not comfortable sharing it publically then you can message me directly or put in a support ticket and then I can feedback here with any suggestions.
Cheers
Phil
Just posting back the relevant messages from our private conversation for the sake anyone else who follows this thread:
Hey
Just took a look at your config.
Based on the error I think the issue originally was that your sequence.yml had sq_{code}â
, but your maya_shot_work
template was sg_{Sequence_name}/...
it should have just been {Sequence}
.
Though Iâm a bit confused as your error message seems to be suggesting that the template is different from that which you posted originally.
sg_{Sequence_name}/{Shot_code}/{Step}/scenes/work.{current_user_name}/{Project_code}{Sequence_code}{Shot_code}{step_short_name}[{name}_]v{version}.{extension}
vs
{Sequence}/{Shot_code}/{Step}/scenes/work.{current_user_name}/{Project_code}_{Sequence_code}_{Shot_code}_{step_short_name}_[{name}_]v{version}.{maya_extension}
I see you fixed it by just not using the sequence, but I think if you correct the sequence folder in the template to be just {Sequence}
then it should work.
Cheers
Phil
[By @donna]
Hi! Thanks you for help. Apologies for not responding sooner. I figured things out.
There were quite a few problems. The first was I didnât understand that the âpathsâ in the template.yml had to use the âSpecialâ keys which corresponded to the exact schema/folder ymls and that I couldnât use a shot query key for the path definition.
Secondly, I figure out that I couldnât have query keys that were duplicates of the fields used in the schema ymls. Ex
in Shot.yml if I had:
type: âshotgun_entityâ
name: âsg_shortcodeâ
entity_type: âShotâ
filters: [ { âpathâ: âsg_sequenceâ, ârelationâ: âisâ, âvaluesâ: [ â$sequenceâ ] } ]
And in the templates.yml I had
Shot:
type: str
shot_name:
type: str
shotgun_entity_type: Shot
shotgun_field_name: code
shot_code:
type: str
shotgun_entity_type: Shot
shotgun_field_name: sg_shortcode
The âshot_codeâ key wasnt allowed because it was the same field queried in the Shot.yml
In the end I didnât realize the the scehma path definitions were so tied to those âSpecialâ keys in the templates.yml and had to be used in the templates.yml path definitions.
Thanks for your help!
Donna