Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions python/tk_nuke_writenode/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,9 @@ def convert_sg_to_nuke_write_nodes(self):
node_pos = (sg_wn.xpos(), sg_wn.ypos())

# create new regular Write node:
new_wn = nuke.createNode("Write")
new_wn.setSelected(False)
with nuke.root():
new_wn = nuke.createNode("Write", inpanel=False)
new_wn.setSelected(False)

# copy across file & proxy knobs (if we've defined a proxy template):
new_wn["file"].setValue(sg_wn["cached_path"].evaluate())
Expand All @@ -441,6 +442,7 @@ def convert_sg_to_nuke_write_nodes(self):
"name",
"xpos",
"ypos",
"colorspace",
]:
continue

Expand All @@ -451,6 +453,13 @@ def convert_sg_to_nuke_write_nodes(self):
# ignore type errors:
pass

# copy color space knob
cs = int_wn["colorspace"].value()
# handle default value where cs would be something like: 'default (linear)'
if cs.startswith("default (") and cs.endswith(")"):
cs = cs[9:-1]
new_wn["colorspace"].setValue(cs)

# Set the nuke write node to have create directories ticked on by default
# As toolkit hasn't created the output folder at this point.
new_wn["create_directories"].setValue(True)
Expand Down Expand Up @@ -553,10 +562,14 @@ def convert_nuke_to_sg_write_nodes(self):
# set as selected:
wn.setSelected(True)
node_name = wn.name()
# rename node to avoid conflict
wn.setName('__' + node_name)
node_pos = (wn.xpos(), wn.ypos())

# create new Shotgun Write node:
new_sg_wn = nuke.createNode(TankWriteNodeHandler.SG_WRITE_NODE_CLASS)
new_sg_wn = nuke.createNode(TankWriteNodeHandler.SG_WRITE_NODE_CLASS, inpanel=False)
# rename new node here (fix missing promote knobs):
new_sg_wn.setName(node_name)
new_sg_wn.setSelected(False)

# copy across file & proxy knobs as well as all cached templates:
Expand Down Expand Up @@ -623,8 +636,6 @@ def convert_nuke_to_sg_write_nodes(self):
# delete original node:
nuke.delete(wn)

# rename new node:
new_sg_wn.setName(node_name)
new_sg_wn.setXpos(node_pos[0])
new_sg_wn.setYpos(node_pos[1])

Expand Down