[tk-multi-publish2] Where do I add resolving logic for a custom key?

If I want to resolve a custom key in our templates.yml when I publish from Nuke, where would I add the logic to resolve that key?


It depends what exactly you are publishing from Nuke, but if you are talking about the Nuke script, you would need to take over the nuke_publish_script.py hook. However this hook by default doesn’t actually handle the path generation, it instead relies on the base hook to do this:

The base publish hook then runs this:

which calls this method to generate the path:

So in short you should take over the nuke_publish_script.py hook or add a new hook to the end of the dependancy chain, and override the get_publish_path method, so you can resolve the custom fields/keys.


I kind of want to make it possible to publish read nodes in the Publisher (instead of Shotgun Writenodes).
The filenames may not necesarily match exactly to the templates so therefore I would like the work_file name to not matter and the publish filename to have a path defined with custom keys like {filename} which would be the basename (without extension).

The publisher would then, upon publish move the files to the publish path and rename as necesary.

1 Like

OK, you would need to modify the collector so that it collected your read node paths as items. I’d use the write node collection methods as an example.

The creating playable media/version is handled via the submit_for_review plugin. I think this would largely work without modification, but you would need to modify this line to ensure you are passing through the resolved fields to the review submission app (which handles the generation of the playable media.)


I think I’m just going to copy the publish_file.py and hook it and recode what is needed.
We also do our custom playable media creation on teh farm so will adjust those as necesary.

I previously made my own Nuke Publisher from scratch since I wasn’t yet very comfortable adjusting the Publish2 but I think I’m getting teh hang of it now so trying to revert to that (I don’t want to keep maintaining all these loose apps :grimacing: )

Thanks, I’ll report back! :smiley:


No worries let me know if I can be of any more help!


Happy Monday (morning)!

So I’ve gotten further, finaly understanding more of the relationships of these files and plugins.

Question 1)
Is there an easy way to create a link field on my items which can be used to select an existing playlist on Shotgun? (Preferably with filtering, so it could just be a dropdown populated by a sg_find call)

Reason: Our Nuke artists are supposed to put their comps into a daillies playlist.
In my custom Nuke Publisher it would search for an open playlist with certain filter parameters (a status) and display None, and the found playlist(s) to the user.

Question 2)
Can I disable Notes on the individual items?
And how can I then acces the Notes on the parent item to add these to my publish?

Hi Ricardo, Happy new year!

You can create a custom UI on the publish plugin, but not the item itself. A drop down of playlists should be fairly straight forward once you understand how to had a custom UI which I provide an example of here.

You can’t disable the notes on items, but you could choose to ignore the entered description in the publish plugin. You should be able to access the parent item via parent, so it would be something like item.parent.description I think.

Hapy New Year! :slight_smile:


Then one more Q:

Just as the collector.py can be seen as the init for the Publisher (i.e. I could run code in that before the dialog shows), is there a place I can place code that needs to run after all the publish logic is completed for all items?

1 Like

The post phase hook sounds like it’s what you’re after.

1 Like

Strangely, that post_phase hook run’s before the Publisher window opens :grimacing:

This is my publish yaml:

shot step

collector: “{self}/collector.py:{config}/tk-multi-publish2/tk-nuke/basic/collector.py”
Work Template: nuke_shot_work
- name: Publish to Shotgun
hook: “{self}/publish_file.py”
settings: {}
- name: Upload for review
hook: “{self}/upload_version.py”
settings: {}
- name: Begin file versioning
hook: “{engine}/tk-multi-publish2/basic/nuke_start_version_control.py”
settings: {}
- name: Publish to Shotgun
hook: “{self}/publish_file.py:{engine}/tk-multi-publish2/basic/nuke_publish_script.py”
Publish Template: nuke_shot_publish
- name: Submit for Review
hook: “{engine}/tk-multi-publish2/basic/submit_for_review.py”
settings: {}
- name: Publish and Generate Shotgun Version
hook: “{self}/publish_file.py:{config}/tk-multi-publish2/tk-nuke/basic/publish_version.py”
Shot Frames Publish Template: custom_shot_frames_output_publish
Shot Movie Publish Template: custom_shot_mov_output_publish
Shot Raw Movie Publish Template: custom_shot_raw_mov_output_publish
- name: Render Playable Media
hook: “{config}/tk-multi-publish2/render_playable_media.py”
settings: {}
post_phase: “{self}/post_phase.py:{config}/tk-multi-publish2/post_phase.py”
# - name: Update Flame Clip
# hook: “{engine}/tk-multi-publish2/basic/nuke_update_flame_clip.py”
# settings:
# Flame Clip Template: flame_shot_clip
help_url: *help_url
location: “@apps.tk-multi-publish2.location

No worries, found the info :slight_smile:



7 posts were split to a new topic: Setting an item’s context in Publish2

A post was merged into an existing topic: Setting an item’s context in Publish2