Remove user knobs using python.

Home Page forums Applications Nuke Remove user knobs using python.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #206504
    Anonymous
    Inactive

    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 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]
    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 re

    node = 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’

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Copy link
Powered by Social Snap