0

Create Nuke WriteNode using python

Hi,

I'm trying to create a Shotgun WriteNode with python code, instead of using the shotgun menu in the toolbar.

However, I cant figure out what python code to use.

I know the gizmo itself is called "WriteTank", but when I execute "nuke.createNode('WriteTank')" (like you would do with a normal gizmo) it gives me the error :

"The render path is currently frozen because Toolkit could not determine a valid path! This was due to the following problem: Unable to determine the render template to use!"

When I create a WriteNode using the menu and I check the scripteditor afterwards it gives me this massive code:

import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_node_created_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
import nuke
if hasattr(nuke, "_shotgun_write_node_handler"):
nuke._shotgun_write_node_handler.on_knob_changed_gizmo_callback()
__import__('nuke')._shotgun_write_node_handler.on_compute_path_gizmo_callback() if hasattr(__import__('nuke'), '_shotgun_write_node_handler') else nuke.thisParent().knob('cached_path').value()

 

댓글 1개

  • 0
    Avatar
    Rob Blau

    This was answered via support, but just to make sure that the answer is available for everybody, here is the code snippet that can be used to create a writenode directly from python:

    import sgtk
    engine = sgtk.platform.current_engine()
    app = engine.apps["tk-nuke-writenode"]
    app_module = app.import_module("tk_nuke_writenode")
    handler = app_module.TankWriteNodeHandler(app)
    node = handler.create_new_node("Shotgun Quick Dailies")
    

    You need to update the profile name with the correct profile for the type of node that you want.

댓글을 남기려면 로그인하세요.