OpenPype
OpenPype copied to clipboard
Nuke: Build template from workfile
Brief description
Following discussion https://github.com/pypeclub/OpenPype/discussions/2013 Similar to PR https://github.com/pypeclub/OpenPype/pull/3544, but allows making template from workfile in one go, and works with creators.
There is already a mechanism for loading Nuke template scripts, even automatically on a first open. Nuke workfile Builder settings allow to create first workfile and run Builder on first launch. This PR allows to create template from workfile with one click. It connects loaders and creators, and applies (some) knob values from the template, for example publishing and Deadline settings.
Description
For propagating master shots, prepare the master shot, and when happy, convert it to the template Nuke script.
Save the template Nuke script to the location set up in the workfile builder settings, for example {root[work]}/{project[name]}/templates/{task[name]}.nk. When artists launches the task with matching task name, your master script will autoload as version 1, complete with correct loaders and creators.
Simple Template
Showing two Loaders and one Write Render

Shot with Template Applied
from above, at first open

Tested Workfile Builder settings

Testing notes:
- Set up the Workfile Builder settings
- Work on first Nuke task as usual. Save
- Run
OpenPype - Workfile to Template. Note that if you select some nodes, only selection will be templated - Use Save as to save the template to the location specified by settings workfile_builder - curstom_templates - path
- Launch Nuke in context of other task. If no version exists, template will auto apply
- Alternatively, you can run
OpenPype - Builde Workfile and Apply Templatefrom the top menu
It looks like this is combination of workfiles builder we had (based on settings) and template based workfile builder (from the PR). Which makes it 3rd implementation of workfile build. Not sure if this is the right way. If there is something missing in this PR https://github.com/pypeclub/OpenPype/pull/3578 which is needed for this feature we should modify it there and reuse it rather then create another implementation.
I will check PR https://github.com/pypeclub/OpenPype/pull/3578. Thx. I aimed on ease of use and self building first version. I have similar stuff in production (OP2) for long time, can't be without it...
But in overall I really like the approach, great work @jrsndl ! I cannot wait to introduce this workflow in productions ;)
I fixed the type bug for Nuke 13, and updated the top description with settings in json
@jrsndl What features are you missing in #3544?
@jrsndl What features are you missing in #3544?
Ease of use
I do miss an easy way to create template from working Nuke script. For artists or io guys prepping the shots, create placeholder dialog is maybe too technical.
More Loaders
The template for Nuke should be able to handle not only Loadclip and Nukenode loaders, but also at least the LoadEffectsInputProcess often used for look.
Creators
Having working template for creators is also important, especially for shots with multiple outputs. At least WriteRender and WritePrerender.
Joining template with WorkfileBuilder
WorkfileBuilder already present in OpenPype allows for nice template filtering for task type and task name. So you can have a template for roto, cleanup and comp task names. Another advantage of joining template with WorkfileBuilder is already present feature of auto creating first version of the work file on opening.
The end goal is to have first version of the workfile generated by template and published for editorial check, all automatically.
@jrsndl I will try to meet your needs for missing features in #3544
Ease of use
Is this template node user generated or code generated?
In our build by template, we cannot transform a workfile into a template for several reasons (I only take nuke cases):
- a template can have several results, for example the placeholder retrieves all the character passes,iIt will then create a tree structure by character. If I want a template to be created from this work file, how should the code choose whether to put one placeholder for all characters or one placeholder per character or maybe one placeholder for all assets?
- our method is recursive, we can integrate a placeholder which contains other placeholders, for example the first placeholder will be replaced by a character template which contains one or more placeholders for the specific character image loaders. This system therefore also prevents an automatic generation of a recusive template.
But nothing prevents to make a simple system of generation of template which unfortunately will not exploit all the power of the system.
More Loaders
We can use any loader in your openpype and even select the options available on some loader, like for example the image plane load in maya.
Creators
You manage the creators, it's a good point that we don't have, it is possible to think about this integration. We leave the creators in the template scene for now. To stay in the example of the characters, in maya if a placeholder for the characters is in a set made by a creator, all the characters will be placed in the corresponding set.
Joining template with WorkfileBuilder
This is a point that we can easily improve, your objective would also be very beneficial to us.
other feature
Update
Our method is intended to update the scene without losing the artists work as much as possible.
Design for all software
The code was planned for a simpler integration in all software, we even made a template builder for photoshop on the same code abstraction as maya and nuke.
Maybe some things still don't work very well in nuke but it's the first implementation in a nodal system that still requires work and reflection. I might not be here to discuss it with you, but @friquette could give you a nice demo.
@ClementHector sorry for the late reply.
Is this template node user generated or code generated?
This template is code generated from Nuke script. Basically, OP loaders are "converted" to the template nodes.
I see now that your approach with regex filters is much more flexible. Maybe, to keep gest from both ways, the solution might be to make a Nuke script that "converts" from already existing Nuke loaders to your template nodes. This would keep the great flexibility, and get the easy start for artists as well?
Creators
For Nuke, creators are "asset specific", so "generic" creators do not work for Nuke. Having creators (for example the main output) ready from the template is much appreciated by junior artists. It would be awesome to have it.
Design for all software The code was planned for a simpler integration in all software, we even made a template builder for photoshop on the same code abstraction as maya and nuke.
This is the reason why your PR is so much better then my attempt. Thank you for the awesome work!
Closing as it is replaced by https://github.com/pypeclub/OpenPype/pull/3838