State:New|TargetRelease:No Target|icon_bug|icon_nuke|database:public|Resolution:Fixed|BugID:508300|
def test(): print("Root Node Created") nuke.addOnCreate(test, nodeClass="Root")
3) In the Node Graph, paste the below node, the Script Editor will print "Root Node Created":NoOp {
onCreate "\nwith nuke.root():\n nuke.createNode(\"Blur\")\n"
selected True
}
Expected behaviour
For the NoOp and Blur nodes to be created without triggering the Root node's onCreate callback.
Actual behaviour
The Root node's onCreate callback fires when other nodes are create through a callback, shown by the Script Editor printing "Root Node Created"
Workaround
Instead of with, use run() to set the context of creating a nodes, so instead of:
NoOp {
onCreate "\nwith nuke.root():\n nuke.createNode(\"Blur\")\n"
selected True
}
use:
NoOp {
onCreate "def runCode():\n\tnuke.createNode('Blur')\nnuke.root().run(runCode)"
selected True
}
Reproduced by support
This bug has been reproduced in:
Nuke 13.2v1 - Windows 10, macOS Bir Sur, CentOS 7
Nuke 12.0v1 - Windows 10
Nuke 9.0v1 - Windows 10, macOS Bir Sur
Earliest version tested
Nuke 9.0v1 - This issue appears to be in all versions of the product
We're sorry to hear that
Please tell us why