Own Nuke image loader

Hi, I have problem like this. Thing which i want to achive, is to load renders into Nuke, with all render layers and passes at once. I mean that there is one publish item on Shotgun with link to beauty pass. Which will be seen by Nuke loader. And when I will loading this published files, loader should found all passes and layers existing in folder at this same time. I know that i could make separate publishes for all passes and layers but it will be not readable whene there are 10 layers with 6 passes each. Do anybody try to make something like that? My idea is to wrote my own hook for Maya publisher which will send render job do Dealine, and when job is done, it will create publish with beauty pass. This step shouldnt by tricky I already do some successful tests. But for now i dont know how to modify behavior of loader? Must I modify all app, or can I just use somekind of inheritance to modify only this load action i need?

It should be possible by just overriding a hook of the loader. When you load a render, search for the related publishes (e.g. with the same name) and load them too.
Have a look at tk-multi-loader2/tk-nuke_actions.py at master · shotgunsoftware/tk-multi-loader2 · GitHub
might be just what you need.

1 Like

Hmm good idea but I prefer to avoid overriding loader app :slight_smile:

I think you misunderstood. The point of the hooks is that you don’t have to override the actual app.
They live in config/hooks in your project.

2 Likes

yeah, you are right. After your comment i have look at tk-multi-loader2 one more time, and I got enlightenment!

You are absolutely right, and this is definitely what i need :slight_smile:

1 Like

Good to see you are on the right track. There are a few guides such as this one on developing hooks (could not find a better one).
One important thing that I did not realize right away - you can define a chain of hooks, e.g.

tk-multi-loader2:
   hook_scene_operation: '{self}/scene_operation_{engine_name}.py:{config}/{engine_name}/workfiles_scene_operation.py'

using a colon. This way, when you do HookBaseClass = sgtk.get_hook_baseclass() the base class is the next one in the chain, and you can override just what you need. {self} in this case is the app’s hooks folder, from which you can inherit the basic hook, and {config} is your config/hooks folder.

1 Like

This is exactly what i done :slight_smile:
Good thing is that you can modify all methods just by use “super”. It’s very handy.
One more time, thanks you for putting me on right track!