-
Notifications
You must be signed in to change notification settings - Fork 41
Documentation
The Nuke Writenode App provides a custom Shotgun Write node which makes it easy to standardise the location where images are rendered to. It can be configured for each environment. In addition to the path, the configuration will also determine the node name and render format to be used.
In order to use the Shotgun Write node, save your script as a Toolkit work file first and then create a new node via the Nuke menu. This will create a node which looks similar to a normal write node:
Rather than entering a path by hand, you just specify a channel and the Toolkit will compute the rest of the path automatically. You can see the computed path in the UI and open up the location on disk by clicking the Show in File System button. The location where the renders are written to depends on the Toolkit configuration.
You can use the value of the channel knob to help differentiate multiple write nodes in a single file. Channel names are unique within a file, and should be thought of as the name of the Write node. The label on the node will reflect the channel name and since the channel is used in the filename, you will be able to find the node in a scene that rendered out the file:
The renders will be versioned and the version number will always follow the current nuke script version which will be incremented automatically when you publish using Multi Publish.
The Write node will cache the current path so that it is still valid if the file is opened outside a Toolkit Work Area. Occasionally, this can mean that the path becomes out of sync and 'locked'. If the render path is locked then renders created with this Write node cannot be published.
To reset a render path, either version-up the scene using the Work-files app's 'Version Up Scene' command or select the Write node individually and in the properties, click Reset Path:
It's common for studios to use a render farm running job management tools (e.g. Deadline) which would typically launch Nuke directly when rendering. Because this is outside of the Shotgun environment, the tk-nuke-writenode app and the Write Node gizmo will not be found without some additional help.
Whilst we are experimenting with a more complete solution, the following is a minimal bootstrap of the tk-nuke engine so that Shotgun Write Nodes behave as expected.
Nuke will run any init.py
scripts found in it's plug-in path - see [here http://docs.thefoundry.co.uk/nuke/63/pythondevguide/startup.html
] for more details.
The following example init.py script should be placed in one of these locations and this will ensure that the tk-nuke engine is loaded correctly.
# Save this file as init.py in your nuke plug-in path as described here:
#
# http://docs.thefoundry.co.uk/nuke/63/pythondevguide/startup.html
#
def init_sgtk(studio_root, default_work_area_path):
"""
Minimal setup to ensure the tk-nuke engine is up
and running when Nuke is started outside or the
Tank command or Shotgun context menus
"""
import sys, os
# make sure sgtk module can be found in the python path:
core_python_path = os.path.abspath(os.path.join(studio_root, "tank/install/core/python"))
if core_python_path not in sys.path:
sys.path.append(core_python_path)
# Check that we need to start the engine:
if "TANK_ENGINE" in os.environ:
# tk-nuke engine is going to be set up by
# tk-multi-launchapp so we don't need to bother
return
# Check that the engine isn't already running
if "TANK_NUKE_ENGINE_MOD_PATH" in os.environ:
# tk-nuke engine is running which will handle all
# engine & context management from now on
return
# initialize tk-nuke engine:
try:
# Determine the work area path that will be used to
# create the initial context the engine will be
# started with. If a file path was specified on the
# command line then this will be sys.argv[0]
work_area_path = default_work_area_path
if len(sys.argv) > 0 and sys.argv[0].endswith(".nk") and os.path.exists(sys.argv[0]):
# file path was passed through the command line
work_area_path = sys.argv[0]
import sgtk
tk = sgtk.Sgtk(default_work_area_path)
ctx = tk.context_from_path(work_area_path)
sgtk.platform.start_engine("tk-nuke", tk, ctx)
except Exception, e:
print "Failed to start Toolkit Engine - %s" % e
# pass in sensible values for studio_root & default_work_area_path
studio_root = "/studio_root" # The location of the Toolkit code on disk
default_work_area_path = "/project_root/my_project" # The default work area to be used if no .nk file is specified on the command line
init_sgtk(studio_root, default_work_area_path)
You will need to modify this script to provide your specific studio/code and project roots - you may also need to extend this if your configuration is more complex than this example or you are passing a python script to the command line using the -t
flag instead of a nuke (.nk) script.
Deadline can copy Nuke scripts to a temporary location when rendering. This will cause problems with the Toolkit as the files will no longer be in a disk location that it recognises. To disable this behaviour and load the scripts from their original location:
- In Deadline, navigate to Tools > Configure Plugin (In the super user mode)
- Disable the option 'Enable Path Mapping'
Technical Details
The following API methods are available on the App:
Return a list of all Shotgun Write Nodes in the current scene.
list
app.get_write_nodes()
Parameters & Return Value
- Returns: List of Toolkit Write nodes found in the scene
Example
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>> nodes = a.get_write_nodes()
### get_node_name(node)
`str` get_node_name(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### get_node_profile_name(node)
`str` get_node_profile_name(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### get_node_render_files(node)
`list` get_node_render_files(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### get_node_render_template(node)
`template` get_node_render_template(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### get_node_publish_template(node)
`template` get_node_publish_template(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### get_node_tank_type(node)
`str` get_node_tank_type(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### get_node_render_path(node)
`str` get_node_render_path(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### generate_node_thumbnail(node)
`str` generate_node_thumbnail(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### reset_node_render_path(node)
`str` reset_node_render_path(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>
### is_node_render_path_locked(node)
`bool` is_node_render_path_locked(`str` node)
<description>
`list` app.get_write_nodes()
**Parameters & Return Value**
* **Returns:** List of Toolkit Write nodes found in the scene
**Example**
```python
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> a = eng.apps["tk-nuke-writenode"]
>>>