From edbd110a472c4bf3c7bdc1385f4d91189e4b6df4 Mon Sep 17 00:00:00 2001 From: Gilles Vink Date: Sun, 11 Sep 2022 22:26:46 +0200 Subject: [PATCH] Added knob changed callback for changing profiles when the node is already created --- app.py | 10 ++++++++++ gizmos/sgWrite.gizmo | 19 ++++++++++++++++--- python/tk_nuke_writenode/create_dialog.py | 0 3 files changed, 26 insertions(+), 3 deletions(-) mode change 100644 => 100755 app.py mode change 100644 => 100755 python/tk_nuke_writenode/create_dialog.py diff --git a/app.py b/app.py old mode 100644 new mode 100755 index e992b8c..68626a8 --- a/app.py +++ b/app.py @@ -78,6 +78,16 @@ def render_farm(self, node): """ self.handler.render_farm(node) + def knob_changed(self, node, knob): + """Function called whenever any knob changes on + the ShotGrid write node + + Args: + node (attribute): node to process + knob (attribute): knob that has changed + """ + self.handler.knob_changed(node, knob) + def read_from_write(self, node): """Creates a read node from the selected write node diff --git a/gizmos/sgWrite.gizmo b/gizmos/sgWrite.gizmo index e843ed4..bc5dde0 100644 --- a/gizmos/sgWrite.gizmo +++ b/gizmos/sgWrite.gizmo @@ -5,13 +5,14 @@ Group { addUserKnob {20 writeTab l "NFA ShotGrid Write"} addUserKnob {41 channels T Write1.channels} addUserKnob {1 output +DISABLED} - addUserKnob {68 category +DISABLED M {"undefined category"}} - addUserKnob {68 dataType l data -STARTLINE M {"undefined datatype"}} + addUserKnob {41 category T sgWriteControls.category} + addUserKnob {41 dataType l data -STARTLINE T sgWriteControls.dataType} addUserKnob {26 ""} addUserKnob {41 file T Write1.file} addUserKnob {26 ""} addUserKnob {22 renderLocal l render T "def render_local():\n import sgtk\n eng = sgtk.platform.current_engine()\n app = eng.apps\[\"tk-nuke-writenode\"]\n write_node = nuke.thisNode()\n app.render_local(write_node)\nrender_local()" +STARTLINE} addUserKnob {22 renderOnFarm l "render on farm" -STARTLINE T "def render_farm():\n import sgtk\n eng = sgtk.platform.current_engine()\n app = eng.apps\[\"tk-nuke-writenode\"]\n write_node = nuke.thisNode()\n app.render_farm(write_node)\nrender_farm()"} + addUserKnob {41 Render +INVISIBLE T Write1.Render} addUserKnob {26 ""} addUserKnob {22 readFromWrite l "create read from write" T "def read_from_write():\n import sgtk\n eng = sgtk.platform.current_engine()\n app = eng.apps\[\"tk-nuke-writenode\"]\n write_node = nuke.thisNode()\n app.read_from_write(write_node)\nread_from_write()" +STARTLINE} addUserKnob {26 isShotGridWriteNode l "" +STARTLINE +INVISIBLE} @@ -19,7 +20,6 @@ Group { Input { inputs 0 name Input - selected true xpos -171 ypos -155 } @@ -33,4 +33,17 @@ Group { xpos -171 ypos -15 } + NoOp { + inputs 0 + name sgWriteControls + selected true + xpos 128 + ypos -86 + hide_input true + addUserKnob {20 sgWriteControls} + addUserKnob {68 category +DISABLED M {"undefined category"}} + addUserKnob {68 dataType l data -STARTLINE M {"undefined datatype"}} + addUserKnob {26 ""} + addUserKnob {26 help_1 l "" +STARTLINE T "

This node is separated to call the knobChanged callback only for these nodes.

\n\n

Not for example when the node's position has changed.

\n\n

This will just improve efficiency quite a bit

\n
"} + } end_group diff --git a/python/tk_nuke_writenode/create_dialog.py b/python/tk_nuke_writenode/create_dialog.py old mode 100644 new mode 100755