Home Page › forums › Applications › Nuke › Remove user knobs using python.
- This topic has 0 replies, 1 voice, and was last updated 3 years, 10 months ago by Anonymous.
-
AuthorPosts
-
December 17, 2016 at 9:38 pm #206504AnonymousInactive
I have a lot of Bool_knob that I generated from python code, and I want to delete these knobs from code, so I thought if it would be possible accessing to knobs from its class or type to remove it.
I have found a way to remove knobs from its name, but it don’t works with either a only one knob.
n = nuke.selectedNode()
knobs = n.knobs()
n.removeKnob(knobs[ knob name ])
[/CODE]I found a way it would be works for my purpose. Find all my user knobs by name with a pattern into its name.
Using below code, I get knobs by matching the pattern correctly, but don’t remove knobs.
[CODE]
import renode = nuke.selectedNode()
s = node.knobs().keys()
for s in node.knobs():
if re.match(r’gz_’, s):
print s
node.removeKnob(knobs[s])
[/CODE]If I access to dict with square brackets then I return this error: KeyError: ‘gz_a'[CODE]
n = nuke.selectedNode()
knobs = n.knobs()
n.removeKnob(knobs[ knob name ])
[/CODE]I found a way it would be works for my purpose. Find all my user knobs by name with a pattern into its name.
Using below code, I get knobs by matching the pattern correctly, but don’t remove knobs.
import re
node = nuke.selectedNode()
s = node.knobs().keys()
for s in node.knobs():
if re.match(r’gz_’, s):
print s
node.removeKnob(knobs[s])
[/CODE]If I access to dict with square brackets then I return this error: KeyError: ‘gz_a'[CODE]
import renode = nuke.selectedNode()
s = node.knobs().keys()
for s in node.knobs():
if re.match(r’gz_’, s):
print s
node.removeKnob(knobs)
[/CODE]If I access to dict with square brackets then I return this error: KeyError: ‘gz_a’
-
AuthorPosts
- You must be logged in to reply to this topic.
