State:Closed|icon_bug|icon_nuke|database:public|Resolution:Fixed|TargetRelease:13.1v4|BugID:134367|
Problem summary
scriptClear/scriptClose does not remove user created knobs from Root.
Customer reported version
nuke.10.5v6
Customer reported platform
centos7
Steps to reproduce
1) Open Nuke.
2) Open a Script Editor (Right click the top bar of any pane > Script Editor).
3) Copy and paste the following code into the Script Editor and run it (Ctrl + Enter):
user_knob = nuke.Double_Knob('user_knob', 'Slider')nuke.root().addKnob(user_knob)nuke.scriptClear()print 'user_knob' in [knob.name() for knob in nuke.root().allKnobs()] 4) Notice that the script returns "True". It should return "False".
Reproduced by Support in:
Nuke 13.0v4 - Windows 10, macOS 10.14
Nuke 13.0v1 - Windows 10
Nuke 12.0v1 - Windows 10
Nuke 11.0v1 - Windows 10
Nuke 10.5v7 - Windows 10
Nuke 10.5v1 - Windows 10
Nuke 10.0v6 - Windows 10
Nuke 10.0v1 - Windows 10
Nuke 9.0v9 - Windows 10
Nuke 9.0v1 - Windows 10
Nuke 8.0v7 - Windows 10
Nuke 8.0v1 - Windows 10, Mac OSX El Capitan - Linux CentOS 6
Earliest version tested
Nuke 8.0v1 - This issue appears to be in all versions of the product
Workaround:
Adding an onDestroy() callback for the root node class allows the User knobs to be cleared with a specific function. Place the following example in the .nuke/menu.py
Example:
def removeUserTab(): '''Function to remove the User tab in root with all knobs (tested up to 60 user knobs removed in one shot). ''' n = nuke.root() while n.knob('User').name() == "User": for name in n.knobs(): try: for each in n.knobs(): if n.knobs()!= "User": n.knobs().get(name).node().removeKnob(n[name]) n.knobs().get('User').node().removeKnob(n['User']) except Exception: pass breaknuke.addOnDestroy(removeUserTab, nodeClass='Root')
Expected behavior
When the following code is run, it should return "False".
user_knob = nuke.Double_Knob('user_knob', 'Slider')nuke.root().addKnob(user_knob)nuke.scriptClear()print 'user_knob' in [knob.name() for knob in nuke.root().allKnobs()]
Actual behavior
When the following code is run, it returns "True".
user_knob = nuke.Double_Knob('user_knob', 'Slider')nuke.root().addKnob(user_knob)nuke.scriptClear()print 'user_knob' in [knob.name() for knob in nuke.root().allKnobs()] We're sorry to hear that
Please tell us why