0

Hiero export sg_episode tag.

Hello, I am running into some issues using tk-hiero-export with our internal episodes tag and am wondering where I should write support code. We use an episode tag, which is nearly identical in function to sequence, and uses the internal 'scene' tag. In the case of the sg3 api I am able to use the scene tag to search entities and find the relations I am looking for between entries, but the hiero exporter is throwing errors on parsing the schema.

The error is being thrown up from some rather low-level code, and I would like not to reach that deep in order to support our custom type.

  File "\\ARC\Data\Software\all\shotgun\studio\install\apps\app_store\tk-hiero-export\v0.1.16\python\tk_hiero_export\shot_updater.py", line 99, in taskStep
self.app.tank.create_filesystem_structure(shot_type, [shot_id])
File "\\ARC\Data\Software\all\shotgun\studio\install\core\python\tank\api.py", line 483, in create_filesystem_structure engine)
File "\\ARC\Data\Software\all\shotgun\studio\install\core\python\tank\folder\operations.py", line 199, in process_filesystem_structure engine)
File "\\ARC\Data\Software\all\shotgun\studio\install\core\python\tank\folder\operations.py", line 57, in create_single_folder_item
shotgun_entity_data = folder_obj.extract_shotgun_data_upwards(tk.shotgun, entity_id_seed)
File "\\ARC\Data\Software\all\shotgun\studio\install\core\python\tank\folder\folder_types.py", line 1270, in extract_shotgun_data_upwards
"again!\n" % (self._entity_type, name, field))
tank.errors.TankError: The Shot 305x010 has a required field sg_episode that does not have a value set in Shotgun.
Double check the values and try again!

 

Thanks,

Robert Durnin

 

 

6 comments

  • 0
    Avatar
    Rob Blau

    Hi Robert, the place you need to look to customize this behavior is in the tk-hiero-export's get_shot hook.  This hook is responsible for returning the Shot that matches a Hiero item, creating it (and the structure it needs) if needed.  The default hook is setup to work with a Sequence/Shot hierarchy, but is easily changed for something like an episode hierarchy.

    You can see the default hook here:

    https://github.com/shotgunsoftware/tk-hiero-export/blob/master/hooks/hiero_get_shot.py

    And docs on how the hook works here:

    https://support.shotgunsoftware.com/entries/95442838

  • 0
    Avatar
    Robert Durnin

    Okay Rob, and thanks for pointing me in the right direction. Will I need to copy that hook forward with every update of the app, or will I need to copy the hook into the app dir under each project? It sounds like a manual process either way, although I haven't read anywhere how the SGTK update mechanism handles custom hook code.

    Thanks again,

    r

     

     

  • 0
    Avatar
    Rob Blau

    The custom hook code does live in the toolkit configuration directory, so you don't need to copy it forward with each app update, but you do need to set it up for each project.  If you base a new project off of the config of an old one the hooks do get transferred over, so you'd be set in that case.

     

    Details on how to customize a hook's behavior are here:
    https://support.shotgunsoftware.com/entries/95442818

     

    Definitely let us know if you need any more help getting this setup.

  • 0
    Avatar
    Rob Blau

    Hey Rob,

    What you want to do once you have the hooks in your project's hooks directory is to update the yaml files in the env dir to tell toolkit to use the hook.  In this case, you want to look at the definition of tk-hiero-export and update the value of the "hook_get_shot" setting.  The magic value of "default" tells toolkit to fall back to the hook in the app's hooks directory, but any other value will look for a file named the value of the setting (with a .py appended to it) in the configuration's hooks directory.

    So it sounds like you have the files in the right place, and the last step should be updating the configs to use them.  We did just release a sizable change to toolkit that gives you a lot more flexibility on how to structure hooks.  Docs on the new features are here:

    https://support.shotgunsoftware.com/entries/95442678

    One of the big changes is that you can setup a chain of hooks and subclass your hook from another.  We haven't yet gone back and refactored our hooks so that they are friendlier to subclassing, but this can give you a setup where you can inherit some changes from the default hook implementation but override some details.  Unfortunately, I don't think that the current implementation of the get_shot hook is structured in a way where you can just take over a little of its functionality.

    Let me know if that doesn't get you going!

  • 0
    Avatar
    Robert Durnin

    Hey Rob, and please forgive me if I am slow to grasp the concept... But I now have a few hooks that I need to migrate into a studio level directory in order to keep them from being lost to SGTK's updating mechanism. If I understand, I should be able to house the hooks under a project config, and have them get called correctly, regardless of any app updates. I'm guessing this means that the responsibility of maintaining code compatibility becomes mine, and I will have to check periodically that new versions aren't 'doing' what I am (etc), but also that they can be easily migrated between alike projects.

    I am guessing that the hook search dirs get searched in some order which puts local ones first, but I am unclear on how I need to organize my directories in order to associate the hooks with the right app...

    At present I have thrown modified versions of hiero_get_shot.py and scene_operation_tk-hiero.py under my projects config hooks dir (/software/shotgun/project_name/config/hooks), but it does not look to be finding them.

    Do I need to create parallel dir structures under the hooks folder to navigate to the app, or should SGTK be finding them?

    Thanks,

    r

     

     

  • 0
    Avatar
    Robert Durnin

    Thanks.

    r

     

     

Please sign in to leave a comment.