How to iterate through more than one nuke node class using nuke.allNodes() in a for loop?
<p>nuke.allNodes() can filter for one specific node class i.e. nuke.allNodes("Transform"). But how to do it if i want to have it filter more? Some work around?</p>

<p>perhaps place them in:  var = []</p>

<p>But how do i access lets say motionblur value in a example (this dose not work):</p>

<pre><code>for i in var:
    print i.knob("motionblur").value() #Transform nuke node class
    print i.knob("samples").value() #ScanlineRender nuke node class
</code></pre>

<p>Thank you.</p>

<p>I'm a little confused because in your code you have <code>i.knob("motionblur")</code>. The string in <code>.knob()</code> should be a name of a knob not the name of a node type. </p>

<p>I would suggest iterating through all the nodes and checking the type of each node. Then do whatever you need to on that type of node.</p>

<pre><code>for i in nuke.allNodes():
    if i.Class() == "MotionBlur":
        #DO SOMETHING
    elif i.Class() == "Transform":
        #DO SOMETHING
</code></pre>

<p>If you are doing the same thing to both types of nodes, you could merge two lists and iterate over it.</p>

<pre><code>n = nuke.allNodes("MotionBlur")
n.extend(nuke.allNodes("Transform"))
for i in n:
    #DO SOMETHING TO BOTH TYPES
</code></pre>

<p>I don't know what you are specifically trying to achieve, so this may not be the most efficient method.</p>

python nuke