I’m trying to change the way the shotgun write node in nuke names files. I would like to do this by adding a hook but there seems to be no hooks in tk-nuke-writenode.
I’m trying to follow this guide here. But I cant seem to figure out how to get it to work. I can see the function I want to change here but no idea how to hook onto it or if its even possible.
How can I hook into the shotgun nuke write node to change the file naming?
You are right, there are no hooks in tk-nuke-writenode.
If you have a look at tk_nuke_writenode.__compute_render_path_from you’ll see that it gets information parsed from the scene path, updates it with information from the current context, and applies that to the output template specified in the config profile.
The natural question arises - why not use different templates for specifying the output path? Are there any special requirements that you did not describe?
Thanks for confirming there are no hooks in tk-nuke-writenode.
My motivation for wanting to change the path is to remove the extra info added by the node itself to the file names.
For example there needs to be something in the output knob of the node if there is nothing it gives an error. I dont want any extra info and dont want the nodes name in the output because our naming convention does not allow it.
It also add as %V which puts in the tank_task into the file name which I also dont want. I was hoping for a simple way to patch out the extra unwanted parts after the path was generated and a hook seemed like the simplest solution.
What I ended up doing is just making a custom version of tk-nuke-writenode which removes the unwanted parts added to the file name.
And I thought the fields in square brackets are optional, i.e. they may not be present in the template. So you can just omit “output” from the template and you’re done. Not 100% sure this is allowed.
That works perfectly! I added a new render template into the template.yml with the nuke.output omitted and then changed the tk-nuke-writenode.yml to use the new template and it work.
This solution is much better than my butchered custom tk-nuke-writenode. Thanks so much for your help.
Great, I had my fair share of engine and app hacks in the beginning, before figuring out how things are supposed to fit together.
Now most of our new functionality is wrapped in Shotgun apps, and it is much more convenient and robust.
By the way also check out how to create multiple write node profiles, this is pretty nice.
Can you please let me know where exactly i can find this file & where to add a render template.
Same thing i was looking for nuke write node, trying to remove the %V.
Templates are in <project>/config/core/templates.yml
Nuke write node profiles are in <project>/config/env/shot_step.yml (for the shot environment) or something included in it. Depends on which config you based your config on.